kern/179999: Bug assigning HCA from IB to ETH

Shahar Klein shahark at mellanox.com
Wed Jun 26 10:00:02 UTC 2013


>Number:         179999
>Category:       kern
>Synopsis:       Bug assigning HCA from IB to ETH
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 26 10:00:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Shahar Klein
>Release:        9.1
>Organization:
Mellanox
>Environment:
FreeBSD alf10 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
The Mellanox HCA ConnectX3 can work in IB mode or ETH mode. It comes defauled to IB and assigning to ETH is done via sysctl:
sys.device.mlx4_core0.mlx4_port1 = desired_mode
 This operation, when trying to assign eth mode, currently fails with:
sysctl: sys.device.mlx4_core0.mlx4_port1: Invalid argument
>How-To-Repeat:
sys.device.mlx4_core0.mlx4_port1 = eth
>Fix:
diff -ur sysA/ofed/drivers/net/mlx4/main.c sysB/ofed/drivers/net/mlx4/main.c
--- sysA/ofed/drivers/net/mlx4/main.c   2013-06-26 12:50:46.000000000 +0300
+++ sysB/ofed/drivers/net/mlx4/main.c   2013-06-26 12:51:15.000000000 +0300
@@ -479,11 +479,11 @@
        int i;
        int err = 0;

-       if (!strcmp(buf, "ib\n"))
+       if (!strcmp(buf, "ib"))
                info->tmp_type = MLX4_PORT_TYPE_IB;
-       else if (!strcmp(buf, "eth\n"))
+       else if (!strcmp(buf, "eth"))
                info->tmp_type = MLX4_PORT_TYPE_ETH;
-       else if (!strcmp(buf, "auto\n"))
+       else if (!strcmp(buf, "auto"))
                info->tmp_type = MLX4_PORT_TYPE_AUTO;
        else {
                mlx4_err(mdev, "%s is not supported port type\n", buf);
diff -ur sysA/ofed/include/linux/sysfs.h sysB/ofed/include/linux/sysfs.h
--- sysA/ofed/include/linux/sysfs.h     2013-06-26 12:50:47.000000000 +0300
+++ sysB/ofed/include/linux/sysfs.h     2013-06-26 12:52:24.000000000 +0300
@@ -104,7 +104,9 @@
        error = SYSCTL_OUT(req, buf, len);
        if (error || !req->newptr || ops->store == NULL)
                goto out;
-       error = SYSCTL_IN(req, buf, PAGE_SIZE);
+        len = req->newlen - req->newidx;
+        error = SYSCTL_IN(req, buf, len);
+        ((char *)buf)[len] = '\0';
        if (error)
                goto out;
        len = ops->store(kobj, attr, buf, req->newlen);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list