using ConnectX card as Ethernet (mlxen)

Garrett Cooper yanegomi at
Wed Dec 12 22:06:07 UTC 2012

On Thu, Dec 6, 2012 at 8:07 PM, Anthony Cornehl <accornehl at> wrote:
> There is an issue with the sysfs/sysctl abstraction for storing values.
> Whups.

I have a patch for the sysctl<->sysfs shim that corrects it to
function when storing/showing values and makes it function more like
Linux. Setting the value works on CURRENT when changing to eth mode a
single caveat: when changing the mode for the card, you need to do it
for the last port. This is because of the following code [in

    200 int mlx4_check_port_params(struct mlx4_dev *dev,
    201                            enum mlx4_port_type *port_type)
    202 {
    203         int i;


    212                         if (port_type[i] == MLX4_PORT_TYPE_ETH &&
    213                             port_type[i + 1] == MLX4_PORT_TYPE_IB)
    214                                 return -EINVAL; /* <-- HERE */
    215                 }
    216         }

Example (setting the first port to eth mode when the other is in ib mode):

# sysctl sys.device.mlx4_core0
sys.device.mlx4_core0.mlx4_port1: ib
sys.device.mlx4_core0.mlx4_port2: ib
# sysctl sys.device.mlx4_core0.mlx4_port1=eth
sys.device.mlx4_core0.mlx4_port1: ib
sysctl: sys.device.mlx4_core0.mlx4_port1: Invalid argument

Example (setting the last port to eth mode when the first one is in ib
mode flips the mode of the entire card to eth mode):

# sysctl sys.device.mlx4_core0.mlx4_port2=eth
sys.device.mlx4_core0.mlx4_port2: ib -> eth
# sysctl sys.device.mlx4_core0
sys.device.mlx4_core0.mlx4_port1: eth
sys.device.mlx4_core0.mlx4_port2: eth

Need to functionally test whether or not it's functioning properly
with eth mode, but at least you can set it with my upcoming patch. I'm
sending the code out to our IB team and submitting the patch to jeff@
for review.


More information about the freebsd-infiniband mailing list