IB/usnic: Implement get_netdev hook
authorYuval Shaia <yuval.shaia@oracle.com>
Wed, 14 Jun 2017 20:13:33 +0000 (23:13 +0300)
committerDoug Ledford <dledford@redhat.com>
Mon, 24 Jul 2017 12:44:46 +0000 (08:44 -0400)
usnic's get_netdev hook for struct ib_device is missing - add it.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Christian Benvenuti <benve@cisco.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/usnic/usnic_ib_main.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.h

index c0c1e8b027b1a6de79e07910ba177c775438fa3c..80577b9d2796eeaa984bde450eb336e5493822e0 100644 (file)
@@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
        us_ibdev->ib_dev.query_port = usnic_ib_query_port;
        us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey;
        us_ibdev->ib_dev.query_gid = usnic_ib_query_gid;
+       us_ibdev->ib_dev.get_netdev = usnic_get_netdev;
        us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer;
        us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd;
        us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;
index 4996984885c2e0e4f11d680695a223601855c11c..f9dc1e80c3b75f00145d71df7f47fe65cd41f5c0 100644 (file)
@@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
        return 0;
 }
 
+struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num)
+{
+       struct usnic_ib_dev *us_ibdev = to_usdev(device);
+
+       if (us_ibdev->netdev)
+               dev_hold(us_ibdev->netdev);
+
+       return us_ibdev->netdev;
+}
+
 int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
                                u16 *pkey)
 {
index 172e43b6fa95d2aed66718b4412cca442eb2afe3..1fda944251162494b7d384fcd8f463d82f220467 100644 (file)
@@ -48,6 +48,7 @@ int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
                                struct ib_qp_init_attr *qp_init_attr);
 int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
                                union ib_gid *gid);
+struct net_device *usnic_get_netdev(struct ib_device *device, u8 port_num);
 int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
                                u16 *pkey);
 struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev,