Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 11, 2017 at 11:14 AM, Yuval Shaia <yuval.shaia@xxxxxxxxxx> wrote:
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 7ba9e69..d0e0f90 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -181,50 +181,6 @@ int bnxt_re_modify_device(struct ib_device *ibdev,
>         return 0;
>  }
>
> -static void __to_ib_speed_width(struct net_device *netdev, u8 *speed, u8 *width)
> -{
> -       struct ethtool_link_ksettings lksettings;
> -       u32 espeed;
> -
> -       if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) {
> -               memset(&lksettings, 0, sizeof(lksettings));
> -               rtnl_lock();
> -               netdev->ethtool_ops->get_link_ksettings(netdev, &lksettings);
> -               rtnl_unlock();
> -               espeed = lksettings.base.speed;
> -       } else {
> -               espeed = SPEED_UNKNOWN;
> -       }
> -       switch (espeed) {
> -       case SPEED_1000:
> -               *speed = IB_SPEED_SDR;
> -               *width = IB_WIDTH_1X;
> -               break;
> -       case SPEED_10000:
> -               *speed = IB_SPEED_QDR;
> -               *width = IB_WIDTH_1X;
> -               break;
> -       case SPEED_20000:
> -               *speed = IB_SPEED_DDR;
> -               *width = IB_WIDTH_4X;
> -               break;
> -       case SPEED_25000:
> -               *speed = IB_SPEED_EDR;
> -               *width = IB_WIDTH_1X;
> -               break;
> -       case SPEED_40000:
> -               *speed = IB_SPEED_QDR;
> -               *width = IB_WIDTH_4X;
> -               break;
> -       case SPEED_50000:
> -               break;
> -       default:
> -               *speed = IB_SPEED_SDR;
> -               *width = IB_WIDTH_1X;
> -               break;
> -       }
> -}
> -
>  /* Port */
>  int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
>                        struct ib_port_attr *port_attr)
> @@ -266,8 +222,9 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
>          * IB stack to avoid race in the NETDEV_UNREG path
>          */
>         if (test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags))
> -               __to_ib_speed_width(rdev->netdev, &port_attr->active_speed,
> -                                   &port_attr->active_width);
> +               if (!ib_get_eth_speed(ibdev, port_num, &port_attr->active_speed,
> +                                     &port_attr->active_width))
> +                       return -EINVAL;
>         return 0;
>  }

The bnxt_re changes looks good to me.

But this change conflicts with one of the patches i submitted as a
part of the bug fix series.

https://patchwork.kernel.org/patch/9786057/

Depending on the order in which Doug pulls these patches, one of us
might have to
re-spin the patch.

Thanks,
Selvin Xavier
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux