IB/Verbs: IB Management Helpers
Subsystems (10)
v2 cover IB/Verbs: IB Management Helpers
Since v1:
* Apply suggestions from Doug, Ira, Jason, Tom, thanks for the comments :-) and please remind me if I missed anything :-P
* Adopt new callback query_transport() to directly get the transport type of device
* Reform a lot to adopt new management helpers, cleanup the old helpers
There are plenty of lengthy code to check the transport type of IB device, or the link layer type of it's port, but actually we are just speculating whether a particular management/feature is supported by the device/port.
Thus instead of inferring, we should have our own mechanism for IB management capability/protocol/feature checking, several proposals below.
This patch set will reform the method of getting transport type, we will now using query_transport() instead of inferring from transport and link layer respectively, also we defined the new transport type to make the concept more reasonable.
Mapping List:
node-type link-layer old-transport new-transport
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
For example:
if (transport == IB) && (link-layer == ETH) will now become: if (query_transport() == IBOE)
Thus we will be able to get rid of the respective transport and link-layer checking, and it will help us to add new protocol/Technology (like OPA) more easier, also with the introduced management helpers, IB management logical will be more clear and easier for extending.
TODO:
The patch set covered a wide range of IB stuff, thus for those who are familiar with the particular part, your suggestion would be invaluable ;-)
Patches haven't been tested yet, we appreciate if any one who have these HW willing to provide his Tested-by :-)
Proposals:
Sean: https://www.mail-archive.com/[email protected]/msg23339.html Doug: https://www.mail-archive.com/[email protected]/msg23418.html Jason: https://www.mail-archive.com/[email protected]/msg23425.html
Michael Wang (17):
[PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW [PATCH v2 02/17] IB/Verbs: Implement raw management helpers
[PATCH v2 03/17] IB/Verbs: Use management helper cap_ib_mad() for mad-check [PATCH v2 04/17] IB/Verbs: Use management helper cap_ib_smi() for smi-check [PATCH v2 05/17] IB/Verbs: Use management helper cap_ib_cm() for cm-check [PATCH v2 06/17] IB/Verbs: Use management helper cap_ib_sa() for sa-check [PATCH v2 07/17] IB/Verbs: Use management helper cap_ib_mcast() for mcast-check [PATCH v2 08/17] IB/Verbs: Use management helper cap_ipoib() for ipoib-check [PATCH v2 09/17] IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept() [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers [PATCH v2 11/17] IB/Verbs: Reform link_layer_show() and ib_uverbs_query_port() [PATCH v2 12/17] IB/Verbs: Use management helper cap_ib_cm_dev() for cm-device-check [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers [PATCH v2 14/17] IB/Verbs: Reserve legacy transport type for 'struct rdma_dev_addr' [PATCH v2 15/17] IB/Verbs: Reform cma_acquire_dev() with management helpers [PATCH v2 16/17] IB/Verbs: Cleanup rdma_node_get_transport()
[PATCH v2 17/17] IB/Verbs: Move rdma_port_get_link_layer() to mlx4 head file
--- drivers/infiniband/core/agent.c | 2 drivers/infiniband/core/cm.c | 22 +- drivers/infiniband/core/cma.c | 281 ++++++++++++--------------- drivers/infiniband/core/device.c | 1 drivers/infiniband/core/mad.c | 20 - drivers/infiniband/core/multicast.c | 12 - drivers/infiniband/core/sa_query.c | 29 +- drivers/infiniband/core/sysfs.c | 8 drivers/infiniband/core/ucm.c | 3 drivers/infiniband/core/ucma.c | 25 -- drivers/infiniband/core/user_mad.c | 26 +- drivers/infiniband/core/uverbs_cmd.c | 6 drivers/infiniband/core/verbs.c | 51 ---- drivers/infiniband/hw/amso1100/c2_provider.c | 7 drivers/infiniband/hw/cxgb3/iwch_provider.c | 7 drivers/infiniband/hw/cxgb4/provider.c | 7 drivers/infiniband/hw/ehca/ehca_hca.c | 6 drivers/infiniband/hw/ehca/ehca_iverbs.h | 3 drivers/infiniband/hw/ehca/ehca_main.c | 1 drivers/infiniband/hw/ipath/ipath_verbs.c | 7 drivers/infiniband/hw/mlx4/main.c | 10 drivers/infiniband/hw/mlx4/mlx4_ib.h | 8 drivers/infiniband/hw/mlx5/main.c | 7 drivers/infiniband/hw/mthca/mthca_provider.c | 7 drivers/infiniband/hw/nes/nes_verbs.c | 6 drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 3 drivers/infiniband/hw/qib/qib_verbs.c | 7 drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 drivers/infiniband/ulp/ipoib/ipoib_main.c | 17 - include/rdma/ib_verbs.h | 163 ++++++++++++++- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 4 net/sunrpc/xprtrdma/svc_rdma_transport.c | 12 - 36 files changed, 490 insertions(+), 294 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/17 IB/Verbs: Implement new callback query_transport() for each HW
Add new callback query_transport() and implement for each HW.
Mapping List:
node-type link-layer old-transport new-transport
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
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/verbs.c | 4 +++- drivers/infiniband/hw/amso1100/c2_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb3/iwch_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb4/provider.c | 7 +++++++ drivers/infiniband/hw/ehca/ehca_hca.c | 6 ++++++ drivers/infiniband/hw/ehca/ehca_iverbs.h | 3 +++ drivers/infiniband/hw/ehca/ehca_main.c | 1 + drivers/infiniband/hw/ipath/ipath_verbs.c | 7 +++++++ drivers/infiniband/hw/mlx4/main.c | 10 ++++++++++ drivers/infiniband/hw/mlx5/main.c | 7 +++++++ drivers/infiniband/hw/mthca/mthca_provider.c | 7 +++++++ drivers/infiniband/hw/nes/nes_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 + drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 3 +++ drivers/infiniband/hw/qib/qib_verbs.c | 7 +++++++ drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 ++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 ++ include/rdma/ib_verbs.h | 7 ++++++- 21 files changed, 104 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),
drivers/infiniband/core/verbs.c +3 -1
@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num); -switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }
drivers/infiniband/hw/amso1100/c2_provider.c +7 -0
@@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +c2_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c2_query_transport; dev->ibdev.query_pkey = c2_query_pkey; dev->ibdev.query_gid = c2_query_gid; dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
drivers/infiniband/hw/cxgb3/iwch_provider.c +7 -0
@@ -1232,6 +1232,12 @@ static int iwch_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +iwch_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = iwch_query_transport; dev->ibdev.query_pkey = iwch_query_pkey; dev->ibdev.query_gid = iwch_query_gid; dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
drivers/infiniband/hw/cxgb4/provider.c +7 -0
@@ -390,6 +390,12 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +c4iw_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c4iw_query_transport; dev->ibdev.query_pkey = c4iw_query_pkey; dev->ibdev.query_gid = c4iw_query_gid; dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
drivers/infiniband/hw/ehca/ehca_hca.c +6 -0
@@ -242,6 +242,12 @@ query_port1:return ret; } +enum rdma_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr) {
drivers/infiniband/hw/ehca/ehca_iverbs.h +3 -0
@@ -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_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num); +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr);
drivers/infiniband/hw/ehca/ehca_main.c +1 -0
@@ -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_transport = ehca_query_transport; shca->ib_device.query_gid = ehca_query_gid; shca->ib_device.query_pkey = ehca_query_pkey;/* shca->in_device.modify_device = ehca_modify_device */
drivers/infiniband/hw/ipath/ipath_verbs.c +7 -0
@@ -1638,6 +1638,12 @@ static int ipath_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +ipath_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = ipath_query_transport; dev->modify_port = ipath_modify_port; dev->query_pkey = ipath_query_pkey; dev->query_gid = ipath_query_gid;
drivers/infiniband/hw/mlx4/main.c +10 -0
@@ -413,6 +413,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_transport_type +mlx4_ib_query_transport (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_TRANSPORT_IB :RDMA_TRANSPORT_IBOE ; +} +int __mlx4_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid,int netw_view) {
@@ -2121,6 +2130,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_transport = mlx4_ib_query_transport; 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;
drivers/infiniband/hw/mlx5/main.c +7 -0
@@ -351,6 +351,12 @@ out:return err; } +static enum rdma_transport_type +mlx5_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +static int mlx5_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid) {
@@ -1336,6 +1342,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_transport = mlx5_ib_query_transport; 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;
drivers/infiniband/hw/mthca/mthca_provider.c +7 -0
@@ -179,6 +179,12 @@ static int mthca_query_port(struct ib_device *ibdev,return err; } +static enum rdma_transport_type +mthca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = mthca_query_transport; dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_port = mthca_modify_port; dev->ib_dev.query_pkey = mthca_query_pkey;
drivers/infiniband/hw/nes/nes_verbs.c +6 -0
@@ -606,6 +606,11 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attrreturn 0 ; } +static enum rdma_transport_type +nes_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = nes_query_transport; nesibdev->ibdev.query_pkey = nes_query_pkey; nesibdev->ibdev.query_gid = nes_query_gid; nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
drivers/infiniband/hw/ocrdma/ocrdma_main.c +1 -0
@@ -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_transport = ocrdma_query_transport; dev->ibdev.modify_port = ocrdma_modify_port; dev->ibdev.query_gid = ocrdma_query_gid; dev->ibdev.get_link_layer = ocrdma_link_layer;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6 -0
@@ -187,6 +187,12 @@ int ocrdma_query_port(struct ib_device *ibdev,return 0 ; } +enum rdma_transport_type +ocrdma_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IBOE ; +} +int ocrdma_modify_port (struct ib_device *ibdev,u8 port,int mask,struct ib_port_modify *props) {
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +3 -0
@@ -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_transport_type +ocrdma_query_transport (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);
drivers/infiniband/hw/qib/qib_verbs.c +7 -0
@@ -1650,6 +1650,12 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +qib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = qib_query_transport; ibdev->modify_port = qib_modify_port; ibdev->query_pkey = qib_query_pkey; ibdev->query_gid = qib_query_gid;
drivers/infiniband/hw/usnic/usnic_ib_main.c +1 -0
@@ -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_transport = usnic_ib_query_transport; 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;
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6 -0
@@ -348,6 +348,12 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +enum rdma_transport_type +usnic_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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)
drivers/infiniband/hw/usnic/usnic_ib_verbs.h +2 -0
@@ -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_transport_type +usnic_ib_query_transport (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);
include/rdma/ib_verbs.h +6 -1
@@ -75,10 +75,13 @@ enum rdma_node_type { };enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , }; __attribute_const__ enum rdma_transport_type
@@ -1501,6 +1504,8 @@ struct ib_device {int (*query_port)(struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr); +enum rdma_transport_type (*query_transport)(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,
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/17] IB/Verbs: Implement new callback query_transport() for each HW
V2 sent out, please ignore this one, my apologies.
Regards,
Michael Wang
Quoted 457 lines · Michael Wang
Add new callback
query_transport()and implement for each HW.Mapping List:
node-type link-layer old-transport new-transport
nes RNIC ETH IWARP IWARP
amso1100 RNIC ETH IWARP IWARPcxgb3 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 IBCc Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>Cc Doug Ledford <[email protected]>Cc Ira Weiny <[email protected]>Cc Sean Hefty <[email protected]>Signed-off-by Michael Wang <[email protected]>--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/verbs.c | 4 +++- drivers/infiniband/hw/amso1100/c2_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb3/iwch_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb4/provider.c | 7 +++++++ drivers/infiniband/hw/ehca/ehca_hca.c | 6 ++++++ drivers/infiniband/hw/ehca/ehca_iverbs.h | 3 +++ drivers/infiniband/hw/ehca/ehca_main.c | 1 + drivers/infiniband/hw/ipath/ipath_verbs.c | 7 +++++++ drivers/infiniband/hw/mlx4/main.c | 10 ++++++++++ drivers/infiniband/hw/mlx5/main.c | 7 +++++++ drivers/infiniband/hw/mthca/mthca_provider.c | 7 +++++++ drivers/infiniband/hw/nes/nes_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 + drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 3 +++ drivers/infiniband/hw/qib/qib_verbs.c | 7 +++++++ drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 ++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 ++ include/rdma/ib_verbs.h | 7 ++++++- 21 files changed, 104 insertions(+), 2 deletions(-)drivers/infiniband/core/device.c +1
-0@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),drivers/infiniband/core/verbs.c +3
-1@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num); -switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }drivers/infiniband/hw/amso1100/c2_provider.c +7
-0@@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +c2_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c2_query_transport; dev->ibdev.query_pkey = c2_query_pkey; dev->ibdev.query_gid = c2_query_gid; dev->ibdev.alloc_ucontext = c2_alloc_ucontext;drivers/infiniband/hw/cxgb3/iwch_provider.c +7
-0@@ -1232,6 +1232,12 @@ static int iwch_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +iwch_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = iwch_query_transport; dev->ibdev.query_pkey = iwch_query_pkey; dev->ibdev.query_gid = iwch_query_gid; dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;drivers/infiniband/hw/cxgb4/provider.c +7
-0@@ -390,6 +390,12 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +c4iw_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c4iw_query_transport; dev->ibdev.query_pkey = c4iw_query_pkey; dev->ibdev.query_gid = c4iw_query_gid; dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;drivers/infiniband/hw/ehca/ehca_hca.c +6
-0@@ -242,6 +242,12 @@ query_port1:return ret; } +enum rdma_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr) {drivers/infiniband/hw/ehca/ehca_iverbs.h +3
-0@@ -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_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num); +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr);drivers/infiniband/hw/ehca/ehca_main.c +1
-0@@ -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_transport = ehca_query_transport; shca->ib_device.query_gid = ehca_query_gid; shca->ib_device.query_pkey = ehca_query_pkey;/* shca->in_device.modify_device = ehca_modify_device */ drivers/infiniband/hw/ipath/ipath_verbs.c +7
-0@@ -1638,6 +1638,12 @@ static int ipath_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +ipath_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = ipath_query_transport; dev->modify_port = ipath_modify_port; dev->query_pkey = ipath_query_pkey; dev->query_gid = ipath_query_gid;drivers/infiniband/hw/mlx4/main.c +10
-0@@ -413,6 +413,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_transport_type +mlx4_ib_query_transport (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_TRANSPORT_IB :RDMA_TRANSPORT_IBOE ; +} +int __mlx4_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid,int netw_view) {@@ -2121,6 +2130,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_transport = mlx4_ib_query_transport; 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;drivers/infiniband/hw/mlx5/main.c +7
-0@@ -351,6 +351,12 @@ out:return err; } +static enum rdma_transport_type +mlx5_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +static int mlx5_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid) {@@ -1336,6 +1342,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_transport = mlx5_ib_query_transport; 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;drivers/infiniband/hw/mthca/mthca_provider.c +7
-0@@ -179,6 +179,12 @@ static int mthca_query_port(struct ib_device *ibdev,return err; } +static enum rdma_transport_type +mthca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = mthca_query_transport; dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_port = mthca_modify_port; dev->ib_dev.query_pkey = mthca_query_pkey;drivers/infiniband/hw/nes/nes_verbs.c +6
-0@@ -606,6 +606,11 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attrreturn 0 ; } +static enum rdma_transport_type +nes_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = nes_query_transport; nesibdev->ibdev.query_pkey = nes_query_pkey; nesibdev->ibdev.query_gid = nes_query_gid; nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;drivers/infiniband/hw/ocrdma/ocrdma_main.c +1
-0@@ -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_transport = ocrdma_query_transport; dev->ibdev.modify_port = ocrdma_modify_port; dev->ibdev.query_gid = ocrdma_query_gid; dev->ibdev.get_link_layer = ocrdma_link_layer;drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6
-0@@ -187,6 +187,12 @@ int ocrdma_query_port(struct ib_device *ibdev,return 0 ; } +enum rdma_transport_type +ocrdma_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IBOE ; +} +int ocrdma_modify_port (struct ib_device *ibdev,u8 port,int mask,struct ib_port_modify *props) {drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +3
-0@@ -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_transport_type +ocrdma_query_transport (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);drivers/infiniband/hw/qib/qib_verbs.c +7
-0@@ -1650,6 +1650,12 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +qib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = qib_query_transport; ibdev->modify_port = qib_modify_port; ibdev->query_pkey = qib_query_pkey; ibdev->query_gid = qib_query_gid;drivers/infiniband/hw/usnic/usnic_ib_main.c +1
-0@@ -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_transport = usnic_ib_query_transport; 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;drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6
-0@@ -348,6 +348,12 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +enum rdma_transport_type +usnic_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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)drivers/infiniband/hw/usnic/usnic_ib_verbs.h +2
-0@@ -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_transport_type +usnic_ib_query_transport (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);include/rdma/ib_verbs.h +4
-1@@ -75,10 +75,13 @@ enum rdma_node_type { };enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , }; __attribute_const__ enum rdma_transport_type
include/rdma/ib_verbs.h struct ib_device { · line 1511
Quoted 8 lines
include/rdma/ib_verbs.h +2
-0@@ -1501,6 +1504,8 @@ struct ib_device {int (*query_port)(struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr); +enum rdma_transport_type (*query_transport)(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,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/17 IB/Verbs: Implement new callback query_transport() for each HW
In reply to Michael WangAdd new callback query_transport() and implement for each HW.
Mapping List:
node-type link-layer old-transport new-transport
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
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/verbs.c | 4 +++- drivers/infiniband/hw/amso1100/c2_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb3/iwch_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb4/provider.c | 7 +++++++ drivers/infiniband/hw/ehca/ehca_hca.c | 6 ++++++ drivers/infiniband/hw/ehca/ehca_iverbs.h | 3 +++ drivers/infiniband/hw/ehca/ehca_main.c | 1 + drivers/infiniband/hw/ipath/ipath_verbs.c | 7 +++++++ drivers/infiniband/hw/mlx4/main.c | 10 ++++++++++ drivers/infiniband/hw/mlx5/main.c | 7 +++++++ drivers/infiniband/hw/mthca/mthca_provider.c | 7 +++++++ drivers/infiniband/hw/nes/nes_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 + drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 3 +++ drivers/infiniband/hw/qib/qib_verbs.c | 7 +++++++ drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 ++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 ++ include/rdma/ib_verbs.h | 7 ++++++- 21 files changed, 104 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),
drivers/infiniband/core/verbs.c +3 -1
@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num); -switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }
drivers/infiniband/hw/amso1100/c2_provider.c +7 -0
@@ -99,6 +99,12 @@ static int c2_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +c2_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c2_query_transport; dev->ibdev.query_pkey = c2_query_pkey; dev->ibdev.query_gid = c2_query_gid; dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
drivers/infiniband/hw/cxgb3/iwch_provider.c +7 -0
@@ -1232,6 +1232,12 @@ static int iwch_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +iwch_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = iwch_query_transport; dev->ibdev.query_pkey = iwch_query_pkey; dev->ibdev.query_gid = iwch_query_gid; dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
drivers/infiniband/hw/cxgb4/provider.c +7 -0
@@ -390,6 +390,12 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +c4iw_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = c4iw_query_transport; dev->ibdev.query_pkey = c4iw_query_pkey; dev->ibdev.query_gid = c4iw_query_gid; dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
drivers/infiniband/hw/ehca/ehca_hca.c +6 -0
@@ -242,6 +242,12 @@ query_port1:return ret; } +enum rdma_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr) {
drivers/infiniband/hw/ehca/ehca_iverbs.h +3 -0
@@ -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_transport_type +ehca_query_transport (struct ib_device *device,u8 port_num); +int ehca_query_sma_attr (struct ehca_shca *shca,u8 port,struct ehca_sma_attr *attr);
drivers/infiniband/hw/ehca/ehca_main.c +1 -0
@@ -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_transport = ehca_query_transport; shca->ib_device.query_gid = ehca_query_gid; shca->ib_device.query_pkey = ehca_query_pkey;/* shca->in_device.modify_device = ehca_modify_device */
drivers/infiniband/hw/ipath/ipath_verbs.c +7 -0
@@ -1638,6 +1638,12 @@ static int ipath_query_port(struct ib_device *ibdev,return 0 ; } +static enum rdma_transport_type +ipath_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = ipath_query_transport; dev->modify_port = ipath_modify_port; dev->query_pkey = ipath_query_pkey; dev->query_gid = ipath_query_gid;
drivers/infiniband/hw/mlx4/main.c +10 -0
@@ -413,6 +413,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_transport_type +mlx4_ib_query_transport (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_TRANSPORT_IB :RDMA_TRANSPORT_IBOE ; +} +int __mlx4_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid,int netw_view) {
@@ -2121,6 +2130,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_transport = mlx4_ib_query_transport; 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;
drivers/infiniband/hw/mlx5/main.c +7 -0
@@ -351,6 +351,12 @@ out:return err; } +static enum rdma_transport_type +mlx5_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IB ; +} +static int mlx5_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid) {
@@ -1336,6 +1342,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_transport = mlx5_ib_query_transport; 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;
drivers/infiniband/hw/mthca/mthca_provider.c +7 -0
@@ -179,6 +179,12 @@ static int mthca_query_port(struct ib_device *ibdev,return err; } +static enum rdma_transport_type +mthca_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = mthca_query_transport; dev->ib_dev.modify_device = mthca_modify_device; dev->ib_dev.modify_port = mthca_modify_port; dev->ib_dev.query_pkey = mthca_query_pkey;
drivers/infiniband/hw/nes/nes_verbs.c +6 -0
@@ -606,6 +606,11 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attrreturn 0 ; } +static enum rdma_transport_type +nes_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = nes_query_transport; nesibdev->ibdev.query_pkey = nes_query_pkey; nesibdev->ibdev.query_gid = nes_query_gid; nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
drivers/infiniband/hw/ocrdma/ocrdma_main.c +1 -0
@@ -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_transport = ocrdma_query_transport; dev->ibdev.modify_port = ocrdma_modify_port; dev->ibdev.query_gid = ocrdma_query_gid; dev->ibdev.get_link_layer = ocrdma_link_layer;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +6 -0
@@ -187,6 +187,12 @@ int ocrdma_query_port(struct ib_device *ibdev,return 0 ; } +enum rdma_transport_type +ocrdma_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_IBOE ; +} +int ocrdma_modify_port (struct ib_device *ibdev,u8 port,int mask,struct ib_port_modify *props) {
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +3 -0
@@ -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_transport_type +ocrdma_query_transport (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);
drivers/infiniband/hw/qib/qib_verbs.c +7 -0
@@ -1650,6 +1650,12 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +static enum rdma_transport_type +qib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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_transport = qib_query_transport; ibdev->modify_port = qib_modify_port; ibdev->query_pkey = qib_query_pkey; ibdev->query_gid = qib_query_gid;
drivers/infiniband/hw/usnic/usnic_ib_main.c +1 -0
@@ -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_transport = usnic_ib_query_transport; 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;
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6 -0
@@ -348,6 +348,12 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,return 0 ; } +enum rdma_transport_type +usnic_ib_query_transport (struct ib_device *device,u8 port_num) +{ +return RDMA_TRANSPORT_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)
drivers/infiniband/hw/usnic/usnic_ib_verbs.h +2 -0
@@ -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_transport_type +usnic_ib_query_transport (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);
include/rdma/ib_verbs.h +6 -1
@@ -75,10 +75,13 @@ enum rdma_node_type { };enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , }; __attribute_const__ enum rdma_transport_type
@@ -1501,6 +1504,8 @@ struct ib_device {int (*query_port)(struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr); +enum rdma_transport_type (*query_transport)(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,
Signature · 1 line
2.1.0
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 1 line · Michael Wang
Add new callback
query_transport()and implement for each HW.
My response here is going to be a long email, but that's because it's easier to respond to the various patches all in one response in order to preserve context. So, while I'm responding to patch 1 of 17, my response will cover all 17 patches in whole.
Quoted 49 lines
Mapping List:
node-type link-layer old-transport new-transport
nes RNIC ETH IWARP IWARP
amso1100 RNIC ETH IWARP IWARPcxgb3 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 IBCc Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>Cc Doug Ledford <[email protected]>Cc Ira Weiny <[email protected]>Cc Sean Hefty <[email protected]>Signed-off-by Michael Wang <[email protected]>--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/verbs.c | 4 +++- drivers/infiniband/hw/amso1100/c2_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb3/iwch_provider.c | 7 +++++++ drivers/infiniband/hw/cxgb4/provider.c | 7 +++++++ drivers/infiniband/hw/ehca/ehca_hca.c | 6 ++++++ drivers/infiniband/hw/ehca/ehca_iverbs.h | 3 +++ drivers/infiniband/hw/ehca/ehca_main.c | 1 + drivers/infiniband/hw/ipath/ipath_verbs.c | 7 +++++++ drivers/infiniband/hw/mlx4/main.c | 10 ++++++++++ drivers/infiniband/hw/mlx5/main.c | 7 +++++++ drivers/infiniband/hw/mthca/mthca_provider.c | 7 +++++++ drivers/infiniband/hw/nes/nes_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 + drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++++++ drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 3 +++ drivers/infiniband/hw/qib/qib_verbs.c | 7 +++++++ drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 ++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 ++ include/rdma/ib_verbs.h | 7 ++++++- 21 files changed, 104 insertions(+), 2 deletions(-)drivers/infiniband/core/device.c +0
-0
drivers/infiniband/core/device.c static int ib_device_check_mandatory(struct ib_device *device) · line 82
Quoted 7 lines
drivers/infiniband/core/device.c +1
-0@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),
I'm concerned about the performance implications of this. The size of this patchset already points out just how many places in the code we have to check for various aspects of the device transport in order to do the right thing. Without going through the entire list to see how many are on critical hot paths, I'm sure some of them are on at least partially critical hot paths (like creation of new connections). I would prefer to see this change be implemented via a device attribute, not a functional call query. That adds a needless function call in these paths.
drivers/infiniband/core/verbs.c enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_ · line 139
Quoted 13 lines
drivers/infiniband/core/verbs.c +2
-1@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num); -switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;
If we are perserving ABI, then this looks wrong. Currently, IBOE returnsi transport IB and link layer Ethernet. It should not return link layer IB, it does not support IB link layer operations (such as MAD access).
Quoted 9 lines
drivers/infiniband/core/verbs.c +1
-0case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }
[ snip ]
Quoted 7 lines
include/rdma/ib_verbs.h +0
-0@@ -75,10 +75,13 @@ enum rdma_node_type { };
include/rdma/ib_verbs.h enum rdma_node_type { · line 85
Quoted 10 lines
include/rdma/ib_verbs.h +4
-1enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , };
I'm also concerned about this. I would like to see this enum essentially turned into a bitmap. One that is constructed in such a way that we can always get the specific test we need with only one compare against the overall value. In order to do so, we need to break it down into the essential elements that are part of each of the transports. So, for instance, we can define the two link layers we have so far, plus reserve one for OPA which we know is coming:
RDMA_LINK_LAYER_IB = 0x00000001, RDMA_LINK_LAYER_ETH = 0x00000002, RDMA_LINK_LAYER_OPA = 0x00000004, RDMA_LINK_LAYER_MASK = 0x0000000f,
We can then define the currently known high level transport types:
RDMA_TRANSPORT_IB = 0x00000010, RDMA_TRANSPORT_IWARP = 0x00000020, RDMA_TRANSPORT_USNIC = 0x00000040,
RDMA_TRANSPORT_USNIC_UDP = 0x00000080,RDMA_TRANSPORT_MASK = 0x000000f0,
We could then define bits for the IB management types:
RDMA_MGMT_IB = 0x00000100, RDMA_MGMT_OPA = 0x00000200, RDMA_MGMT_MASK = 0x00000f00,
Then we have space to define specific quirks:
RDMA_SEPARATE_READ_SGE = 0x00001000,RDMA_QUIRKS_MASK = 0xfffff000
Once those are defined, a few definitions for device drivers to use when they initialize a device to set the bitmap to the right values:
#define IS_IWARP (RDMA_LINK_LAYER_ETH | RDMA_TRANSPORT_IWARP | RDMA_SEPARATE_READ_SGE)
#define IS_IB (RDMA_LINK_LAYER_IB | RDMA_TRANSPORT_IB | RDMA_MGMT_IB) #define IS_IBOE (RDMA_LINK_LAYER_ETH | RDMA_TRANSPORT_IB) #define IS_USNIC (RDMA_LINK_LAYER_ETH | RDMA_TRANSPORT_USNIC) #define IS_OPA (RDMA_LINK_LAYER_OPA | RDMA_TRANSPORT_IB | RDMA_MGMT_IB | RDMA_MGMT_OPA)
Then you need to define the tests:
static inline bool rdma_transport_is_iwarp(struct ib_device *dev, u8 port)
{
return dev->port[port]->transport & RDMA_TRANSPORT_IWARP;
}/* Note: this intentionally covers IB, IBOE, and OPA...use
rdma_dev_is_ib if you want to only get physical IB devices */
static inline boolrdma_transport_is_ib(struct ibdev *dev)
{
return dev->port[port]->transport & RDMA_TRANSPORT_IB;
}rdma_port_is_ib(struct ib_device *dev, u8 port)
{
return dev->port[port]->transport & RDMA_LINK_LAYER_IB;
}rdma_port_is_iboe(struct ib_device *dev, u8 port)
{
return dev->port[port]->transport & IS_IBOE == IS_IBOE;
}rdma_port_is_usnic(struct ib_device *dev, u8 port)
{
return dev->port[port]->transport & RDMA_TRANSPORT_USNIC;
}rdma_port_is_opa(struct ib_device *dev, u8 port)
{
return dev->port[port]->transport & RDMA_LINK_LAYER_OPA;
}rdma_port_is_iwarp(struct ib_device *dev, u8 port)
{
return rdma_transport_is_iwarp(dev, port);
}rdma_port_ib_fabric_mgmt(struct ibdev *dev, u8 port)
{
return dev->port[port]->transport & RDMA_MGMT_IB;
}rdma_port_opa_mgmt(struct ibdev *dev, u8 port)
{
return dev->port[port]->transport & RDMA_MGMT_OPA;
}Other things can be changed too. Like rdma_port_get_link_layer can become this:
{
return dev->transport & RDMA_LINK_LAYER_MASK;
}From patch 2/17:
include/rdma/ib_verbs.h
Quoted 7 lines
include/rdma/ib_verbs.h +3
-0+static inline int rdma_ib_mgmt (struct ib_device *device,u8 port_num) +{ + enum rdma_transport_type tp = device->query_transport(device,
port_num);include/rdma/ib_verbs.h +3
-0+ +return (tp ==RDMA_TRANSPORT_IB || tp ==RDMA_TRANSPORT_IBOE ); +}
This looks wrong. IBOE doesn't have IB management. At least it doesn't have subnet management.
Actually, reading through the remainder of the patches, there is some serious confusion taking place here. In later patches, you use this as a surrogate for cap_cm, which implies you are talking about connection management. This is very different than the rdma_dev_ib_mgmt() test that I create above, which specifically refers to IB management tasks unique to IB/OPA: MAD, SM, multicast.
The kernel connection management code is not really limited. It supports IB, IBOE, iWARP, and in the future it will support OPA. There are some places in the CM code were we test for just IB/IBOE currently, but that's only because we split iWARP out higher up in the abstraction hierarchy. So, calling something rdma_ib_mgmt and meaning a rather specialized tested in the CM is probably misleading.
To straighten all this out, lets break management out into the two distinct types:
rdma_port_ib_fabric_mgmt() <- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport & RDMA_MGMT_IB test. If will be true for IB and OPA fabrics.
rdma_port_conn_mgmt() <- connection management, which we currently support everything except USNIC (correct Sean?), so a test would be something like !(transport & RDMA_TRANSPORT_USNIC). This is then split out into two subgroups, IB style and iWARP stype connection management (aka, rdma_port_iw_conn_mgmt() and rdma_port_ib_conn_mgmt()). In my above bitmap, since I didn't give IBOE its own transport type, these subgroups still boil down to the simple tests transport & iWARP and transport & IB like they do today.
From patch 3/17:
Quoted 11 lines
+/**
+ *cap_ib_mad- Check if the port of device has the capability Infiniband
+ * Management Datagrams.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support Infiniband
+ * Management Datagrams.
+ */
include/rdma/ib_verbs.h
Quoted 5 lines
include/rdma/ib_verbs.h +5
-0+static inline int cap_ib_mad (struct ib_device *device,u8 port_num) +{ +return rdma_ib_mgmt (device, port_num); +} +
Why add cap_ib_mad? It's nothing more than rdma_port_ib_fabric_mgmt with a new name. Just use rdma_port_ib_fabric_mgmt() everywhere you have cap_ib_mad.
From patch 4/17:
Quoted 11 lines
+/**
+ *cap_ib_smi- Check if the port of device has the capability Infiniband
+ * Subnet Management Interface.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support Infiniband
+ * Subnet Management Interface.
+ */
include/rdma/ib_verbs.h
Quoted 5 lines
include/rdma/ib_verbs.h +5
-0+static inline int cap_ib_smi (struct ib_device *device,u8 port_num) +{ +return rdma_transport_ib (device, port_num); +} +
Same as the previous patch. This is needless indirection. Just use rdma_port_ib_fabric_mgmt directly.
Patch 5/17:
Again, just use rdma_port_ib_conn_mgmt() directly.
Patch 6/17:
Again, just use rdma_port_ib_fabric_mgmt() directly.
Patch 7/17:
Again, just use rdma_port_ib_fabric_mgmt() directly. It's perfectly applicable to the IB mcast registration requirements.
Patch 8/17:
Here we can create a new test if we are using the bitmap I created above:
rdma_port_ipoib(struct ib_device *dev, u8 port)
{
return !(dev->port[port]->transport & RDMA_LINK_LAYER_ETH);
}This is presuming that OPA will need ipoib devices. This will cause all non-Ethernet link layer devices to return true, and right now, that is all IB and all OPA devices.
Patch 9/17:
Most of the other comments on this patch stand as they are. I would add the test:
rdma_port_separate_read_sge(dev, port)
{
return dev->port[port]->transport & RDMA_SEPERATE_READ_SGE;
}and add the helper function:
rdma_port_get_read_sge(dev, port)
{
if (rdma_transport_is_iwarp)
return 1;
return dev->port[port]->max_sge;
}Then, as Jason points out, if at some point in the future the kernel is modified to support devices with assymetrical read/write SGE sizes, this function can be modified to support those devices.
Patch 10/17:
As Sean pointed out, force_grh should be rdma_dev_is_iboe(). The cm handles iw devices, but you notice all of the functions you modify here start with ib_. The iwarp connections are funneled through iw_ specific function variants, and so even though the cm handles iwarp, ib, and roce devices, you never see anything other than ib/iboe (and opa in the future) get to the ib_ variants of the functions. So, they wrote the original tests as tests against the link layer being ethernet and used that to differentiate between ib and iboe devices. It works, but can confuse people. So, everyplace that has !rdma_transport_ib should really be rdma_dev_is_iboe instead. If we ever merge the iw_ and ib_ functions in the future, having this right will help avoid problems.
Patch 11/17:
I wouldn't reform the link_layer_show except to make it compile with the new defines I used above.
Patch 12/17:
Go ahead and add a helper to check all ports on a dev, just make it rdma_hca_ib_conn_mgmt() and have it loop through rdma_port_ib_conn_mgmt() return codes.
Patch 13/17:
This patch is largely unneeded if we reworked the bitmap like I have above. A lot of the changes you made to switch from case statements to multiple if statements can go back to being case statements because in the bitmap IB and IBOE are still both transport IB, so you just do the case on the transport bits and not on the link layer bits.
Patch 14/17:
Seems ok.
Patch 15/17:
If you implement the bitmap like I list above, then this code will need fixed up to use the bitmap. Otherwise it looks OK.
Patch 16/17:
OK.
Patch 17/17:
I would drop this patch. In the future, the mlx5 driver will support both Ethernet and IB like mlx4 does, and we would just need to pull this code back to core instead of only in mlx4.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
RE: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
PiBJJ20gY29uY2VybmVkIGFib3V0IHRoZSBwZXJmb3JtYW5jZSBpbXBsaWNhdGlvbnMgb2YgdGhp cy4gIFRoZSBzaXpl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Bjb3VsZCB0aGVuIGRlZmluZSBiaXRzIGZvciB0aGUgSUIgbWFuYWdlbWVudCB0 eXBlczoNCj4gDQo+IFJETUFfTUdNVF9JQiAgICAgICAgICAgICA9IDB4MDAwMDAxMDAsDQo+IFJE TUFfTUdNVF9PUEEgICAgICAgICAgICA9IDB4MDAwMDAyMDAsDQo+IFJETUFfTUdNVF9NQVNLICAg ICAgICAgICA9IDB4MDAwMDBmMDAsDQo+IA0KPiBUaGVuIHdlIGhhdmUgc3BhY2UgdG8gZGVmaW5l IHNwZWNpZmljIHF1aXJrczoNCj4gDQo+IFJETUFfU0VQQVJBVEVfUkVBRF9TR0UgICA9IDB4MDAw MDEwMDAsDQo+IFJETUFfUVVJUktTX01BU0sgICAgICAgICA9IDB4ZmZmZmYwMDANCg0KSSB0b28g d291bGQgbGlrZSB0byBzZWUgdGhpcyBhcyB0aGUgZW5kIHJlc3VsdCwgYnV0IEkgdGhpbmsgaXQn cyBwb3NzaWJsZSB0byBzdGFnZSB0aGUgY2hhbmdlcyBieSBoYXZpbmcgdGhlIHN0YXRpYyBpbmxp bmUgY2FsbHMgYmVpbmcgYWRkZWQgY29udmVydCB0byB1c2luZyB0aGVzZSBzb3J0IG9mIGF0dHJp YnV0ZXMuDQoNCi0gU2Vhbg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 3 lines · Sean
I too would like to see this as the end result, but I think it's possible to stage the changes by having the static inline calls being added convert to using these sort of attributes.
I agree as well, this patch set is already so big.
But Doug may be right, this conversion may need to be part of the series that is applied in one go for performance reasons. But that is just a patch at the end to optimize the inlines calls.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Doug LedfordQuoted 7 lines · Doug Ledford
To straighten all this out, lets break management out into the two distinct types:
rdma_port_ib_fabric_mgmt()<- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport &RDMA_MGMT_IBtest. If will be true for IB and OPA fabrics.
Quoted 8 lines
rdma_port_conn_mgmt()<- connection management, which we currently support everything except USNIC (correct Sean?), so a test would be something like !(transport &RDMA_TRANSPORT_USNIC). This is then split out into two subgroups, IB style and iWARP stype connection management (aka,rdma_port_iw_conn_mgmt()andrdma_port_ib_conn_mgmt()). In my above bitmap, since I didn't give IBOE its own transport type, these subgroups still boil down to the simple tests transport & iWARP and transport & IB like they do today.
There is a lot more variation here than just these two tests, and those two tests won't scale to include OPA.
IB ROCEE OPA
SMI Y N Y (though the OPA smi looked a bit different) IB SMP Y N N OPA SMP N N Y GMP Y Y Y SA Y N Y PM Y Y Y (? guessing for OPA) CM Y Y Y
GMP needs GRH N Y N
It may be unrealistic, but I was hoping we could largely scrub the opaque 'is spec iWARP, is spec ROCEE' kinds of tests because they don't tell anyone what it is the code cares about.
Maybe what is needed is a more precise language for the functions:
Quoted 3 lines
Quoted 3 lines
+ *
cap_ib_mad- Check if the port of device has the capability Infiniband
+ * Management Datagrams.
As used this seems to mean:
True if the port can do IB/OPA SMP, or GMP management packets on QP0 or QP1. (Y Y Y) ie: Do we need the MAD layer at all.
ib_smi seems to be true if QP0 is supported (Y N Y)
Maybe the above set would make a lot more sense as:
cap_ib_qp0
cap_ib_qp1
cap_opa_qp0
ib_cm seems to mean that the CM protocol from the IBA is used on the port (Y Y Y)
ib_sa means the IBA SA protocol is supported (Y Y Y)
ib_mcast true if the IBA SA protocol is used for multicast GIDs (Y N
Y)
ipoib means the port supports the ipoib protocol (Y N ?)
This seem reasonable and understandable, even if they are currently a bit duplicating.
Quoted 10 lines
Patch 9/17:
Most of the other comments on this patch stand as they are. I would add the test:
rdma_port_separate_read_sge(dev, port){ return dev->port[port]->transport & RDMA_SEPERATE_READ_SGE; }
Quoted 8 lines
and add the helper function:
rdma_port_get_read_sge(dev, port){ if (rdma_transport_is_iwarp) return 1; return dev->port[port]->max_sge; }
Hum, that is nice, but it doesn't quite fit with how the ULP needs to work. The max limit when creating a WR is the value passed into the qp_cap, not the device maximum limit.
To do this properly we need to extend the qp_cap, and that is just too big a change. A one bit iWarp quirk is OK for now.
Quoted 1 line
As Sean pointed out,
force_grhshould berdma_dev_is_iboe(). The cm
I actually really prefer cap_mandatory_grh - that is what is going on here. ie based on that name (as a reviewer) I'd expect to see the mad layer check that the mandatory GRH is always present, or blow up.
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there? cap_pkey_supported ?
Jason
Tom Talpey
reviewerRe: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 11 lines · Jason Gunthorpe
On Wed, Apr 08, 2015 at 02:29:46PM -0400, Doug Ledford wrote:
...
Quoted 7 lines
rdma_port_get_read_sge(dev, port){ if (rdma_transport_is_iwarp) return 1; return dev->port[port]->max_sge; }
Quoted 3 lines
Hum, that is nice, but it doesn't quite fit with how the ULP needs to work. The max limit when creating a WR is the value passed into the
qp_cap, not the device maximum limit.
Agreed, and I will again say that not all devices necessarily support the same max_sge for all WR types. The current one-size-fits-all API may make the upper layer think so, but it's possibly being lied to.
Quoted 2 lines
To do this properly we need to extend the
qp_cap, and that is just too big a change. A one bit iWarp quirk is OK for now.
Yes, it would be a large-ish change, and I like Doug's choice of word "quirk" to capture these as exceptions, until the means for addressing them is decided.
Overall, I like Doug's proposals, especially from an upper layer
perspective. I might suggest further refining them into categories, perhaps "management", primarily of interest to kernel and the plumbing of connections; and actual "RDMA semantics", of interest
to RDMA consumers.
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Jason GunthorpeOn 04/08/2015 10:10 PM, Jason Gunthorpe wrote:
[snip]
Quoted 6 lines
Quoted 2 lines
As Sean pointed out,
force_grhshould berdma_dev_is_iboe(). The cmI actually really prefer
cap_mandatory_grh- that is what is going on here. ie based on that name (as a reviewer) I'd expect to see the mad layer check that the mandatory GRH is always present, or blow up.
Sounds good, will be in next version :-)
Regards,
Michael Wang
Quoted 6 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Jason GunthorpeOn 04/08/2015 10:10 PM, Jason Gunthorpe wrote:
[snip]
Quoted 3 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?
I'm not sure if this count in capability... how shall we describe it?
Regards,
Michael Wang
Quoted 3 lines
Jason
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 7 lines · Michael Wang
On 04/08/2015 10:10 PM, Jason Gunthorpe wrote:
[snip]Quoted 3 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?I'm not sure if this count in capability... how shall we describe it?
I'm not sure how rocee uses pkey, but maybe the the GRH and pkey thing would work well together under a single 'cap_ethernet_ah' ?
Jason
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 11 lines · Jason Gunthorpe
Quoted 7 lines · Michael Wang
On 04/08/2015 10:10 PM, Jason Gunthorpe wrote:
[snip]Quoted 3 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?I'm not sure if this count in capability... how shall we describe it?
I'm not sure how rocee uses pkey, but maybe the the GRH and pkey thing would work well together under a single '
cap_ethernet_ah' ?
Sounds better, we can use this in all the case that handling address for eth-link-layer :-)
Regards,
Michael Wang
Quoted 3 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Jason GunthorpeQuoted 22 lines · Jason Gunthorpe
Quoted 7 lines · Doug Ledford
To straighten all this out, lets break management out into the two distinct types:
rdma_port_ib_fabric_mgmt()<- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport &RDMA_MGMT_IBtest. If will be true for IB and OPA fabrics.Quoted 8 lines
rdma_port_conn_mgmt()<- connection management, which we currently support everything except USNIC (correct Sean?), so a test would be something like !(transport &RDMA_TRANSPORT_USNIC). This is then split out into two subgroups, IB style and iWARP stype connection management (aka,rdma_port_iw_conn_mgmt()andrdma_port_ib_conn_mgmt()). In my above bitmap, since I didn't give IBOE its own transport type, these subgroups still boil down to the simple tests transport & iWARP and transport & IB like they do today.There is a lot more variation here than just these two tests, and those two tests won't scale to include OPA.
IB ROCEE OPA
Quoted 9 lines
SMI Y N Y (though the OPA smi looked a bit different) IB SMP Y N N OPA SMP N N Y GMP Y Y Y SA Y N Y PM Y Y Y (? guessing for OPA) CM Y Y YGMP needs GRH N Y N
You can still break this down to a manageable bitmap.
SMI, SMP, and SA are all essentially the same and can be combined to one bitmap that is
IB_SM 0x1OPA_SM 0x2
and the defines are such that IB devices define IB_SM, and OPA devices define IB_SM and OPA_SM. Any minor differences between OPA and IB can be handled by testing just the OPA_SM bit. This will exclude all IBOE devices and iWARP devices.
GMP, PM, and CM are all the same, and are all identical to transport == INFINIBAND.
GMP needs GRH happens to be precisely the same as ib_dev_is_iboe.
These are exactly the tests I proposed Jason. I'm not sure I see your point here. I guess my point is that although the scenario of all the different items seems complex, it really does boil down to needing only exactly what I proposed earlier to fulfill the entire test matrix.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 4 lines · Doug Ledford
These are exactly the tests I proposed Jason. I'm not sure I see your point here. I guess my point is that although the scenario of all the different items seems complex, it really does boil down to needing only exactly what I proposed earlier to fulfill the entire test matrix.
I have no problem with minimizing a bitmap, but I want the accessors to make sense first.
My specific problem with your suggestion was combining cap_ib_mad, cap_ib_sa, and cap_ib_smi into rdma_port_ib_fabric_mgmt.
Not only do the three cap things not return the same value for all situations, the documentary knowledge is lost by the reduction.
I'd prefer we look at this from a 'what do the call sites need' view, not a 'how do we minimize' view.
I've written this before: The mess here is that it is too hard to know what the call sites are actually checking for when it is some baroque conditional.
Jason
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 16 lines · Jason Gunthorpe
Quoted 4 lines · Doug Ledford
These are exactly the tests I proposed Jason. I'm not sure I see your point here. I guess my point is that although the scenario of all the different items seems complex, it really does boil down to needing only exactly what I proposed earlier to fulfill the entire test matrix.
I have no problem with minimizing a bitmap, but I want the accessors to make sense first.
My specific problem with your suggestion was combining
cap_ib_mad,cap_ib_sa, andcap_ib_smiintordma_port_ib_fabric_mgmt.Not only do the three cap things not return the same value for all situations, the documentary knowledge is lost by the reduction.
Quoted 6 lines
I'd prefer we look at this from a 'what do the call sites need' view, not a 'how do we minimize' view.
I've written this before: The mess here is that it is too hard to know what the call sites are actually checking for when it is some baroque conditional.
The two goals: being specific about what the test is returning and minimizing the bitmap footprint; are not necessarily opposed. One can do both at the same time.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 3 lines · Doug Ledford
The two goals: being specific about what the test is returning and minimizing the bitmap footprint; are not necessarily opposed. One can do both at the same time.
Agree
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Doug LedfordOn 04/09/2015 11:19 PM, Doug Ledford wrote:
[snip]
Quoted 8 lines
Quoted 4 lines
I've written this before: The mess here is that it is too hard to know what the call sites are actually checking for when it is some baroque conditional.
The two goals: being specific about what the test is returning and minimizing the bitmap footprint; are not necessarily opposed. One can do both at the same time.
This could be internal reforming after the cap_XX() stuff works for core layer, at that time we don't need to touch core layer anymore, just introducing this bitmap stuff in verb layer, replacing the implementation of these helpers with the bitmap check, and following the semantic (description).
Regards,
Michael Wang
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 7 lines · Michael Wang
On 04/09/2015 11:19 PM, Doug Ledford wrote:
[snip]Quoted 5 lines
Quoted 4 lines
I've written this before: The mess here is that it is too hard to know what the call sites are actually checking for when it is some baroque conditional.
Quoted 8 lines
Quoted 3 lines
The two goals: being specific about what the test is returning and minimizing the bitmap footprint; are not necessarily opposed. One can do both at the same time.
This could be internal reforming after the
cap_XX()stuff works for core layer, at that time we don't need to touch core layer anymore, just introducing this bitmap stuff in verb layer, replacing the implementation of these helpers with the bitmap check, and following the semantic (description).
Agreed.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Jason GunthorpeFirst off there are 2 separate issues here:
1) We need to communicate if a port supports or requires various management support from the ib_mad, ib_cm, and/or ib_sa modules.
2) We need to communicate how a addresses are formated and resolved for a particular port
In general I don't think we need to remove all uses of the Transport or Link Layer.
Although we may be able to remove most of the transport uses.
Quoted 18 lines · Jason Gunthorpe
Quoted 7 lines · Doug Ledford
To straighten all this out, lets break management out into the two distinct types:
rdma_port_ib_fabric_mgmt()<- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport &RDMA_MGMT_IBtest. If will be true for IB and OPA fabrics.Quoted 8 lines
rdma_port_conn_mgmt()<- connection management, which we currently support everything except USNIC (correct Sean?), so a test would be something like !(transport &RDMA_TRANSPORT_USNIC). This is then split out into two subgroups, IB style and iWARP stype connection management (aka,rdma_port_iw_conn_mgmt()andrdma_port_ib_conn_mgmt()). In my above bitmap, since I didn't give IBOE its own transport type, these subgroups still boil down to the simple tests transport & iWARP and transport & IB like they do today.
Quoted 5 lines
There is a lot more variation here than just these two tests, and those two tests won't scale to include OPA.
IB ROCEE OPA
SMI Y N Y (though the OPA smi looked a bit different)
Yes OPA is different but it is based on the class version of the individual MADs not any particular device/port support.
Quoted 1 line
IB SMP Y N N
Correction:
IB SMP Y N Y (OPA supports the IB NodeInfo query)
Quoted 1 line
OPA SMP N N Y
How is this different from the SMI?
Quoted 3 lines
GMP Y Y Y SA Y N Y PM Y Y Y (? guessing for OPA)
^^^ Yes
Quoted 6 lines
CM Y Y Y
GMP needs GRH N Y NIt may be unrealistic, but I was hoping we could largely scrub the opaque 'is spec iWARP, is spec ROCEE' kinds of tests because they don't tell anyone what it is the code cares about.
I somewhat agree except for things like addressing. In the area of addressing I think we are likely to need to define something like "cap_addr_ib", "cap_addr_iboe", "cap_addr_iwarp". See below for more details.
Quoted 12 lines
Maybe what is needed is a more precise language for the functions:
Quoted 3 lines
Quoted 3 lines
+ *
cap_ib_mad- Check if the port of device has the capability Infiniband
+ * Management Datagrams.As used this seems to mean:
True if the port can do IB/OPA SMP, or GMP management packets on QP0 or QP1. (Y Y Y) ie: Do we need the MAD layer at all.
Quoted 6 lines
ib_smiseems to be true if QP0 is supported (Y N Y)Maybe the above set would make a lot more sense as:
cap_ib_qp0
cap_ib_qp1
cap_opa_qp0
I disagree.
All we need right now is is cap_qp0. All devices currently support QP1.
Then after all this is settled I can add:
IB ROCEE OPA
OPA MAD Space N N Y Port is OPA MAD space.
Quoted 3 lines
ib_cmseems to mean that the CM protocol from the IBA is used on the port (Y Y Y)
Agree.
Quoted 2 lines
ib_sameans the IBA SA protocol is supported (Y Y Y)
I think this should be (Y N Y)
IBoE has no SA. The IBoE code "fabricates" a Path Record it does not need to interact with the SA.
Quoted 3 lines
ib_mcasttrue if the IBA SA protocol is used for multicast GIDs (Y N
Y)
Given the above why can't we just have the "ib_sa" flag?
Quoted 2 lines
ipoib means the port supports the ipoib protocol (Y N ?)
OPA does IPoIB so... (Y N Y)
However, I think checking the link layer is more appropriate here. It does not make sense to do IP over IB over Eth. Even though the IBoE can do the "IB" protocol.
Making flags in the driver to indicate which ULPs they support is a _bad_ _idea_.
FWIW: I don't consider the MAD and SA (multicast) modules ULPs. Rather they
are helper modules which are built to share code amongst the drivers to process things on behalf of the drivers themselves. As such advertising a need for or particular support within those modules make sense.
So although strictly speaking we could do IPoIBoEth, I think having IPoIB check the LL and limiting itself to ports which are IB LL is appropriate.
Quoted 23 lines
This seem reasonable and understandable, even if they are currently a bit duplicating.
Quoted 10 lines
Patch 9/17:
Most of the other comments on this patch stand as they are. I would add the test:
rdma_port_separate_read_sge(dev, port){ return dev->port[port]->transport & RDMA_SEPERATE_READ_SGE; }Quoted 8 lines
and add the helper function:
rdma_port_get_read_sge(dev, port){ if (rdma_transport_is_iwarp) return 1; return dev->port[port]->max_sge; }
Quoted 6 lines
Hum, that is nice, but it doesn't quite fit with how the ULP needs to work. The max limit when creating a WR is the value passed into the
qp_cap, not the device maximum limit.To do this properly we need to extend the
qp_cap, and that is just too big a change. A one bit iWarp quirk is OK for now.
I agree. This is the one place we probably want to just keep the "Transport" check.
Quoted 6 lines
Quoted 2 lines
As Sean pointed out,
force_grhshould berdma_dev_is_iboe(). The cmI actually really prefer
cap_mandatory_grh- that is what is going on here. ie based on that name (as a reviewer) I'd expect to see the mad layer check that the mandatory GRH is always present, or blow up.
While GRH mandatory (for the GMP) is what this is. The function ib_init_ah_from_path generically is really handling an "IBoE address" to send to and therefore we need to force the GRH in the AH.
There is a whole slew of LL and Transport checks which are used to format/resolve addresses.
Functions which need to know that the address format is "IBoE"
-- cma.c: cma_acquire_dev -- cma.c: cma_modify_qp_rtr -- sa_query.c: ib_init_ah_from_path -- verbs.c: ib_resolve_eth_l2_attrs
What about a check rdma_port_req_iboe_addr()?
Functions where AF_IB is checked against LL because it does not make sense to use AF_IB on anything but an IB LL
-- cma.c: cma_listen_on_dev -- cma.c: cma_bind_loopback
These checks should be directly against the LL
Functions where the ARP type is checked against the link layer.
-- cma.c: cma_acquire_dev
-- cma.c: cma_bind_loopback
These checks should be directly against the LL
Quoted 3 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?
It seems IBoE just hardcodes the pkey to 0xffff. I don't see it used anywhere.
Function where port requires "real" PKey
-- cma.c: cma_ib_init_qp_attr
Check rdma_port_req_pkey()?
Over all for the addressing choices:
The "Transport" (or protocol, or whatever) is Verbs. The Layer below Verbs (OPA/IB/Eth/TCP) defines how addressing, route, and connection information is generated, communicated, and used.
As Jason and Doug have been saying sometimes we want to know when that requires SA interaction or the use of the CM protocol (or neither). Other times we just need to know what the Address format or Link Layer is.
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 15 lines · ira.weiny
First off there are 2 separate issues here:
1) We need to communicate if a port supports or requires various management support from the
ib_mad,ib_cm, and/orib_samodules.2) We need to communicate how a addresses are formated and resolved for a particular port
In general I don't think we need to remove all uses of the Transport or Link Layer.
Although we may be able to remove most of the transport uses.
On Wed, Apr 08, 2015 at 02:10:15PM -0600, Jason Gunthorpe wrote:
[snip]
Quoted 5 lines
Quoted 4 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?
Quoted 7 lines
It seems IBoE just hardcodes the pkey to
0xffff. I don't see it used anywhere.Function where port requires "real" PKey
-- cma.c: cma_ib_init_qp_attrCheck
rdma_port_req_pkey()?
What about cap_eth_ah() for all the cases need eth addressing handling?
Quoted 11 lines
Over all for the addressing choices:
The "Transport" (or protocol, or whatever) is Verbs. The Layer below Verbs (OPA/IB/Eth/TCP) defines how addressing, route, and connection information is generated, communicated, and used.
As Jason and Doug have been saying sometimes we want to know when that requires SA interaction or the use of the CM protocol (or neither). Other times we just need to know what the Address format or Link Layer is.
Till now it seems like we could be able to eliminate the link layer helper in core layer, but I'll reserve that helper in next version, if later we do not need it anymore, let's erase it then ;-)
Regards,
Michael Wang
Quoted 4 lines
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 24 lines · Michael Wang
Quoted 15 lines · ira.weiny
First off there are 2 separate issues here:
1) We need to communicate if a port supports or requires various management support from the
ib_mad,ib_cm, and/orib_samodules.2) We need to communicate how a addresses are formated and resolved for a particular port
In general I don't think we need to remove all uses of the Transport or Link Layer.
Although we may be able to remove most of the transport uses.
On Wed, Apr 08, 2015 at 02:10:15PM -0600, Jason Gunthorpe wrote:
[snip]
Quoted 7 lines
Quoted 4 lines
Some of the other checks in this file revolve around pkey, I'm not sure what rocee does there?
cap_pkey_supported?It seems IBoE just hardcodes the pkey to
0xffff. I don't see it used anywhere.
Quoted 7 lines
Quoted 5 lines
Function where port requires "real" PKey
-- cma.c: cma_ib_init_qp_attrCheck
rdma_port_req_pkey()?What about
cap_eth_ah()for all the cases need eth addressing handling?
That works.
Quoted 9 lines
Quoted 9 lines
Over all for the addressing choices:
The "Transport" (or protocol, or whatever) is Verbs. The Layer below Verbs (OPA/IB/Eth/TCP) defines how addressing, route, and connection information is generated, communicated, and used.
Quoted 7 lines
Quoted 3 lines
As Jason and Doug have been saying sometimes we want to know when that requires SA interaction or the use of the CM protocol (or neither). Other times we just need to know what the Address format or Link Layer is.
Till now it seems like we could be able to eliminate the link layer helper in core layer, but I'll reserve that helper in next version, if later we do not need it anymore, let's erase it then ;-)
Eliminating Link Layer is fine if we can do it, but I still think that something like IPoIB should check the link layer.
After sleeping on it the driver exporting cap_ipoib() does not seem _so_ bad but I still see a distinction between ULPs like IPoIB and the other modules we have been discussing.
Ira
Quoted 7 lines
Regards,
Michael WangQuoted 4 lines
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to ira.weinyQuoted 9 lines · ira.weiny
Quoted 2 lines
IB ROCEE OPA
SMI Y N Y (though the OPA smi looked a bit different)Yes OPA is different but it is based on the class version of the individual MADs not any particular device/port support.
Quoted 1 line
OPA SMP N N Y
How is this different from the SMI?
Any code that generates SMPs and SMIs is going to need to know what format to generate them in. It seems we have a sort of weird world where IB SMPs are supported on OPA but not the IB SMI.
Not sure any users exist though..
Quoted 8 lines
Quoted 4 lines
Maybe the above set would make a lot more sense as:
cap_ib_qp0
cap_ib_qp1
cap_opa_qp0I disagree.
All we need right now is is
cap_qp0. All devices currently support QP1.
I didn't list iWarp in the table because everything is no, but it doesn't support QP1.
Quoted 6 lines
Quoted 1 line
ib_sameans the IBA SA protocol is supported (Y Y Y)I think this should be (Y N Y)
IBoE has no SA. The IBoE code "fabricates" a Path Record it does not need to interact with the SA.
I was wondering why there are so many checks in the SA code, I know RoCEE doesn't use it, but why are there there?
Quoted 4 lines
Quoted 2 lines
ib_mcasttrue if the IBA SA protocol is used for multicast GIDs (Y N
Y)Given the above why can't we just have the "
ib_sa" flag?
Maybe I got it wrong, but yes, if it really means 'IBA SA protocol for multicast then it can just be cap_sa.
But there is also the idea that some devices can't do multicast at all (iWarp), we must care about that at some point?
Quoted 3 lines
However, I think checking the link layer is more appropriate here. It does not make sense to do IP over IB over Eth. Even though the IBoE can do the "IB" protocol.
Yes, it is ugly.
I think if we look closely we'll find that IPoIB today has a hard requirement on cap_sa being true, so lets use that?
In fact any ULP that unconditionally uses the SA can use that.
Quoted 7 lines
Quoted 3 lines
I actually really prefer
cap_mandatory_grh- that is what is going on here. ie based on that name (as a reviewer) I'd expect to see the mad layer check that the mandatory GRH is always present, or blow up.While GRH mandatory (for the GMP) is what this is. The function
ib_init_ah_from_pathgenerically is really handling an "IBoE address" to send to and therefore we need to force the GRH in the AH.
This make sense to me.
It appears we have at least rocee, rocee v2 (udp?), tcp, ib and opa address and AH formats? opa would support ib addresses too I guess.
A
bool rdma_port_addr_is_XXX()
along with a
enum AddrType rdma_port_addr_type()
Might be the thing? The latter should only be used with switch()
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 8 lines · Jason Gunthorpe
Quoted 5 lines · ira.weiny
Quoted 2 lines
IB ROCEE OPA
SMI Y N Y (though the OPA smi looked a bit different)Yes OPA is different but it is based on the class version of the individual MADs not any particular device/port support.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
OPA SMP N N Y
How is this different from the SMI?
Any code that generates SMPs and SMIs is going to need to know what format to generate them in. It seems we have a sort of weird world where IB SMPs are supported on OPA but not the IB SMI.
My mistake it was late. The MAD stack needs to know if it should implement the IB SMI or the IB & OPA SMI. That also implies the use of QP0 or vise versa.
In my email to Doug I suggested "OPA MAD" which covers the need to implement the OPA SMI on that device for MADs which have that class version.
Quoted 2 lines
Not sure any users exist though..
I think all the "users" are either userspace or the drivers themselves. It is really just the common SMI processing which needs to be turned on/off. Again I think this can be covered with the QP0 flag.
RDMA_MGMT_QP0 = 0x00000200,
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Maybe the above set would make a lot more sense as:
cap_ib_qp0
cap_ib_qp1
cap_opa_qp0
Quoted 6 lines
Quoted 3 lines
I disagree.
All we need right now is is
cap_qp0. All devices currently support QP1.I didn't list iWarp in the table because everything is no, but it doesn't support QP1.
Isn't ocrdma an iWarp device?
int ocrdma_process_mad(struct ib_device *ibdev,
int process_mad_flags,
u8 port_num,
struct ib_wc *in_wc,
struct ib_grh *in_grh,
struct ib_mad *in_mad, struct ib_mad *out_mad)
{
int status;
struct ocrdma_dev *dev;
switch (in_mad->mad_hdr.mgmt_class) {
case IB_MGMT_CLASS_PERF_MGMT:
dev = get_ocrdma_dev(ibdev);
if (!ocrdma_pma_counters(dev, out_mad))
status = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
else
status = IB_MAD_RESULT_SUCCESS;
break;
default:
status = IB_MAD_RESULT_SUCCESS;
break;
}
return status;
}Regardless I was wrong. USNIC devices don't support MADs at all. So we do need the "supports MADs at all flag".
RDMA_MGMT_IB_MAD = 0x00000100,
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
ib_sameans the IBA SA protocol is supported (Y Y Y)I think this should be (Y N Y)
IBoE has no SA. The IBoE code "fabricates" a Path Record it does not need to interact with the SA.
I was wondering why there are so many checks in the SA code, I know RoCEE doesn't use it, but why are there there?
Which checks are you referring to? I think there are separate calls to query the SA when running on IB for both the Route resolution and the Multicast join operations. The choice of those calls could be made by a "cap_sa()" helper.
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
ib_mcasttrue if the IBA SA protocol is used for multicast GIDs (Y N
Y)Given the above why can't we just have the "
ib_sa" flag?Maybe I got it wrong, but yes, if it really means 'IBA SA protocol for multicast then it can just be
cap_sa.But there is also the idea that some devices can't do multicast at all (iWarp), we must care about that at some point?
I was not sure how to handle this either... I guess you need a cap_multicast()???
Quoted 9 lines
Quoted 4 lines
However, I think checking the link layer is more appropriate here. It does not make sense to do IP over IB over Eth. Even though the IBoE can do the "IB" protocol.
Yes, it is ugly.
I think if we look closely we'll find that IPoIB today has a hard requirement on
cap_sabeing true, so lets use that?
I don't think that is appropriate. You have been advocating that the checks be clear as to what support we need. While currently the IPoIB layer does (for IB and OPA) require an SA I think those checks are only appropriate when it is attempting an SA query.
The choice to run IPoIB at all is a different matter.
Quoted 2 lines
In fact any ULP that unconditionally uses the SA can use that.
They _can_ use that but the point of this exercise (and additional checks going forward) is that we don't "hide" meaning like this.
IPoIB should restrict itself to running on IB link layers. Should additional link layers be added which IPoIB works on then we add that check.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
I actually really prefer
cap_mandatory_grh- that is what is going on here. ie based on that name (as a reviewer) I'd expect to see the mad layer check that the mandatory GRH is always present, or blow up.
Quoted 8 lines
Quoted 3 lines
While GRH mandatory (for the GMP) is what this is. The function
ib_init_ah_from_pathgenerically is really handling an "IBoE address" to send to and therefore we need to force the GRH in the AH.This make sense to me.
It appears we have at least rocee, rocee v2 (udp?), tcp, ib and opa address and AH formats?
Seems that way. But has the rocee v2 been accepted?
Quoted 1 line
opa would support ib addresses too I guess.
Yes opa address == ib addresses. So there is no need to distinguish them.
Quoted 9 lines
A
boolrdma_port_addr_is_XXX()along with a
enum AddrType
rdma_port_addr_type()Might be the thing? The latter should only be used with
switch()
Sounds good to me. But Doug has a point that the address type and the "port" type go together. So this could probably be the same call for both of those.
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 1 line · ira.weiny
Isn't ocrdma an iWarp device?
No, it's roce. It and mlx4 roce devices currently interoperate.
Quoted 9 lines
Quoted 2 lines
I think if we look closely we'll find that IPoIB today has a hard requirement on
cap_sabeing true, so lets use that?I don't think that is appropriate. You have been advocating that the checks be clear as to what support we need. While currently the IPoIB layer does (for IB and OPA) require an SA I think those checks are only appropriate when it is attempting an SA query.
The choice to run IPoIB at all is a different matter.
Appropriately named or not, Jason's choice of words "has a hard requirement" is correct ;-) For IPoIB, the broadcast group of the fake Ethernet fabric is a very specific IB multicast group per the IPoIB spec.
Quoted 8 lines
Quoted 2 lines
In fact any ULP that unconditionally uses the SA can use that.
They _can_ use that but the point of this exercise (and additional checks going forward) is that we don't "hide" meaning like this.
IPoIB should restrict itself to running on IB link layers. Should additional link layers be added which IPoIB works on then we add that check.
I think your right that checking the link layer is the right thing, and for now, there is no need to check cap_sa because the link layer check enforces it. In the future, if there is a new link layer we want to use this on, and it doesn't have an sa, then we have to enable sa checks and alternate methods at that time.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 11 lines · Doug Ledford
Quoted 8 lines · ira.weiny
Quoted 2 lines
I think if we look closely we'll find that IPoIB today has a hard requirement on
cap_sabeing true, so lets use that?I don't think that is appropriate. You have been advocating that the checks be clear as to what support we need. While currently the IPoIB layer does (for IB and OPA) require an SA I think those checks are only appropriate when it is attempting an SA query.
Quoted 4 lines
Quoted 1 line
The choice to run IPoIB at all is a different matter.
Appropriately named or not, Jason's choice of words "has a hard requirement" is correct ;-)
Agreed. I meant that using "cap_sa" is not appropriate. Not that IPoIB did not have a hard requirement... :-D
I actually think that _both_ the check for IB link layer and the "cap_sa" is required. Perhaps not at start up...
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to ira.weinyQuoted 1 line · ira.weiny
Isn't ocrdma an iWarp device?
No, it is RoCEE
Quoted 6 lines
Quoted 2 lines
I was wondering why there are so many checks in the SA code, I know RoCEE doesn't use it, but why are there there?
Which checks are you referring to? I think there are separate calls to query the SA when running on IB for both the Route resolution and the Multicast join operations. The choice of those calls could be made by a "
cap_sa()" helper.
I will point them out next time I look through the patches
Quoted 5 lines
Quoted 2 lines
I think if we look closely we'll find that IPoIB today has a hard requirement on
cap_sabeing true, so lets use that?I don't think that is appropriate. You have been advocating that the checks be clear as to what support we need.
Right, but this is narrow, and we are not hiding meaning.
Look at the IPoIB ULP, and look at the hard requiments of the code, then translate those back to our new cap scheme. We see today's IPoIB will not run without:
- UD support
- IB addressing
- IB multicast
- IB SA
- CM (optional)
It seems perfectly correct for a ULP to say at the very start, I need all these caps, or I will not run (how could it run?). This is true of any ULP that has a hard need to use those APIs.
That would seem to be the very essance of the cap scheme. Declare what you need, not what standard you think you need.
Hiding meaning is to say 'only run on IB or OPA': WHY are we limited to those two?
Quoted 3 lines
While currently the IPoIB layer does (for IB and OPA) require an SA I think those checks are only appropriate when it is attempting an SA query.
That doesn't make any sense unless someone also adds support for handling the !SA case.
Quoted 4 lines
Quoted 2 lines
It appears we have at least rocee, rocee v2 (udp?), tcp, ib and opa address and AH formats?
Seems that way. But has the rocee v2 been accepted?
Don't know much about it yet, patches exist, it seems to have a slightly different addressing format.
Quoted 3 lines
Quoted 1 line
opa would support ib addresses too I guess.
Yes opa address == ib addresses. So there is no need to distinguish them.
The patches you sent showed a different LRH format for OPA (eg 32 bit LID), so someday we will need to know that the full 32 bit LID is available.
We can see how this might work in future, lets say OPAv2 *requires* the 32 bit LID, for that case cap_ib_address = 0 cap_opa_address = 1. If we don't update IPoIB and it uses the tests from above then it immediately, and correctly, stops running on those OPAv2 devices.
Once patched to support cap_op_address then it will begin working again. That seems very sane..
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 4 lines · Jason Gunthorpe
On Fri, Apr 10, 2015 at 01:38:38PM -0400, ira.weiny wrote:
Hiding meaning is to say 'only run on IB or OPA': WHY are we limited to those two?
For something else, I might agree with this. But, for the specific case of IPoIB, it's pretty fair. IPoIB is more than just an ULP. It's a spec. And it's very IB specific. It will only work with OPA because OPA is imitating IB. To run it on another fabric, you would need more than just to make it work. If the new fabric doesn't have a broadcast group, or has multicast registration like IB does, you need the equivalent of IBTA, whatever that may be for this new fabric, buy in on the pre-defined multicast groups and you might need firmware support in the switches.
Quoted 7 lines
We can see how this might work in future, lets say OPAv2 *requires* the 32 bit LID, for that case
cap_ib_address= 0cap_opa_address= 1. If we don't update IPoIB and it uses the tests from above then it immediately, and correctly, stops running on those OPAv2 devices.Once patched to support
cap_op_addressthen it will begin working again. That seems very sane..
It is very sane from an implementation standpoint, but from the larger interoperability standpoint, you need that spec to be extended to the new fabric simultaneously.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 8 lines · Doug Ledford
IPoIB is more than just an ULP. It's a spec. And it's very IB specific. It will only work with OPA because OPA is imitating IB. To run it on another fabric, you would need more than just to make it work. If the new fabric doesn't have a broadcast group, or has multicast registration like IB does, you need the equivalent of IBTA, whatever that may be for this new fabric, buy in on the pre-defined multicast groups and you might need firmware support in the switches.
It feels like the 'cap_ib_addressing' or whatever we call it captures this very well. The IPoIB RFC is very much concerned with GID's and MGID's and broadly requires the IBA addressing
scheme. cap_ib_addressing asserts the port uses that scheme.
We wouldn't accept patches to IPoIB to add a new addressing scheme without seeing proper diligence to the standards work.
Looking away from the stadards, using cap_XX seems very sane: We are building a well defined system of invarients, You can't call into the sa functions if cap_sa is not set, you can't call into the mcast functions if cap_mcast is not set, you can't form a AH from IB GIDs/MGID/LID without cap_ib_addressing.
I makes so much sense for the ULP to directly require the needed cap's for the kernel APIs it intends to call, or not use the RDMA port at all.
Quoted 11 lines
Quoted 7 lines
We can see how this might work in future, lets say OPAv2 *requires* the 32 bit LID, for that case
cap_ib_address= 0cap_opa_address= 1. If we don't update IPoIB and it uses the tests from above then it immediately, and correctly, stops running on those OPAv2 devices.Once patched to support
cap_op_addressthen it will begin working again. That seems very sane..It is very sane from an implementation standpoint, but from the larger interoperability standpoint, you need that spec to be extended to the new fabric simultaneously.
I liked the OPAv2 hypothetical because it doesn't actually touch the IPoIB spec. IPoIB spec has little to say about LIDs or LRHs it works entirely at the GID/MGID/GRH level.
Jason
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 16 lines · Jason Gunthorpe
Quoted 8 lines · Doug Ledford
IPoIB is more than just an ULP. It's a spec. And it's very IB specific. It will only work with OPA because OPA is imitating IB. To run it on another fabric, you would need more than just to make it work. If the new fabric doesn't have a broadcast group, or has multicast registration like IB does, you need the equivalent of IBTA, whatever that may be for this new fabric, buy in on the pre-defined multicast groups and you might need firmware support in the switches.
It feels like the '
cap_ib_addressing' or whatever we call it captures this very well. The IPoIB RFC is very much concerned with GID's and MGID's and broadly requires the IBA addressing
scheme.cap_ib_addressingasserts the port uses that scheme.
Quoted 8 lines
We wouldn't accept patches to IPoIB to add a new addressing scheme without seeing proper diligence to the standards work.
Looking away from the stadards, using
cap_XXseems very sane: We are building a well defined system of invarients, You can't call into the sa functions ifcap_sais not set, you can't call into the mcast functions ifcap_mcastis not set, you can't form a AH from IB GIDs/MGID/LID withoutcap_ib_addressing.
Yep.
Quoted 4 lines
I makes so much sense for the ULP to directly require the needed cap's for the kernel APIs it intends to call, or not use the RDMA port at all.
Yes.
So trying to sum up.
Have we settled on the following "capabilities"? Helper function names aside.
/* legacy to communicate to userspace */
RDMA_LINK_LAYER_IB = 0x0000000000000001, RDMA_LINK_LAYER_ETH = 0x0000000000000002, RDMA_LINK_LAYER_MASK = 0x000000000000000f, /* more bits? */ /* I'm hoping we don't need more bits here */
/* legacy to communicate to userspace */
RDMA_TRANSPORT_IB = 0x0000000000000010, RDMA_TRANSPORT_IWARP = 0x0000000000000020, RDMA_TRANSPORT_USNIC = 0x0000000000000040, RDMA_TRANSPORT_USNIC_UDP = 0x0000000000000080, RDMA_TRANSPORT_MASK = 0x00000000000000f0, /* more bits? */ /* I'm hoping we don't need more bits here */
/* New flags */
RDMA_MGMT_IB_MAD = 0x0000000000000100, /* ib_mad module support */ RDMA_MGMT_QP0 = 0x0000000000000200, /* ib_mad QP0 support */ RDMA_MGMT_IB_SA = 0x0000000000000400, /* ib_sa module support */ /* NOTE includes IB Mcast */ RDMA_MGMT_IB_CM = 0x0000000000000800, /* ib_cm module support */ RDMA_MGMT_OPA_MAD = 0x0000000000001000, /* ib_mad OPA MAD support */ RDMA_MGMT_MASK = 0x00000000000fff00,
RDMA_ADDR_IB = 0x0000000000100000, /* Port does IB AH, PR, Pkey */RDMA_ADDR_IBoE = 0x0000000000200000, /* Port does IBoE AH, PR, Pkey */
/* Do we need iWarp (TCP) here? */RDMA_ADDR_IB_MASK = 0x000000000ff00000,
RDMA_SEPARATE_READ_SGE = 0x0000000010000000,RDMA_QUIRKS_MASK = 0x000000fff0000000
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
We can see how this might work in future, lets say OPAv2 *requires* the 32 bit LID, for that case
cap_ib_address= 0cap_opa_address= 1. If we don't update IPoIB and it uses the tests from above then it immediately, and correctly, stops running on those OPAv2 devices.Once patched to support
cap_op_addressthen it will begin working again. That seems very sane..
Quoted 7 lines
Quoted 3 lines
It is very sane from an implementation standpoint, but from the larger interoperability standpoint, you need that spec to be extended to the new fabric simultaneously.
I liked the OPAv2 hypothetical because it doesn't actually touch the IPoIB spec. IPoIB spec has little to say about LIDs or LRHs it works entirely at the GID/MGID/GRH level.
Agreed.
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Tom Talpey
reviewerRe: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 24 lines · ira.weiny
On Fri, Apr 10, 2015 at 01:17:23PM -0600, Jason Gunthorpe wrote:
...
So trying to sum up.Have we settled on the following "capabilities"? Helper function names aside.
/* legacy to communicate to userspace */
RDMA_LINK_LAYER_IB = 0x0000000000000001, RDMA_LINK_LAYER_ETH = 0x0000000000000002, RDMA_LINK_LAYER_MASK = 0x000000000000000f, /* more bits? */ /* I'm hoping we don't need more bits here *//* legacy to communicate to userspace */
RDMA_TRANSPORT_IB = 0x0000000000000010, RDMA_TRANSPORT_IWARP = 0x0000000000000020, RDMA_TRANSPORT_USNIC = 0x0000000000000040, RDMA_TRANSPORT_USNIC_UDP = 0x0000000000000080, RDMA_TRANSPORT_MASK = 0x00000000000000f0, /* more bits? */ /* I'm hoping we don't need more bits here *//* New flags */
Quoted 7 lines
RDMA_MGMT_IB_MAD = 0x0000000000000100, /* ib_mad module support */ RDMA_MGMT_QP0 = 0x0000000000000200, /* ib_mad QP0 support */ RDMA_MGMT_IB_SA = 0x0000000000000400, /* ib_sa module support */ /* NOTE includes IB Mcast */ RDMA_MGMT_IB_CM = 0x0000000000000800, /* ib_cm module support */ RDMA_MGMT_OPA_MAD = 0x0000000000001000, /* ib_mad OPA MAD support */ RDMA_MGMT_MASK = 0x00000000000fff00,
You explicitly say "userspace" - why would an upper layer need to know the link, transport and management details? These seem to be mid-layer matters.
Quoted 4 lines
RDMA_ADDR_IB=0x0000000000100000, /* Port does IB AH, PR, Pkey */RDMA_ADDR_IBoE=0x0000000000200000, /* Port does IBoE AH, PR, Pkey */
/* Do we need iWarp (TCP) here? */RDMA_ADDR_IB_MASK=0x000000000ff00000,
I do see a ULP needing to know the address family needed to pass to rdma_connect and rdma_listen, so I would add "IP", but not "iWARP".
Quoted 2 lines
RDMA_SEPARATE_READ_SGE=0x0000000010000000,RDMA_QUIRKS_MASK=0x000000fff0000000
This is good, but it also needs an attribute to signal the need for a remote-writable RDMA Read sink buffer, for today's iWARP.
Tom.
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Jason GunthorpeQuoted 17 lines · Jason Gunthorpe
Quoted 3 lines · ira.weiny
I don't think that is appropriate. You have been advocating that the checks be clear as to what support we need.
Right, but this is narrow, and we are not hiding meaning.
Look at the IPoIB ULP, and look at the hard requiments of the code, then translate those back to our new cap scheme. We see today's IPoIB will not run without:
- UD support
- IB addressing
- IB multicast
- IB SA
- CM (optional)
Quoted 3 lines
It seems perfectly correct for a ULP to say at the very start, I need all these caps, or I will not run (how could it run?). This is true of any ULP that has a hard need to use those APIs.
Having IPoIB check for all of these and fail to start if not supported is good. But the suggestion before was to have "cap_ipoib". I don't think we want that.
Quoted 3 lines
That would seem to be the very essance of the cap scheme. Declare what you need, not what standard you think you need.
Right.
Quoted 3 lines
Hiding meaning is to say 'only run on IB or OPA': WHY are we limited to those two?
Because only those 2 support the list of capabilities above.
Quoted 7 lines
Quoted 4 lines
While currently the IPoIB layer does (for IB and OPA) require an SA I think those checks are only appropriate when it is attempting an SA query.
That doesn't make any sense unless someone also adds support for handling the !SA case.
Fair enough but IPoIB does need to check for SA support now as well as IB addressing which is currently IB Link Layer (although as Doug said the Port and Address format go hand in hand. So I'm happy calling it whatever.)
Quoted 13 lines
Quoted 5 lines
Quoted 3 lines
It appears we have at least rocee, rocee v2 (udp?), tcp, ib and opa address and AH formats?
Seems that way. But has the rocee v2 been accepted?
Don't know much about it yet, patches exist, it seems to have a slightly different addressing format.
Quoted 3 lines
Quoted 1 line
opa would support ib addresses too I guess.
Yes opa address == ib addresses. So there is no need to distinguish them.
Quoted 8 lines
The patches you sent showed a different LRH format for OPA (eg 32 bit LID), so someday we will need to know that the full 32 bit LID is available.
We can see how this might work in future, lets say OPAv2 *requires* the 32 bit LID, for that case
cap_ib_address= 0cap_opa_address= 1. If we don't update IPoIB and it uses the tests from above then it immediately, and correctly, stops running on those OPAv2 devices.
For your hypothetical case, agreed. But I want to make it clear for those who may be casually reading this thread that OPA addresses are IB addresses right now.
Quoted 3 lines
Once patched to support
cap_op_addressthen it will begin working again. That seems very sane..
Agreed.
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Doug LedfordQuoted 7 lines · Doug Ledford
Quoted 1 line · Michael Wang
Add new callback
query_transport()and implement for each HW.My response here is going to be a long email, but that's because it's easier to respond to the various patches all in one response in order to preserve context. So, while I'm responding to patch 1 of 17, my response will cover all 17 patches in whole.
Thanks for the review :-)
Quoted 2 lines
Quoted 2 lines
Mapping List:
[snip]
Quoted 15 lines
drivers/infiniband/core/device.c static int ib_device_check_mandatory(struct ib_device *device) · line 82
Quoted 13 lines
drivers/infiniband/core/device.c +1
-0@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),I'm concerned about the performance implications of this. The size of
Quoted 8 lines
this patchset already points out just how many places in the code we have to check for various aspects of the device transport in order to do the right thing. Without going through the entire list to see how many are on critical hot paths, I'm sure some of them are on at least partially critical hot paths (like creation of new connections). I would prefer to see this change be implemented via a device attribute, not a functional call query. That adds a needless function call in these paths.
That's exactly the first issue come into my mind while working on this.
Mostly I was influenced by the current device callback mechanism, we have plenty of query callback and they are widely used in hot path, thus I finally decided to use query_transport() to utilize the existed mechanism.
Actually I used to learn that the bitmask operation is somewhat expensive too, while the callback may only cost two register, one instruction and twice jump, thus I guess we may need some benchmark to tell the difference on performance, so I just pick the easier way as first step :-P
Quoted 9 lines
Quoted 9 lines
drivers/infiniband/core/verbs.c +0
-0@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num);
Quoted 10 lines
drivers/infiniband/core/verbs.c enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_ · line 139
Quoted 5 lines
drivers/infiniband/core/verbs.c +2
-1-switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;If we are perserving ABI, then this looks wrong. Currently, IBOE returnsi transport IB and link layer Ethernet. It should not return link layer IB, it does not support IB link layer operations (such as MAD access).
That's my bad, IBOE is ETH link layer.
Quoted 1 line
[snip]
Quoted 9 lines
Quoted 1 line
};
I'm also concerned about this. I would like to see this enum essentially turned into a bitmap. One that is constructed in such a way that we can always get the specific test we need with only one compare against the overall value. In order to do so, we need to break it down into the essential elements that are part of each of the transports. So, for instance, we can define the two link layers we have so far, plus reserve one for OPA which we know is coming:
The idea sounds interesting, but frankly speaking I'm already starting to worried about the size of this patch set...
I really prefer to move optimizing/reforming work like this into next stage, after this pioneer patch set settle down and working stably, after all, we have already get rid of the old transport helpers, reforming based on that should be far more easier and clear.
Next version will be reorganized to separate the implementation and wrapper replacement, which make the patch set even bigger, fortunately, since the logical is not very complex, we are still able to handle it, I really prefer we can focus on performance and concise after infrastructure built up.
Quoted 5 lines
RDMA_LINK_LAYER_IB = 0x00000001, RDMA_LINK_LAYER_ETH = 0x00000002, RDMA_LINK_LAYER_OPA = 0x00000004, RDMA_LINK_LAYER_MASK = 0x0000000f,
[snip]
Quoted 4 lines
From patch 2/17:
Quoted 10 lines
drivers/infiniband/core/verbs.c
Quoted 7 lines
drivers/infiniband/core/verbs.c +3
-0+static inline int rdma_ib_mgmt (struct ib_device *device,u8 port_num) +{ + enum rdma_transport_type tp = device->query_transport(device,
port_num);drivers/infiniband/core/verbs.c +3
-0+ +return (tp ==RDMA_TRANSPORT_IB || tp ==RDMA_TRANSPORT_IBOE ); +}This looks wrong. IBOE doesn't have IB management. At least it doesn't have subnet management.
This helper actually could be erased at last :-) after Sean's suggestion on cma stuff, no where need this raw helper anymore, just cap_ib_cm(), cap_iw_cm() and cap_ib_mad() is enough.
Quoted 7 lines
Actually, reading through the remainder of the patches, there is some serious confusion taking place here. In later patches, you use this as a surrogate for
cap_cm, which implies you are talking about connection management. This is very different than therdma_dev_ib_mgmt()test that I create above, which specifically refers to IB management tasks unique to IB/OPA: MAD, SM, multicast.
[snip]
Quoted 9 lines
drivers/infiniband/core/verbs.c
Quoted 5 lines
drivers/infiniband/core/verbs.c +5
-0+static inline int cap_ib_mad (struct ib_device *device,u8 port_num) +{ +return rdma_ib_mgmt (device, port_num); +} +Why add
cap_ib_mad? It's nothing more thanrdma_port_ib_fabric_mgmtwith a new name. Just userdma_port_ib_fabric_mgmt()everywhere you havecap_ib_mad.
That will be excellent if we use more concise semantic to address the requirement, but I really want to make this as next stage since it sounds like not a small topic...
At this stage I suggest we focus on:
1. erase all the scene using old transport/link-layer helpers
2. classify helpers for each management branch somewhat accurately
3. make sure it's table and works well (most important!)
So we can do further reforming based on that milestone in future ;-)
Quoted 1 line
[snip]
Quoted 11 lines
rdma_port_get_read_sge(dev, port){ if (rdma_transport_is_iwarp) return 1; return dev->port[port]->max_sge; }Then, as Jason points out, if at some point in the future the kernel is modified to support devices with assymetrical read/write SGE sizes, this function can be modified to support those devices.
This part is actually a big topic too... frankly speaking I prefer some expert in that part to reform the stuff in future and give a good testing :-)
Quoted 14 lines
Patch 10/17:
As Sean pointed out,
force_grhshould berdma_dev_is_iboe(). The cm handles iw devices, but you notice all of the functions you modify here start withib_. The iwarp connections are funneled throughiw_specific function variants, and so even though the cm handles iwarp, ib, and roce devices, you never see anything other than ib/iboe (and opa in the future) get to theib_variants of the functions. So, they wrote the original tests as tests against the link layer being ethernet and used that to differentiate between ib and iboe devices. It works, but can confuse people. So, everyplace that has !rdma_transport_ib should really berdma_dev_is_iboeinstead. If we ever merge theiw_andib_functions in the future, having this right will help avoid problems.
Exactly, we noticed that the name transport do confusing peoples, next version will use rdma_tech_iboe() to distinguish from transport stuff, I guess that will make thing more clear :-)
Quoted 5 lines
Patch 11/17:
I wouldn't reform the
link_layer_showexcept to make it compile with the new defines I used above.
This is try to erase the old transport/link-layer helpers, so we could have a clean stage for further reforming ;-)
Quoted 1 line
[snip]
Quoted 8 lines
OK.
Patch 17/17:
I would drop this patch. In the future, the mlx5 driver will support both Ethernet and IB like mlx4 does, and we would just need to pull this code back to core instead of only in mlx4.
Actually we don't need that helper anymore, mlx4 can directly using it's own implemented get_link_layer(), I just leave it there as a remind.
It doesn't make sense to put it in core level if only mlx4/5 using it, mlx5 would have it's own get_link_layer() implementation too if it's going to support ETH port, they just need to use that new one :-)
Regards,
Michael Wang
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Doug LedfordQuoted 14 lines
drivers/infiniband/core/device.c static int ib_device_check_mandatory(struct ib_device *device) · line 82
Quoted 12 lines
drivers/infiniband/core/device.c +1
-0@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),I'm concerned about the performance implications of this. The size of
Quoted 8 lines
this patchset already points out just how many places in the code we have to check for various aspects of the device transport in order to do the right thing. Without going through the entire list to see how many are on critical hot paths, I'm sure some of them are on at least partially critical hot paths (like creation of new connections). I would prefer to see this change be implemented via a device attribute, not a functional call query. That adds a needless function call in these paths.
I like the idea of a query_transport but at the same time would like to see the use of "transport" reduced. A reduction in the use of this call could eliminate most performance concerns.
So can we keep this abstraction if at the end of the series we limit its use?
Quoted 9 lines
Quoted 9 lines
drivers/infiniband/core/verbs.c +0
-0@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num);
Quoted 10 lines
drivers/infiniband/core/verbs.c enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_ · line 139
Quoted 5 lines
drivers/infiniband/core/verbs.c +2
-1-switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;If we are perserving ABI, then this looks wrong. Currently, IBOE returnsi transport IB and link layer Ethernet. It should not return link layer IB, it does not support IB link layer operations (such as MAD access).
I think the original code has the bug.
IBoE devices currently return a transport of IB but they probably never get here because they support the get_link_layer callback used a few lines above. So this "bug" was probably never hit.
Quoted 39 lines
Quoted 10 lines
drivers/infiniband/core/verbs.c +1
-0case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }[ snip ]
Quoted 7 lines
include/rdma/ib_verbs.h +0
-0@@ -75,10 +75,13 @@ enum rdma_node_type { };include/rdma/ib_verbs.h enum rdma_node_type { · line 85
Quoted 10 lines
include/rdma/ib_verbs.h +4
-1enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , };I'm also concerned about this. I would like to see this enum essentially turned into a bitmap. One that is constructed in such a way that we can always get the specific test we need with only one compare against the overall value. In order to do so, we need to break it down into the essential elements that are part of each of the transports. So, for instance, we can define the two link layers we have so far, plus reserve one for OPA which we know is coming:
Quoted 4 lines
RDMA_LINK_LAYER_IB = 0x00000001, RDMA_LINK_LAYER_ETH = 0x00000002, RDMA_LINK_LAYER_OPA = 0x00000004, RDMA_LINK_LAYER_MASK = 0x0000000f,
I would reserve more bits here.
Quoted 8 lines
We can then define the currently known high level transport types:
RDMA_TRANSPORT_IB = 0x00000010, RDMA_TRANSPORT_IWARP = 0x00000020, RDMA_TRANSPORT_USNIC = 0x00000040,
RDMA_TRANSPORT_USNIC_UDP=0x00000080,RDMA_TRANSPORT_MASK=0x000000f0,
I would reserve more bits here.
Quoted 6 lines
We could then define bits for the IB management types:
RDMA_MGMT_IB = 0x00000100, RDMA_MGMT_OPA = 0x00000200, RDMA_MGMT_MASK = 0x00000f00,
We at least need bits for SA / CM support.
I said previously all device types support QP1 I was wrong... I forgot about USNIC devices. So the full management bit mask is.
RDMA_MGMT_IB_MAD = 0x00000100, RDMA_MGMT_QP0 = 0x00000200, RDMA_MGMT_SA = 0x00000400, RDMA_MGMT_CM = 0x00000800, RDMA_MGMT_OPA_MAD = 0x00001000, RDMA_MGMT_MASK = 0x000fff00,
With a couple of spares.
The MAD stack is pretty agnostic to the types of MADs passing through it so we don't really need PM flags etc.
Quoted 5 lines
Then we have space to define specific quirks:
RDMA_SEPARATE_READ_SGE=0x00001000,RDMA_QUIRKS_MASK=0xfffff000
shift for spares...
RDMA_SEPARATE_READ_SGE = 0x00100000,RDMA_QUIRKS_MASK = 0xfff00000
Quoted 24 lines
Once those are defined, a few definitions for device drivers to use when they initialize a device to set the bitmap to the right values:
#define
IS_IWARP(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_IWARP|RDMA_SEPARATE_READ_SGE)
#defineIS_IB(RDMA_LINK_LAYER_IB|RDMA_TRANSPORT_IB|RDMA_MGMT_IB) #defineIS_IBOE(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_IB) #defineIS_USNIC(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_USNIC) #defineIS_OPA(RDMA_LINK_LAYER_OPA|RDMA_TRANSPORT_IB|RDMA_MGMT_IB|RDMA_MGMT_OPA)Then you need to define the tests:
static inline bool
rdma_transport_is_iwarp(struct ib_device *dev, u8 port){ return dev->port[port]->transport & RDMA_TRANSPORT_IWARP; }/* Note: this intentionally covers IB, IBOE, and OPA...use
rdma_dev_is_ibif you want to only get physical IB devices */
static inline boolrdma_transport_is_ib(struct ibdev *dev)
Quoted 5 lines
{ return dev->port[port]->transport & RDMA_TRANSPORT_IB; }
rdma_port_is_ib(struct ib_device *dev, u8 port)
I prefer
rdma_port_link_layer_is_ibrdma_port_link_layer_is_eth
Quoted 5 lines
{ return dev->port[port]->transport & RDMA_LINK_LAYER_IB; }
rdma_port_is_iboe(struct ib_device *dev, u8 port)
I'm not sure what this means.
rdma_port_req_iboe_addr seems more appropriate because what we really need to know is that this device requires an IBoE address format. (PKey is "fake", PathRecord is fabricated rather than queried, GRH is required in the AH conversion.)
Quoted 5 lines
{ return dev->port[port]->transport & IS_IBOE == IS_IBOE; }
rdma_port_is_usnic(struct ib_device *dev, u8 port)
rdma_transport_is_usnic
Quoted 5 lines
{ return dev->port[port]->transport & RDMA_TRANSPORT_USNIC; }
rdma_port_is_opa(struct ib_device *dev, u8 port)
rdma_port_link_layer_is_opa
Quoted 7 lines
{ return dev->port[port]->transport & RDMA_LINK_LAYER_OPA; }
rdma_port_is_iwarp(struct ib_device *dev, u8 port){ return rdma_transport_is_iwarp(dev, port);
Why not call rdma_transport_is_iwarp?
Quoted 5 lines
}
rdma_port_ib_fabric_mgmt(struct ibdev *dev, u8 port){ return dev->port[port]->transport & RDMA_MGMT_IB;
I agree with Jason that this does not adequately describe the functionality we are looking for.
Quoted 3 lines
}
rdma_port_opa_mgmt(struct ibdev *dev, u8 port)
Agree.
Quoted 14 lines
{ return dev->port[port]->transport & RDMA_MGMT_OPA; }Other things can be changed too. Like
rdma_port_get_link_layercan become this:{ return dev->transport & RDMA_LINK_LAYER_MASK; }From patch 2/17:
Quoted 10 lines
include/rdma/ib_verbs.h
Quoted 7 lines
include/rdma/ib_verbs.h +3
-0+static inline int rdma_ib_mgmt (struct ib_device *device,u8 port_num) +{ + enum rdma_transport_type tp = device->query_transport(device,
port_num);include/rdma/ib_verbs.h +3
-0+ +return (tp ==RDMA_TRANSPORT_IB || tp ==RDMA_TRANSPORT_IBOE ); +}This looks wrong. IBOE doesn't have IB management. At least it doesn't have subnet management.
Right that is why we need a bit for CM vs SA capability.
Quoted 7 lines
Actually, reading through the remainder of the patches, there is some serious confusion taking place here. In later patches, you use this as a surrogate for
cap_cm, which implies you are talking about connection management. This is very different than therdma_dev_ib_mgmt()test that I create above, which specifically refers to IB management tasks unique to IB/OPA: MAD, SM, multicast.
multicast is part of SA so should be covered by the SA capability.
Quoted 7 lines
The kernel connection management code is not really limited. It supports IB, IBOE, iWARP, and in the future it will support OPA. There are some places in the CM code were we test for just IB/IBOE currently, but that's only because we split iWARP out higher up in the abstraction hierarchy. So, calling something
rdma_ib_mgmtand meaning a rather specialized tested in the CM is probably misleading.
Right! So we should have a CM capability.
Quoted 7 lines
To straighten all this out, lets break management out into the two distinct types:
rdma_port_ib_fabric_mgmt()<- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport &RDMA_MGMT_IBtest. If will be true for IB and OPA fabrics.
General management is covered by
RDMA_MGMT_IB_MAD = 0x00000100,RDMA_MGMT_QP0 = 0x00000200,
...RDMA_MGMT_OPA_MAD = 0x00001000,
Quoted 9 lines
rdma_port_conn_mgmt()<- connection management, which we currently support everything except USNIC (correct Sean?), so a test would be something like !(transport &RDMA_TRANSPORT_USNIC). This is then split out into two subgroups, IB style and iWARP stype connection management (aka,rdma_port_iw_conn_mgmt()andrdma_port_ib_conn_mgmt()). In my above bitmap, since I didn't give IBOE its own transport type, these subgroups still boil down to the simple tests transport & iWARP and transport & IB like they do today.
Specific management features CM, route resolution (SA), and special Multicast management requirements (SA) are covered by:
RDMA_MGMT_SA = 0x00000400,RDMA_MGMT_CM = 0x00000800,
Quoted 16 lines
From patch 3/17:
Quoted 12 lines
+/**
+ *cap_ib_mad- Check if the port of device has the capability Infiniband
+ * Management Datagrams.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support Infiniband
+ * Management Datagrams.
+ */
+static inline intcap_ib_mad(struct ib_device *device, u8 port_num)
Quoted 8 lines
include/rdma/ib_verbs.h
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+{ +return rdma_ib_mgmt (device, port_num); +} +Why add
cap_ib_mad? It's nothing more thanrdma_port_ib_fabric_mgmtwith a new name. Just userdma_port_ib_fabric_mgmt()everywhere you havecap_ib_mad.
Because USNIC apparently does not support MADs at all. So we end up needing a "big flag" to turn on/off ib_mad.
RDMA_MGMT_IB_MAD = 0x00000100,
Quoted 15 lines
From patch 4/17:
Quoted 11 lines
+/**
+ *cap_ib_smi- Check if the port of device has the capability Infiniband
+ * Subnet Management Interface.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support Infiniband
+ * Subnet Management Interface.
+ */
Quoted 8 lines
include/rdma/ib_verbs.h
Quoted 5 lines
include/rdma/ib_verbs.h +5
-0+static inline int cap_ib_smi (struct ib_device *device,u8 port_num) +{ +return rdma_transport_ib (device, port_num); +} +Same as the previous patch. This is needless indirection. Just use
rdma_port_ib_fabric_mgmtdirectly.
No this is not the same... You said:
<quote>
rdma_port_ib_fabric_mgmt() <- fabric specific management tasks: MAD, SM, multicast. The proper test for this with my bitmap above is a simple transport & RDMA_MGMT_IB test. If will be true for IB and OPA fabrics.
</quote>
But what we are looking for here is "does the port support QP0" Previously flagged as "smi". Cover this with this flag.
RDMA_MGMT_QP0 = 0x00000200,
So the optimized version of the above is:
static inline int cap_ib_smi(struct ib_device *device, u8 port_num)
{
return [<device> <port>]->flags & RDMA_MGMT_QP0;
}Quoted 4 lines
Patch 5/17:
Again, just use
rdma_port_ib_conn_mgmt()directly.
Agreed.
Quoted 4 lines
Patch 6/17:
Again, just use
rdma_port_ib_fabric_mgmt()directly.
No this needs to be
rdma_port_requires_sa()
or something...
Quoted 5 lines
Patch 7/17:
Again, just use
rdma_port_ib_fabric_mgmt()directly. It's perfectly applicable to the IB mcast registration requirements.
No this needs to be
rdma_port_requires_sa()
or something...
Quoted 9 lines
Patch 8/17:
Here we can create a new test if we are using the bitmap I created above:
rdma_port_ipoib(struct ib_device *dev, u8 port){ return !(dev->port[port]->transport & RDMA_LINK_LAYER_ETH);
I would prefer a link layer (or generic) bit mask rather than '&' of "transport" and "link layer". That just seems wrong.
Quoted 5 lines
}
This is presuming that OPA will need ipoib devices. This will cause all non-Ethernet link layer devices to return true, and right now, that is all IB and all OPA devices.
Agreed.
Quoted 26 lines
Patch 9/17:
Most of the other comments on this patch stand as they are. I would add the test:
rdma_port_separate_read_sge(dev, port){ return dev->port[port]->transport & RDMA_SEPERATE_READ_SGE; }and add the helper function:
rdma_port_get_read_sge(dev, port){ if (rdma_transport_is_iwarp) return 1; return dev->port[port]->max_sge; }Then, as Jason points out, if at some point in the future the kernel is modified to support devices with assymetrical read/write SGE sizes, this function can be modified to support those devices.
Patch 10/17:
Quoted 11 lines
As Sean pointed out,
force_grhshould berdma_dev_is_iboe(). The cm handles iw devices, but you notice all of the functions you modify here start withib_. The iwarp connections are funneled throughiw_specific function variants, and so even though the cm handles iwarp, ib, and roce devices, you never see anything other than ib/iboe (and opa in the future) get to theib_variants of the functions. So, they wrote the original tests as tests against the link layer being ethernet and used that to differentiate between ib and iboe devices. It works, but can confuse people. So, everyplace that has !rdma_transport_ib should really berdma_dev_is_iboeinstead. If we ever merge theiw_andib_functions in the future, having this right will help avoid problems.
I guess rdma_dev_is_iboe is ok. But it seems like we are keying off the addresses not necessarily the devices.
Quoted 31 lines
Patch 11/17:
I wouldn't reform the
link_layer_showexcept to make it compile with the new defines I used above.Patch 12/17:
Go ahead and add a helper to check all ports on a dev, just make it
rdma_hca_ib_conn_mgmt()and have it loop throughrdma_port_ib_conn_mgmt()return codes.Patch 13/17:
This patch is largely unneeded if we reworked the bitmap like I have above. A lot of the changes you made to switch from case statements to multiple if statements can go back to being case statements because in the bitmap IB and IBOE are still both transport IB, so you just do the case on the transport bits and not on the link layer bits.
Patch 14/17:
Seems ok.
Patch 15/17:
If you implement the bitmap like I list above, then this code will need fixed up to use the bitmap. Otherwise it looks OK.
Patch 16/17:
Quoted 7 lines
OK.
Patch 17/17:
I would drop this patch. In the future, the mlx5 driver will support both Ethernet and IB like mlx4 does, and we would just need to pull this code back to core instead of only in mlx4.
Agreed.
Ira
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 23 lines · ira.weiny
Quoted 14 lines
drivers/infiniband/core/device.c static int ib_device_check_mandatory(struct ib_device *device) · line 82
Quoted 12 lines
drivers/infiniband/core/device.c +1
-0@@ -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_transport),IB_MANDATORY_FUNC (query_pkey),IB_MANDATORY_FUNC (query_gid), IB_MANDATORY_FUNC(alloc_pd),I'm concerned about the performance implications of this. The size of
Quoted 8 lines
this patchset already points out just how many places in the code we have to check for various aspects of the device transport in order to do the right thing. Without going through the entire list to see how many are on critical hot paths, I'm sure some of them are on at least partially critical hot paths (like creation of new connections). I would prefer to see this change be implemented via a device attribute, not a functional call query. That adds a needless function call in these paths.
Quoted 5 lines
I like the idea of a
query_transportbut at the same time would like to see the use of "transport" reduced. A reduction in the use of this call could eliminate most performance concerns.So can we keep this abstraction if at the end of the series we limit its use?
The reason I don't like a query is because the transport type isn't changing. It's a static device attribute. The only devices that *can* change their transport are mlx4 or mlx5 devices, and they tear down and deregister their current device and bring up a new one when they need to change transports or link layers. So, this really isn't something we should query, this should be part of our static device attributes. Every other query in the list above is for something that changes. This is not.
Quoted 65 lines
Quoted 9 lines
Quoted 9 lines
drivers/infiniband/core/verbs.c +0
-0@@ -133,14 +133,16 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_if (device->get_link_layer)return device->get_link_layer (device, port_num);Quoted 10 lines
drivers/infiniband/core/verbs.c enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_ · line 139
Quoted 5 lines
drivers/infiniband/core/verbs.c +2
-1-switch (rdma_node_get_transport (device->node_type)) { +switch (device->query_transport (device, port_num)) {case RDMA_TRANSPORT_IB : +case RDMA_TRANSPORT_IBOE :return IB_LINK_LAYER_INFINIBAND ;If we are perserving ABI, then this looks wrong. Currently, IBOE returnsi transport IB and link layer Ethernet. It should not return link layer IB, it does not support IB link layer operations (such as MAD access).
I think the original code has the bug.
IBoE devices currently return a transport of IB but they probably never get here because they support the
get_link_layercallback used a few lines above. So this "bug" was probably never hit.Quoted 39 lines
Quoted 10 lines
drivers/infiniband/core/verbs.c +1
-0case RDMA_TRANSPORT_IWARP :case RDMA_TRANSPORT_USNIC :case RDMA_TRANSPORT_USNIC_UDP :return IB_LINK_LAYER_ETHERNET ;default : +BUG ();return IB_LINK_LAYER_UNSPECIFIED ; } }[ snip ]
Quoted 7 lines
include/rdma/ib_verbs.h +0
-0@@ -75,10 +75,13 @@ enum rdma_node_type { };include/rdma/ib_verbs.h enum rdma_node_type { · line 85
Quoted 10 lines
include/rdma/ib_verbs.h +4
-1enum rdma_transport_type { +/* legacy for users */ RDMA_TRANSPORT_IB ,RDMA_TRANSPORT_IWARP ,RDMA_TRANSPORT_USNIC , -RDMA_TRANSPORT_USNIC_UDP +RDMA_TRANSPORT_USNIC_UDP , +/* new transport */ +RDMA_TRANSPORT_IBOE , };I'm also concerned about this. I would like to see this enum essentially turned into a bitmap. One that is constructed in such a way that we can always get the specific test we need with only one compare against the overall value. In order to do so, we need to break it down into the essential elements that are part of each of the transports. So, for instance, we can define the two link layers we have so far, plus reserve one for OPA which we know is coming:
Quoted 6 lines
Quoted 4 lines
RDMA_LINK_LAYER_IB = 0x00000001, RDMA_LINK_LAYER_ETH = 0x00000002, RDMA_LINK_LAYER_OPA = 0x00000004, RDMA_LINK_LAYER_MASK = 0x0000000f,I would reserve more bits here.
Sure. I didn't mean to imply that this was as large is these bit fields would ever need to be, I just typed it up quickly at the time.
Quoted 75 lines
Quoted 8 lines
We can then define the currently known high level transport types:
RDMA_TRANSPORT_IB = 0x00000010, RDMA_TRANSPORT_IWARP = 0x00000020, RDMA_TRANSPORT_USNIC = 0x00000040,
RDMA_TRANSPORT_USNIC_UDP=0x00000080,RDMA_TRANSPORT_MASK=0x000000f0,I would reserve more bits here.
Quoted 6 lines
We could then define bits for the IB management types:
RDMA_MGMT_IB = 0x00000100, RDMA_MGMT_OPA = 0x00000200, RDMA_MGMT_MASK = 0x00000f00,We at least need bits for SA / CM support.
I said previously all device types support QP1 I was wrong... I forgot about USNIC devices. So the full management bit mask is.
RDMA_MGMT_IB_MAD = 0x00000100, RDMA_MGMT_QP0 = 0x00000200, RDMA_MGMT_SA = 0x00000400, RDMA_MGMT_CM = 0x00000800, RDMA_MGMT_OPA_MAD = 0x00001000, RDMA_MGMT_MASK = 0x000fff00,With a couple of spares.
The MAD stack is pretty agnostic to the types of MADs passing through it so we don't really need PM flags etc.
Quoted 5 lines
Then we have space to define specific quirks:
RDMA_SEPARATE_READ_SGE=0x00001000,RDMA_QUIRKS_MASK=0xfffff000shift for spares...
RDMA_SEPARATE_READ_SGE=0x00100000,RDMA_QUIRKS_MASK=0xfff00000Quoted 28 lines
Once those are defined, a few definitions for device drivers to use when they initialize a device to set the bitmap to the right values:
#define
IS_IWARP(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_IWARP|RDMA_SEPARATE_READ_SGE)
#defineIS_IB(RDMA_LINK_LAYER_IB|RDMA_TRANSPORT_IB|RDMA_MGMT_IB) #defineIS_IBOE(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_IB) #defineIS_USNIC(RDMA_LINK_LAYER_ETH|RDMA_TRANSPORT_USNIC) #defineIS_OPA(RDMA_LINK_LAYER_OPA|RDMA_TRANSPORT_IB|RDMA_MGMT_IB|RDMA_MGMT_OPA)Then you need to define the tests:
static inline bool
rdma_transport_is_iwarp(struct ib_device *dev, u8 port){ return dev->port[port]->transport & RDMA_TRANSPORT_IWARP; }/* Note: this intentionally covers IB, IBOE, and OPA...use
rdma_dev_is_ibif you want to only get physical IB devices */
static inline boolrdma_transport_is_ib(struct ibdev *dev){ return dev->port[port]->transport & RDMA_TRANSPORT_IB; }
Quoted 6 lines
Quoted 1 line
rdma_port_is_ib(struct ib_device *dev, u8 port)I prefer
rdma_port_link_layer_is_ibrdma_port_link_layer_is_eth
In my quick example, anything that started with rdma_transport* was testing the high level transport attribute of any given port of any given device, and anything that started with rdma_port* was testing the link layer on a specific port of any given device.
Quoted 5 lines
Quoted 5 lines
{ return dev->port[port]->transport & RDMA_LINK_LAYER_IB; }
Quoted 8 lines
Quoted 1 line
rdma_port_is_iboe(struct ib_device *dev, u8 port)I'm not sure what this means.
rdma_port_req_iboe_addrseems more appropriate because what we really need to know is that this device requires an IBoE address format. (PKey is "fake", PathRecord is fabricated rather than queried, GRH is required in the AH conversion.)
TomAto, Tomato...port_is_ib implicity means port_req_iboe_addr.
Quoted 21 lines
Quoted 6 lines
{ return dev->port[port]->transport & IS_IBOE == IS_IBOE; }
rdma_port_is_usnic(struct ib_device *dev, u8 port)
rdma_transport_is_usnicQuoted 5 lines
{ return dev->port[port]->transport & RDMA_TRANSPORT_USNIC; }
rdma_port_is_opa(struct ib_device *dev, u8 port)
rdma_port_link_layer_is_opaQuoted 4 lines
{ return dev->port[port]->transport & RDMA_LINK_LAYER_OPA; }
Quoted 5 lines
Quoted 3 lines
rdma_port_is_iwarp(struct ib_device *dev, u8 port){ return rdma_transport_is_iwarp(dev, port);Why not call
rdma_transport_is_iwarp?
As per my above statement, rdma_transport* tests were testing the high level transport type, rdma_port* types were testing link layers. iWARP has an Eth link layer, so technically port_is_iwarp makes no sense. But since all the other types had a check too, I included port_is_iwarp just to be complete, and if you are going to ask if a specific port is iwarp as a link layer, it makes sense to say yes if the transport is iwarp, not if the link layer is eth.
[ snip lots of stuff that is all correct ]
Quoted 11 lines
Quoted 8 lines
Patch 8/17:
Here we can create a new test if we are using the bitmap I created above:
rdma_port_ipoib(struct ib_device *dev, u8 port){ return !(dev->port[port]->transport & RDMA_LINK_LAYER_ETH);I would prefer a link layer (or generic) bit mask rather than '&' of "transport" and "link layer". That just seems wrong.
I kept the name transport, but it's really a device attribute bitmap. And of all the link layer types, eth is the only one for which IPoIB makes no sense (even if it's possible to do). So, as long as the ETH bit isn't set, we're good to go. But, calling it dev->port[port]->attributes instead of transport would make it more clear what it is.
Quoted 2 lines
I guess
rdma_dev_is_iboeis ok. But it seems like we are keying off the addresses not necessarily the devices.
They're one and the same. The addresses go with the device, the device goes with the addresses. You never have one without the other. The name of the check is not really important, just as long as it's clearly documented. I get why you link the address variant, because it pops out all the things that are special about IBoE addressing and calls out that the issues need to be handled. However, saying requires_iboe_addr(), while foreshadowing the work that needs done, doesn't actually document the work that needs done. Whether we call is dev_is_iboe() or requires_iboe_addr(), it would be good if the documentation spelled out those specific requirements for reference sake.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 7 lines · Doug Ledford
documented. I get why you link the address variant, because it pops out all the things that are special about IBoE addressing and calls out that the issues need to be handled. However, saying
requires_iboe_addr(), while foreshadowing the work that needs done, doesn't actually document the work that needs done. Whether we call isdev_is_iboe()orrequires_iboe_addr(), it would be good if the documentation spelled out those specific requirements for reference sake.
My deep hope for this, was that the test 'requires_iboe_addr' or whatever we call it would have a *really good* kdoc.
List all the ways iboe_addr's work, how they differ from IB addresses, refer to the specs people should read to understand it, etc.
The patches don't do this, and maybe Michael is the wrong person to fill that in, but we can get it done..
Jason
BTW: Michael, next time you post the series, please trim the CC list...
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 10 lines · Jason Gunthorpe
Quoted 7 lines · Doug Ledford
documented. I get why you link the address variant, because it pops out all the things that are special about IBoE addressing and calls out that the issues need to be handled. However, saying
requires_iboe_addr(), while foreshadowing the work that needs done, doesn't actually document the work that needs done. Whether we call isdev_is_iboe()orrequires_iboe_addr(), it would be good if the documentation spelled out those specific requirements for reference sake.
Quoted 8 lines
My deep hope for this, was that the test '
requires_iboe_addr' or whatever we call it would have a *really good* kdoc.List all the ways iboe_addr's work, how they differ from IB addresses, refer to the specs people should read to understand it, etc.
The patches don't do this, and maybe Michael is the wrong person to fill that in, but we can get it done..
That's exactly what I'm thinking ;-)
At first I'm just trying to save us some code but now it's becoming a topic far above that purpose, I'd like to help commit whatever we already settled and pass the internal reforming works to experts like you guys , implement the bitmask stuff ;-)
And I can still help on review and may be testing with mlx4 if later I got the access.
Quoted 5 lines
Jason
BTW: Michael, next time you post the series, please trim the CC list...
Thanks for the remind, I'll do trim in v3 :-)
Regards,
Michael Wang
Quoted 1 line
Tom Talpey
reviewerRe: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
In reply to Doug LedfordQuoted 7 lines · Doug Ledford
As per my above statement, rdma_transport* tests were testing the high level transport type, rdma_port* types were testing link layers. iWARP has an Eth link layer, so technically
port_is_iwarpmakes no sense. But since all the other types had a check too, I includedport_is_iwarpjust to be complete, and if you are going to ask if a specific port is iwarp as a link layer, it makes sense to say yes if the transport is iwarp, not if the link layer is eth.
Not wanting to split hairs, but I would not rule out the possibility of a future device supporting iWARP on one port and another RDMA protocol on another. One could also imagine softiWARP and softROCE co-existing atop a single ethernet NIC.
So, I disagree that port_is_iwarp() is a nonsequitur.
Tom.
Re: [PATCH v2 01/17] IB/Verbs: Implement new callback query_transport() for each HW
Quoted 9 lines · Tom Talpey
Quoted 7 lines · Doug Ledford
As per my above statement, rdma_transport* tests were testing the high level transport type, rdma_port* types were testing link layers. iWARP has an Eth link layer, so technically
port_is_iwarpmakes no sense. But since all the other types had a check too, I includedport_is_iwarpjust to be complete, and if you are going to ask if a specific port is iwarp as a link layer, it makes sense to say yes if the transport is iwarp, not if the link layer is eth.
Quoted 6 lines
Not wanting to split hairs, but I would not rule out the possibility of a future device supporting iWARP on one port and another RDMA protocol on another. One could also imagine softiWARP and softROCE co-existing atop a single ethernet NIC.
So, I disagree that
port_is_iwarp()is a nonsequitur.
Agreed, but that wasn't what I was calling non-sense. I was referring to the fact that in my quick little write up, the rdma_port* functions were all intended to test link layers, not high level transports. There is no such thing as an iWARP link layer. It was still a port specific test, and would work in all the situations you described, it's just that asking if a port's link layer is iWARP makes no sense, so I returned true if the transport was iWARP regardless of what the link layer actually was.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
PATCH v2 2/17 IB/Verbs: Implement raw management helpers
In reply to Michael WangAdd raw helpers:
rdma_transport_ib
rdma_transport_iboe
rdma_transport_iwarp
rdma_ib_mgmt
To help us checking transport type.
--- include/rdma/ib_verbs.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
include/rdma/ib_verbs.h +25 -0
@@ -1748,6 +1748,31 @@ int ib_query_port(struct ib_device *device,enum rdma_link_layer rdma_port_get_link_layer (struct ib_device *device,u8 port_num); +static inline int rdma_transport_ib (struct ib_device *device,u8 port_num) +{ +return device->query_transport (device, port_num) + ==RDMA_TRANSPORT_IB ; +} + +static inline int rdma_transport_iboe (struct ib_device *device,u8 port_num) +{ +return device->query_transport (device, port_num) + ==RDMA_TRANSPORT_IBOE ; +} + +static inline int rdma_transport_iwarp (struct ib_device *device,u8 port_num) +{ +return device->query_transport (device, port_num) + ==RDMA_TRANSPORT_IWARP ; +} + +static inline int rdma_ib_mgmt (struct ib_device *device,u8 port_num) +{ +enum rdma_transport_type tp = device->query_transport (device, port_num); + +return (tp ==RDMA_TRANSPORT_IB || tp ==RDMA_TRANSPORT_IBOE ); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 02/17] IB/Verbs: Implement raw management helpers
PiArc3RhdGljIGlubGluZSBpbnQgcmRtYV90cmFuc3BvcnRfaWIoc3RydWN0IGliX2RldmljZSAq ZGV2aWNlLCB1OA0KPiBwb3J0X251bSkNCj4gK3sNCj4gKwlyZXR1cm4gZGV2aWNlLT5xdWVyeV90 cmFuc3BvcnQoZGV2aWNlLCBwb3J0X251bSkNCj4gKwkJCT09IFJETUFfVFJBTlNQT1JUX0lCOw0K PiArfQ0KPiArDQo+ICtzdGF0aWMgaW5saW5lIGludCByZG1hX3RyYW5zcG9ydF9pYm9lKHN0cnVj dCBpYl9kZXZpY2UgKmRldmljZSwgdTgNCj4gcG9ydF9udW0pDQo+ICt7DQo+ICsJcmV0dXJuIGRl dmljZS0+cXVlcnlfdHJhbnNwb3J0KGRldmljZSwgcG9ydF9udW0pDQo+ICsJCQk9PSBSRE1BX1RS QU5TUE9SVF9JQk9FOw0KPiArfQ0KDQpXZSBuZWVkIHRvIGRvIHNvbWV0aGluZyB3aXRoIHRoZSBm dW5jdGlvbiBuYW1lcyB0byBtYWtlIHRoZWlyIHVzZSBtb3JlIG9idmlvdXMuICBCb3RoIElCIGFu ZCBJQm9FIGhhdmUgdHJhbnNwb3J0IElCLiAgSSB0aGluayBKYXNvbiBzdWdnZXN0ZWQgcmRtYV90 ZWNoX2liIC8gcmRtYV90ZWNoX2lib2UuDQoNClJlZ2FyZGluZyB0cmFuc3BvcnQgdHlwZXMsIEkg YmVsaWV2ZSB0aGF0IHVzbmljIHN1cHBvcnRzIDIgZGlmZmVyZW50IHRyYW5zcG9ydHMuICBBbHRo b3VnaCB1c25pYyBpc24ndCB1c2VkIGJ5IGFueXRoaW5nIGVsc2UgaW4gdGhlIGNvcmUgbGF5ZXIs IHdlIHNob3VsZCBwcm9iYWJseSBiZSBhYmxlIHRvIGhhbmRsZSBhIGRldmljZSB0aGF0IHN1cHBv cnRzIG11bHRpcGxlIHByb3RvY29scy4gIEknbSBub3Qgc3VyZSB3aGF0IHRoZSAndHJhbnNwb3J0 JyBzaG91bGQgYmUgZm9yIGlXYXJwLCBzaW5jZSBpV2FycCBpcyBsYXllcmVkIG92ZXIgVENQLiAg QnV0IHRoYXQgbWF5IGp1c3QgbWVhbiB0aGF0IHRoZSB0ZXJtIHRyYW5zcG9ydCBpc24ndCBncmVh dC4NCg0KLSBTZWFuDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 02/17] IB/Verbs: Implement raw management helpers
Quoted 16 lines · Sean
include/rdma/ib_verbs.h int ib_query_port(struct ib_device *device, · line 1761
Quoted 13 lines
+static inline int
rdma_transport_ib(struct ib_device *device, u8 port_num)include/rdma/ib_verbs.h +6
-0+{ +return device->query_transport (device, port_num) + ==RDMA_TRANSPORT_IB ; +} + +static inline int rdma_transport_iboe(struct ib_device *device, u8
port_num)include/rdma/ib_verbs.h +4
-0+{ +return device->query_transport (device, port_num) + ==RDMA_TRANSPORT_IBOE ; +}We need to do something with the function names to make their use more obvious. Both IB and IBoE have transport IB. I think Jason suggested
rdma_tech_ib/rdma_tech_iboe.
Quoted 1 line
Regarding transport types, I believe that usnic supports 2 different transports. Although usnic isn't used by anything else in the core layer, we should probably be able to handle a device that supports multiple protocols. I'm not sure what the 'transport' should be for iWarp, since iWarp is layered over TCP. But that may just mean that the term transport isn't great.
Agree, it do confusing folks, I will use tech instead in next version :-)
Regards,
Michael Wang
Quoted 3 lines
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/17 IB/Verbs: Use management helper cap_ib_mad() for mad-check
In reply to Michael WangIntroduce helper cap_ib_mad() to help us check if the port of an IB device support Infiniband Management Datagrams.
Reform ib_umad_add_one() to fit per-port-check method better.
--- drivers/infiniband/core/mad.c | 18 +++++++++--------- drivers/infiniband/core/user_mad.c | 26 ++++++++++++++++++++------ include/rdma/ib_verbs.h | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 15 deletions(-)
drivers/infiniband/core/mad.c +9 -9
@@ -3057,9 +3057,6 @@ static void ib_mad_init_device(struct ib_device *device) {int start, end, i; -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; -if (device->node_type ==RDMA_NODE_IB_SWITCH ) { start =0 ; end =0 ;
@@ -3069,6 +3066,9 @@ static void ib_mad_init_device(struct ib_device *device) }for (i = start; i <= end; i++) { +if (!cap_ib_mad (device, i)) +continue ; +if (ib_mad_port_open (device, i)) {dev_err (&device->dev,"Couldn't open port %d\n" , i); goto error;
@@ -3086,15 +3086,15 @@ error_agent:dev_err (&device->dev,"Couldn't close port %d\n" , i); error: - i--; +while (--i >= start) { +if (!cap_ib_mad (device, i)) +continue ; -while (i >= start) {if (ib_agent_port_close (device, i))dev_err (&device->dev,"Couldn't close port %d for agents\n" , i);if (ib_mad_port_close (device, i))dev_err (&device->dev,"Couldn't close port %d\n" , i); - i--; } }
@@ -3102,9 +3102,6 @@ static void ib_mad_remove_device(struct ib_device *device) {int i, num_ports, cur_port; -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; -if (device->node_type ==RDMA_NODE_IB_SWITCH ) { num_ports =1 ; cur_port =0 ;
@@ -3113,6 +3110,9 @@ static void ib_mad_remove_device(struct ib_device *device) cur_port =1 ; }for (i =0 ; i < num_ports; i++, cur_port++) { +if (!cap_ib_mad (device, i)) +continue ; +if (ib_agent_port_close (device, cur_port)) dev_err(&device->dev, "Couldn't close port %d for agents\n",
drivers/infiniband/core/user_mad.c +20 -6
@@ -1273,9 +1273,7 @@ static void ib_umad_add_one(struct ib_device *device) {struct ib_umad_device *umad_dev;int s, e, i; - -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; +int count =0 ;if (device->node_type ==RDMA_NODE_IB_SWITCH ) s = e =0 ;
@@ -1296,11 +1294,21 @@ static void ib_umad_add_one(struct ib_device *device) umad_dev->end_port = e;for (i = s; i <= e; ++i) { +if (!cap_ib_mad (device, i)) +continue ; + umad_dev->port[i - s].umad_dev = umad_dev;if (ib_umad_init_port (device, i, umad_dev, &umad_dev->port[i - s])) goto err; + + count++; + } + +if (!count) { +kobject_put (&umad_dev->kobj); +return ; }ib_set_client_data (device, &umad_client, umad_dev);
@@ -1308,8 +1316,12 @@ static void ib_umad_add_one(struct ib_device *device)return ; err: -while (--i >= s) +while (--i >= s) { +if (!cap_ib_mad (device, i)) +continue ; +ib_umad_kill_port (&umad_dev->port[i - s]); + }kobject_put (&umad_dev->kobj); }
@@ -1322,8 +1334,10 @@ static void ib_umad_remove_one(struct ib_device *device)if (!umad_dev)return ; -for (i =0 ; i <= umad_dev->end_port - umad_dev->start_port; ++i) -ib_umad_kill_port (&umad_dev->port[i]); +for (i =0 ; i <= umad_dev->end_port - umad_dev->start_port; ++i) { +if (cap_ib_mad (device, i)) +ib_umad_kill_port (&umad_dev->port[i]); + }kobject_put (&umad_dev->kobj); }
include/rdma/ib_verbs.h +15 -0
@@ -1773,6 +1773,21 @@ static inline int rdma_ib_mgmt(struct ib_device *device, u8 port_num)return (tp ==RDMA_TRANSPORT_IB || tp ==RDMA_TRANSPORT_IBOE ); } +/** +* cap_ib_mad - Check if the port of device has the capability Infiniband +* Management Datagrams. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support Infiniband +* Management Datagrams. +*/ +static inline int cap_ib_mad (struct ib_device *device,u8 port_num) +{ +return rdma_ib_mgmt (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 03/17] IB/Verbs: Use management helper cap_ib_mad() for mad-check
drivers/infiniband/core/mad.c static void ib_mad_init_device(struct ib_device *device) · line 3071
Quoted 13 lines · Michael Wang
drivers/infiniband/core/mad.c +3
-3-if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; -if (device->node_type ==RDMA_NODE_IB_SWITCH ) { start =0 ; end =0 ;@@ -3069,6 +3066,9 @@ static void ib_mad_init_device(struct ib_device *device) }for (i = start; i <= end; i++) { +if (!cap_ib_mad (device, i)) +continue ; +
I would prefer to see these changes in control flow as dedicated patches, at the top of your patch stack.
For this kind of work a patch should be mechanical changes only, it is easier to review that way.
Same comment applies throughout.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 03/17] IB/Verbs: Use management helper cap_ib_mad() for mad-check
Quoted 19 lines · Jason Gunthorpe
drivers/infiniband/core/mad.c static void ib_mad_init_device(struct ib_device *device) · line 3071
Quoted 13 lines · Michael Wang
drivers/infiniband/core/mad.c +3
-3-if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; -if (device->node_type ==RDMA_NODE_IB_SWITCH ) { start =0 ; end =0 ;@@ -3069,6 +3066,9 @@ static void ib_mad_init_device(struct ib_device *device) }for (i = start; i <= end; i++) { +if (!cap_ib_mad (device, i)) +continue ; +I would prefer to see these changes in control flow as dedicated patches, at the top of your patch stack.
Quoted 4 lines
For this kind of work a patch should be mechanical changes only, it is easier to review that way.
Same comment applies throughout.
Make sense :-) I will re-organize the sequence and put them at last.
Regards,
Michael Wang
Quoted 3 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/17 IB/Verbs: Use management helper cap_ib_smi() for smi-check
In reply to Michael WangIntroduce helper cap_ib_smi() to help us check if the port of an IB device support Infiniband Subnet Management Interface.
--- drivers/infiniband/core/agent.c | 2 +- drivers/infiniband/core/mad.c | 2 +- include/rdma/ib_verbs.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-)
drivers/infiniband/core/agent.c +1 -1
@@ -156,7 +156,7 @@ int ib_agent_port_open(struct ib_device *device, int port_num) goto error1; } -if (rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_INFINIBAND ) { +if (cap_ib_smi (device, port_num)) {/* Obtain send only MAD agent for SMI QP */ port_priv->agent[0] = ib_register_mad_agent(device, port_num, IB_QPT_SMI, NULL, 0,
drivers/infiniband/core/mad.c +1 -1
@@ -2938,7 +2938,7 @@ static int ib_mad_port_open(struct ib_device *device,init_mad_qp (port_priv, &port_priv->qp_info[1 ]); cq_size = mad_sendq_size + mad_recvq_size; - has_smi =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_INFINIBAND ; + has_smi =cap_ib_smi (device, port_num);if (has_smi) cq_size *=2 ;
include/rdma/ib_verbs.h +15 -0
@@ -1788,6 +1788,21 @@ static inline int cap_ib_mad(struct ib_device *device, u8 port_num)return rdma_ib_mgmt (device, port_num); } +/** +* cap_ib_smi - Check if the port of device has the capability Infiniband +* Subnet Management Interface. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support Infiniband +* Subnet Management Interface. +*/ +static inline int cap_ib_smi (struct ib_device *device,u8 port_num) +{ +return rdma_transport_ib (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 1 line
2.1.0
PATCH v2 5/17 IB/Verbs: Use management helper cap_ib_cm() for cm-check
In reply to Michael WangIntroduce helper cap_ib_cm() to help us check if the port of an IB device support Infiniband Communication Manager.
Reform cm_add_one() to fit per-port-check method better.
--- drivers/infiniband/core/cm.c | 22 +++++++++++++++++++--- include/rdma/ib_verbs.h | 15 +++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-)
drivers/infiniband/core/cm.c +19 -3
@@ -3761,9 +3761,7 @@ static void cm_add_one(struct ib_device *ib_device)unsigned long flags;int ret;u8 i; - -if (rdma_node_get_transport (ib_device->node_type) !=RDMA_TRANSPORT_IB ) -return ; +int count =0 ; cm_dev =kzalloc (sizeof (*cm_dev) +sizeof (*port) * ib_device->phys_port_cnt,GFP_KERNEL );
@@ -3783,6 +3781,9 @@ static void cm_add_one(struct ib_device *ib_device)set_bit (IB_MGMT_METHOD_SEND , reg_req.method_mask);for (i =1 ; i <= ib_device->phys_port_cnt; i++) { +if (!cap_ib_cm (ib_device, i)) +continue ; + port =kzalloc (sizeof *port,GFP_KERNEL );if (!port) goto error1;
@@ -3809,7 +3810,16 @@ static void cm_add_one(struct ib_device *ib_device) ret =ib_modify_port (ib_device, i,0 , &port_modify);if (ret) goto error3; + + count++; } + +if (!count) { +device_unregister (cm_dev->device); +kfree (cm_dev); +return ; + } +ib_set_client_data (ib_device, &cm_client, cm_dev);write_lock_irqsave (&cm.device_lock, flags);
@@ -3825,6 +3835,9 @@ error1: port_modify.set_port_cap_mask =0 ; port_modify.clr_port_cap_mask =IB_PORT_CM_SUP ;while (--i) { +if (!cap_ib_cm (ib_device, i)) +continue ; + port = cm_dev->port[i-1 ];ib_modify_port (ib_device, port->port_num,0 , &port_modify);ib_unregister_mad_agent (port->mad_agent);
@@ -3853,6 +3866,9 @@ static void cm_remove_one(struct ib_device *ib_device)write_unlock_irqrestore (&cm.device_lock, flags);for (i =1 ; i <= ib_device->phys_port_cnt; i++) { +if (!cap_ib_cm (ib_device, i)) +continue ; + port = cm_dev->port[i-1 ];ib_modify_port (ib_device, port->port_num,0 , &port_modify);ib_unregister_mad_agent (port->mad_agent);
include/rdma/ib_verbs.h +15 -0
@@ -1803,6 +1803,21 @@ static inline int cap_ib_smi(struct ib_device *device, u8 port_num)return rdma_transport_ib (device, port_num); } +/** +* cap_ib_cm - Check if the port of device has the capability Infiniband +* Communication Manager. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support Infiniband +* Communication Manager. +*/ +static inline int cap_ib_cm (struct ib_device *device,u8 port_num) +{ +return rdma_ib_mgmt (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 6/17 IB/Verbs: Use management helper cap_ib_sa() for sa-check
In reply to Michael WangIntroduce helper cap_ib_sa() to help us check if the port of an IB device support Infiniband Subnet Administrator.
Reform ib_sa_add_one() to fit per-port-check method better.
--- drivers/infiniband/core/sa_query.c | 27 +++++++++++++++++---------- include/rdma/ib_verbs.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/infiniband/core/sa_query.c +17 -10
@@ -450,7 +450,7 @@ static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *eventstruct ib_sa_port *port = &sa_dev->port[event->element.port_num - sa_dev->start_port]; -if (rdma_port_get_link_layer (handler->device, port->port_num) !=IB_LINK_LAYER_INFINIBAND ) +if (WARN_ON (!cap_ib_sa (handler->device, port->port_num)))return ;spin_lock_irqsave (&port->ah_lock, flags);
@@ -1153,9 +1153,7 @@ static void ib_sa_add_one(struct ib_device *device) {struct ib_sa_device *sa_dev;int s, e, i; - -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; +int count =0 ;if (device->node_type ==RDMA_NODE_IB_SWITCH ) s = e =0 ;
@@ -1175,7 +1173,7 @@ static void ib_sa_add_one(struct ib_device *device)for (i =0 ; i <= e - s; ++i) {spin_lock_init (&sa_dev->port[i].ah_lock); -if (rdma_port_get_link_layer (device, i +1 ) !=IB_LINK_LAYER_INFINIBAND ) +if (!cap_ib_sa (device, i +1 ))continue ; sa_dev->port[i].sm_ah =NULL ;
@@ -1189,6 +1187,13 @@ static void ib_sa_add_one(struct ib_device *device) goto err;INIT_WORK (&sa_dev->port[i].update_task, update_sm_ah); + + count++; + } + +if (!count) { +kfree (sa_dev); +return ; }ib_set_client_data (device, &sa_client, sa_dev);
@@ -1204,16 +1209,18 @@ static void ib_sa_add_one(struct ib_device *device)if (ib_register_event_handler (&sa_dev->event_handler)) goto err; -for (i =0 ; i <= e - s; ++i) -if (rdma_port_get_link_layer (device, i +1 ) ==IB_LINK_LAYER_INFINIBAND ) +for (i =0 ; i <= e - s; ++i) { +if (cap_ib_sa (device, i +1 ))update_sm_ah (&sa_dev->port[i].update_task); + }return ; err: -while (--i >=0 ) -if (rdma_port_get_link_layer (device, i +1 ) ==IB_LINK_LAYER_INFINIBAND ) +while (--i >=0 ) { +if (cap_ib_sa (device, i +1 ))ib_unregister_mad_agent (sa_dev->port[i].agent); + }kfree (sa_dev);
@@ -1233,7 +1240,7 @@ static void ib_sa_remove_one(struct ib_device *device)flush_workqueue (ib_wq);for (i =0 ; i <= sa_dev->end_port - sa_dev->start_port; ++i) { -if (rdma_port_get_link_layer (device, i +1 ) ==IB_LINK_LAYER_INFINIBAND ) { +if (cap_ib_sa (device, i +1 )) {ib_unregister_mad_agent (sa_dev->port[i].agent);if (sa_dev->port[i].sm_ah)kref_put (&sa_dev->port[i].sm_ah->ref, free_sm_ah);
include/rdma/ib_verbs.h +15 -0
@@ -1818,6 +1818,21 @@ static inline int cap_ib_cm(struct ib_device *device, u8 port_num)return rdma_ib_mgmt (device, port_num); } +/** +* cap_ib_sa - Check if the port of device has the capability Infiniband +* Subnet Administrator. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support Infiniband +* Subnet Administrator. +*/ +static inline int cap_ib_sa (struct ib_device *device,u8 port_num) +{ +return rdma_transport_ib (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/17 IB/Verbs: Use management helper cap_ib_mcast() for mcast-check
In reply to Michael WangIntroduce helper cap_ib_mcast() to help us check if the port of an IB device support Infiniband Multicast.
--- drivers/infiniband/core/multicast.c | 12 +++--------- include/rdma/ib_verbs.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-)
drivers/infiniband/core/multicast.c +3 -9
@@ -780,8 +780,7 @@ static void mcast_event_handler(struct ib_event_handler *handler,int index; dev = container_of(handler, struct mcast_device, event_handler); -if (rdma_port_get_link_layer (dev->device, event->element.port_num) != -IB_LINK_LAYER_INFINIBAND ) +if (WARN_ON (!cap_ib_mcast (dev->device, event->element.port_num)))return ; index = event->element.port_num - dev->start_port;
@@ -808,9 +807,6 @@ static void mcast_add_one(struct ib_device *device)int i;int count =0 ; -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; - dev =kmalloc (sizeof *dev + device->phys_port_cnt *sizeof *port,GFP_KERNEL );if (!dev)
@@ -824,8 +820,7 @@ static void mcast_add_one(struct ib_device *device) }for (i =0 ; i <= dev->end_port - dev->start_port; i++) { -if (rdma_port_get_link_layer (device, dev->start_port + i) != -IB_LINK_LAYER_INFINIBAND ) +if (!cap_ib_mcast (device, dev->start_port + i))continue ; port = &dev->port[i]; port->dev = dev;
@@ -863,8 +858,7 @@ static void mcast_remove_one(struct ib_device *device)flush_workqueue (mcast_wq);for (i =0 ; i <= dev->end_port - dev->start_port; i++) { -if (rdma_port_get_link_layer (device, dev->start_port + i) == -IB_LINK_LAYER_INFINIBAND ) { +if (cap_ib_mcast (device, dev->start_port + i)) { port = &dev->port[i];deref_port (port);wait_for_completion (&port->comp);
include/rdma/ib_verbs.h +15 -0
@@ -1833,6 +1833,21 @@ static inline int cap_ib_sa(struct ib_device *device, u8 port_num)return rdma_transport_ib (device, port_num); } +/** +* cap_ib_mcast - Check if the port of device has the capability Infiniband +* Multicast. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support Infiniband +* Multicast. +*/ +static inline int cap_ib_mcast (struct ib_device *device,u8 port_num) +{ +return cap_ib_sa (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 8/17 IB/Verbs: Use management helper cap_ipoib() for ipoib-check
In reply to Michael WangIntroduce helper cap_ipoib() to help us check if the port of an IB device support IP over Infiniband.
Reform ipoib_add_one() to fit per-port-check method better.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 17 ++++++++++------- include/rdma/ib_verbs.h | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +10 -7
@@ -1654,9 +1654,7 @@ static void ipoib_add_one(struct ib_device *device)struct net_device *dev;struct ipoib_dev_priv *priv;int s, e, p; - -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; +int count =0 ; dev_list =kmalloc (sizeof *dev_list,GFP_KERNEL );if (!dev_list)
@@ -1673,13 +1671,21 @@ static void ipoib_add_one(struct ib_device *device) }for (p = s; p <= e; ++p) { -if (rdma_port_get_link_layer (device, p) !=IB_LINK_LAYER_INFINIBAND ) +if (!cap_ipoib (device, p))continue ; + dev =ipoib_add_port ("ib%d" , device, p);if (!IS_ERR (dev)) { priv =netdev_priv (dev);list_add_tail (&priv->list, dev_list); } + + count++; + } + +if (!count) { +kfree (dev_list); +return ; }ib_set_client_data (device, &ipoib_client, dev_list);
@@ -1690,9 +1696,6 @@ static void ipoib_remove_one(struct ib_device *device)struct ipoib_dev_priv *priv, *tmp;struct list_head *dev_list; -if (rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) -return ; - dev_list =ib_get_client_data (device, &ipoib_client);if (!dev_list)return ;
include/rdma/ib_verbs.h +15 -0
@@ -1848,6 +1848,21 @@ static inline int cap_ib_mcast(struct ib_device *device, u8 port_num)return cap_ib_sa (device, port_num); } +/** +* cap_ipoib - Check if the port of device has the capability +* IP over Infiniband. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support +* IP over Infiniband. +*/ +static inline int cap_ipoib (struct ib_device *device,u8 port_num) +{ +return rdma_transport_ib (device, port_num); +} +int ib_query_gid (struct ib_device *device,u8 port_num,int index,union ib_gid *gid);
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 9/17 IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept()
In reply to Michael WangIntroduce helper cap_read_multi_sge() to help us check if the port of an IB device support RDMA Read Multiple Scatter-Gather Entries.
Reform svc_rdma_accept() to adopt management helpers.
--- include/rdma/ib_verbs.h | 15 +++++++++++++++ net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 4 ++-- net/sunrpc/xprtrdma/svc_rdma_transport.c | 12 +++++------- 3 files changed, 22 insertions(+), 9 deletions(-)
include/rdma/ib_verbs.h +15 -0
@@ -1849,6 +1849,21 @@ static inline int cap_ib_mcast(struct ib_device *device, u8 port_num) }/** +* cap_read_multi_sge - Check if the port of device has the capability +* RDMA Read Multiple Scatter-Gather Entries. +* +* @device: Device to be checked +* @port_num: Port number of the device +* +* Return 0 when port of the device don't support +* RDMA Read Multiple Scatter-Gather Entries. +*/ +static inline int cap_read_multi_sge (struct ib_device *device,u8 port_num) +{ +return !rdma_transport_iwarp (device, port_num); +} + +/** * cap_ipoib - Check if the port of device has the capability * IP over Infiniband. *
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +2 -2
@@ -118,8 +118,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,static int rdma_read_max_sge (struct svcxprt_rdma *xprt,int sge_count) { -if (rdma_node_get_transport (xprt->sc_cm_id->device->node_type) == -RDMA_TRANSPORT_IWARP ) +if (!cap_read_multi_sge (xprt->sc_cm_id->device, + xprt->sc_cm_id->port_num))return 1 ;else return min_t (int, sge_count, xprt->sc_max_sge);
net/sunrpc/xprtrdma/svc_rdma_transport.c +5 -7
@@ -979,8 +979,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)/* * Determine if a DMA MR is required and if so, what privs are required */ -switch (rdma_node_get_transport (newxprt->sc_cm_id->device->node_type)) { -case RDMA_TRANSPORT_IWARP : +if (rdma_transport_iwarp (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) { newxprt->sc_dev_caps |=SVCRDMA_DEVCAP_READ_W_INV ;if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ;
@@ -992,8 +992,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -case RDMA_TRANSPORT_IB : + }else if (rdma_ib_mgmt (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) {if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ; dma_mr_acc =IB_ACCESS_LOCAL_WRITE ;
@@ -1003,10 +1003,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -default : + }else goto errout; - }/* Create the DMA MR if needed, otherwise, use the DMA LKEY */ if (need_dma_mr) {
Signature · 1 line
2.1.0
Tom Talpey
reviewerRe: [PATCH v2 09/17] IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept()
Quoted 10 lines · Michael Wang
/**
+ *cap_read_multi_sge- Check if the port of device has the capability
+ * RDMA Read Multiple Scatter-Gather Entries.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support
+ * RDMA Read Multiple Scatter-Gather Entries.
+ */
include/rdma/ib_verbs.h static inline int cap_ib_mcast(struct ib_device *device, u8 port_num) · line 1864
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+static inline int cap_read_multi_sge (struct ib_device *device,u8 port_num) +{ +return !rdma_transport_iwarp (device, port_num); +}
This just papers over the issue we discussed earlier. How *many* entries does the device support? If a device supports one, or two, is that enough? How does the upper layer know the limit?
This needs an explicit device attribute, to be fixed properly.
Quoted 10 lines
include/rdma/ib_verbs.h +2
-0+ +/** * cap_ipoib - Check if the port of device has the capability * IP over Infiniband. * net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +0
-0
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c static void rdma_build_arg_xdr(struct svc_rqst *rqstp, · line 125
Quoted 10 lines
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +2
-2@@ -118,8 +118,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,static int rdma_read_max_sge (struct svcxprt_rdma *xprt,int sge_count) { -if (rdma_node_get_transport (xprt->sc_cm_id->device->node_type) == -RDMA_TRANSPORT_IWARP ) +if (!cap_read_multi_sge (xprt->sc_cm_id->device, + xprt->sc_cm_id->port_num))return 1 ;else return min_t (int, sge_count, xprt->sc_max_sge);
This is incorrect. The RDMA Read max is not at all the same as the max_sge. It is a different operation, with a different set of work request parameters.
In other words, the above same comment applies.
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 984
Quoted 13 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-2@@ -979,8 +979,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)/* * Determine if a DMA MR is required and if so, what privs are required */ -switch (rdma_node_get_transport (newxprt->sc_cm_id->device->node_type)) { -case RDMA_TRANSPORT_IWARP : +if (rdma_transport_iwarp (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) { newxprt->sc_dev_caps |=SVCRDMA_DEVCAP_READ_W_INV ;
Do I read this correctly that it is forcing the "read with invalidate" capability to "on" for all iWARP devices? I don't think that is correct, for the legacy devices you're also supporting.
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 999
Quoted 11 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-2@@ -992,8 +992,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -case RDMA_TRANSPORT_IB : + }else if (rdma_ib_mgmt (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) {if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ; dma_mr_acc =IB_ACCESS_LOCAL_WRITE ;
Now I'm even more confused. How is the presence of IB management related to needing a privileged lmr?
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 09/17] IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept()
Hi, Tom
Thanks for the comments :-)
Quoted 20 lines · Tom Talpey
Quoted 10 lines · Michael Wang
/**
+ *cap_read_multi_sge- Check if the port of device has the capability
+ * RDMA Read Multiple Scatter-Gather Entries.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support
+ * RDMA Read Multiple Scatter-Gather Entries.
+ */include/rdma/ib_verbs.h static inline int cap_ib_mcast(struct ib_device *device, u8 port_num) · line 1864
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+static inline int cap_read_multi_sge (struct ib_device *device,u8 port_num) +{ +return !rdma_transport_iwarp (device, port_num); +}This just papers over the issue we discussed earlier. How *many* entries does the device support? If a device supports one, or two, is that enough? How does the upper layer know the limit?
Quoted 1 line
This needs an explicit device attribute, to be fixed properly.
This is the prototype to expose the problem we have in here, I would prefer some one good at this part to extending the API in future, basing on the right logical.
Currently this just inherit from the legacy, it implemented in order to be compatible with the current code.
Quoted 26 lines
Quoted 11 lines
include/rdma/ib_verbs.h +2
-0+ +/** * cap_ipoib - Check if the port of device has the capability * IP over Infiniband. * net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +0
-0net/sunrpc/xprtrdma/svc_rdma_recvfrom.c static void rdma_build_arg_xdr(struct svc_rqst *rqstp, · line 125
Quoted 10 lines
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +2
-2@@ -118,8 +118,8 @@ static void rdma_build_arg_xdr(struct svc_rqst *rqstp,static int rdma_read_max_sge (struct svcxprt_rdma *xprt,int sge_count) { -if (rdma_node_get_transport (xprt->sc_cm_id->device->node_type) == -RDMA_TRANSPORT_IWARP ) +if (!cap_read_multi_sge (xprt->sc_cm_id->device, + xprt->sc_cm_id->port_num))return 1 ;else return min_t (int, sge_count, xprt->sc_max_sge);This is incorrect. The RDMA Read max is not at all the same as the
max_sge. It is a different operation, with a different set of work request parameters.
Quoted 1 line
In other words, the above same comment applies.
Any idea on how to improve this part?
Again, all these helpers just inherit the old logical, if it's wrong, let's correct it ;-)
And if we don't know how to correct, we can leave this as a signpost and waiting for someone good at this particular part to fix it.
Quoted 11 lines
Quoted 11 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +0
-1@@ -979,8 +979,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)/* * Determine if a DMA MR is required and if so, what privs are required */ -switch (rdma_node_get_transport (newxprt->sc_cm_id->device->node_type)) {
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 984
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-1-case RDMA_TRANSPORT_IWARP : +if (rdma_transport_iwarp (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) { newxprt->sc_dev_caps |=SVCRDMA_DEVCAP_READ_W_INV ;Do I read this correctly that it is forcing the "read with invalidate" capability to "on" for all iWARP devices? I don't think that is correct, for the legacy devices you're also supporting.
Hmm.. but that's exactly same as the old logical, correct? Or do you mean the old logical is wrong?
Quoted 16 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 999
Quoted 13 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-2@@ -992,8 +992,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -case RDMA_TRANSPORT_IB : + }else if (rdma_ib_mgmt (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) {if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ; dma_mr_acc =IB_ACCESS_LOCAL_WRITE ;Now I'm even more confused. How is the presence of IB management related to needing a privileged lmr?
I think you actually mean we need some more wrapper here with the right name, correct?
I'm not good at this part, any suggestions?
Regards,
Michael Wang
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 09/17] IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept()
In reply to Tom TalpeyQuoted 11 lines · Tom Talpey
Quoted 10 lines · Michael Wang
/**
+ *cap_read_multi_sge- Check if the port of device has the capability
+ * RDMA Read Multiple Scatter-Gather Entries.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support
+ * RDMA Read Multiple Scatter-Gather Entries.
+ */
Quoted 8 lines
include/rdma/ib_verbs.h static inline int cap_ib_mcast(struct ib_device *device, u8 port_num) · line 1864
Quoted 4 lines
include/rdma/ib_verbs.h +4
-0+static inline int cap_read_multi_sge (struct ib_device *device,u8 port_num) +{ +return !rdma_transport_iwarp (device, port_num); +}This just papers over the issue we discussed earlier. How *many* entries does the device support? If a device supports one, or two, is that enough? How does the upper layer know the limit?
I think Michael is fine to just make this one mechanical change.
The kernel only supports two kinds of devices today, ones with 1 read SGE and ones where READ SGE == WRITE SGE == SEND SGE.
If someone makes another variation then it is up to them to propose a better fix.
Quoted 5 lines
Quoted 5 lines
static int
rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count){net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +1
-2-if (rdma_node_get_transport (xprt->sc_cm_id->device->node_type) == -RDMA_TRANSPORT_IWARP ) + if (!cap_read_multi_sge(xprt->sc_cm_id->device,
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c static void rdma_build_arg_xdr(struct svc_rqst *rqstp, · line 125
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +1
-0+ xprt->sc_cm_id->port_num))return 1 ; else return min_t(int, sge_count, xprt->sc_max_sge);This is incorrect. The RDMA Read max is not at all the same as the
max_sge. It is a different operation, with a different set of work request parameters.
The algorithm looks OK to me,
newxprt->sc_max_sge = min((size_t)devattr.max_sge,
(size_t)RPCSVC_MAXPAGES);So it returns 1 or the number of sge entries per WR, and max_sge is for READ/WRITE/SEND in every case except when cap_read_multi_sge == 1
Quoted 4 lines
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +0
-1/* * Determine if a DMA MR is required and if so, what privs are required */ -switch (rdma_node_get_transport (newxprt->sc_cm_id->device->node_type)) {
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 984
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-1-case RDMA_TRANSPORT_IWARP : +if (rdma_transport_iwarp (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) { newxprt->sc_dev_caps |=SVCRDMA_DEVCAP_READ_W_INV ;Do I read this correctly that it is forcing the "read with invalidate" capability to "on" for all iWARP devices? I don't think that is correct, for the legacy devices you're also supporting.
No idea here, this logic was added in:
commit 3a5c63803d0552a3ad93b85c262f12cd86471443
Author: Tom Tucker <[email protected]> Date: Tue Sep 30 13:46:13 2008 -0500
svcrdma: Query device for Fast Reg support during connection setup
Query the device capabilities in the svc_rdma_accept function to determine what advanced memory management capabilities are supported by the device. Based on the query, select the most secure model available given the requirements of the transport and capabilities of the adapter.
Quoted 6 lines
Quoted 6 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +0
-2@@ -992,8 +992,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -case RDMA_TRANSPORT_IB :
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 999
Quoted 5 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-0+ }else if (rdma_ib_mgmt (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) {if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ; dma_mr_acc =IB_ACCESS_LOCAL_WRITE ;Now I'm even more confused. How is the presence of IB management related to needing a privileged lmr?
Agree, this needs to be someone else.
I think the test is probably based on this comment:
* NB: iWARP requires remote write access for the data sink
* of an RDMA_READ. IB does not.
So the if should be:
if (cap_rdma_read_needs_write(..) &&
!(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) {
need_dma_mr = 1;
dma_mr_acc =
(IB_ACCESS_LOCAL_WRITE |
IB_ACCESS_REMOTE_WRITE);And the identical if blocks merged.
Plus the
if (rdma_transport_iwarp(newxprt->sc_cm_id->device, newxprt->sc_cm_id->port_num))
newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV
Jason
Re: [PATCH v2 09/17] IB/Verbs: Use helper cap_read_multi_sge() and reform svc_rdma_accept()
On 04/07/2015 07:42 PM, Jason Gunthorpe wrote:
[snip]
Quoted 31 lines
Quoted 6 lines
Quoted 6 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +0
-2@@ -992,8 +992,8 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) dma_mr_acc =IB_ACCESS_LOCAL_WRITE ; }else need_dma_mr =0 ; -break ; -case RDMA_TRANSPORT_IB :Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) · line 999
Quoted 5 lines
net/sunrpc/xprtrdma/svc_rdma_transport.c +2
-0+ }else if (rdma_ib_mgmt (newxprt->sc_cm_id->device, + newxprt->sc_cm_id->port_num)) {if (!(newxprt->sc_dev_caps &SVCRDMA_DEVCAP_FAST_REG )) { need_dma_mr =1 ; dma_mr_acc =IB_ACCESS_LOCAL_WRITE ;Now I'm even more confused. How is the presence of IB management related to needing a privileged lmr?
Agree, this needs to be someone else.
I think the test is probably based on this comment:
* NB: iWARP requires remote write access for the data sink
* of anRDMA_READ. IB does not.So the if should be:
if (cap_rdma_read_needs_write(..) && !(newxprt->sc_dev_caps & SVCRDMA_DEVCAP_FAST_REG)) { need_dma_mr = 1; dma_mr_acc = (IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_WRITE);
Quoted 6 lines
And the identical if blocks merged.
Plus the
if (rdma_transport_iwarp(newxprt->sc_cm_id->device, newxprt->sc_cm_id->port_num))
newxprt->sc_dev_caps|=SVCRDMA_DEVCAP_READ_W_INV
Sounds good :-) I'll give this part a reform in next version.
Regards,
Michael Wang
Quoted 3 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 10/17 IB/Verbs: Adopt management helpers for IB helpers
In reply to Michael WangAdopt management helpers for:
ib_init_ah_from_path() ib_init_ah_from_wc() ib_resolve_eth_l2_attrs()
--- drivers/infiniband/core/sa_query.c | 2 +- drivers/infiniband/core/verbs.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/infiniband/core/sa_query.c +1 -1
@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate; - force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);if (rec->hop_limit >1 || force_grh) { ah_attr->ah_flags =IB_AH_GRH ;
drivers/infiniband/core/verbs.c +2 -4
@@ -200,11 +200,9 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc,u32 flow_class;u16 gid_index;int ret; -int is_eth = (rdma_port_get_link_layer (device, port_num) == -IB_LINK_LAYER_ETHERNET );memset (ah_attr,0 ,sizeof *ah_attr); -if (is_eth) { +if (!rdma_transport_ib (device, port_num)) {if (!(wc->wc_flags &IB_WC_GRH ))return -EPROTOTYPE ;
@@ -873,7 +871,7 @@ int ib_resolve_eth_l2_attrs(struct ib_qp *qp,union ib_gid sgid;if ((*qp_attr_mask &IB_QP_AV ) && - (rdma_port_get_link_layer (qp->device, qp_attr->ah_attr.port_num) ==IB_LINK_LAYER_ETHERNET )) { + (!rdma_transport_ib (qp->device, qp_attr->ah_attr.port_num))) { ret =ib_query_gid (qp->device, qp_attr->ah_attr.port_num, qp_attr->ah_attr.grh.sgid_index, &sgid);if (ret)
Signature · 1 line
2.1.0
RE: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
Quoted 44 lines
drivers/infiniband/core/sa_query.c +1
-1@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate; - force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);drivers/infiniband/core/sa_query.c +0
-0if (rec->hop_limit >1 || force_grh) { ah_attr->ah_flags =IB_AH_GRH ;drivers/infiniband/core/verbs.c +2
-4@@ -200,11 +200,9 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc, u32 flow_class;u16 gid_index;int ret; -int is_eth = (rdma_port_get_link_layer (device, port_num) == -IB_LINK_LAYER_ETHERNET );memset (ah_attr,0 ,sizeof *ah_attr); -if (is_eth) { +if (!rdma_transport_ib (device, port_num)) {if (!(wc->wc_flags &IB_WC_GRH ))return -EPROTOTYPE ;@@ -873,7 +871,7 @@ int ib_resolve_eth_l2_attrs(struct ib_qp *qp,union ib_gid sgid;if ((*qp_attr_mask &IB_QP_AV ) && - (rdma_port_get_link_layer (qp->device, qp_attr->ah_attr.port_num) == IB_LINK_LAYER_ETHERNET)) { + (!rdma_transport_ib(qp->device, qp_attr->ah_attr.port_num))) { ret =ib_query_gid (qp->device, qp_attr->ah_attr.port_num, qp_attr->ah_attr.grh.sgid_index, &sgid);
Quoted 1 line
if (ret)
The above checks would be better as:
force_grh = rdma_transport_iboe(...)
They are RoCE/IBoE specific checks.
Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
On 04/07/2015 08:40 PM, Hefty, Sean wrote:
[snip]
Quoted 27 lines
Quoted 23 lines
drivers/infiniband/core/verbs.c +2
-4@@ -200,11 +200,9 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, struct ib_wc *wc, u32 flow_class;u16 gid_index;int ret; -int is_eth = (rdma_port_get_link_layer (device, port_num) == -IB_LINK_LAYER_ETHERNET );memset (ah_attr,0 ,sizeof *ah_attr); -if (is_eth) { +if (!rdma_transport_ib (device, port_num)) {if (!(wc->wc_flags &IB_WC_GRH ))return -EPROTOTYPE ;@@ -873,7 +871,7 @@ int ib_resolve_eth_l2_attrs(struct ib_qp *qp,union ib_gid sgid;if ((*qp_attr_mask &IB_QP_AV ) && - (rdma_port_get_link_layer (qp->device, qp_attr->ah_attr.port_num) == IB_LINK_LAYER_ETHERNET)) { + (!rdma_transport_ib(qp->device, qp_attr->ah_attr.port_num))) { ret =ib_query_gid (qp->device, qp_attr->ah_attr.port_num, qp_attr->ah_attr.grh.sgid_index, &sgid);Quoted 1 line
if (ret)
The above checks would be better as:
Quoted 3 lines
force_grh=rdma_transport_iboe(...)They are RoCE/IBoE specific checks.
Got it, will be in next version :-)
Regards,
Michael Wang
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
In reply to Michael Wangdrivers/infiniband/core/sa_query.c int ib_init_ah_from_path(struct ib_device *device, u8 port_num, · line 543
Quoted 8 lines · Michael Wang
index f704254..4e61104 100644
+++b/drivers/infiniband/core/sa_query.cdrivers/infiniband/core/sa_query.c +1
-1@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate; - force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);
Maybe these tests should be called cap_mandatory_grh - but I'm not really sure how iWarp uses the GRH fields in the AH...
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
Quoted 9 lines
-----Original Message-----
From: Jason Gunthorpe [mailto:[email protected]]
Sent: Tuesday, April 07, 2015 3:13 PM
To: Michael Wang
Cc: Roland Dreier; Sean Hefty; [email protected]; [email protected]; [email protected]; [email protected]; Hal Rosenstock; Tom Tucker; Steve Wise; Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal Latif; Upinder Malhi; Trond Myklebust; J. Bruce Fields; David S. Miller; Ira Weiny; PJ Waskiewicz; Tatyana Nikolova; Or
Gerlitz; Jack
Quoted 2 lines
Morgenstein; Haggai Eran; Ilya Nelkenbaum; Yann Droneaud; Bart Van Assche; Shachar Raindel; Sagi Grimberg; Devesh Sharma; Matan Barak; Moni Shoua; Jiri Kosina; Selvin Xavier; Mitesh Ahuja; Li RongQing; Rasmus Villemoes; Alex Estrin; Doug Ledford; Eric
Dumazet; Erez
Quoted 10 lines
Shitrit; Tom Gundersen; Chuck Lever
Subject: Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpersQuoted 6 lines · Michael Wang
index f704254..4e61104 100644
+++b/drivers/infiniband/core/sa_query.cdrivers/infiniband/core/sa_query.c +0
-0@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate;
Quoted 6 lines
drivers/infiniband/core/sa_query.c int ib_init_ah_from_path(struct ib_device *device, u8 port_num, · line 543
Quoted 2 lines
drivers/infiniband/core/sa_query.c +1
-1- force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);Maybe these tests should be called
cap_mandatory_grh- but I'm not really sure how iWarp uses the GRH fields in the AH...
iWARP runs on top of TCP...this SA code is all IB-specific. The reason it was checking for ETHERNET, I think, is for RoCE. So
this change is totally incorrect, I think, because RoCE is an IB transport, but it runs on ETHERNET.
Steve.
Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
Hi, Steve
Thanks for the comment :-)
On 04/07/2015 10:16 PM, Steve Wise wrote:
[snip]
Quoted 10 lines
Quoted 7 lines
drivers/infiniband/core/sa_query.c int ib_init_ah_from_path(struct ib_device *device, u8 port_num, · line 543
Quoted 3 lines
drivers/infiniband/core/sa_query.c +1
-1- force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);Maybe these tests should be called
cap_mandatory_grh- but I'm not really sure how iWarp uses the GRH fields in the AH...iWARP runs on top of TCP...this SA code is all IB-specific. The reason it was checking for ETHERNET, I think, is for RoCE. So
this change is totally incorrect, I think, because RoCE is an IB transport, but it runs on ETHERNET.
I guess it's the name 'transport' which confusing folks... actually (!rdma_transport_ib) including RoCE/IBoE, but yes, here it's for IBoE only, so let's change it to rdma_transport_iboe ;-)
Regards,
Michael Wang
Quoted 5 lines
Steve.
Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
In reply to Steve WiseQuoted 30 lines · Steve Wise
Quoted 9 lines
-----Original Message-----
From: Jason Gunthorpe [mailto:jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org]
Sent: Tuesday, April 07, 2015 3:13 PM
To: Michael Wang
Cc: Roland Dreier; Sean Hefty; [email protected]; [email protected]; [email protected]; [email protected]; Hal Rosenstock; Tom Tucker; Steve Wise; Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal Latif; Upinder Malhi; Trond Myklebust; J. Bruce Fields; David S. Miller; Ira Weiny; PJ Waskiewicz; Tatyana Nikolova; OrGerlitz; Jack
Quoted 2 lines
Morgenstein; Haggai Eran; Ilya Nelkenbaum; Yann Droneaud; Bart Van Assche; Shachar Raindel; Sagi Grimberg; Devesh Sharma; Matan Barak; Moni Shoua; Jiri Kosina; Selvin Xavier; Mitesh Ahuja; Li RongQing; Rasmus Villemoes; Alex Estrin; Doug Ledford; Eric
Dumazet; Erez
Quoted 10 lines
Shitrit; Tom Gundersen; Chuck Lever
Subject: Re: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpersQuoted 6 lines · Michael Wang
index f704254..4e61104 100644
+++b/drivers/infiniband/core/sa_query.cdrivers/infiniband/core/sa_query.c +0
-0@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate;Quoted 6 lines
drivers/infiniband/core/sa_query.c int ib_init_ah_from_path(struct ib_device *device, u8 port_num, · line 543
Quoted 2 lines
drivers/infiniband/core/sa_query.c +1
-1- force_grh =rdma_port_get_link_layer (device, port_num) ==IB_LINK_LAYER_ETHERNET ; + force_grh = !rdma_transport_ib (device, port_num);Maybe these tests should be called
cap_mandatory_grh- but I'm not really sure how iWarp uses the GRH fields in the AH...
Quoted 2 lines
iWARP runs on top of TCP...this SA code is all IB-specific. The reason it was checking for ETHERNET, I think, is for RoCE. So
this change is totally incorrect, I think, because RoCE is an IB transport, but it runs on ETHERNET.
But RoCE does not have an SA?
Looks like ib_init_ah_from_path was overloaded to handle non-standard "path records".
It seems like the correct functionality would be to use ib_init_ah_from_path() for true SA PathRecords and have another call iboe_init_ah() wrap ib_init_ah_from_path() when RoCE address information is needed in the AH.
For Michaels patches I think
force_grh = rdma_device_is_iboe(...)
is the logic we need here.
Ira
Quoted 5 lines
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 10/17] IB/Verbs: Adopt management helpers for IB helpers
In reply to Jason GunthorpeQuoted 7 lines
Review int ib_init_ah_from_path(struct ib_device *device,
Quoted 3 lines
index f704254..4e61104 100644
+++b/drivers/infiniband/core/sa_query.c(quoted diff) +0
-0@@ -540,7 +540,7 @@ int ib_init_ah_from_path(struct ib_device *device,u8
port_num,Quoted 3 lines
drivers/infiniband/core/sa_query.c +0
-0ah_attr->port_num = port_num; ah_attr->static_rate = rec->rate;
Quoted 6 lines
Review int ib_init_ah_from_path(struct ib_device *device, · line 543
Quoted 1 line
(quoted diff) +0
-1- force_grh = rdma_port_get_link_layer(device, port_num) ==
IB_LINK_LAYER_ETHERNET;drivers/infiniband/core/sa_query.c int ib_init_ah_from_path(struct ib_device *device, u8 port_num, · line 543
Quoted 1 line
drivers/infiniband/core/sa_query.c +1
-0+ force_grh = !rdma_transport_ib (device, port_num);Maybe these tests should be called
cap_mandatory_grh- but I'm not really sure how iWarp uses the GRH fields in the AH...
AH are used with unconnected endpoints, which iWarp doesn't currently support. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 11/17 IB/Verbs: Reform link_layer_show() and ib_uverbs_query_port()
In reply to Michael WangReform link_layer_show() and ib_uverbs_query_port() with management helpers.
--- drivers/infiniband/core/sysfs.c | 8 ++------ drivers/infiniband/core/uverbs_cmd.c | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-)
drivers/infiniband/core/sysfs.c +2 -6
@@ -248,14 +248,10 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused,static ssize_t link_layer_show (struct ib_port *p,struct port_attribute *unused,char *buf) { -switch (rdma_port_get_link_layer (p->ibdev, p->port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (p->ibdev, p->port_num))return sprintf (buf,"%s\n" ,"InfiniBand" ); -case IB_LINK_LAYER_ETHERNET : +else return sprintf (buf,"%s\n" ,"Ethernet" ); -default : -return sprintf (buf,"%s\n" ,"Unknown" ); - } }static PORT_ATTR_RO (state);
drivers/infiniband/core/uverbs_cmd.c +4 -2
@@ -515,8 +515,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.active_width = attr.active_width; resp.active_speed = attr.active_speed; resp.phys_state = attr.phys_state; - resp.link_layer =rdma_port_get_link_layer (file->device->ib_dev, - cmd.port_num); + resp.link_layer =rdma_transport_ib (file->device->ib_dev, + cmd.port_num) ? +IB_LINK_LAYER_INFINIBAND : +IB_LINK_LAYER_ETHERNET ;if (copy_to_user ((void __user *) (unsigned long ) cmd.response, &resp,sizeof resp))
Signature · 1 line
2.1.0
RE: [PATCH v2 11/17] IB/Verbs: Reform link_layer_show() and ib_uver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QgbG9uZykgY21kLnJlc3BvbnNlLA0KPiAgCQkJICZyZXNwLCBzaXplb2YgcmVzcCkpDQoN CkJvdGggb2YgdGhlIGFib3ZlIGNoZWNrIHRoZSB0cmFuc3BvcnQgaW4gb3JkZXIgdG8gZGV0ZXJt aW5lIHRoZSBsaW5rIGxheWVyLg0KDQpUaGVzZSB2YWx1ZXMgYXJlIGV4cG9zZWQgdG8gdXNlciBz cGFjZS4gIERvZXMgYW55b25lIGtub3cgd2hhdCBsaW5rIGxheWVyIGlXYXJwIHJldHVybnMgdG8g dXNlciBzcGFjZT8gDQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 11/17] IB/Verbs: Reform link_layer_show() and ib_uverbs_query_port()
Quoted 43 lines
Quoted 43 lines
drivers/infiniband/core/sysfs.c +2
-6@@ -248,14 +248,10 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused, static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused, char *buf) { - switch (rdma_port_get_link_layer(p->ibdev, p->port_num)) { - case IB_LINK_LAYER_INFINIBAND: + if (rdma_transport_ib(p->ibdev, p->port_num)) return sprintf(buf, "%s\n", "InfiniBand"); -case IB_LINK_LAYER_ETHERNET : + else return sprintf(buf, "%s\n", "Ethernet"); -default : -return sprintf (buf,"%s\n" ,"Unknown" ); - } }static
PORT_ATTR_RO(state);drivers/infiniband/core/uverbs_cmd.c +4
-2@@ -515,8 +515,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.active_width = attr.active_width; resp.active_speed = attr.active_speed; resp.phys_state = attr.phys_state; - resp.link_layer =rdma_port_get_link_layer (file->device- >ib_dev, - cmd.port_num); + resp.link_layer =rdma_transport_ib (file->device->ib_dev, + cmd.port_num) ? +IB_LINK_LAYER_INFINIBAND : +IB_LINK_LAYER_ETHERNET ;
Quoted 6 lines
drivers/infiniband/core/uverbs_cmd.c ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, · line 524
Quoted 2 lines
drivers/infiniband/core/uverbs_cmd.c +0
-0if (copy_to_user ((void __user *) (unsigned long ) cmd.response, &resp,sizeof resp))Both of the above check the transport in order to determine the link layer.
These values are exposed to user space. Does anyone know what link layer iWarp returns to user space?
Ethernet:
t4:~ # ibv_devinfo -d cxgb4_0|grep link_layer
link_layer: Ethernet
link_layer: Ethernet
Steve.
Re: [PATCH v2 11/17] IB/Verbs: Reform link_layer_show() and ib_uverbs_query_port()
In reply to Hefty, SeanOn 04/07/2015 08:49 PM, Hefty, Sean wrote:
[snip]
Quoted 13 lines
Quoted 13 lines
drivers/infiniband/core/uverbs_cmd.c +4
-2@@ -515,8 +515,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.active_width = attr.active_width; resp.active_speed = attr.active_speed; resp.phys_state = attr.phys_state; - resp.link_layer =rdma_port_get_link_layer (file->device- > ib_dev, - cmd.port_num); + resp.link_layer =rdma_transport_ib (file->device->ib_dev, + cmd.port_num) ? +IB_LINK_LAYER_INFINIBAND : +IB_LINK_LAYER_ETHERNET ;
Quoted 6 lines
drivers/infiniband/core/uverbs_cmd.c ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, · line 524
Quoted 2 lines
drivers/infiniband/core/uverbs_cmd.c +0
-0if (copy_to_user ((void __user *) (unsigned long ) cmd.response, &resp,sizeof resp))Both of the above check the transport in order to determine the link layer.
These values are exposed to user space. Does anyone know what link layer iWarp returns to user space?
It should be ETH for IWARP according to the old logical :-)
Regards,
Michael Wang
Quoted 1 line
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 12/17 IB/Verbs: Use management helper cap_ib_cm_dev() for cm-device-check
In reply to Michael WangIntroduce helper cap_ib_cm_dev() to help us check if any port of device has the capability Infiniband Communication Manager.
--- drivers/infiniband/core/cma.c | 5 ++--- drivers/infiniband/core/ucm.c | 3 +-- include/rdma/ib_verbs.h | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-)
drivers/infiniband/core/cma.c +2 -3
@@ -1625,8 +1625,7 @@ static void cma_listen_on_dev(struct rdma_id_private *id_priv,struct rdma_cm_id *id;int ret; -if (cma_family (id_priv) ==AF_IB && -rdma_node_get_transport (cma_dev->device->node_type) !=RDMA_TRANSPORT_IB ) +if (cma_family (id_priv) ==AF_IB && !cap_ib_cm_dev (cma_dev->device))return ; id = rdma_create_id(cma_listen_handler, id_priv, id_priv->id.ps,
@@ -2028,7 +2027,7 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv)mutex_lock (&lock);list_for_each_entry (cur_dev, &dev_list, list) {if (cma_family (id_priv) ==AF_IB && -rdma_node_get_transport (cur_dev->device->node_type) !=RDMA_TRANSPORT_IB ) + !cap_ib_cm_dev (cur_dev->device))continue ;if (!cma_dev)
drivers/infiniband/core/ucm.c +1 -2
@@ -1253,8 +1253,7 @@ static void ib_ucm_add_one(struct ib_device *device)dev_t base;struct ib_ucm_device *ucm_dev; -if (!device->alloc_ucontext || -rdma_node_get_transport (device->node_type) !=RDMA_TRANSPORT_IB ) +if (!device->alloc_ucontext || !cap_ib_cm_dev (device))return ; ucm_dev =kzalloc (sizeof *ucm_dev,GFP_KERNEL );
include/rdma/ib_verbs.h +20 -0
@@ -1819,6 +1819,26 @@ static inline int cap_ib_cm(struct ib_device *device, u8 port_num) }/** +* cap_ib_cm_dev - Check if any port of device has the capability Infiniband +* Communication Manager. +* +* @device: Device to be checked +* +* Return 0 when all port of the device don't support Infiniband +* Communication Manager. +*/ +static inline int cap_ib_cm_dev (struct ib_device *device) +{ +int i; + +for (i =1 ; i <= device->phys_port_cnt; i++) { +if (cap_ib_cm (device, i)) +return 1 ; + } +return 0 ; +} + +/** * cap_ib_sa - Check if the port of device has the capability Infiniband * Subnet Administrator. *
Signature · 1 line
2.1.0
PATCH v2 13/17 IB/Verbs: Reform cma/ucma with management helpers
In reply to Michael WangReform cma/ucma with management helpers.
--- drivers/infiniband/core/cma.c | 182 +++++++++++++---------------------------- drivers/infiniband/core/ucma.c | 25 ++---- 2 files changed, 65 insertions(+), 142 deletions(-)
drivers/infiniband/core/cma.c +59 -123
@@ -435,10 +435,10 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) pkey =ntohs (addr->sib_pkey);list_for_each_entry (cur_dev, &dev_list, list) { -if (rdma_node_get_transport (cur_dev->device->node_type) !=RDMA_TRANSPORT_IB ) -continue ; -for (p =1 ; p <= cur_dev->device->phys_port_cnt; ++p) { +if (!rdma_ib_mgmt (cur_dev->device, p)) +continue ; +if (ib_find_cached_pkey (cur_dev->device, p, pkey, &index))continue ;
@@ -633,10 +633,10 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,if (ret) goto out; -if (rdma_node_get_transport (id_priv->cma_dev->device->node_type) - ==RDMA_TRANSPORT_IB && -rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num) - ==IB_LINK_LAYER_ETHERNET ) { +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id_priv->id.device); + +if (rdma_transport_iboe (id_priv->id.device, id_priv->id.port_num)) { ret =rdma_addr_find_smac_by_sgid (&sgid, qp_attr.smac,NULL );if (ret)
@@ -700,8 +700,7 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv,int ret;u16 pkey; -if (rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num) == -IB_LINK_LAYER_INFINIBAND ) +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) pkey =ib_addr_get_pkey (dev_addr);else pkey =0xffff ;
@@ -735,8 +734,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,int ret =0 ; id_priv = container_of(id, struct rdma_id_private, id); -switch (rdma_node_get_transport (id_priv->id.device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id_priv->id.device, id_priv->id.port_num)) {if (!id_priv->cm_id.ib || (id_priv->id.qp_type ==IB_QPT_UD )) ret =cma_ib_init_qp_attr (id_priv, qp_attr, qp_attr_mask);else
@@ -745,19 +743,16 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,if (qp_attr->qp_state ==IB_QPS_RTR ) qp_attr->rq_psn = id_priv->seq_num; -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id_priv->id.device, + id_priv->id.port_num)) {if (!id_priv->cm_id.iw) { qp_attr->qp_access_flags =0 ; *qp_attr_mask =IB_QP_STATE |IB_QP_ACCESS_FLAGS ; }else ret =iw_cm_init_qp_attr (id_priv->cm_id.iw, qp_attr, qp_attr_mask); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }
@@ -928,13 +923,9 @@ static inline int cma_user_data_offset(struct rdma_id_private *id_priv)static void cma_cancel_route (struct rdma_id_private *id_priv) { -switch (rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) {if (id_priv->query)ib_sa_cancel_query (id_priv->query_id, id_priv->query); -break ; -default : -break ; } }
@@ -1006,17 +997,14 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) mc =container_of (id_priv->mc_list.next, struct cma_multicast, list);list_del (&mc->list); -switch (rdma_port_get_link_layer (id_priv->cma_dev->device, id_priv->id.port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num)) {ib_sa_free_multicast (mc->multicast.ib);kfree (mc);break ; -case IB_LINK_LAYER_ETHERNET : + }else if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num))kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } } }
@@ -1037,17 +1025,13 @@ void rdma_destroy_id(struct rdma_cm_id *id)mutex_unlock (&id_priv->handler_mutex);if (id_priv->cma_dev) { -switch (rdma_node_get_transport (id_priv->id.device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id_priv->id.device, id_priv->id.port_num)) {if (id_priv->cm_id.ib)ib_destroy_cm_id (id_priv->cm_id.ib); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id_priv->id.device, + id_priv->id.port_num)) {if (id_priv->cm_id.iw)iw_destroy_cm_id (id_priv->cm_id.iw); -break ; -default : -break ; }cma_leave_mc_groups (id_priv);cma_release_dev (id_priv);
@@ -1966,26 +1950,14 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms)return -EINVAL ;atomic_inc (&id_priv->refcount); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_resolve_ib_route (id_priv, timeout_ms); -break ; -case IB_LINK_LAYER_ETHERNET : - ret =cma_resolve_iboe_route (id_priv); -break ; -default : - ret = -ENOSYS ; - } -break ; -case RDMA_TRANSPORT_IWARP : +if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_resolve_ib_route (id_priv, timeout_ms); +else if (rdma_transport_iboe (id->device, id->port_num)) + ret =cma_resolve_iboe_route (id_priv); +else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_resolve_iw_route (id_priv, timeout_ms); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;
@@ -2059,7 +2031,7 @@ port_found: goto out; id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer (cma_dev->device, p) ==IB_LINK_LAYER_INFINIBAND ) ? + (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;rdma_addr_set_sgid (&id_priv->id.route.addr.dev_addr, &gid);
@@ -2536,18 +2508,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) id_priv->backlog = backlog;if (id->device) { -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_ib_listen (id_priv);if (ret) goto err; -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =cma_iw_listen (id_priv, backlog);if (ret) goto err; -break ; -default : + }else { ret = -ENOSYS ; goto err; }
@@ -2883,20 +2852,15 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_resolve_ib_udp (id_priv, conn_param);else ret =cma_connect_ib (id_priv, conn_param); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_connect_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;
@@ -2999,8 +2963,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) {if (conn_param) ret = cma_send_sidr_rep(id_priv, IB_SIDR_SUCCESS,
@@ -3016,14 +2979,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)else ret =cma_rep_recv (id_priv); } -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_accept_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto reject;
@@ -3067,8 +3026,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_send_sidr_rep (id_priv,IB_SIDR_REJECT ,0 , private_data, private_data_len);
@@ -3076,15 +3034,11 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ret =ib_send_cm_rej (id_priv->cm_id.ib,IB_CM_REJ_CONSUMER_DEFINED ,NULL ,0 , private_data, private_data_len); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_reject (id_priv->cm_id.iw, private_data, private_data_len); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }EXPORT_SYMBOL (rdma_reject);
@@ -3098,22 +3052,17 @@ int rdma_disconnect(struct rdma_cm_id *id)if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_modify_qp_err (id_priv);if (ret) goto out;/* Initiate or respond to a disconnect. */ if (ib_send_cm_dreq (id_priv->cm_id.ib,NULL ,0 ))ib_send_cm_drep (id_priv->cm_id.ib,NULL ,0 ); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_disconnect (id_priv->cm_id.iw,0 ); -break ; -default : + }else ret = -EINVAL ; -break ; - } out:return ret; }
@@ -3359,24 +3308,13 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,list_add (&mc->list, &id_priv->mc_list);spin_unlock (&id_priv->lock); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_join_ib_multicast (id_priv, mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_init (&mc->mcref); - ret =cma_iboe_join_multicast (id_priv, mc); -break ; -default : - ret = -EINVAL ; - } -break ; -default : +if (rdma_transport_iboe (id->device, id->port_num)) { +kref_init (&mc->mcref); + ret =cma_iboe_join_multicast (id_priv, mc); + }else if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_join_ib_multicast (id_priv, mc); +else ret = -ENOSYS ; -break ; - }if (ret) {spin_lock_irq (&id_priv->lock);
@@ -3404,19 +3342,17 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)ib_detach_mcast (id->qp, &mc->multicast.ib->rec.mgid,be16_to_cpu (mc->multicast.ib->rec.mlid)); -if (rdma_node_get_transport (id_priv->cma_dev->device->node_type) ==RDMA_TRANSPORT_IB ) { -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ib_sa_free_multicast (mc->multicast.ib); -kfree (mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } - } + +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id->device); + +if (rdma_transport_ib (id->device, id->port_num)) { +ib_sa_free_multicast (mc->multicast.ib); +kfree (mc); + }else if (rdma_transport_iboe (id->device, + id->port_num)) +kref_put (&mc->mcref, release_mc); +return ; } }
drivers/infiniband/core/ucma.c +6 -19
@@ -722,26 +722,13 @@ static ssize_t ucma_query_route(struct ucma_file *file, resp.node_guid = (__force __u64 ) ctx->cm_id->device->node_guid; resp.port_num = ctx->cm_id->port_num; -switch (rdma_node_get_transport (ctx->cm_id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (ctx->cm_id->device, - ctx->cm_id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ucma_copy_ib_route (&resp, &ctx->cm_id->route); -break ; -case IB_LINK_LAYER_ETHERNET : -ucma_copy_iboe_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } -break ; -case RDMA_TRANSPORT_IWARP : + +if (rdma_transport_ib (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_ib_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iboe (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_iboe_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iwarp (ctx->cm_id->device, ctx->cm_id->port_num))ucma_copy_iw_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } out: if (copy_to_user((void __user *)(unsigned long)cmd.response,
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
Quoted 130 lines
-----Original Message-----
From: Michael Wang [mailto:[email protected]]
Sent: Tuesday, April 07, 2015 7:37 AM
To: Roland Dreier; Sean Hefty; [email protected]; [email protected]; [email protected]; [email protected]
Cc: Hal Rosenstock; Tom Tucker; Steve Wise; Hoang-Nam Nguyen; Christoph Raisch; Mike Marciniszyn; Eli Cohen; Faisal Latif; Upinder Malhi; Trond Myklebust; J. Bruce Fields; David S. Miller; Ira Weiny; PJ Waskiewicz; Tatyana Nikolova; Or Gerlitz; Jack Morgenstein; Haggai Eran; Ilya Nelkenbaum; Yann Droneaud; Bart Van Assche; Shachar Raindel; Sagi Grimberg; Devesh Sharma; Matan Barak; Moni Shoua; Jiri Kosina; Selvin Xavier; Mitesh Ahuja; Li RongQing; Rasmus Villemoes; Alex Estrin; Doug Ledford; Eric Dumazet; Erez Shitrit; Tom Gundersen; Chuck Lever; Michael Wang
Subject: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpersReform cma/ucma with management helpers.
Cc Jason Gunthorpe <[email protected]>Cc Doug Ledford <[email protected]>Cc Ira Weiny <[email protected]>Cc Sean Hefty <[email protected]>Signed-off-by Michael Wang <[email protected]>--- drivers/infiniband/core/cma.c | 182 +++++++++++++---------------------------- drivers/infiniband/core/ucma.c | 25 ++---- 2 files changed, 65 insertions(+), 142 deletions(-)drivers/infiniband/core/cma.c +15
-25@@ -435,10 +435,10 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) pkey =ntohs (addr->sib_pkey);list_for_each_entry (cur_dev, &dev_list, list) { -if (rdma_node_get_transport (cur_dev->device->node_type) !=RDMA_TRANSPORT_IB ) -continue ; -for (p =1 ; p <= cur_dev->device->phys_port_cnt; ++p) { +if (!rdma_ib_mgmt (cur_dev->device, p)) +continue ; +if (ib_find_cached_pkey (cur_dev->device, p, pkey, &index))continue ;@@ -633,10 +633,10 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,if (ret) goto out; -if (rdma_node_get_transport (id_priv->cma_dev->device->node_type) - ==RDMA_TRANSPORT_IB && -rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num) - ==IB_LINK_LAYER_ETHERNET ) { +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id_priv->id.device); + +if (rdma_transport_iboe (id_priv->id.device, id_priv->id.port_num)) { ret =rdma_addr_find_smac_by_sgid (&sgid, qp_attr.smac,NULL );if (ret)@@ -700,8 +700,7 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv,int ret;u16 pkey; -if (rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num) == -IB_LINK_LAYER_INFINIBAND ) +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) pkey =ib_addr_get_pkey (dev_addr);else pkey =0xffff ;@@ -735,8 +734,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,int ret =0 ; id_priv = container_of(id, struct rdma_id_private, id); -switch (rdma_node_get_transport (id_priv->id.device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id_priv->id.device, id_priv->id.port_num)) {if (!id_priv->cm_id.ib || (id_priv->id.qp_type ==IB_QPT_UD )) ret =cma_ib_init_qp_attr (id_priv, qp_attr, qp_attr_mask);else @@ -745,19 +743,16 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,if (qp_attr->qp_state ==IB_QPS_RTR ) qp_attr->rq_psn = id_priv->seq_num; -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id_priv->id.device, + id_priv->id.port_num)) {if (!id_priv->cm_id.iw) { qp_attr->qp_access_flags =0 ; *qp_attr_mask =IB_QP_STATE |IB_QP_ACCESS_FLAGS ; }else ret =iw_cm_init_qp_attr (id_priv->cm_id.iw, qp_attr, qp_attr_mask); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }@@ -928,13 +923,9 @@ static inline int cma_user_data_offset(struct rdma_id_private *id_priv)static void cma_cancel_route (struct rdma_id_private *id_priv) { -switch (rdma_port_get_link_layer (id_priv->id.device, id_priv->id.port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) {if (id_priv->query)ib_sa_cancel_query (id_priv->query_id, id_priv->query); -break ; -default : -break ; } }@@ -1006,17 +997,14 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) mc =container_of (id_priv->mc_list.next, struct cma_multicast, list);list_del (&mc->list); -switch (rdma_port_get_link_layer (id_priv->cma_dev->device, id_priv->id.port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num)) {ib_sa_free_multicast (mc->multicast.ib);kfree (mc);break ; -case IB_LINK_LAYER_ETHERNET :
drivers/infiniband/core/cma.c static void cma_leave_mc_groups(struct rdma_id_private *id_priv) · line 1010
Quoted 10 lines
drivers/infiniband/core/cma.c +2
-4+ }else if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num))kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } } }
Doesn't the above change result in:
if (rdma_transport_ib()) {
} else if (rdma_transport_ib()) {
}
????
Quoted 291 lines
drivers/infiniband/core/cma.c +42
-94@@ -1037,17 +1025,13 @@ void rdma_destroy_id(struct rdma_cm_id *id)mutex_unlock (&id_priv->handler_mutex);if (id_priv->cma_dev) { -switch (rdma_node_get_transport (id_priv->id.device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id_priv->id.device, id_priv->id.port_num)) {if (id_priv->cm_id.ib)ib_destroy_cm_id (id_priv->cm_id.ib); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id_priv->id.device, + id_priv->id.port_num)) {if (id_priv->cm_id.iw)iw_destroy_cm_id (id_priv->cm_id.iw); -break ; -default : -break ; }cma_leave_mc_groups (id_priv);cma_release_dev (id_priv);@@ -1966,26 +1950,14 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms)return -EINVAL ;atomic_inc (&id_priv->refcount); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_resolve_ib_route (id_priv, timeout_ms); -break ; -case IB_LINK_LAYER_ETHERNET : - ret =cma_resolve_iboe_route (id_priv); -break ; -default : - ret = -ENOSYS ; - } -break ; -case RDMA_TRANSPORT_IWARP : +if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_resolve_ib_route (id_priv, timeout_ms); +else if (rdma_transport_iboe (id->device, id->port_num)) + ret =cma_resolve_iboe_route (id_priv); +else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_resolve_iw_route (id_priv, timeout_ms); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;@@ -2059,7 +2031,7 @@ port_found: goto out; id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer (cma_dev->device, p) ==IB_LINK_LAYER_INFINIBAND ) ? + (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;rdma_addr_set_sgid (&id_priv->id.route.addr.dev_addr, &gid);@@ -2536,18 +2508,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) id_priv->backlog = backlog;if (id->device) { -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_ib_listen (id_priv);if (ret) goto err; -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =cma_iw_listen (id_priv, backlog);if (ret) goto err; -break ; -default : + }else { ret = -ENOSYS ; goto err; }@@ -2883,20 +2852,15 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_resolve_ib_udp (id_priv, conn_param);else ret =cma_connect_ib (id_priv, conn_param); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_connect_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;@@ -2999,8 +2963,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) {if (conn_param) ret = cma_send_sidr_rep(id_priv, IB_SIDR_SUCCESS,@@ -3016,14 +2979,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)else ret =cma_rep_recv (id_priv); } -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_accept_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto reject;@@ -3067,8 +3026,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_send_sidr_rep (id_priv,IB_SIDR_REJECT ,0 , private_data, private_data_len);@@ -3076,15 +3034,11 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ret =ib_send_cm_rej (id_priv->cm_id.ib,IB_CM_REJ_CONSUMER_DEFINED ,NULL ,0 , private_data, private_data_len); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_reject (id_priv->cm_id.iw, private_data, private_data_len); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }EXPORT_SYMBOL (rdma_reject);@@ -3098,22 +3052,17 @@ int rdma_disconnect(struct rdma_cm_id *id)if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_modify_qp_err (id_priv);if (ret) goto out;/* Initiate or respond to a disconnect. */ if (ib_send_cm_dreq (id_priv->cm_id.ib,NULL ,0 ))ib_send_cm_drep (id_priv->cm_id.ib,NULL ,0 ); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_disconnect (id_priv->cm_id.iw,0 ); -break ; -default : + }else ret = -EINVAL ; -break ; - } out:return ret; }@@ -3359,24 +3308,13 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,list_add (&mc->list, &id_priv->mc_list);spin_unlock (&id_priv->lock); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_join_ib_multicast (id_priv, mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_init (&mc->mcref); - ret =cma_iboe_join_multicast (id_priv, mc); -break ; -default : - ret = -EINVAL ; - } -break ; -default : +if (rdma_transport_iboe (id->device, id->port_num)) { +kref_init (&mc->mcref); + ret =cma_iboe_join_multicast (id_priv, mc); + }else if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_join_ib_multicast (id_priv, mc); +else ret = -ENOSYS ; -break ; - }if (ret) {spin_lock_irq (&id_priv->lock);@@ -3404,19 +3342,17 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)ib_detach_mcast (id->qp, &mc->multicast.ib->rec.mgid,be16_to_cpu (mc->multicast.ib->rec.mlid)); -if (rdma_node_get_transport (id_priv->cma_dev->device->node_type) ==RDMA_TRANSPORT_IB ) { -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ib_sa_free_multicast (mc->multicast.ib); -kfree (mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } - } + +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id->device); + +if (rdma_transport_ib (id->device, id->port_num)) { +ib_sa_free_multicast (mc->multicast.ib); +kfree (mc); + }else if (rdma_transport_iboe (id->device, + id->port_num)) +kref_put (&mc->mcref, release_mc); +return ; } }drivers/infiniband/core/ucma.c +6
-20@@ -722,26 +722,13 @@ static ssize_t ucma_query_route(struct ucma_file *file, resp.node_guid = (__force __u64 ) ctx->cm_id->device->node_guid; resp.port_num = ctx->cm_id->port_num; -switch (rdma_node_get_transport (ctx->cm_id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (ctx->cm_id->device, - ctx->cm_id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ucma_copy_ib_route (&resp, &ctx->cm_id->route); -break ; -case IB_LINK_LAYER_ETHERNET : -ucma_copy_iboe_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } -break ; -case RDMA_TRANSPORT_IWARP : + +if (rdma_transport_ib (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_ib_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iboe (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_iboe_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iwarp (ctx->cm_id->device, ctx->cm_id->port_num))ucma_copy_iw_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } out: if (copy_to_user((void __user *)(unsigned long)cmd.response, --2.1.0
Re: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
On 04/07/2015 11:11 PM, Steve Wise wrote:
[snip]
Quoted 25 lines
Quoted 12 lines
drivers/infiniband/core/cma.c +2
-3@@ -1006,17 +997,14 @@ static void cma_leave_mc_groups(struct rdma_id_private *id_priv) mc =container_of (id_priv->mc_list.next, struct cma_multicast, list);list_del (&mc->list); -switch (rdma_port_get_link_layer (id_priv->cma_dev->device, id_priv->id.port_num)) { -case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num)) {ib_sa_free_multicast (mc->multicast.ib);kfree (mc);break ; -case IB_LINK_LAYER_ETHERNET :drivers/infiniband/core/cma.c static void cma_leave_mc_groups(struct rdma_id_private *id_priv) · line 1010
Quoted 10 lines
drivers/infiniband/core/cma.c +2
-4+ }else if (rdma_transport_ib (id_priv->cma_dev->device, + id_priv->id.port_num))kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } } }Doesn't the above change result in:
Quoted 4 lines
if (
rdma_transport_ib()) {
} else if (rdma_transport_ib()) {
}
My bad here.. I guess 'else' is enough.
Regards,
Michael Wang
Quoted 294 lines
????
Quoted 291 lines
drivers/infiniband/core/cma.c +42
-94@@ -1037,17 +1025,13 @@ void rdma_destroy_id(struct rdma_cm_id *id)mutex_unlock (&id_priv->handler_mutex);if (id_priv->cma_dev) { -switch (rdma_node_get_transport (id_priv->id.device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id_priv->id.device, id_priv->id.port_num)) {if (id_priv->cm_id.ib)ib_destroy_cm_id (id_priv->cm_id.ib); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id_priv->id.device, + id_priv->id.port_num)) {if (id_priv->cm_id.iw)iw_destroy_cm_id (id_priv->cm_id.iw); -break ; -default : -break ; }cma_leave_mc_groups (id_priv);cma_release_dev (id_priv);@@ -1966,26 +1950,14 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms)return -EINVAL ;atomic_inc (&id_priv->refcount); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_resolve_ib_route (id_priv, timeout_ms); -break ; -case IB_LINK_LAYER_ETHERNET : - ret =cma_resolve_iboe_route (id_priv); -break ; -default : - ret = -ENOSYS ; - } -break ; -case RDMA_TRANSPORT_IWARP : +if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_resolve_ib_route (id_priv, timeout_ms); +else if (rdma_transport_iboe (id->device, id->port_num)) + ret =cma_resolve_iboe_route (id_priv); +else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_resolve_iw_route (id_priv, timeout_ms); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;@@ -2059,7 +2031,7 @@ port_found: goto out; id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer (cma_dev->device, p) ==IB_LINK_LAYER_INFINIBAND ) ? + (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;rdma_addr_set_sgid (&id_priv->id.route.addr.dev_addr, &gid);@@ -2536,18 +2508,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) id_priv->backlog = backlog;if (id->device) { -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_ib_listen (id_priv);if (ret) goto err; -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =cma_iw_listen (id_priv, backlog);if (ret) goto err; -break ; -default : + }else { ret = -ENOSYS ; goto err; }@@ -2883,20 +2852,15 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_resolve_ib_udp (id_priv, conn_param);else ret =cma_connect_ib (id_priv, conn_param); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_connect_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto err;@@ -2999,8 +2963,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) id_priv->srq = conn_param->srq; } -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) {if (conn_param) ret = cma_send_sidr_rep(id_priv, IB_SIDR_SUCCESS,@@ -3016,14 +2979,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)else ret =cma_rep_recv (id_priv); } -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_accept_iw (id_priv, conn_param); -break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret) goto reject;@@ -3067,8 +3026,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {if (id->qp_type ==IB_QPT_UD ) ret =cma_send_sidr_rep (id_priv,IB_SIDR_REJECT ,0 , private_data, private_data_len);@@ -3076,15 +3034,11 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ret =ib_send_cm_rej (id_priv->cm_id.ib,IB_CM_REJ_CONSUMER_DEFINED ,NULL ,0 , private_data, private_data_len); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_reject (id_priv->cm_id.iw, private_data, private_data_len); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }EXPORT_SYMBOL (rdma_reject);@@ -3098,22 +3052,17 @@ int rdma_disconnect(struct rdma_cm_id *id)if (!id_priv->cm_id.ib)return -EINVAL ; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_modify_qp_err (id_priv);if (ret) goto out;/* Initiate or respond to a disconnect. */ if (ib_send_cm_dreq (id_priv->cm_id.ib,NULL ,0 ))ib_send_cm_drep (id_priv->cm_id.ib,NULL ,0 ); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_disconnect (id_priv->cm_id.iw,0 ); -break ; -default : + }else ret = -EINVAL ; -break ; - } out:return ret; }@@ -3359,24 +3308,13 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,list_add (&mc->list, &id_priv->mc_list);spin_unlock (&id_priv->lock); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_join_ib_multicast (id_priv, mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_init (&mc->mcref); - ret =cma_iboe_join_multicast (id_priv, mc); -break ; -default : - ret = -EINVAL ; - } -break ; -default : +if (rdma_transport_iboe (id->device, id->port_num)) { +kref_init (&mc->mcref); + ret =cma_iboe_join_multicast (id_priv, mc); + }else if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_join_ib_multicast (id_priv, mc); +else ret = -ENOSYS ; -break ; - }if (ret) {spin_lock_irq (&id_priv->lock);@@ -3404,19 +3342,17 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)ib_detach_mcast (id->qp, &mc->multicast.ib->rec.mgid,be16_to_cpu (mc->multicast.ib->rec.mlid)); -if (rdma_node_get_transport (id_priv->cma_dev->device->node_type) ==RDMA_TRANSPORT_IB ) { -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ib_sa_free_multicast (mc->multicast.ib); -kfree (mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } - } + +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id->device); + +if (rdma_transport_ib (id->device, id->port_num)) { +ib_sa_free_multicast (mc->multicast.ib); +kfree (mc); + }else if (rdma_transport_iboe (id->device, + id->port_num)) +kref_put (&mc->mcref, release_mc); +return ; } }drivers/infiniband/core/ucma.c +6
-20@@ -722,26 +722,13 @@ static ssize_t ucma_query_route(struct ucma_file *file, resp.node_guid = (__force __u64 ) ctx->cm_id->device->node_guid; resp.port_num = ctx->cm_id->port_num; -switch (rdma_node_get_transport (ctx->cm_id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (ctx->cm_id->device, - ctx->cm_id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ucma_copy_ib_route (&resp, &ctx->cm_id->route); -break ; -case IB_LINK_LAYER_ETHERNET : -ucma_copy_iboe_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } -break ; -case RDMA_TRANSPORT_IWARP : + +if (rdma_transport_ib (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_ib_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iboe (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_iboe_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iwarp (ctx->cm_id->device, ctx->cm_id->port_num))ucma_copy_iw_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } out: if (copy_to_user((void __user *)(unsigned long)cmd.response, --2.1.0
RE: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
In reply to Michael WangPiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9pbmZpbmliYW5kL2NvcmUvY21hLmMgYi9kcml2ZXJzL2lu ZmluaWJhbmQvY29yZS9jbWEuYw0KPiBpbmRleCBkOGE4ZWE3Li5jMjNmNDgzIDEwMDY0NA0KPiAt LS0gYS9kcml2ZXJzL2luZmluaWJhbmQvY29yZS9jbWEuYw0KPiArKysgYi9kcml2ZXJzL2luZmlu aWJhbmQvY29yZS9jbWEuYw0KPiBAQCAtNDM1LDEwICs0MzUsMTAgQEAgc3RhdGljIGludCBjbWFf cmVzb2x2ZV9pYl9kZXYoc3RydWN0IHJkbWFfaWRfcHJpdmF0ZQ0KPiAqaWRfcHJpdikNCj4gIAlw a2V5ID0gbnRvaHMoYWRkci0+c2liX3BrZXkpOw0KPiANCj4gIAlsaXN0X2Zvcl9lYWNoX2VudHJ5 KGN1cl9kZXYsICZkZXZfbGlzdCwgbGlzdCkgew0KPiAtCQlpZiAocmRtYV9ub2RlX2dldF90cmFu c3BvcnQoY3VyX2Rldi0+ZGV2aWNlLT5ub2RlX3R5cGUpICE9DQo+IFJETUFfVFJBTlNQT1JUX0lC KQ0KPiAtCQkJY29udGludWU7DQo+IC0NCj4gIAkJZm9yIChwID0gMTsgcCA8PSBjdXJfZGV2LT5k ZXZpY2UtPnBoeXNfcG9ydF9jbnQ7ICsrcCkgew0KPiArCQkJaWYgKCFyZG1hX2liX21nbXQoY3Vy X2Rldi0+ZGV2aWNlLCBwKSkNCj4gKwkJCQljb250aW51ZTsNCg0KVGhpcyBjaGVjayB3YW50cyB0 byBiZSBzb21ldGhpbmcgbGlrZSBpc19hZl9pYl9zdXBwb3J0ZWQoKS4gIENoZWNraW5nIGZvciBJ QiB0cmFuc3BvcnQgbWF5IGFjdHVhbGx5IGJlIGJldHRlciB0aGFu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WFfY29w eV9pYm9lX3JvdXRlKCZyZXNwLCAmY3R4LT5jbV9pZC0+cm91dGUpOw0KPiArCWVsc2UgaWYgKHJk bWFfdHJhbnNwb3J0X2l3YXJwKGN0eC0+Y21faWQtPmRldmljZSwgY3R4LT5jbV9pZC0NCj4gPnBv cnRfbnVtKSkNCj4gIAkJdWNtYV9jb3B5X2l3X3JvdXRlKCZyZXNwLCAmY3R4LT5jbV9pZC0+cm91 dGUpOw0KPiAtCQlicmVhazsNCj4gLQlkZWZhdWx0Og0KPiAtCQlicmVhazsNCj4gLQl9DQo+IA0K PiAgb3V0Og0KPiAgCWlmIChjb3B5X3RvX3VzZXIoKHZvaWQgX191c2VyICopKHVuc2lnbmVkIGxv bmcpY21kLnJlc3BvbnNlLA0KDQoNCi0gU2Vhbg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
Hi, Sean
Thanks for the review :-) cma is the most tough part during reform, I really need some guide in here.
Quoted 8 lines · Sean
Quoted 8 lines
drivers/infiniband/core/cma.c +0
-0@@ -435,10 +435,10 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) pkey =ntohs (addr->sib_pkey);
Quoted 10 lines
drivers/infiniband/core/cma.c static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) · line 440
Quoted 8 lines
drivers/infiniband/core/cma.c +2
-3list_for_each_entry (cur_dev, &dev_list, list) { -if (rdma_node_get_transport (cur_dev->device->node_type) != RDMA_TRANSPORT_IB) -continue ; -for (p =1 ; p <= cur_dev->device->phys_port_cnt; ++p) { +if (!rdma_ib_mgmt (cur_dev->device, p)) +continue ;This check wants to be something like
is_af_ib_supported(). Checking for IB transport may actually be better than checking for IB management. I don't know if IBoE/RoCE devices supportAF_IB.
The wrapper make sense, but do we have the guarantee that IBoE port won't be used for AF_IB address? I just can't locate the place we filtered it out...
Quoted 1 line
[snip]
Quoted 5 lines
drivers/infiniband/core/cma.c static int cma_modify_qp_rtr(struct rdma_id_private *id_priv, · line 637
Quoted 3 lines
drivers/infiniband/core/cma.c +2
-1- == IB_LINK_LAYER_ETHERNET) { +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id_priv->id.device);This shouldn't happen. The
BUG_ONlooks okay.
Got it :-)
Quoted 12 lines
Quoted 12 lines
drivers/infiniband/core/cma.c +1
-1+if (rdma_transport_iboe (id_priv->id.device, id_priv->id.port_num)) { ret =rdma_addr_find_smac_by_sgid (&sgid, qp_attr.smac,NULL );if (ret)@@ -700,8 +700,7 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv, int ret;u16 pkey; - if (rdma_port_get_link_layer(id_priv->id.device, id_priv-
Quoted 8 lines
drivers/infiniband/core/cma.c static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv, · line 706
Quoted 6 lines
Quoted 1 line
id.port_num) ==
drivers/infiniband/core/cma.c +1
-1- IB_LINK_LAYER_INFINIBAND) +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) pkey =ib_addr_get_pkey (dev_addr);else pkey =0xffff ;Check here should be against the link layer, not transport.
I guess the name confusing us again... what if use rdma_tech_ib() here? it's the only tech using IB link layers, others are all ETH.
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/core/cma.c +0
-0@@ -735,8 +734,7 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct
[snip]
Quoted 9 lines
drivers/infiniband/core/cma.c static inline int cma_user_data_offset(struct rdma_id_private *id_priv) · line 926
Quoted 7 lines
static void
cma_cancel_route(struct rdma_id_private *id_priv){drivers/infiniband/core/cma.c +0
-1- switch (rdma_port_get_link_layer(id_priv->id.device, id_priv-Quoted 1 line
id.port_num)) {
drivers/infiniband/core/cma.c +1
-1-case IB_LINK_LAYER_INFINIBAND : +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) {The check should be
cap_ib_sa()
Got it, will be in next version :-)
All the mcast/sa suggestion below will be applied too.
Quoted 1 line
[snip]
Quoted 8 lines
drivers/infiniband/core/cma.c port_found: · line 2035
Quoted 6 lines
drivers/infiniband/core/cma.c +0
-1id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer(cma_dev->device, p) ==
IB_LINK_LAYER_INFINIBAND) ?drivers/infiniband/core/cma.c +1
-0+ (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;This wants the link layer, or maybe use
cap_ipoib.
Is this related with ipoib only?
Quoted 7 lines
Quoted 7 lines
drivers/infiniband/core/cma.c +0
-0rdma_addr_set_sgid (&id_priv->id.route.addr.dev_addr, &gid);@@ -2536,18 +2508,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
Quoted 7 lines
drivers/infiniband/core/cma.c int rdma_listen(struct rdma_cm_id *id, int backlog) · line 2511
Quoted 5 lines
drivers/infiniband/core/cma.c +1
-2id_priv->backlog = backlog;if (id->device) { -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {Want
cap_ib_cm()
Will be in next version :-) and the other cap_ib_cm() suggestion too.
Quoted 3 lines
Quoted 3 lines
drivers/infiniband/core/cma.c +0
-0ret =cma_ib_listen (id_priv);
[snip]
Quoted 11 lines
drivers/infiniband/core/cma.c int rdma_accept(struct rdma_cm_id *id, struct · line 2984
Quoted 9 lines
drivers/infiniband/core/cma.c +1
-2@@ -3016,14 +2979,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) else ret =cma_rep_recv (id_priv); } -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) ret =cma_accept_iw (id_priv, conn_param);If
cap_ib_cm()is used in the places marked above, maybe add acap_iw_cm()for the else conditions.
Sounds good, will be in next version :-)
Regards,
Michael Wang
Quoted 202 lines
Quoted 12 lines
drivers/infiniband/core/cma.c +1
-4-break ; -default : +else ret = -ENOSYS ; -break ; - }if (ret)drivers/infiniband/core/cma.c +0
-0goto reject;drivers/infiniband/core/cma.c int rdma_reject(struct rdma_cm_id *id, const void · line 3030
Quoted 7 lines
drivers/infiniband/core/cma.c +1
-2@@ -3067,8 +3026,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, if (!id_priv->cm_id.ib) return -EINVAL; -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) {
cap_ib_cm()Quoted 25 lines
drivers/infiniband/core/cma.c +0
-0if (id->qp_type ==IB_QPT_UD ) ret = cma_send_sidr_rep(id_priv, IB_SIDR_REJECT, 0,drivers/infiniband/core/cma.c +2
-6private_data, private_data_len);@@ -3076,15 +3034,11 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ret =ib_send_cm_rej (id_priv->cm_id.ib,IB_CM_REJ_CONSUMER_DEFINED ,NULL ,0 , private_data, private_data_len); -break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_reject (id_priv->cm_id.iw, private_data, private_data_len); -break ; -default : + }else ret = -ENOSYS ; -break ; - }return ret; }
EXPORT_SYMBOL(rdma_reject);drivers/infiniband/core/cma.c +0
-0@@ -3098,22 +3052,17 @@ int rdma_disconnect(struct rdma_cm_id *id)if (!id_priv->cm_id.ib)return -EINVAL ;drivers/infiniband/core/cma.c int rdma_disconnect(struct rdma_cm_id *id) · line 3061
Quoted 10 lines
drivers/infiniband/core/cma.c +1
-2-switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : +if (rdma_ib_mgmt (id->device, id->port_num)) { ret =cma_modify_qp_err (id_priv);if (ret) goto out;/* Initiate or respond to a disconnect. */ if (ib_send_cm_dreq (id_priv->cm_id.ib,NULL ,0 ))ib_send_cm_drep (id_priv->cm_id.ib,NULL ,0 );
cap_ib_cm()Quoted 28 lines
drivers/infiniband/core/cma.c +2
-16-break ; -case RDMA_TRANSPORT_IWARP : + }else if (rdma_transport_iwarp (id->device, id->port_num)) { ret =iw_cm_disconnect (id_priv->cm_id.iw,0 ); -break ; -default : + }else ret = -EINVAL ; -break ; - } out:return ret; }@@ -3359,24 +3308,13 @@ int rdma_join_multicast(struct rdma_cm_id *id,struct sockaddr *addr, list_add(&mc->list, &id_priv->mc_list);spin_unlock (&id_priv->lock); -switch (rdma_node_get_transport (id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (id->device, id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : - ret =cma_join_ib_multicast (id_priv, mc); -break ; -case IB_LINK_LAYER_ETHERNET : -kref_init (&mc->mcref); - ret =cma_iboe_join_multicast (id_priv, mc); -break ;drivers/infiniband/core/cma.c int rdma_join_multicast(struct rdma_cm_id *id, · line 3316
Quoted 10 lines
drivers/infiniband/core/cma.c +5
-5-default : - ret = -EINVAL ; - } -break ; -default : +if (rdma_transport_iboe (id->device, id->port_num)) { +kref_init (&mc->mcref); + ret =cma_iboe_join_multicast (id_priv, mc); + }else if (rdma_transport_ib (id->device, id->port_num)) + ret =cma_join_ib_multicast (id_priv, mc);
cap_ib_mcast()Quoted 21 lines
drivers/infiniband/core/cma.c +1
-2+else ret = -ENOSYS ; -break ; - }if (ret) {drivers/infiniband/core/cma.c +0
-6spin_lock_irq (&id_priv->lock);@@ -3404,19 +3342,17 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) ib_detach_mcast(id->qp, &mc->multicast.ib->rec.mgid, be16_to_cpu(mc->multicast.ib- > rec.mlid)); -if (rdma_node_get_transport (id_priv->cma_dev->device- > node_type) == RDMA_TRANSPORT_IB) { -switch (rdma_port_get_link_layer (id->device, id- > port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ib_sa_free_multicast (mc->multicast.ib); -kfree (mc); -break ;drivers/infiniband/core/cma.c void rdma_leave_multicast(struct rdma_cm_id *id, · line 3347
Quoted 10 lines
drivers/infiniband/core/cma.c +3
-7-case IB_LINK_LAYER_ETHERNET : -kref_put (&mc->mcref, release_mc); -break ; -default : -break ; - } - } + +/* Will this happen? */ +BUG_ON (id_priv->cma_dev->device != id->device);Should not happen
drivers/infiniband/core/cma.c void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr) · line 3351
Quoted 4 lines
drivers/infiniband/core/cma.c +4
-0+ +if (rdma_transport_ib (id->device, id->port_num)) { +ib_sa_free_multicast (mc->multicast.ib); +kfree (mc);
cap_ib_mcast()Quoted 25 lines
drivers/infiniband/core/cma.c +4
-0+ }else if (rdma_transport_iboe (id->device, + id->port_num)) +kref_put (&mc->mcref, release_mc); +return ; } }drivers/infiniband/core/ucma.c +0
-8@@ -722,26 +722,13 @@ static ssize_t ucma_query_route(struct ucma_file *file, resp.node_guid = (__force __u64 ) ctx->cm_id->device->node_guid; resp.port_num = ctx->cm_id->port_num; -switch (rdma_node_get_transport (ctx->cm_id->device->node_type)) { -case RDMA_TRANSPORT_IB : -switch (rdma_port_get_link_layer (ctx->cm_id->device, - ctx->cm_id->port_num)) { -case IB_LINK_LAYER_INFINIBAND : -ucma_copy_ib_route (&resp, &ctx->cm_id->route); -break ; -case IB_LINK_LAYER_ETHERNET :drivers/infiniband/core/ucma.c static ssize_t ucma_query_route(struct ucma_file · line 728
Quoted 10 lines
drivers/infiniband/core/ucma.c +3
-7-ucma_copy_iboe_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - } -break ; -case RDMA_TRANSPORT_IWARP : + +if (rdma_transport_ib (ctx->cm_id->device, ctx->cm_id->port_num)) +ucma_copy_ib_route (&resp, &ctx->cm_id->route);
cap_ib_sa()Quoted 11 lines
drivers/infiniband/core/ucma.c +3
-4+else if (rdma_transport_iboe (ctx->cm_id->device, ctx->cm_id- > port_num)) +ucma_copy_iboe_route (&resp, &ctx->cm_id->route); +else if (rdma_transport_iwarp (ctx->cm_id->device, ctx->cm_id- > port_num))ucma_copy_iw_route (&resp, &ctx->cm_id->route); -break ; -default : -break ; - }Quoted 2 lines
out:
if (copy_to_user((void__user*)(unsigned long)cmd.response,- Sean
RE: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
Quoted 21 lines · Sean
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/infiniband/core/cma.cQuoted 4 lines
drivers/infiniband/core/cma.c static int cma_resolve_ib_dev(struct
Quoted 4 lines
index d8a8ea7..c23f483 100644
drivers/infiniband/core/cma.c +0
-0@@ -435,10 +435,10 @@ static int cma_resolve_ib_dev(struct
rdma_id_privateQuoted 13 lines
drivers/infiniband/core/cma.c static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) · line 440
Quoted 11 lines
drivers/infiniband/core/cma.c +2
-3*id_priv) pkey =ntohs (addr->sib_pkey);list_for_each_entry (cur_dev, &dev_list, list) { -if (rdma_node_get_transport (cur_dev->device->node_type) != RDMA_TRANSPORT_IB) -continue ; -for (p =1 ; p <= cur_dev->device->phys_port_cnt; ++p) { +if (!rdma_ib_mgmt (cur_dev->device, p)) +continue ;This check wants to be something like
is_af_ib_supported(). Checking
Quoted 6 lines
for IB transport may actually be better than checking for IB management. I don't know if IBoE/RoCE devices support
AF_IB.The wrapper make sense, but do we have the guarantee that IBoE port won't be used for
AF_IBaddress? I just can't locate the place we filtered it out...
I can't think of a reason why IBoE wouldn't work with AF_IB, but I'm not sure if anyone has tested it. The original check would have let IBoE through. When I suggested checking for IB transport, I meant the actual transport protocol, which would have included both IB and IBoE.
Quoted 16 lines
Quoted 1 line
drivers/infiniband/core/cma.c static int cma_ib_init_qp_attr(struct
Quoted 1 line
drivers/infiniband/core/cma.c +0
-0@@ -700,8 +700,7 @@ static int cma_ib_init_qp_attr(struct
rdma_id_privateQuoted 5 lines
Quoted 5 lines
drivers/infiniband/core/cma.c +0
-1*id_priv, int ret;u16 pkey; - if (rdma_port_get_link_layer(id_priv->id.device, id_priv-Quoted 8 lines
drivers/infiniband/core/cma.c static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv, · line 706
Quoted 6 lines
Quoted 1 line
id.port_num) ==
drivers/infiniband/core/cma.c +1
-1- IB_LINK_LAYER_INFINIBAND) +if (rdma_transport_ib (id_priv->id.device, id_priv->id.port_num)) pkey =ib_addr_get_pkey (dev_addr);else pkey =0xffff ;Check here should be against the link layer, not transport.
Quoted 2 lines
I guess the name confusing us again... what if use
rdma_tech_ib()here? it's the only tech using IB link layers, others are all ETH.
Yes, that would work.
Quoted 9 lines
Quoted 7 lines
drivers/infiniband/core/cma.c port_found: · line 2035
Quoted 5 lines
drivers/infiniband/core/cma.c +0
-1id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer(cma_dev->device, p) ==
IB_LINK_LAYER_INFINIBAND) ?drivers/infiniband/core/cma.c +1
-0+ (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;This wants the link layer, or maybe use
cap_ipoib.Is this related with ipoib only?
ARPHDR_INFINIBAND is related to ipoib. In your next update, maybe go with tech_ib. I don't know the status of ipoib over iboe.
Re: [PATCH v2 13/17] IB/Verbs: Reform cma/ucma with management helpers
On 04/08/2015 07:02 PM, Hefty, Sean wrote:
[snip]
Quoted 6 lines
Quoted 4 lines
The wrapper make sense, but do we have the guarantee that IBoE port won't be used for
AF_IBaddress? I just can't locate the place we filtered it out...I can't think of a reason why IBoE wouldn't work with
AF_IB, but I'm not sure if anyone has tested it. The original check would have let IBoE through. When I suggested checking for IB transport, I meant the actual transport protocol, which would have included both IB and IBoE.
Got it :-)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0
-0@@ -700,8 +700,7 @@ static int cma_ib_init_qp_attr(struct
[snip]
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/infiniband/core/cma.c port_found: · line 2035
Quoted 6 lines
(quoted diff) +0
-1id_priv->id.route.addr.dev_addr.dev_type = - (rdma_port_get_link_layer(cma_dev->device, p) ==
IB_LINK_LAYER_INFINIBAND) ?drivers/infiniband/core/cma.c +1
-0+ (rdma_transport_ib (cma_dev->device, p)) ?ARPHRD_INFINIBAND :ARPHRD_ETHER ;This wants the link layer, or maybe use
cap_ipoib.
Quoted 3 lines
Quoted 1 line
Is this related with ipoib only?
ARPHDR_INFINIBANDis related to ipoib. In your next update, maybe go withtech_ib. I don't know the status of ipoib over iboe.
Will be in next version :-)
Regards,
Michael Wang
Quoted 1 line
PATCH v2 14/17 IB/Verbs: Reserve legacy transport type for 'struct rdma_dev_addr'
In reply to Michael WangReserve the legacy transport type for the 'transport' member of 'struct rdma_dev_addr' until we make sure this is no longer needed.
--- drivers/infiniband/core/cma.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
drivers/infiniband/core/cma.c +23 -2
@@ -244,14 +244,35 @@ static inline void cma_set_ip_ver(struct cma_hdr *hdr, u8 ip_ver) hdr->ip_version = (ip_ver <<4 ) | (hdr->ip_version &0xF ); } +static inline void cma_set_legacy_transport (struct rdma_cm_id *id) +{ +switch (id->device->node_type) { +case RDMA_NODE_IB_CA : +case RDMA_NODE_IB_SWITCH : +case RDMA_NODE_IB_ROUTER : + id->route.addr.dev_addr.transport =RDMA_TRANSPORT_IB ; +break ; +case RDMA_NODE_RNIC : + id->route.addr.dev_addr.transport =RDMA_TRANSPORT_IWARP ; +break ; +case RDMA_NODE_USNIC : + id->route.addr.dev_addr.transport =RDMA_TRANSPORT_USNIC ; +break ; +case RDMA_NODE_USNIC_UDP : + id->route.addr.dev_addr.transport =RDMA_TRANSPORT_USNIC_UDP ; +break ; +default : +BUG (); + } +} +static void cma_attach_to_dev (struct rdma_id_private *id_priv,struct cma_device *cma_dev) {atomic_inc (&cma_dev->refcount); id_priv->cma_dev = cma_dev; id_priv->id.device = cma_dev->device; - id_priv->id.route.addr.dev_addr.transport = -rdma_node_get_transport (cma_dev->device->node_type); +cma_set_legacy_transport (&id_priv->id);list_add_tail (&id_priv->list, &cma_dev->id_list); }
Signature · 1 line
2.1.0
PATCH v2 15/17 IB/Verbs: Reform cma_acquire_dev() with management helpers
In reply to Michael WangReform cma_acquire_dev() with management helpers, introduce cma_validate_port() to make the code more clean.
--- drivers/infiniband/core/cma.c | 69 +++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 28 deletions(-)
drivers/infiniband/core/cma.c +41 -28
@@ -370,18 +370,36 @@ static int cma_translate_addr(struct sockaddr *addr, struct rdma_dev_addr *dev_areturn ret; } +static inline int cma_validate_port (struct ib_device *device,u8 port, +union ib_gid *gid,int dev_type) +{ +u8 found_port; +int ret = -ENODEV ; + +if ((dev_type ==ARPHRD_INFINIBAND ) && !rdma_transport_ib (device, port)) +return ret; + +if ((dev_type !=ARPHRD_INFINIBAND ) &&rdma_transport_ib (device, port)) +return ret; + + ret =ib_find_cached_gid (device, gid, &found_port,NULL ); + +if (!ret && (port == found_port)) +return 0 ; + +return ret; +} +static int cma_acquire_dev (struct rdma_id_private *id_priv,struct rdma_id_private *listen_id_priv) {struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;struct cma_device *cma_dev; -union ib_gid gid, iboe_gid; +union ib_gid gid, iboe_gid, *gidp;int ret = -ENODEV ; -u8 port, found_port; -enum rdma_link_layer dev_ll = dev_addr->dev_type ==ARPHRD_INFINIBAND ? -IB_LINK_LAYER_INFINIBAND :IB_LINK_LAYER_ETHERNET ; +u8 port; -if (dev_ll !=IB_LINK_LAYER_INFINIBAND && +if (dev_addr->dev_type !=ARPHRD_INFINIBAND && id_priv->id.ps ==RDMA_PS_IPOIB )return -EINVAL ;
@@ -391,41 +409,36 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv,memcpy (&gid, dev_addr->src_dev_addr +rdma_addr_gid_offset (dev_addr),sizeof gid); -if (listen_id_priv && -rdma_port_get_link_layer (listen_id_priv->id.device, - listen_id_priv->id.port_num) == dev_ll) { + +if (listen_id_priv) { cma_dev = listen_id_priv->cma_dev; port = listen_id_priv->id.port_num; -if (rdma_node_get_transport (cma_dev->device->node_type) ==RDMA_TRANSPORT_IB && -rdma_port_get_link_layer (cma_dev->device, port) ==IB_LINK_LAYER_ETHERNET ) - ret =ib_find_cached_gid (cma_dev->device, &iboe_gid, - &found_port,NULL ); -else - ret =ib_find_cached_gid (cma_dev->device, &gid, - &found_port,NULL ); + gidp =rdma_transport_iboe (cma_dev->device, port) ? + &iboe_gid : &gid; -if (!ret && (port == found_port)) { - id_priv->id.port_num = found_port; + ret =cma_validate_port (cma_dev->device, port, gidp, + dev_addr->dev_type); +if (!ret) { + id_priv->id.port_num = port; goto out; } } +list_for_each_entry (cma_dev, &dev_list, list) {for (port =1 ; port <= cma_dev->device->phys_port_cnt; ++port) {if (listen_id_priv && listen_id_priv->cma_dev == cma_dev && listen_id_priv->id.port_num == port)continue ; -if (rdma_port_get_link_layer (cma_dev->device, port) == dev_ll) { -if (rdma_node_get_transport (cma_dev->device->node_type) ==RDMA_TRANSPORT_IB && -rdma_port_get_link_layer (cma_dev->device, port) ==IB_LINK_LAYER_ETHERNET ) - ret =ib_find_cached_gid (cma_dev->device, &iboe_gid, &found_port,NULL ); -else - ret =ib_find_cached_gid (cma_dev->device, &gid, &found_port,NULL ); - -if (!ret && (port == found_port)) { - id_priv->id.port_num = found_port; - goto out; - } + + gidp =rdma_transport_iboe (cma_dev->device, port) ? + &iboe_gid : &gid; + + ret =cma_validate_port (cma_dev->device, port, gidp, + dev_addr->dev_type); +if (!ret) { + id_priv->id.port_num = port; + goto out; } } }
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 16/17 IB/Verbs: Cleanup rdma_node_get_transport()
In reply to Michael WangWe have get rid of all the scene using rdma_node_get_transport(), now clean it up.
--- drivers/infiniband/core/verbs.c | 21 --------------------- include/rdma/ib_verbs.h | 3 --- 2 files changed, 24 deletions(-)
drivers/infiniband/core/verbs.c +0 -21
@@ -107,27 +107,6 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate) }EXPORT_SYMBOL (ib_rate_to_mbps); -__attribute_const__ enum rdma_transport_type -rdma_node_get_transport (enum rdma_node_type node_type) -{ -switch (node_type) { -case RDMA_NODE_IB_CA : -case RDMA_NODE_IB_SWITCH : -case RDMA_NODE_IB_ROUTER : -return RDMA_TRANSPORT_IB ; -case RDMA_NODE_RNIC : -return RDMA_TRANSPORT_IWARP ; -case RDMA_NODE_USNIC : -return RDMA_TRANSPORT_USNIC ; -case RDMA_NODE_USNIC_UDP : -return RDMA_TRANSPORT_USNIC_UDP ; -default : -BUG (); -return 0 ; - } -} -EXPORT_SYMBOL (rdma_node_get_transport); -enum rdma_link_layer rdma_port_get_link_layer (struct ib_device *device,u8 port_num) {if (device->get_link_layer)
include/rdma/ib_verbs.h +0 -3
@@ -84,9 +84,6 @@ enum rdma_transport_type { RDMA_TRANSPORT_IBOE, }; -__attribute_const__ enum rdma_transport_type -rdma_node_get_transport (enum rdma_node_type node_type); -enum rdma_link_layer {IB_LINK_LAYER_UNSPECIFIED ,IB_LINK_LAYER_INFINIBAND ,
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 17/17 IB/Verbs: Move rdma_port_get_link_layer() to mlx4 head file
In reply to Michael WangNow only mlx4 still using rdma_port_get_link_layer(), move it to it's private head file.
--- drivers/infiniband/core/verbs.c | 20 -------------------- drivers/infiniband/hw/mlx4/mlx4_ib.h | 8 ++++++++ include/rdma/ib_verbs.h | 3 --- 3 files changed, 8 insertions(+), 23 deletions(-)
drivers/infiniband/core/verbs.c +0 -20
@@ -107,26 +107,6 @@ __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate) }EXPORT_SYMBOL (ib_rate_to_mbps); -enum rdma_link_layer rdma_port_get_link_layer (struct ib_device *device,u8 port_num) -{ -if (device->get_link_layer) -return device->get_link_layer (device, port_num); - -switch (device->query_transport (device, port_num)) { -case RDMA_TRANSPORT_IB : -case RDMA_TRANSPORT_IBOE : -return IB_LINK_LAYER_INFINIBAND ; -case RDMA_TRANSPORT_IWARP : -case RDMA_TRANSPORT_USNIC : -case RDMA_TRANSPORT_USNIC_UDP : -return IB_LINK_LAYER_ETHERNET ; -default : -BUG (); -return IB_LINK_LAYER_UNSPECIFIED ; - } -} -EXPORT_SYMBOL (rdma_port_get_link_layer); -/* Protection domains */ struct ib_pd *ib_alloc_pd (struct ib_device *device)
drivers/infiniband/hw/mlx4/mlx4_ib.h +8 -0
@@ -708,6 +708,14 @@ int __mlx4_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index,int __mlx4_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid,int netw_view); +static enum rdma_link_layer +rdma_port_get_link_layer (struct ib_device *device,u8 port_num) +{ +/* Will this happen? */ +BUG_ON (!device->get_link_layer); +return device->get_link_layer (device, port_num); +} +static inline bool mlx4_ib_ah_grh_present (struct mlx4_ib_ah *ah) {u8 port =be32_to_cpu (ah->av.ib.port_pd) >>24 &3 ;
include/rdma/ib_verbs.h +0 -3
@@ -1742,9 +1742,6 @@ int ib_query_device(struct ib_device *device,int ib_query_port (struct ib_device *device,u8 port_num,struct ib_port_attr *port_attr); -enum rdma_link_layer rdma_port_get_link_layer (struct ib_device *device, -u8 port_num); -static inline int rdma_transport_ib (struct ib_device *device,u8 port_num) {return device->query_transport (device, port_num)
Signature · 5 lines
2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Tom Talpey
reviewerQuoted 4 lines · Michael Wang
Mapping List:
node-type link-layer old-transport new-transport
nes RNIC ETH IWARP IWARP
amso1100 RNIC ETH IWARP IWARP
Quoted 10 lines
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
Can I rewind to ask a high-level question - what's the testing plan for all of this? Do you have folks lined up for verifying each of these adapters/networks, and what tests will they run?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Tom Talpey
Quoted 14 lines · Michael Wang
Mapping List:
node-type link-layer old-transport new-transport
nes RNIC ETH IWARP IWARPamso1100 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
Quoted 3 lines
Can I rewind to ask a high-level question - what's the testing plan for all of this? Do you have folks lined up for verifying each of these adapters/networks, and what tests will they run?
I think no one can have the access to all these hardware, so we can only depends on those who accidentally have one to help the testing, but it's still far from that stage..
Besides, the logical is not very complex in this part, all the mapping could find corresponding code as proof, so reviewing carefully then give a public testing on some tree may could be a plan too?
But yes, I won't be able to give an exhaustive testing by myself and no one is backing me on that currently :-P me too are waiting for the answers on how to assure the quality for patch set like this...
Regards,
Michael Wang
Quoted 3 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Michael Wang
I think no one can have the access to all these hardware, so we can only depends on those who accidentally have one to help the testing, but it's still far from that stage..
I have seen other patches in this style use the compiler to do the check, if the patch doesn't change the compiled output then it is obviously OK.
Some careful use of macros might make that possible, but it is a fair amount of work.
However, that may be the only way to get something this invasive applied, especially since we've already seen mistakes in the manual transforms :|
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Jason Gunthorpe
Quoted 3 lines · Michael Wang
I think no one can have the access to all these hardware, so we can only depends on those who accidentally have one to help the testing, but it's still far from that stage..
I have seen other patches in this style use the compiler to do the check, if the patch doesn't change the compiled output then it is obviously OK.
Quoted 6 lines
Some careful use of macros might make that possible, but it is a fair amount of work.
However, that may be the only way to get something this invasive applied, especially since we've already seen mistakes in the manual transforms :|
Make sense, I may be able to testing with mlx4 in our lab, but IMHO review carefully may be more reliable then incomplete testing in this case, if we have some tree or branch for next staging, that could be a good place for public testing, but it's haven't reached that stage yet ;-)
Regards,
Michael Wang
Quoted 3 lines
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html