using ConnectX card as Ethernet (mlxen)

Garrett Cooper yanegomi at
Wed Nov 14 23:53:15 UTC 2012

On Wed, Nov 14, 2012 at 3:32 PM, John Nielsen <lists at> wrote:

> On Nov 9, 2012, at 9:51 PM, Garrett Cooper <yanegomi at> wrote:
> > On Fri, Nov 9, 2012 at 7:44 PM, John Nielsen <lists at> wrote:
> > On the off chance there's someone on this list already that didn't see
> my earlier (unanswered) question, I'm reposting it below. I don't have
> FreeBSD on this hardware any more but I would like to know for future
> reference if using these cards with an Ethernet switch is an option.
> >
> >     I know this might seem dumb, but what if you did
> sys.device.mlx4_core0.mlx4_port1="`printf 'en\n'`" (the newline's
> important).
> I'll try it next time I have an opportunity. Can you explain why the
> newline might make a difference? Also, I don't think I ever tried 'en',
> just 'eth'. Can someone say what the right value is or should be?

It was a WAG based on this section of code (from

 469 static ssize_t set_port_type(struct device *dev,
 470                              struct device_attribute *attr,
 471                              const char *buf, size_t count)
 472 {
 473         struct mlx4_port_info *info = container_of(attr, struct
mlx4_port_i     nfo,
 474                                                    port_attr);
 475         struct mlx4_dev *mdev = info->dev;
 476         struct mlx4_priv *priv = mlx4_priv(mdev);
 477         enum mlx4_port_type types[MLX4_MAX_PORTS];
 478         enum mlx4_port_type new_types[MLX4_MAX_PORTS];
 479         int i;
 480         int err = 0;
 482         if (!strcmp(buf, "ib\n"))
 483                 info->tmp_type = MLX4_PORT_TYPE_IB;
 484         else if (!strcmp(buf, "eth\n"))
 485                 info->tmp_type = MLX4_PORT_TYPE_ETH;
 486         else if (!strcmp(buf, "auto\n"))
 487                 info->tmp_type = MLX4_PORT_TYPE_AUTO;
 488         else {
 489                 mlx4_err(mdev, "%s is not supported port type\n", buf);
 490                 return -EINVAL;
 491         }

I don't have one of these cards so I can't verify whether or not that's the
issue today, but it seemed like a likely cause.

This being there is probably the remnant of a pseudo-valid hacky assumption
on Linux (you're echo'ing to a sysfs node and it's tacking on a newline),
but an invalid assumption on FreeBSD (the sysctl<->sysfs compat layer
doesn't make any translation assumptions w.r.t. newlines, etc).


More information about the freebsd-infiniband mailing list