]> git.karo-electronics.de Git - linux-beck.git/commitdiff
IB/Verbs: Implement new callback query_protocol()
authorMichael Wang <yun.wang@profitbricks.com>
Tue, 5 May 2015 12:50:18 +0000 (14:50 +0200)
committerDoug Ledford <dledford@redhat.com>
Mon, 18 May 2015 17:35:03 +0000 (13:35 -0400)
Add new callback query_protocol() and implement for each HW.

Mapping List:
node-type link-layer transport protocol
nes RNIC ETH IWARP IWARP
amso1100 RNIC ETH IWARP IWARP
cxgb3    RNIC ETH IWARP IWARP
cxgb4    RNIC ETH IWARP IWARP
usnic    USNIC_UDP ETH USNIC_UDP USNIC_UDP
ocrdma   IB_CA ETH IB IBOE
mlx4     IB_CA IB/ETH IB IB/IBOE
mlx5     IB_CA IB IB IB
ehca     IB_CA IB IB IB
ipath    IB_CA IB IB IB
mthca    IB_CA IB IB IB
qib      IB_CA IB IB IB

Signed-off-by: Michael Wang <yun.wang@profitbricks.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
20 files changed:
drivers/infiniband/core/device.c
drivers/infiniband/hw/amso1100/c2_provider.c
drivers/infiniband/hw/cxgb3/iwch_provider.c
drivers/infiniband/hw/cxgb4/provider.c
drivers/infiniband/hw/ehca/ehca_hca.c
drivers/infiniband/hw/ehca/ehca_iverbs.h
drivers/infiniband/hw/ehca/ehca_main.c
drivers/infiniband/hw/ipath/ipath_verbs.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/nes/nes_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_main.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h
drivers/infiniband/hw/qib/qib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_main.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.c
drivers/infiniband/hw/usnic/usnic_ib_verbs.h
include/rdma/ib_verbs.h

index 18c1ece765f2c55b8317fba4daa5716df0ab814f..b360350a0b205ffd6cfd6ef3be472295dbe84821 100644 (file)
@@ -76,6 +76,7 @@ static int ib_device_check_mandatory(struct ib_device *device)
        } mandatory_table[] = {
                IB_MANDATORY_FUNC(query_device),
                IB_MANDATORY_FUNC(query_port),
+               IB_MANDATORY_FUNC(query_protocol),
                IB_MANDATORY_FUNC(query_pkey),
                IB_MANDATORY_FUNC(query_gid),
                IB_MANDATORY_FUNC(alloc_pd),
index bdf3507810cb767767cd8496ea510f9a14497f7c..6fe329a5d59574ba3c9fb7faf623f5cad07777b6 100644 (file)
@@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,
        return 0;
 }
 
+static enum rdma_protocol_type
+c2_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IWARP;
+}
+
 static int c2_query_pkey(struct ib_device *ibdev,
                         u8 port, u16 index, u16 * pkey)
 {
@@ -801,6 +807,7 @@ int c2_register_device(struct c2_dev *dev)
        dev->ibdev.dma_device = &dev->pcidev->dev;
        dev->ibdev.query_device = c2_query_device;
        dev->ibdev.query_port = c2_query_port;
+       dev->ibdev.query_protocol = c2_query_protocol;
        dev->ibdev.query_pkey = c2_query_pkey;
        dev->ibdev.query_gid = c2_query_gid;
        dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
index 811b24a539c0037c83704339b19bcbdcf8060b77..298d1caab3a52507e5c3bac0244fb7a8db0ce920 100644 (file)
@@ -1232,6 +1232,12 @@ static int iwch_query_port(struct ib_device *ibdev,
        return 0;
 }
 
+static enum rdma_protocol_type
+iwch_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IWARP;
+}
+
 static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
                        char *buf)
 {
@@ -1385,6 +1391,7 @@ int iwch_register_device(struct iwch_dev *dev)
        dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
        dev->ibdev.query_device = iwch_query_device;
        dev->ibdev.query_port = iwch_query_port;
+       dev->ibdev.query_protocol = iwch_query_protocol;
        dev->ibdev.query_pkey = iwch_query_pkey;
        dev->ibdev.query_gid = iwch_query_gid;
        dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
index 66bd6a2ad83b04f34e2b5fbb822e0b8ff062359b..f52ee6343d41d92c6922eeacda296b282a2e525b 100644 (file)
@@ -390,6 +390,12 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
        return 0;
 }
 
+static enum rdma_protocol_type
+c4iw_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IWARP;
+}
+
 static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
                        char *buf)
 {
@@ -506,6 +512,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
        dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
        dev->ibdev.query_device = c4iw_query_device;
        dev->ibdev.query_port = c4iw_query_port;
+       dev->ibdev.query_protocol = c4iw_query_protocol;
        dev->ibdev.query_pkey = c4iw_query_pkey;
        dev->ibdev.query_gid = c4iw_query_gid;
        dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
index 9ed4d2588304a2029e4d401aaee28e8cddd3403e..1f4dc9c87bf9436295ebd53a6e8d794c6570d06c 100644 (file)
@@ -242,6 +242,12 @@ query_port1:
        return ret;
 }
 
+enum rdma_protocol_type
+ehca_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IB;
+}
+
 int ehca_query_sma_attr(struct ehca_shca *shca,
                        u8 port, struct ehca_sma_attr *attr)
 {
index 22f79afa7fc11b7eef3e3597119545fb659fc1ee..077185b3fbd68d26419945b9239ebdca15ca78f1 100644 (file)
@@ -49,6 +49,9 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props);
 int ehca_query_port(struct ib_device *ibdev, u8 port,
                    struct ib_port_attr *props);
 
+enum rdma_protocol_type
+ehca_query_protocol(struct ib_device *device, u8 port_num);
+
 int ehca_query_sma_attr(struct ehca_shca *shca, u8 port,
                        struct ehca_sma_attr *attr);
 
index cd8d290a09fc2029f5542660c42e652b9216fe3e..321545b708adc68ddbc7f925f79638af1f75af7b 100644 (file)
@@ -467,6 +467,7 @@ static int ehca_init_device(struct ehca_shca *shca)
        shca->ib_device.dma_device          = &shca->ofdev->dev;
        shca->ib_device.query_device        = ehca_query_device;
        shca->ib_device.query_port          = ehca_query_port;
+       shca->ib_device.query_protocol      = ehca_query_protocol;
        shca->ib_device.query_gid           = ehca_query_gid;
        shca->ib_device.query_pkey          = ehca_query_pkey;
        /* shca->in_device.modify_device    = ehca_modify_device    */
index 44ea9390417ceb0a572058ff9097be0d3871fe8e..34b94c3ae67454130ecaff8fdeb9f45b38b091ee 100644 (file)
@@ -1638,6 +1638,12 @@ static int ipath_query_port(struct ib_device *ibdev,
        return 0;
 }
 
+static enum rdma_protocol_type
+ipath_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IB;
+}
+
 static int ipath_modify_device(struct ib_device *device,
                               int device_modify_mask,
                               struct ib_device_modify *device_modify)
@@ -2140,6 +2146,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
        dev->query_device = ipath_query_device;
        dev->modify_device = ipath_modify_device;
        dev->query_port = ipath_query_port;
+       dev->query_protocol = ipath_query_protocol;
        dev->modify_port = ipath_modify_port;
        dev->query_pkey = ipath_query_pkey;
        dev->query_gid = ipath_query_gid;
index cc64400d41ace3005c8a878b4c6811b0506726f9..64f5914379257056c337c6aaf1f0a1bee17d0c69 100644 (file)
@@ -420,6 +420,15 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
        return __mlx4_ib_query_port(ibdev, port, props, 0);
 }
 
+static enum rdma_protocol_type
+mlx4_ib_query_protocol(struct ib_device *device, u8 port_num)
+{
+       struct mlx4_dev *dev = to_mdev(device)->dev;
+
+       return dev->caps.port_mask[port_num] == MLX4_PORT_TYPE_IB ?
+               RDMA_PROTOCOL_IB : RDMA_PROTOCOL_IBOE;
+}
+
 int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
                        union ib_gid *gid, int netw_view)
 {
@@ -2201,6 +2210,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 
        ibdev->ib_dev.query_device      = mlx4_ib_query_device;
        ibdev->ib_dev.query_port        = mlx4_ib_query_port;
+       ibdev->ib_dev.query_protocol    = mlx4_ib_query_protocol;
        ibdev->ib_dev.get_link_layer    = mlx4_ib_port_link_layer;
        ibdev->ib_dev.query_gid         = mlx4_ib_query_gid;
        ibdev->ib_dev.query_pkey        = mlx4_ib_query_pkey;
index 57c9809e8b8774e8aac47806134216ef97c46883..8dec38055c4983a4c597fe97e0ea86460d6d603e 100644 (file)
@@ -262,6 +262,12 @@ out:
        return err;
 }
 
+static enum rdma_protocol_type
+mlx5_ib_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IB;
+}
+
 static int mlx5_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
                             union ib_gid *gid)
 {
@@ -1244,6 +1250,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 
        dev->ib_dev.query_device        = mlx5_ib_query_device;
        dev->ib_dev.query_port          = mlx5_ib_query_port;
+       dev->ib_dev.query_protocol      = mlx5_ib_query_protocol;
        dev->ib_dev.query_gid           = mlx5_ib_query_gid;
        dev->ib_dev.query_pkey          = mlx5_ib_query_pkey;
        dev->ib_dev.modify_device       = mlx5_ib_modify_device;
index 415f8e1a54dbc82cf4ab81bf5ad98bd9034d0733..ad1cca3a3a5c3169ebb1907f83ecaeb3bbde61a5 100644 (file)
@@ -179,6 +179,12 @@ static int mthca_query_port(struct ib_device *ibdev,
        return err;
 }
 
+static enum rdma_protocol_type
+mthca_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IB;
+}
+
 static int mthca_modify_device(struct ib_device *ibdev,
                               int mask,
                               struct ib_device_modify *props)
@@ -1281,6 +1287,7 @@ int mthca_register_device(struct mthca_dev *dev)
        dev->ib_dev.dma_device           = &dev->pdev->dev;
        dev->ib_dev.query_device         = mthca_query_device;
        dev->ib_dev.query_port           = mthca_query_port;
+       dev->ib_dev.query_protocol       = mthca_query_protocol;
        dev->ib_dev.modify_device        = mthca_modify_device;
        dev->ib_dev.modify_port          = mthca_modify_port;
        dev->ib_dev.query_pkey           = mthca_query_pkey;
index c0d0296e7a003089dec6d8d180de2bb6dd05964d..027f6d1cd059f4705a47313e520069348b0f68a8 100644 (file)
@@ -606,6 +606,11 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
        return 0;
 }
 
+static enum rdma_protocol_type
+nes_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IWARP;
+}
 
 /**
  * nes_query_pkey
@@ -3879,6 +3884,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
        nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev;
        nesibdev->ibdev.query_device = nes_query_device;
        nesibdev->ibdev.query_port = nes_query_port;
+       nesibdev->ibdev.query_protocol = nes_query_protocol;
        nesibdev->ibdev.query_pkey = nes_query_pkey;
        nesibdev->ibdev.query_gid = nes_query_gid;
        nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
index 7a2b59aca004bfac1eae4fc258fcb08d077bf449..85d99e9306a083154dd7ca4f76a152f0655f3696 100644 (file)
@@ -244,6 +244,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
        /* mandatory verbs. */
        dev->ibdev.query_device = ocrdma_query_device;
        dev->ibdev.query_port = ocrdma_query_port;
+       dev->ibdev.query_protocol = ocrdma_query_protocol;
        dev->ibdev.modify_port = ocrdma_modify_port;
        dev->ibdev.query_gid = ocrdma_query_gid;
        dev->ibdev.get_link_layer = ocrdma_link_layer;
index 877175563634df79a889ed8a428405258b9df1e4..3e98360e908d9a18905e1a1f4e95251d15e869a6 100644 (file)
@@ -187,6 +187,12 @@ int ocrdma_query_port(struct ib_device *ibdev,
        return 0;
 }
 
+enum rdma_protocol_type
+ocrdma_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IBOE;
+}
+
 int ocrdma_modify_port(struct ib_device *ibdev, u8 port, int mask,
                       struct ib_port_modify *props)
 {
index b8f7853fd36ce7a61e53004105c2b9082af14ebb..3cdc81e6ae9b75e36a41761e0a5148b8186120d0 100644 (file)
@@ -41,6 +41,9 @@ int ocrdma_query_port(struct ib_device *, u8 port, struct ib_port_attr *props);
 int ocrdma_modify_port(struct ib_device *, u8 port, int mask,
                       struct ib_port_modify *props);
 
+enum rdma_protocol_type
+ocrdma_query_protocol(struct ib_device *device, u8 port_num);
+
 void ocrdma_get_guid(struct ocrdma_dev *, u8 *guid);
 int ocrdma_query_gid(struct ib_device *, u8 port,
                     int index, union ib_gid *gid);
index 4a3599890ea5f114655a34e472bee9197d73bd2c..9fd4b285e5e523ae38323eee937bf92be7e2a17e 100644 (file)
@@ -1650,6 +1650,12 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,
        return 0;
 }
 
+static enum rdma_protocol_type
+qib_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_IB;
+}
+
 static int qib_modify_device(struct ib_device *device,
                             int device_modify_mask,
                             struct ib_device_modify *device_modify)
@@ -2184,6 +2190,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
        ibdev->query_device = qib_query_device;
        ibdev->modify_device = qib_modify_device;
        ibdev->query_port = qib_query_port;
+       ibdev->query_protocol = qib_query_protocol;
        ibdev->modify_port = qib_modify_port;
        ibdev->query_pkey = qib_query_pkey;
        ibdev->query_gid = qib_query_gid;
index 0d0f98695d535315285e1d660accb71f3fedc4f6..bd9f364e909ceb24cb400b18c0fca330ece359b4 100644 (file)
@@ -360,6 +360,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
 
        us_ibdev->ib_dev.query_device = usnic_ib_query_device;
        us_ibdev->ib_dev.query_port = usnic_ib_query_port;
+       us_ibdev->ib_dev.query_protocol = usnic_ib_query_protocol;
        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_link_layer = usnic_ib_port_link_layer;
index 53bd6a2d9cdbbae4545a70d1d070b17eafb18154..732b5c5eeb324893ba0d056727d54f86752568b1 100644 (file)
@@ -348,6 +348,12 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
        return 0;
 }
 
+enum rdma_protocol_type
+usnic_ib_query_protocol(struct ib_device *device, u8 port_num)
+{
+       return RDMA_PROTOCOL_USNIC_UDP;
+}
+
 int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
                                int qp_attr_mask,
                                struct ib_qp_init_attr *qp_init_attr)
index bb864f5aed708e1f2ea5bb287fa00ef586bdb1ea..57ddba5035acd7ced97424bbf871355d4fa2ad5e 100644 (file)
@@ -27,6 +27,8 @@ int usnic_ib_query_device(struct ib_device *ibdev,
                                struct ib_device_attr *props);
 int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
                                struct ib_port_attr *props);
+enum rdma_protocol_type
+usnic_ib_query_protocol(struct ib_device *device, u8 port_num);
 int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
                                int qp_attr_mask,
                                struct ib_qp_init_attr *qp_init_attr);
index 65994a19e84055e7b4f4d8cde83a07eb41c1a69a..080f204273e4341a2ce8359aca2e3f26c3e13c97 100644 (file)
@@ -81,6 +81,13 @@ enum rdma_transport_type {
        RDMA_TRANSPORT_USNIC_UDP
 };
 
+enum rdma_protocol_type {
+       RDMA_PROTOCOL_IB,
+       RDMA_PROTOCOL_IBOE,
+       RDMA_PROTOCOL_IWARP,
+       RDMA_PROTOCOL_USNIC_UDP
+};
+
 __attribute_const__ enum rdma_transport_type
 rdma_node_get_transport(enum rdma_node_type node_type);
 
@@ -1501,6 +1508,8 @@ struct ib_device {
        int                        (*query_port)(struct ib_device *device,
                                                 u8 port_num,
                                                 struct ib_port_attr *port_attr);
+       enum rdma_protocol_type    (*query_protocol)(struct ib_device *device,
+                                                    u8 port_num);
        enum rdma_link_layer       (*get_link_layer)(struct ib_device *device,
                                                     u8 port_num);
        int                        (*query_gid)(struct ib_device *device,