Skip to content

linux/mlx5: fix MLNX_EN 24.10 patch: malformed hunk and --driver-suffix support - #992

Open
kogdenko wants to merge 2 commits into
luigirizzo:masterfrom
kogdenko:fix-mlx5-24.10-patch
Open

kogdenko wants to merge 2 commits into
luigirizzo:masterfrom
kogdenko:fix-mlx5-24.10-patch

Conversation

@kogdenko

Copy link
Copy Markdown
Contributor

The mellanox--mlx5--24.10 patch currently cannot be applied, and with
--driver-suffix the resulting driver neither links nor creates any netdev.
This PR fixes both. Only LINUX/final-patches/mellanox--mlx5--24.10 changes.

1. Malformed hunk (affects every MLNX_EN 24.10 build)

The _mlx5e_probe hunk added in ca769e4 declares 6 lines of old context
but carries only 5, so patch rejects the whole file:

patch: **** malformed patch at line 336: @@ -7544,6 +7602,11 @@ static int _mlx5e_probe(struct auxiliary_device *adev)

Fixed by adding the missing trailing context line.

2. --driver-suffix support

With a suffix the module becomes mlx5_core<suffix>, but two things did
not follow the rename:

  • CONFIG_MLX5_TC_CT objects not renamed. Their Makefile line was kept
    as context instead of being changed to mlx5_core$(NETMAP_DRIVER_SUFFIX)-...,
    so with TC_CT enabled modpost fails:
    ERROR: modpost: "mlx5_tc_ct_init" [.../mlx5_core_gbtcp.ko] undefined!
    
  • Auxiliary devices never bound. mlx5_core names its auxiliary devices
    after KBUILD_MODNAME (mlx5_core<suffix>.eth.N), while its auxiliary
    drivers match the hardcoded MLX5_ADEV_NAME "mlx5_core". No netdev is
    created, and mlx5_init() warns
    mlx5_core name not in sync with kernel module name.
    The Makefile now defines MLX5_ADEV_NAME as
    "mlx5_core$(NETMAP_DRIVER_SUFFIX)" for every object in the core
    directory (mlx5_dpll and the SF drivers included), and driver.h keeps
    "mlx5_core" only as an #ifndef default.

Builds without a suffix are unchanged: the macro evaluates to "mlx5_core".

Testing

  • MLNX_EN 24.10-4.1.4.0, Ubuntu 24.04, kernel 6.8.0-149-generic,
    BlueField-2 (ConnectX-6 Dx)
  • ./configure --drivers=mlx5 --driver-suffix=_gbtcp --select-version=mlx5:24.10-4.1.4.0
  • The patch applies cleanly to pristine MLNX_EN sources and the driver
    builds. mlx5_core_gbtcp binds both ports, and netmap opens them in
    native mode (admode=1; mlx5e_netmap_configure_rx_ring in dmesg).

Related

Building MLNX_EN 24.10 on this kernel also needs a separate, independent
fix for UDP_TUNNEL_NIC_INFO_MAY_SLEEP.

The _mlx5e_probe hunk added in ca769e4 declares 6 lines of old
context but only carries 5, so patch(1) rejects the whole file as
malformed and the mlx5 driver cannot be built at all.

Add the missing trailing context line.

Tested with MLNX_EN 24.10-4.1.4.0 on Ubuntu 24.04, 6.8.0-149-generic.
With --driver-suffix the mlx5 module is renamed to mlx5_core<suffix>,
but two things were not adjusted:

- The CONFIG_MLX5_TC_CT object line was kept as context instead of
  being renamed to mlx5_core$(NETMAP_DRIVER_SUFFIX)-..., so with
  TC_CT enabled the connection tracking objects are not linked and
  modpost fails with undefined mlx5_tc_ct_* symbols.

- mlx5_core registers its auxiliary devices with the module name
  (KBUILD_MODNAME), while its auxiliary drivers match the hardcoded
  MLX5_ADEV_NAME "mlx5_core". The devices become
  mlx5_core<suffix>.eth.N and nothing binds them: no netdev is
  created and mlx5_init() warns that "mlx5_core name not in sync
  with kernel module name". Define MLX5_ADEV_NAME from the Makefile
  so that it follows the suffix for every object of the core
  directory (mlx5_dpll and the SF drivers included).

Without a suffix the build is unchanged.

Tested with MLNX_EN 24.10-4.1.4.0 and --driver-suffix=_gbtcp on
Ubuntu 24.04, 6.8.0-149-generic: the ports come up and work in native
netmap mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant