Skip to contentSkip to conversation

RDMA fixes and refactoring for 4.15

PATCH Applied Leon Romanovsky 11 participants 94 messages Nov 14, 2017 – Jan 19, 2018 53 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover RDMA fixes and refactoring for 4.15

Hi Doug,

Please consider to take the following series to your coming pull request.

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-11-14

Thanks
---------------------------------------

Artemy Kovalyov (1):
IB/umem: Fix use of npages/nmap fields

Daniel Jurgens (1):
IB/cm: Add debug prints to ib_cm

Erez Alfasi (1):
IB/mlx4: Remove unused ibpd parameter

Erez Shitrit (2):
IB/ipoib: Avoid memory leak if neigh destination was changed IB/ipoib: Update pathrec field if not valid record

Majd Dibbiny (1):
IB/core: Make sure that PSN does not overflow

Matan Barak (1):
IB/core: Fix memory leak in cm_req_handler error flows

Parav Pandit (24):
IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled IB/{core/cm}: Fix dmac query for IPv6 link local destination IB/core: Depend on IPv6 stack to resolve link local address IB/core: Avoid exporting module internal function RDMA/cma: Fix consider size of destination address RDMA/cma: Set default GID type as RoCE when resolving RoCE route RDMA/cma: Simplify netdev check
RDMA/cma: Avoid setting path record type twice RDMA/cma: Introduce and use helper functions to init work IB/core: Avoid unnecessary type cast
IB/core: Refactor to avoid unnecessary check on GID lookup miss IB/rxe: Avoid passing unused index pointer which is optional IB/core: Avoid exporting module internal ib_find_gid_by_filter() RDMA/core: Avoid redundant memcpy in resolving address IB/core: Removed unused function
RDMA/{core, cma}: Simplify rdma_translate_ip RDMA/core: Avoid copying ifindex twice
IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link
layer
IB/{cm, umad}: Fix honor av init error
IB/cm: Fix honor address handle attribute init error IB/cm: Fix avoid sleep while spin lock is held IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to
ib_init_ah_attr_from_path
IB/{core, umad, cm}: Rename ib_init_ah_from_wc to
ib_init_ah_attr_from_wc
IB/cm: Refactor to avoid setting path record software only fields

 drivers/infiniband/core/addr.c            |  65 ++--------
 drivers/infiniband/core/cache.c           |  25 ++--
 drivers/infiniband/core/cm.c              | 191 ++++++++++++++++++++----------
 drivers/infiniband/core/cma.c             | 118 +++++++++---------
 drivers/infiniband/core/core_priv.h       |  13 --
 drivers/infiniband/core/device.c          |  16 +--
 drivers/infiniband/core/sa_query.c        |   8 +-
 drivers/infiniband/core/security.c        |  10 +-
 drivers/infiniband/core/umem.c            |   2 +-
 drivers/infiniband/core/user_mad.c        |  10 +-
 drivers/infiniband/core/verbs.c           | 183 ++++++++++++++--------------
 drivers/infiniband/hw/mlx4/qp.c           |   4 +-
 drivers/infiniband/sw/rxe/rxe_recv.c      |   3 +-
 drivers/infiniband/ulp/ipoib/ipoib_ib.c   |   3 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  62 +++++++---
 include/rdma/ib_addr.h                    |   5 +-
 include/rdma/ib_sa.h                      |  10 +-
 include/rdma/ib_verbs.h                   |  11 +-
 18 files changed, 379 insertions(+), 360 deletions(-)

--
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 1/31 IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently two RoCE default GIDs are added whenever HCA supports RoCEv1 and RoCEv2. Default GIDs are created using unique GUID and well known prefix as defined by the IB spec 1.3 section 4.1.1 and 3.5.10.

For few HCAs GUID is derived from the MAC address of the netdev. Due to this scheme, default RoCEv2 GID resemebles link-local IPv6 based GID. Even when IPv6 is disabled at compile time in kernel, default RoCEv2 GID can get added. When such RoCEv2 GID is used, offload HCA starts using IPv6 packets for QP.
This leads to sending IPv6 packets in network from a host which has IPv6 disabled kernel.

This can be seen with below simple test.
ib_send_bw -x 1 -d mlx5_1
ib_send_bw -x 1 -d mlx5_1 <ip_v4_addr>

It may not be a good idea to send/receive IPv6 packets on kernel which has IPv6 disabled.

Therefore lets honor networking stack's IPv6 disabled setting. This patch avoids adding RoCEv2 based default GID when IPv6 is disabled in kernel.

ibv_devinfo -v output can be seen as below on IPv6 disabled kernel as below with one IPv4 address assign to netdevice.

GID[  0]: fe80:0000:0000:0000:268a:07ff:fe55:4661
GID[  2]: 0000:0000:0000:0000:0000:ffff:c3a8:0124
GID[  3]: 0000:0000:0000:0000:0000:ffff:c3a8:0124

This also ensures that any RoCE specific legacy application who has assumed GID indexes for IP addresses start from 2, still continue to have such IP based GIDs assigned from start index of 2.

---
 drivers/infiniband/core/cache.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/infiniband/core/cache.c +9 -0
index 77515638c55c..e5bba898741d 100644
@@ -670,6 +670,15 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
 	memset(&gid_attr, 0, sizeof(gid_attr));
 	gid_attr.ndev = ndev;
 
+	/* Default GID is created using unique GUID and local subnet prefix,
+	 * as described in section 4.1.1 and 3.5.10 in IB spec 1.3.
+	 * Therefore don't create RoCEv2 default GID based on it that
+	 * resembles as IPv6 GID based on link local address when IPv6 is
+	 * disabled in kernel.
+	 */
+	if (!IS_ENABLED(CONFIG_IPV6))
+		gid_type_mask &= ~BIT(IB_GID_TYPE_ROCE_UDP_ENCAP);
+
 	for (gid_type = 0; gid_type < IB_GID_TYPE_SIZE; ++gid_type) {
 		int ix;
 		union ib_gid current_gid;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#4 lore raw

Re: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

Quoted 1 line · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Did you want to say "IB/core: Do not add RoCEv2 default GID when IPv6 is disabled" (i.e remove the word "Fix" and Cap the "do")
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMgZBzak5V68AV4VFsPgrKOueXcCduHWBJQ-j=1+TBT+iA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

RE: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyAzOjI1IFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBMZW9uDQo+IFJvbWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1 YmplY3Q6IFJlOiBbUEFUQ0ggcmRtYS1uZXh0IDAxLzMxXSBJQi9jb3JlOiBGaXggZG8gbm90IGFk ZCBSb0NFdjIgZGVmYXVsdA0KPiBHSUQgd2hlbiBJUHY2IGlzIGRpc2FibGVkDQo+IA0KPiBPbiBU dWUsIE5vdiAxNCwgMjAxNyBhdCAyOjUxIFBNLCBMZW9uIFJvbWFub3Zza3kgPGxlb25Aa2VybmVs Lm9yZz4gd3JvdGU6DQo+ID4gRnJvbTogUGFyYXYgUGFuZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+ DQo+IA0KPiBEaWQgeW91IHdhbnQgdG8gc2F5ICJJQi9jb3JlOiBEbyBub3QgYWRkIFJvQ0V2MiBk ZWZhdWx0IEdJRCB3aGVuIElQdjYgaXMNCj4gZGlzYWJsZWQiIChpLmUgcmVtb3ZlIHRoZSB3b3Jk ICJGaXgiIGFuZCBDYXAgdGhlICJkbyIpDQpTb3VuZHMgZ29vZC4gRWl0aGVyIHdlIGNhbiBkbyB2 MSBvciBEb3VnIGNhbiBjaGFuZ2Ugd2hpbGUgbWVyZ2luZyBkZXBlbmRpbmcgb24gY29tbWVudHMg b24gb3RoZXIgcGF0Y2hlcy4NCg==
--
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

#7 lore raw

Re: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

In reply to a message not in the archive

drivers/infiniband/core/cache.c void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, · line 680

Quoted 8 lines · Leon Romanovsky
drivers/infiniband/core/cache.c +8 -0
+	/* Default GID is created using unique GUID and local subnet prefix,
+	 * as described in section 4.1.1 and 3.5.10 in IB spec 1.3.
+	 * Therefore don't create RoCEv2 default GID based on it that
+	 * resembles as IPv6 GID based on link local address when IPv6 is
+	 * disabled in kernel.
+	 */
+	if (!IS_ENABLED(CONFIG_IPV6))
+		gid_type_mask &= ~BIT(IB_GID_TYPE_ROCE_UDP_ENCAP);

There is also a sysctl to globally disable ipv6, I would think it would be better to check than then a CONFIG symbol?

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

A message that is not in the archive (sent off-list or not yet received): 20171115001817.GH25894-uk2M96/[email protected]

#9 lore raw

RE: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

Hi Jason,

Quoted 11 lines

-----Original Message-----
From: Jason Gunthorpe [mailto:jgg-uk2M96/[email protected]]
Sent: Tuesday, November 14, 2017 6:18 PM
To: Leon Romanovsky <[email protected]>
Cc: Doug Ledford <[email protected]>; [email protected]; Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
Subject: Re: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default
GID when IPv6 is disabled

On Tue, Nov 14, 2017 at 02:51:48PM +0200, Leon Romanovsky wrote:

Quoted 12 lines

drivers/infiniband/core/cache.c void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, · line 680

Quoted 8 lines
drivers/infiniband/core/cache.c +8 -0
+	/* Default GID is created using unique GUID and local subnet prefix,
+	 * as described in section 4.1.1 and 3.5.10 in IB spec 1.3.
+	 * Therefore don't create RoCEv2 default GID based on it that
+	 * resembles as IPv6 GID based on link local address when IPv6 is
+	 * disabled in kernel.
+	 */
+	if (!IS_ENABLED(CONFIG_IPV6))
+		gid_type_mask &= ~BIT(IB_GID_TYPE_ROCE_UDP_ENCAP);

There is also a sysctl to globally disable ipv6, I would think it would be better to check than then a CONFIG symbol?

Currently in rest of the IB stack in cma.c, addr.c we check for IS_ENABLED(CONFIG_IPV6). May be when all of them are changed, this can also shift to honoring sysctl. --
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB300800ABA04E768A68684608D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#11 lore raw

Re: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

Quoted 3 lines · Parav Pandit

Currently in rest of the IB stack in cma.c, addr.c we check for IS_ENABLED(CONFIG_IPV6). May be when all of them are changed, this can also shift to honoring sysctl.

I think most of the rest of the stack is guarding things that would cause linking problems when ipv6 is compiled out, those cannot be changed to sysctl.

Since this clearly should be sysctl based it should start out that way.

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

A message that is not in the archive (sent off-list or not yet received): 20171115044049.GK25894-uk2M96/[email protected]

#13 lore raw

RE: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

Quoted 13 lines

-----Original Message-----
From: Jason Gunthorpe [mailto:jgg-uk2M96/[email protected]]
Sent: Tuesday, November 14, 2017 10:41 PM
To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc: Leon Romanovsky <[email protected]>; Doug Ledford <[email protected]>; [email protected]
Subject: Re: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default
GID when IPv6 is disabled

On Wed, Nov 15, 2017 at 03:59:26AM +0000, Parav Pandit wrote:

Quoted 8 lines
Quoted 3 lines

Currently in rest of the IB stack in cma.c, addr.c we check for IS_ENABLED(CONFIG_IPV6). May be when all of them are changed, this can also shift to honoring sysctl.

I think most of the rest of the stack is guarding things that would cause linking problems when ipv6 is compiled out, those cannot be changed to sysctl.

Since this clearly should be sysctl based it should start out that way.

Ok. But I will not be able to provide such fix anytime soon. --
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

#14 lore raw

Re: [rdma-next, 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

In reply to a message not in the archive
Quoted 28 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently two RoCE default GIDs are added whenever HCA supports RoCEv1 and RoCEv2. Default GIDs are created using unique GUID and well known prefix as defined by the IB spec 1.3 section 4.1.1 and 3.5.10.

For few HCAs GUID is derived from the MAC address of the netdev. Due to this scheme, default RoCEv2 GID resemebles link-local IPv6 based GID. Even when IPv6 is disabled at compile time in kernel, default RoCEv2 GID can get added. When such RoCEv2 GID is used, offload HCA starts using IPv6 packets for QP.
This leads to sending IPv6 packets in network from a host which has IPv6 disabled kernel.

This can be seen with below simple test.
ib_send_bw -x 1 -d mlx5_1
ib_send_bw -x 1 -d mlx5_1 <ip_v4_addr>

It may not be a good idea to send/receive IPv6 packets on kernel which has IPv6 disabled.

Therefore lets honor networking stack's IPv6 disabled setting. This patch avoids adding RoCEv2 based default GID when IPv6 is disabled in kernel.

ibv_devinfo -v output can be seen as below on IPv6 disabled kernel as below with one IPv4 address assign to netdevice.

Quoted 7 lines
GID[  0]: fe80:0000:0000:0000:268a:07ff:fe55:4661
GID[  2]: 0000:0000:0000:0000:0000:ffff:c3a8:0124
GID[  3]: 0000:0000:0000:0000:0000:ffff:c3a8:0124

This also ensures that any RoCE specific legacy application who has assumed GID indexes for IP addresses start from 2, still continue to have such IP based GIDs assigned from start index of 2.

I'm not going to take this patch.. The entire concept is wrong.

rocev2 should *NOT* be creating a default IPv6 address, ever. So turning that off is simply the wrong solution to this problem.

rocev2 is IP based and must exclusively follow the IP address list in the host.

It must never invent its own IP that is not associated with a netdev.

Creating a rocev1 compatability DGID does makes sense, but that is a *DGID* and it must never be co-mingled with rocev2 packets.

Quoted 3 lines

BTW, Leon when you send these patches please make sure the Reviewer's are CC'd as they should see and have a chance to respond to review comments.. I added Eli manually in this case..

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

A message that is not in the archive (sent off-list or not yet received): 20171218204818.GA18725-uk2M96/[email protected]

#16 lore raw

Re: [rdma-next, 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Leon Romanovsky

BTW, Leon when you send these patches please make sure the Reviewer's are CC'd as they should see and have a chance to respond to review comments.. I added Eli manually in this case..

I will try to pay more attention to it.

Thanks

Quoted 6 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

#17 lore raw

PATCH 2/31 IB/{core/cm}: Fix dmac query for IPv6 link local destination

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

ib_init_ah_from_wc() is querying dmac address for IPv6 link local destination address and for all other address type without any association with netdevice.
For resolving IPv6 link local address to its mac address, it is must to provide the link local interface index as required by IPv6 stack. Currently rdma_cm based RoCE applications fails to establish connection using IPv6 link local addresses. This problem is described at [1].

Also, for rest of the IPv4 and IPv6 addresses, it is necessary to consider netdevice from which the MAD packet is received.

Therefore, this patch refers to the GID index from wc. Each RoCE GID is associated with respective netdevice. Patch uses the netdevice of such GID entry to ensure that dmac resolve happens using netdevice of received packet.
RoCE GID table management ensures that right upper netdevices of the physical netdevices are added. Therefore init_ah_from_wc doesn't need to perform such check.

Now that route lookup is done based on the netdevice of the GID entry, simplify code to not have ifindex and vlan pointers.
As part of that, refactor to have netdevice as input parameter. This is already discussed at [2].

Finally ib_init_ah_from_wc resolves dmac for unicast GID in similar way as what ib_resolve_eth_dmac() does. So ib_resolve_eth_dmac is refactored to split for unicast and non unicast GIDs, so that it can be reused by ib_init_ah_from_wc.
While we are at refactoring ib_resolve_eth_dmac(), it is further simplified
(a) to avoid hoplimit as optional parameter, as there is only one user who always queries hoplimit.
(b) for empty line.
(c) avoided zero initialization of ret.
(d) removed as exported symbol as only ib core uses it.

For IPv6, this is tested using simple rping test as below. rping -sv -a ::0
rping -c -a fe80::268a:7ff:fe55:4661%ens2f1 -C 1 -v -d

[1] https://www.spinics.net/lists/linux-rdma/msg45690.html
[2] https://www.spinics.net/lists/linux-rdma/msg45710.html

---
 drivers/infiniband/core/addr.c  |  24 ++-----
 drivers/infiniband/core/verbs.c | 136 +++++++++++++++++-----------------------
 include/rdma/ib_addr.h          |   2 +-
 3 files changed, 64 insertions(+), 98 deletions(-)
drivers/infiniband/core/addr.c +5 -19
index f4e8185bccd3..da4469c38eac 100644
@@ -761,27 +761,23 @@ static void resolve_cb(int status, struct sockaddr *src_addr,
 
 int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 				 const union ib_gid *dgid,
-				 u8 *dmac, u16 *vlan_id, int *if_index,
+				 u8 *dmac, const struct net_device *ndev,
 				 int *hoplimit)
 {
-	int ret = 0;
 	struct rdma_dev_addr dev_addr;
 	struct resolve_cb_context ctx;
-	struct net_device *dev;
-
 	union {
 		struct sockaddr     _sockaddr;
 		struct sockaddr_in  _sockaddr_in;
 		struct sockaddr_in6 _sockaddr_in6;
 	} sgid_addr, dgid_addr;
-
+	int ret;
 
 	rdma_gid2ip(&sgid_addr._sockaddr, sgid);
 	rdma_gid2ip(&dgid_addr._sockaddr, dgid);
 
 	memset(&dev_addr, 0, sizeof(dev_addr));
-	if (if_index)
-		dev_addr.bound_dev_if = *if_index;
+	dev_addr.bound_dev_if = ndev->ifindex;
 	dev_addr.net = &init_net;
 
 	ctx.addr = &dev_addr;
@@ -798,19 +794,9 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 		return ret;
 
 	memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN);
-	dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if);
-	if (!dev)
-		return -ENODEV;
-	if (if_index)
-		*if_index = dev_addr.bound_dev_if;
-	if (vlan_id)
-		*vlan_id = rdma_vlan_dev_vlan_id(dev);
-	if (hoplimit)
-		*hoplimit = dev_addr.hoplimit;
-	dev_put(dev);
-	return ret;
+	*hoplimit = dev_addr.hoplimit;
+	return 0;
 }
-EXPORT_SYMBOL(rdma_addr_find_l2_eth_by_grh);
 
 int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id)
 {
drivers/infiniband/core/verbs.c +58 -78

180 lines not on this page · raw message

include/rdma/ib_addr.h +1 -1
index 18c564f60e93..d5c3bbb84608 100644
@@ -134,7 +134,7 @@ int rdma_addr_size(struct sockaddr *addr);
 int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
 int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 				 const union ib_gid *dgid,
-				 u8 *smac, u16 *vlan_id, int *if_index,
+				 u8 *dmac, const struct net_device *ndev,
 				 int *hoplimit);
 
 static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#19 lore raw

Re: [rdma-next, 02/31] IB/{core/cm}: Fix dmac query for IPv6 link local destination

Quoted 15 lines · Leon Romanovsky
drivers/infiniband/core/verbs.c +15 -0
+static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
+				       struct rdma_ah_attr *ah_attr)
+{
+	struct ib_gid_attr sgid_attr;
+	struct ib_global_route *grh;
+	int hop_limit = 0xff;
+	union ib_gid sgid;
+	int ret;
+
+	grh = rdma_ah_retrieve_grh(ah_attr);
+
+	ret = ib_query_gid(device,
+			   rdma_ah_get_port_num(ah_attr),
+			   grh->sgid_index,
+			   &sgid, &sgid_attr);

[..]

drivers/infiniband/core/verbs.c int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, · line 578

Quoted 11 lines
drivers/infiniband/core/verbs.c +9 -0
+		ret = get_sgid_index_from_eth(device, port_num,
+					      vlan_id, &dgid,
+					      gid_type, &gid_index);
 		if (ret)
 			return ret;
+		flow_class = be32_to_cpu(grh->version_tclass_flow);
+		rdma_ah_set_grh(ah_attr, &sgid,
+				flow_class & 0xFFFFF,
+				(u8)gid_index, hoplimit,
+				(flow_class >> 20) & 0xFF);
+		return ib_resolve_unicast_gid_dmac(device, ah_attr);

This patch looks like a major improvement, so I am going to take it.

However, I dislike this flow here, calling get_sgid_index_from_eth to get an index then converting the index to a ib_gid_attr via ib_query_gid is silly.

We should have support APIs that go directly from the WC & GRH to a gid_attr without the racy inbetween step of gid_index.

Can you send a followup to fix it?

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

#20 lore raw

PATCH 3/31 IB/core: Depend on IPv6 stack to resolve link local address

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently ib_resolve_eth_dmac() bypasses IPv6 stack for resolving link local destination mac address and translates the IPv6 link local GID to MAC address, which is not always correct.
Static link local neighbour entry can be setup using
ip -6 neigh add <link_local_addr> lladdr <mac_addr> dev eth0 Current code bypasses such administratively set entries and IPV6 stack.

IPv6 RFC 4861 defines neighbour discovery protocol and is already implemented by the kernel.

Now that rdma_addr_find_l2_eth_by_grh() supports resolving link local address to find destination mac address, lets make use of it. This aligns it to how the rest of the IPv6 stack resolves link local destination IPv6 address.

---
 drivers/infiniband/core/verbs.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/infiniband/core/verbs.c +11 -5
index 54b56c4fcc38..75ebd74f8bbd 100644
@@ -506,9 +506,20 @@ static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
 		return ret;
 	}
 
+	/* If destination is link local and source GID is RoCEv1,
+	 * IP stack is not used.
+	 */
+	if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw) &&
+	    sgid_attr.gid_type == IB_GID_TYPE_ROCE) {
+		rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
+				ah_attr->roce.dmac);
+		goto done;
+	}
+
 	ret = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
 					   ah_attr->roce.dmac,
 					   sgid_attr.ndev, &hop_limit);
+done:
 	dev_put(sgid_attr.ndev);
 
 	grh->hop_limit = hop_limit;
@@ -1280,11 +1291,6 @@ static int ib_resolve_eth_dmac(struct ib_device *device,
 
 	grh = rdma_ah_retrieve_grh(ah_attr);
 
-	if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw)) {
-		rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
-				ah_attr->roce.dmac);
-		return 0;
-	}
 	if (rdma_is_multicast_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) {
 		if (ipv6_addr_v4mapped((struct in6_addr *)ah_attr->grh.dgid.raw)) {
 			__be32 addr = 0;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#22 lore raw

Re: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve link local address

Quoted 8 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently ib_resolve_eth_dmac() bypasses IPv6 stack for resolving link local destination mac address and translates the IPv6 link local GID to MAC address, which is not always correct.
Static link local neighbour entry can be setup using
ip -6 neigh add <link_local_addr> lladdr <mac_addr> dev eth0 Current code bypasses such administratively set entries and IPV6 stack.

At the very least this description makes little sense.

The code is inspecting a DGID, and when in rocev1 mode, the DGID is *NOT* an IPv6 address and the correct thing to do is what it is doing now.

In rocev2 mode the DGID becomes and IPv6 address and you should do ND.

Has this distinction been captured in the patch?

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

A message that is not in the archive (sent off-list or not yet received): 20171115003238.GI25894-uk2M96/[email protected]

#24 lore raw

RE: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve link local address

Hi Jason,

Quoted 19 lines

-----Original Message-----
From: Jason Gunthorpe [mailto:jgg-uk2M96/[email protected]]
Sent: Tuesday, November 14, 2017 6:33 PM
To: Leon Romanovsky <[email protected]>
Cc: Doug Ledford <[email protected]>; [email protected]; Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
Subject: Re: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve
link local address

Quoted 8 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently ib_resolve_eth_dmac() bypasses IPv6 stack for resolving link local destination mac address and translates the IPv6 link local GID to MAC address, which is not always correct.
Static link local neighbour entry can be setup using ip -6 neigh add <link_local_addr> lladdr <mac_addr> dev eth0 Current code bypasses such administratively set entries and IPV6 stack.

Quoted 3 lines

At the very least this description makes little sense.

The code is inspecting a DGID, and when in rocev1 mode, the DGID is

And it is inspecting SGID type too as rocev1 or v2 using below check. sgid_attr.gid_type == IB_GID_TYPE_ROCE

Quoted 2 lines

*NOT* an IPv6 address and the correct thing to do is what it is doing now.

Yes. It does what it does today. When SGID is RoCEv1, it doesn't do ND.

Quoted 3 lines

In rocev2 mode the DGID becomes and IPv6 address and you should do ND.

Has this distinction been captured in the patch?

Yes. When SGID type is RoCEv2, it performs ARP/ND.
This is described in commit log - it uses rdma_addr_find_l2_eth_by_grh() which performs ND.

Quoted 2 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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB30080133A617972DC6F362F1D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#26 lore raw

Re: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve link local address

Quoted 2 lines · Parav Pandit
Quoted 1 line

Has this distinction been captured in the patch?

Yes. When SGID type is RoCEv2, it performs ARP/ND.

Good then..

Quoted 2 lines

This is described in commit log - it uses
rdma_addr_find_l2_eth_by_grh() which performs ND.

I find your commit messages very hard to understand.

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

A message that is not in the archive (sent off-list or not yet received): 20171115044129.GL25894-uk2M96/[email protected]

#28 lore raw

RE: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve link local address

Quoted 14 lines

-----Original Message-----
From: Jason Gunthorpe [mailto:jgg-uk2M96/[email protected]]
Sent: Tuesday, November 14, 2017 10:41 PM
To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc: Leon Romanovsky <[email protected]>; Doug Ledford <[email protected]>; [email protected]
Subject: Re: [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve
link local address

Quoted 1 line · Parav Pandit
Quoted 1 line

Has this distinction been captured in the patch?

Quoted 9 lines
Quoted 1 line

Yes. When SGID type is RoCEv2, it performs ARP/ND.

Good then..

Quoted 2 lines

This is described in commit log - it uses
rdma_addr_find_l2_eth_by_grh() which performs ND.

I find your commit messages very hard to understand.

Thanks Jason for the input. I will improve upon in future commits. --
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

#29 lore raw

PATCH 4/31 IB/core: Avoid exporting module internal function

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

ib_security_modify_qp and ib_security_pkey_access are core internal function. So avoid exporting them.
ib_security_pkey_access is used only when secuirty hooks are enabled so avoid defining it otherwise.

---
 drivers/infiniband/core/core_priv.h | 13 -------------
 drivers/infiniband/core/security.c  | 10 ++++------
 2 files changed, 4 insertions(+), 19 deletions(-)
drivers/infiniband/core/core_priv.h +0 -13
index a1d687a664f8..6c4541af54bb 100644
@@ -213,11 +213,6 @@ int ib_get_cached_subnet_prefix(struct ib_device *device,
 				u64              *sn_pfx);
 
 #ifdef CONFIG_SECURITY_INFINIBAND
-int ib_security_pkey_access(struct ib_device *dev,
-			    u8 port_num,
-			    u16 pkey_index,
-			    void *sec);
-
 void ib_security_destroy_port_pkey_list(struct ib_device *device);
 
 void ib_security_cache_change(struct ib_device *device,
@@ -240,14 +235,6 @@ int ib_mad_agent_security_setup(struct ib_mad_agent *agent,
 void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent);
 int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index);
 #else
-static inline int ib_security_pkey_access(struct ib_device *dev,
-					  u8 port_num,
-					  u16 pkey_index,
-					  void *sec)
-{
-	return 0;
-}
-
 static inline void ib_security_destroy_port_pkey_list(struct ib_device *device)
 {
 }
drivers/infiniband/core/security.c +4 -6
index 23278ed5be45..209d0574fc1f 100644
@@ -620,12 +620,11 @@ int ib_security_modify_qp(struct ib_qp *qp,
 	}
 	return ret;
 }
-EXPORT_SYMBOL(ib_security_modify_qp);
 
-int ib_security_pkey_access(struct ib_device *dev,
-			    u8 port_num,
-			    u16 pkey_index,
-			    void *sec)
+static int ib_security_pkey_access(struct ib_device *dev,
+				   u8 port_num,
+				   u16 pkey_index,
+				   void *sec)
 {
 	u64 subnet_prefix;
 	u16 pkey;
@@ -642,7 +641,6 @@ int ib_security_pkey_access(struct ib_device *dev,
 
 	return security_ib_pkey_access(sec, subnet_prefix, pkey);
 }
-EXPORT_SYMBOL(ib_security_pkey_access);
 
 static int ib_mad_agent_security_change(struct notifier_block *nb,
 					unsigned long event,
Signature · 6 lines
2.15.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
#30 lore raw

PATCH 5/31 IB/mlx4: Remove unused ibpd parameter

In reply to a message not in the archive

From: Erez Alfasi <ereza-VPRAkNaXOzVWk0Htik3J/[email protected]>

Remove unused ibpd parameter from create_qp_rss() function.

---
 drivers/infiniband/hw/mlx4/qp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/qp.c +2 -2
index 013049bcdb53..dc1c61745ad8 100644
@@ -725,7 +725,7 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
 	return 0;
 }
 
-static int create_qp_rss(struct mlx4_ib_dev *dev, struct ib_pd *ibpd,
+static int create_qp_rss(struct mlx4_ib_dev *dev,
 			 struct ib_qp_init_attr *init_attr,
 			 struct mlx4_ib_create_qp_rss *ucmd,
 			 struct mlx4_ib_qp *qp)
@@ -848,7 +848,7 @@ static struct ib_qp *_mlx4_ib_create_qp_rss(struct ib_pd *pd,
 	qp->pri.vid = 0xFFFF;
 	qp->alt.vid = 0xFFFF;
 
-	err = create_qp_rss(to_mdev(pd->device), pd, init_attr, &ucmd, qp);
+	err = create_qp_rss(to_mdev(pd->device), init_attr, &ucmd, qp);
 	if (err) {
 		kfree(qp);
 		return ERR_PTR(err);
Signature · 6 lines
2.15.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
#31 lore raw

PATCH 6/31 IB/ipoib: Avoid memory leak if neigh destination was changed

In reply to a message not in the archive

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Demonstration of the bug is as the follow:
ipoib wants to send to GID fe80:0000:0000:0000:0002:c903:00ef:5ee2, it creates new record in the DB with that gid as a key, and issues a new request to the sm.
Now, the SM from some reason returns path-record with other SGID (for example, fe80:0000:0000:0001:0002:c903:00ef:5ee2 that contains the local subnet prefix) now ipoib will overwrite the current entry with the new one, and if new request to the original GID arrives ipoib will not find it in the DB (was overwritten) and will create new record that in its turn will also be overwritten by the response from the SM, and so on till the driver eats all the device memory.

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +10 -0
index 12b7f911f0e5..b173d618c59c 100644
@@ -775,6 +775,16 @@ static void path_rec_completion(int status,
 	spin_lock_irqsave(&priv->lock, flags);
 
 	if (!IS_ERR_OR_NULL(ah)) {
+		/* check there is no mismatch from the request */
+		if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			   sizeof(union ib_gid))) {
+			pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+				dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+			/* overwrite the response from the sm  before copy to the db */
+			memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			       sizeof(union ib_gid));
+		}
+
 		path->pathrec = *pathrec;
 
 		old_ah   = path->ah;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#33 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 9 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Demonstration of the bug is as the follow:

this series contains bunch of fixes, any reason to direct them to -next (4.16) and not -rc (4.15)

Also, in most of the cases ppl didn't provide a Fixes: line with the offending patch, any reason to skip that?
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMjPD-MwKHknnYVBzzhSoxCFWE2i9jOCC500yEn5pFXarg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#35 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 9 lines · Or Gerlitz
Quoted 8 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Quoted 4 lines
Quoted 1 line

Demonstration of the bug is as the follow:

this series contains bunch of fixes, any reason to direct them to -next (4.16) and not -rc (4.15)

Doug didn't send his pull request yet and most probably we will have two pull requests in this merge window, one with already accepted code and another with fixes from Denny and us. So all these patches are targeted for 4.15.

Quoted 3 lines

Also, in most of the cases ppl didn't provide a Fixes: line with the offending patch, any reason to skip that?

There are two main reasons:
1. I didn't request to add Fixes for refactoring code (most Parav's patches), because I don't want that code to be picked for stable@ trees by Greg's and Sasha's automatic scripts.
2. Sometimes, it is not clear the origin of the bug and the chances to have wrong Fixes are higher than to have right ones.

Everything else is my mistake during review. Can you point me to specific commits where you would like to see Fixes with right Fixes? I'll add.

Thanks

#36 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

In reply to a message not in the archive
Quoted 30 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Demonstration of the bug is as the follow:
ipoib wants to send to GID fe80:0000:0000:0000:0002:c903:00ef:5ee2, it creates new record in the DB with that gid as a key, and issues a new request to the sm.
Now, the SM from some reason returns path-record with other SGID (for example, fe80:0000:0000:0001:0002:c903:00ef:5ee2 that contains the local subnet prefix) now ipoib will overwrite the current entry with the new one, and if new request to the original GID arrives ipoib will not find it in the DB (was overwritten) and will create new record that in its turn will also be overwritten by the response from the SM, and so on till the driver eats all the device memory.

 drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
index 12b7f911f0e5..b173d618c59c 100644
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -775,6 +775,16 @@ static void path_rec_completion(int status,
 	spin_lock_irqsave(&priv->lock, flags);

drivers/infiniband/ulp/ipoib/ipoib_main.c static void path_rec_completion(int status, · line 785

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +8 -0
 
 	if (!IS_ERR_OR_NULL(ah)) {
+		/* check there is no mismatch from the request */
+		if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			   sizeof(union ib_gid))) {
+			pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+				dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+			/* overwrite the response from the sm  before copy to the db */
+			memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			       sizeof(union ib_gid));

This doesn't seem like it should be a warning, and replacing the good DGID from the SA with local garbage seems really wrong.

The SA should be free to return a correct DGID, for instance by replacing a old or link local subnet prefix with the current value of the subnet prefix, or by returning a different gid index for the destination depending on mulitpath requirements.

So the right thing to do here is to somehow make ipoib use the data from the SA.

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

A message that is not in the archive (sent off-list or not yet received): 20171115001510.GG25894-uk2M96/[email protected]

#38 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 32 lines · Jason Gunthorpe
Quoted 31 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Demonstration of the bug is as the follow:
ipoib wants to send to GID fe80:0000:0000:0000:0002:c903:00ef:5ee2, it creates new record in the DB with that gid as a key, and issues a new request to the sm.
Now, the SM from some reason returns path-record with other SGID (for example, fe80:0000:0000:0001:0002:c903:00ef:5ee2 that contains the local subnet prefix) now ipoib will overwrite the current entry with the new one, and if new request to the original GID arrives ipoib will not find it in the DB (was overwritten) and will create new record that in its turn will also be overwritten by the response from the SM, and so on till the driver eats all the device memory.

 drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
index 12b7f911f0e5..b173d618c59c 100644
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -775,6 +775,16 @@ static void path_rec_completion(int status,
      spin_lock_irqsave(&priv->lock, flags);
 
Quoted 12 lines

drivers/infiniband/ulp/ipoib/ipoib_main.c static void path_rec_completion(int status, · line 785

Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +8 -0
      if (!IS_ERR_OR_NULL(ah)) {
+             /* check there is no mismatch from the request */
+             if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                        sizeof(union ib_gid))) {
+                     pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+                             dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+                     /* overwrite the response from the sm  before copy to the db */
+                     memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                            sizeof(union ib_gid));

This doesn't seem like it should be a warning, and replacing the good DGID from the SA with local garbage seems really wrong.

IPoIB is L2 driver and should act as a pipe and cannot add its opinion about what is a good or a garbage GID.
If the host is asking for specific mac address, IPoIB should return the response for the original request/mac and should not decide what is good for the host.
This issue can happen from several issues, sm-bug or bad configuration, i don't think IPoIB is the place to fix that. So, what left for IPoIB is to protect itself from endless memory leak, and this what the patch tries to do.

Quoted 6 lines

The SA should be free to return a correct DGID, for instance by replacing a old or link local subnet prefix with the current value of the subnet prefix, or by returning a different gid index for the destination depending on mulitpath requirements.

Quoted 8 lines

So the right thing to do here is to somehow make ipoib use the data from the SA.

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

--
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

A message that is not in the archive (sent off-list or not yet received): CAAk-MO-QQj3_H2CZuCCOCU51tWwdCfkvhh-Q3LqrKM=Su2Q+Kg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#40 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 10 lines · Erez Shitrit
Quoted 10 lines
Quoted 9 lines
      if (!IS_ERR_OR_NULL(ah)) {
drivers/infiniband/ulp/ipoib/ipoib_main.c +8 -0
+             /* check there is no mismatch from the request */
+             if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                        sizeof(union ib_gid))) {
+                     pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+                             dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+                     /* overwrite the response from the sm  before copy to the db */
+                     memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                            sizeof(union ib_gid));
Quoted 5 lines
Quoted 2 lines

This doesn't seem like it should be a warning, and replacing the good DGID from the SA with local garbage seems really wrong.

IPoIB is L2 driver and should act as a pipe and cannot add its opinion about what is a good or a garbage GID.

Which is why ipoib should not override the result from the SA.

It needs to work in a way where it looks up a DGID from the LLADDR and gets back a wire GRH and LRH which come from SA.

Quoted 3 lines

If the host is asking for specific mac address, IPoIB should return the response for the original request/mac and should not decide what is good for the host.

No, it is up to the SA to return the GRH to put in the packets, it should never be changed in any way by a ULP.

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

A message that is not in the archive (sent off-list or not yet received): 20171115153946.GP25894-uk2M96/[email protected]

#42 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 11 lines · Jason Gunthorpe
Quoted 10 lines · Erez Shitrit
Quoted 10 lines
Quoted 9 lines
      if (!IS_ERR_OR_NULL(ah)) {
(quoted diff) +8 -0
+             /* check there is no mismatch from the request */
+             if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                        sizeof(union ib_gid))) {
+                     pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+                             dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+                     /* overwrite the response from the sm  before copy to the db */
+                     memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                            sizeof(union ib_gid));
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This doesn't seem like it should be a warning, and replacing the good DGID from the SA with local garbage seems really wrong.

IPoIB is L2 driver and should act as a pipe and cannot add its opinion about what is a good or a garbage GID.

Which is why ipoib should not override the result from the SA.

It override only the DGID in the record, and that for IPoIB uses only, not the ah which is the important.
otherwise if the host will re-ask again for that DGID it will not be found in IPoIB database, and new record will be created and so on till the end of all the device memory.

Quoted 3 lines

It needs to work in a way where it looks up a DGID from the LLADDR and gets back a wire GRH and LRH which come from SA.

For that there is the ah object, this object is used as it came from the SA.

Quoted 7 lines
Quoted 4 lines

If the host is asking for specific mac address, IPoIB should return the response for the original request/mac and should not decide what is good for the host.

No, it is up to the SA to return the GRH to put in the packets, it should never be changed in any way by a ULP.

The change is only for the ULP, the user/host has no idea of that, and it gets the same ah that came from the SA.

Quoted 2 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

A message that is not in the archive (sent off-list or not yet received): CAAk-MO-nMs-+RtK_QOxPzq7uCA9hpG30ho52v4CSRPZ6769=1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#44 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 21 lines · Erez Shitrit
Quoted 17 lines · Jason Gunthorpe
Quoted 15 lines · Erez Shitrit
Quoted 10 lines

Review

Quoted 9 lines
     if (!IS_ERR_OR_NULL(ah)) {
(quoted diff) +8 -0
+             /* check there is no mismatch from the request */
+             if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                        sizeof(union ib_gid))) {
+                     pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+                             dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+                     /* overwrite the response from the sm  before copy to the db */
+                     memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+                            sizeof(union ib_gid));
Quoted 2 lines

This doesn't seem like it should be a warning, and replacing the good DGID from the SA with local garbage seems really wrong.

IPoIB is L2 driver and should act as a pipe and cannot add its opinion about what is a good or a garbage GID.

Quoted 7 lines
Quoted 1 line

Which is why ipoib should not override the result from the SA.

It override only the DGID in the record, and that for IPoIB uses only, not the ah which is the important.
otherwise if the host will re-ask again for that DGID it will not be found in IPoIB database, and new record will be created and so on till the end of all the device memory.

Isn’t the correct solution to mask away the 16-bit subnet prefix when looking up a unicast DGID in the database?

Thxs, Håkon

Quoted 19 lines
Quoted 4 lines

It needs to work in a way where it looks up a DGID from the LLADDR and gets back a wire GRH and LRH which come from SA.

For that there is the ah object, this object is used as it came from the SA.

Quoted 7 lines
Quoted 4 lines

If the host is asking for specific mac address, IPoIB should return the response for the original request/mac and should not decide what is good for the host.

No, it is up to the SA to return the GRH to put in the packets, it should never be changed in any way by a ULP.

The change is only for the ULP, the user/host has no idea of that, and it gets the same ah that came from the SA.

Quoted 1 line
Quoted 5 lines
Quoted 1 line

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

--
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

A message that is not in the archive (sent off-list or not yet received): 3321F53B-3534-4433-B627-80959DEA1850-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org

#46 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

Quoted 8 lines · Håkon Bugge
Quoted 5 lines

It override only the DGID in the record, and that for IPoIB uses only, not the ah which is the important. otherwise if the host will re-ask again for that DGID it will not be found in IPoIB database, and new record will be created and so on till the end of all the device memory.

Isn’t the correct solution to mask away the 16-bit subnet prefix when looking up a unicast DGID in the database?

No, the SA can also alter the GUID portion to point to a GUID alias. The spec envisioned using this for global multipathing.

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

#47 lore raw

Re: [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

In reply to a message not in the archive
Quoted 4 lines · Erez Shitrit
Quoted 2 lines

It needs to work in a way where it looks up a DGID from the LLADDR and gets back a wire GRH and LRH which come from SA.

For that there is the ah object, this object is used as it came from the SA.

Okay, that makes sense. This is such an important point, the patch description really should have explored it.

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

#48 lore raw

Re: [rdma-next, 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed

In reply to a message not in the archive
Quoted 33 lines · Leon Romanovsky

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

If from some reason the SM responses to path query request with response that doesn't contain the exact SGID, ipoib should warn and change that part of the response before push it to the path record DB. Otherwise, new record will be added to the path record DB with no access to them from the ipoib.

Demonstration of the bug is as the follow:
ipoib wants to send to GID fe80:0000:0000:0000:0002:c903:00ef:5ee2, it creates new record in the DB with that gid as a key, and issues a new request to the sm.
Now, the SM from some reason returns path-record with other SGID (for example, fe80:0000:0000:0001:0002:c903:00ef:5ee2 that contains the local subnet prefix) now ipoib will overwrite the current entry with the new one, and if new request to the original GID arrives ipoib will not find it in the DB (was overwritten) and will create new record that in its turn will also be overwritten by the response from the SM, and so on till the driver eats all the device memory.

 drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -0
index 12b7f911f0e5..b173d618c59c 100644
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -775,6 +775,16 @@ static void path_rec_completion(int status,
 	spin_lock_irqsave(&priv->lock, flags);
 
 	if (!IS_ERR_OR_NULL(ah)) {
+		/* check there is no mismatch from the request */

drivers/infiniband/ulp/ipoib/ipoib_main.c static void path_rec_completion(int status, · line 788

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +9 -0
+		if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			   sizeof(union ib_gid))) {
+			pr_warn("%s got PathRec for gid %pI6 while asked for %pI6\n",
+				dev->name, pathrec->dgid.raw, path->pathrec.dgid.raw);
+			/* overwrite the response from the sm  before copy to the db */
+			memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
+			       sizeof(union ib_gid));
+		}
+
 		path->pathrec = *pathrec;

I applied this, but converted the pr_warn to ipoib_dbg (it is not an error for the SA to change the DGID), reworded the commit message and comment:

		/*
		 * pathrec.dgid is used as the database key from the LLADDR,
		 * it must remain unchanged even if the SA returns a different
		 * GID to use in the AH.
		 */
		if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
			   sizeof(union ib_gid))) {
			ipoib_dbg(
				priv,
				"%s got PathRec for gid %pI6 while asked for %pI6\n",
				dev->name, pathrec->dgid.raw,
				path->pathrec.dgid.raw);
			memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
			       sizeof(union ib_gid));
		}

--
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

#49 lore raw

PATCH 7/31 IB/ipoib: Update pathrec field if not valid record

In reply to a message not in the archive

From: Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case that the PathRecord is not valid (SM changed its network prefix) ipoib will continue issue PathQuery requests with the same parameters that are in its database, which are no longer valid anymore.

Now the driver in that case will re-initialize the record from a valid place (the priv structure keeps the updated values), and a valid request will be issued.

---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 49 +++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 15 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +34 -15
index b173d618c59c..33f592cee5d8 100644
@@ -850,6 +850,23 @@ static void path_rec_completion(int status,
 	}
 }
 
+static void init_path_rec(struct ipoib_dev_priv *priv, struct ipoib_path *path,
+			  void *gid)
+{
+	path->dev = priv->dev;
+
+	if (rdma_cap_opa_ah(priv->ca, priv->port))
+		path->pathrec.rec_type = SA_PATH_REC_TYPE_OPA;
+	else
+		path->pathrec.rec_type = SA_PATH_REC_TYPE_IB;
+
+	memcpy(path->pathrec.dgid.raw, gid, sizeof(union ib_gid));
+	path->pathrec.sgid	    = priv->local_gid;
+	path->pathrec.pkey	    = cpu_to_be16(priv->pkey);
+	path->pathrec.numb_path     = 1;
+	path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
+}
+
 static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -862,21 +879,11 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
 	if (!path)
 		return NULL;
 
-	path->dev = dev;
-
 	skb_queue_head_init(&path->queue);
 
 	INIT_LIST_HEAD(&path->neigh_list);
 
-	if (rdma_cap_opa_ah(priv->ca, priv->port))
-		path->pathrec.rec_type = SA_PATH_REC_TYPE_OPA;
-	else
-		path->pathrec.rec_type = SA_PATH_REC_TYPE_IB;
-	memcpy(path->pathrec.dgid.raw, gid, sizeof (union ib_gid));
-	path->pathrec.sgid	    = priv->local_gid;
-	path->pathrec.pkey	    = cpu_to_be16(priv->pkey);
-	path->pathrec.numb_path     = 1;
-	path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
+	init_path_rec(priv, path, gid);
 
 	return path;
 }
@@ -1005,6 +1012,10 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
 
 	spin_lock_irqsave(&priv->lock, flags);
 
+	/* no broadcast means that all paths are (going to be) not valid */
+	if (!priv->broadcast)
+		goto drop_and_unlock;
+
 	path = __path_find(dev, phdr->hwaddr + 4);
 	if (!path || !path->valid) {
 		int new_path = 0;
@@ -1014,6 +1025,10 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
 			new_path = 1;
 		}
 		if (path) {
+			if (!new_path)
+				/* make sure there is no changes in the existing path record */
+				init_path_rec(priv, path, phdr->hwaddr + 4);
+
 			if (skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
 				push_pseudo_header(skb, phdr->hwaddr);
 				__skb_queue_tail(&path->queue, skb);
@@ -1030,8 +1045,7 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
 			} else
 				__path_add(dev, path);
 		} else {
-			++dev->stats.tx_dropped;
-			dev_kfree_skb_any(skb);
+			goto drop_and_unlock;
 		}
 
 		spin_unlock_irqrestore(&priv->lock, flags);
@@ -1051,11 +1065,16 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
 		push_pseudo_header(skb, phdr->hwaddr);
 		__skb_queue_tail(&path->queue, skb);
 	} else {
-		++dev->stats.tx_dropped;
-		dev_kfree_skb_any(skb);
+		goto drop_and_unlock;
 	}
 
 	spin_unlock_irqrestore(&priv->lock, flags);
+	return;
+
+drop_and_unlock:
+	++dev->stats.tx_dropped;
+	dev_kfree_skb_any(skb);
+	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
 static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
Signature · 6 lines
2.15.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
#50 lore raw

PATCH 8/31 RDMA/cma: Fix consider size of destination address

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

While copying destination address in statistics, consider size of destination address.

---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
index 1fdb473b5df7..9841e7ca5c06 100644
@@ -4431,7 +4431,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
 					  RDMA_NL_RDMA_CM_ATTR_SRC_ADDR))
 				goto out;
 			if (ibnl_put_attr(skb, nlh,
-					  rdma_addr_size(cma_src_addr(id_priv)),
+					  rdma_addr_size(cma_dst_addr(id_priv)),
 					  cma_dst_addr(id_priv),
 					  RDMA_NL_RDMA_CM_ATTR_DST_ADDR))
 				goto out;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#52 lore raw

Re: [PATCH rdma-next 08/31] RDMA/cma: Fix consider size of destination address

drivers/infiniband/core/cma.c static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)

Quoted 18 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

While copying destination address in statistics, consider size of destination address.

---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +0 -0
index 1fdb473b5df7..9841e7ca5c06 100644
@@ -4431,7 +4431,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)

Leon, isn't that the code you want to remove in your other patch? --
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMiA7G48_boRVJK336n2DNT8voJVJMiT-qhqpfXqz7aNxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#54 lore raw

Re: [PATCH rdma-next 08/31] RDMA/cma: Fix consider size of destination address

Quoted 14 lines · Or Gerlitz
Quoted 13 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

While copying destination address in statistics, consider size of destination address.

---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines

drivers/infiniband/core/cma.c static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)

Quoted 5 lines
drivers/infiniband/core/cma.c +0 -0
index 1fdb473b5df7..9841e7ca5c06 100644
@@ -4431,7 +4431,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)

Leon, isn't that the code you want to remove in your other patch?

Yes, I want, but those two parallel things, I posted RFC to see if anyone actually is using it and if everything goes smooth, I'll post proper patch for next cycle (4.16).

Right now, code exists in the tree and Parav has fix to it (he is not using it too).

Thanks

Quoted 4 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

#55 lore raw

PATCH 9/31 IB/core: Make sure that PSN does not overflow

In reply to a message not in the archive

From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/[email protected]>

The rq/sq->psn is 24 bits as defined in the IB spec,therefore we mask out the 8 most significant bits to avoid overflow in modify qp.

---
 drivers/infiniband/core/verbs.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/infiniband/core/verbs.c +16 -0
index 75ebd74f8bbd..584b6029cb44 100644
@@ -1321,6 +1321,7 @@ static int ib_resolve_eth_dmac(struct ib_device *device,
 int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
 			    int attr_mask, struct ib_udata *udata)
 {
+	u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
 	int ret;
 
 	if (attr_mask & IB_QP_AV) {
@@ -1328,6 +1329,21 @@ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
 		if (ret)
 			return ret;
 	}
+
+	if (rdma_ib_or_roce(qp->device, port)) {
+		if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
+			pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
+				__func__, qp->device->name);
+			attr->rq_psn &= 0xffffff;
+		}
+
+		if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
+			pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n",
+				__func__, qp->device->name);
+			attr->sq_psn &= 0xffffff;
+		}
+	}
+
 	ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
 	if (!ret && (attr_mask & IB_QP_PORT))
 		qp->port = attr->port_num;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-10-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#57 lore raw

Re: [PATCH rdma-next 09/31] IB/core: Make sure that PSN does not overflow

Quoted 34 lines · Leon Romanovsky

From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/[email protected]>

The rq/sq->psn is 24 bits as defined in the IB spec,therefore we mask out the 8 most significant bits to avoid overflow in modify qp.

---
 drivers/infiniband/core/verbs.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/infiniband/core/verbs.c +6 -0
index 75ebd74f8bbd..584b6029cb44 100644
@@ -1321,6 +1321,7 @@ static int ib_resolve_eth_dmac(struct ib_device *device,
 int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
                            int attr_mask, struct ib_udata *udata)
 {
+       u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
        int ret;
 
        if (attr_mask & IB_QP_AV) {
@@ -1328,6 +1329,21 @@ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
                if (ret)
                        return ret;
        }
+
+       if (rdma_ib_or_roce(qp->device, port)) {
+               if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
+                       pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
+                               __func__, qp->device->name);

drivers/infiniband/core/verbs.c int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr, · line 1346

Quoted 10 lines
drivers/infiniband/core/verbs.c +10 -0
+                       attr->rq_psn &= 0xffffff;
+               }
+
+               if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
+                       pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n",
+                               __func__, qp->device->name);
+                       attr->sq_psn &= 0xffffff;
+               }
+       }
+

Isn't this what we tried to push in the past and Jason/Sean rejected [1]?

[1] https://marc.info/?l=linux-rdma&m=142309249413868&w=2

Quoted 10 lines
drivers/infiniband/core/verbs.c +0 -1
        ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
        if (!ret && (attr_mask & IB_QP_PORT))
                qp->port = attr->port_num;
--

2.15.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

--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMj+QYJs7cTaP7-Z2WGoPZN2ujh+_2sQhW7ZKg0ZGjQacg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#59 lore raw

Re: [PATCH rdma-next 09/31] IB/core: Make sure that PSN does not overflow

Quoted 18 lines · Or Gerlitz
Quoted 5 lines
drivers/infiniband/core/verbs.c +5 -0
+
+       if (rdma_ib_or_roce(qp->device, port)) {
+               if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
+                       pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
+                               __func__, qp->device->name);

drivers/infiniband/core/verbs.c int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr, · line 1346

Quoted 10 lines
drivers/infiniband/core/verbs.c +10 -0
+                       attr->rq_psn &= 0xffffff;
+               }
+
+               if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
+                       pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n",
+                               __func__, qp->device->name);
+                       attr->sq_psn &= 0xffffff;
+               }
+       }
+

Isn't this what we tried to push in the past and Jason/Sean rejected [1]?

Quoted 1 line

[1] https://marc.info/?l=linux-rdma&m=142309249413868&w=2

No, this version is what I asked for originally in that thread:

I think we'd be better off keeping the current behavior of masking the PSN, not enforcing the limit.

The issue was because the link'd version returned an error.

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

#60 lore raw

Re: [PATCH rdma-next 09/31] IB/core: Make sure that PSN does not overflow

In reply to a message not in the archive
Quoted 11 lines · Leon Romanovsky

From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/[email protected]>

The rq/sq->psn is 24 bits as defined in the IB spec,therefore we mask out the 8 most significant bits to avoid overflow in modify qp.

 drivers/infiniband/core/verbs.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Applied to -next, thanks

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

#61 lore raw

PATCH 10/31 IB/core: Fix memory leak in cm_req_handler error flows

In reply to a message not in the archive

From: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>

In cm_req_handler error flows, sometimes cm_id_priv->timewait_info isn't free'd.

---
 drivers/infiniband/core/cm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +3 -2
index f6b159d79977..fe7a5e0d79b0 100644
@@ -1842,8 +1842,7 @@ static int cm_req_handler(struct cm_work *work)
 	listen_cm_id_priv = cm_match_req(work, cm_id_priv);
 	if (!listen_cm_id_priv) {
 		ret = -EINVAL;
-		kfree(cm_id_priv->timewait_info);
-		goto destroy;
+		goto free_timeinfo;
 	}
 
 	cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
@@ -1945,6 +1944,8 @@ static int cm_req_handler(struct cm_work *work)
 rejected:
 	atomic_dec(&cm_id_priv->refcount);
 	cm_deref_id(listen_cm_id_priv);
+free_timeinfo:
+	kfree(cm_id_priv->timewait_info);
 destroy:
 	ib_destroy_cm_id(cm_id);
 	return ret;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-11-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#63 lore raw

Re: [PATCH rdma-next 10/31] IB/core: Fix memory leak in cm_req_handler error flows

Quoted 4 lines · Leon Romanovsky

From: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>

In cm_req_handler error flows, sometimes cm_id_priv->timewait_info isn't free'd.

Other patches in this series use IB/cm: prefix, best if you align to that across the place
--
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

#64 lore raw

PATCH 11/31 IB/cm: Add debug prints to ib_cm

In reply to a message not in the archive

From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/[email protected]>

Add debug prints to the error paths in the connection manager control flows, to help debug connection management problems.

---
 drivers/infiniband/core/cm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
drivers/infiniband/core/cm.c +51 -0
index fe7a5e0d79b0..cbb385e02947 100644
@@ -1841,6 +1841,8 @@ static int cm_req_handler(struct cm_work *work)
 
 	listen_cm_id_priv = cm_match_req(work, cm_id_priv);
 	if (!listen_cm_id_priv) {
+		pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__,
+			 be32_to_cpu(cm_id->local_id));
 		ret = -EINVAL;
 		goto free_timeinfo;
 	}
@@ -1998,6 +2000,8 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id,
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state != IB_CM_REQ_RCVD &&
 	    cm_id->state != IB_CM_MRA_REQ_SENT) {
+		pr_debug("%s: local_comm_id %d, cm_id->state: %d\n", __func__,
+			 be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -2064,6 +2068,8 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_id,
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state != IB_CM_REP_RCVD &&
 	    cm_id->state != IB_CM_MRA_REP_SENT) {
+		pr_debug("%s: local_id %d, cm_id->state %d\n", __func__,
+			 be32_to_cpu(cm_id->local_id), cm_id->state);
 		ret = -EINVAL;
 		goto error;
 	}
@@ -2171,6 +2177,8 @@ static int cm_rep_handler(struct cm_work *work)
 	cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0);
 	if (!cm_id_priv) {
 		cm_dup_rep_handler(work);
+		pr_debug("%s: remote_comm_id %d, no cm_id_priv\n", __func__,
+			 be32_to_cpu(rep_msg->remote_comm_id));
 		return -EINVAL;
 	}
 
@@ -2184,6 +2192,10 @@ static int cm_rep_handler(struct cm_work *work)
 	default:
 		spin_unlock_irq(&cm_id_priv->lock);
 		ret = -EINVAL;
+		pr_debug("%s: cm_id_priv->id.state: %d, local_comm_id %d, remote_comm_id %d\n",
+			 __func__, cm_id_priv->id.state,
+			 be32_to_cpu(rep_msg->local_comm_id),
+			 be32_to_cpu(rep_msg->remote_comm_id));
 		goto error;
 	}
 
@@ -2197,6 +2209,8 @@ static int cm_rep_handler(struct cm_work *work)
 		spin_unlock(&cm.lock);
 		spin_unlock_irq(&cm_id_priv->lock);
 		ret = -EINVAL;
+		pr_debug("%s: Failed to insert remote id %d\n", __func__,
+			 be32_to_cpu(rep_msg->remote_comm_id));
 		goto error;
 	}
 	/* Check for a stale connection. */
@@ -2214,6 +2228,10 @@ static int cm_rep_handler(struct cm_work *work)
 			     IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP,
 			     NULL, 0);
 		ret = -EINVAL;
+		pr_debug("%s: Stale connection. local_comm_id %d, remote_comm_id %d\n",
+			 __func__, be32_to_cpu(rep_msg->local_comm_id),
+			 be32_to_cpu(rep_msg->remote_comm_id));
+
 		if (cur_cm_id_priv) {
 			cm_id = &cur_cm_id_priv->id;
 			ib_send_cm_dreq(cm_id, NULL, 0);
@@ -2360,6 +2378,8 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_id,
 	cm_id_priv = container_of(cm_id, struct cm_id_private, id);
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	if (cm_id->state != IB_CM_ESTABLISHED) {
+		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+			 be32_to_cpu(cm_id->local_id), cm_id->state);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -2429,6 +2449,8 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id,
 	if (cm_id->state != IB_CM_DREQ_RCVD) {
 		spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 		kfree(data);
+		pr_debug("%s: local_id %d, cm_idcm_id->state(%d) != IB_CM_DREQ_RCVD\n",
+			 __func__, be32_to_cpu(cm_id->local_id), cm_id->state);
 		return -EINVAL;
 	}
 
@@ -2494,6 +2516,9 @@ static int cm_dreq_handler(struct cm_work *work)
 		atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
 				counter[CM_DREQ_COUNTER]);
 		cm_issue_drep(work->port, work->mad_recv_wc);
+		pr_debug("%s: no cm_id_priv, local_comm_id %d, remote_comm_id %d\n",
+			 __func__, be32_to_cpu(dreq_msg->local_comm_id),
+			 be32_to_cpu(dreq_msg->remote_comm_id));
 		return -EINVAL;
 	}
 
@@ -2536,6 +2561,9 @@ static int cm_dreq_handler(struct cm_work *work)
 				counter[CM_DREQ_COUNTER]);
 		goto unlock;
 	default:
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		goto unlock;
 	}
 	cm_id_priv->id.state = IB_CM_DREQ_RCVD;
@@ -2639,6 +2667,8 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id,
 		cm_enter_timewait(cm_id_priv);
 		break;
 	default:
+		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+			 be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -2749,6 +2779,9 @@ static int cm_rej_handler(struct cm_work *work)
 		/* fall through */
 	default:
 		spin_unlock_irq(&cm_id_priv->lock);
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		ret = -EINVAL;
 		goto out;
 	}
@@ -2812,6 +2845,9 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
 		}
 		/* fall through */
 	default:
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		ret = -EINVAL;
 		goto error1;
 	}
@@ -2913,6 +2949,9 @@ static int cm_mra_handler(struct cm_work *work)
 				counter[CM_MRA_COUNTER]);
 		/* fall through */
 	default:
+		pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		goto out;
 	}
 
@@ -3693,6 +3732,7 @@ static void cm_work_handler(struct work_struct *_work)
 		ret = cm_timewait_handler(work);
 		break;
 	default:
+		pr_debug("cm_event.event: 0x%x\n", work->cm_event.event);
 		ret = -EINVAL;
 		break;
 	}
@@ -3728,6 +3768,8 @@ static int cm_establish(struct ib_cm_id *cm_id)
 		ret = -EISCONN;
 		break;
 	default:
+		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+			 be32_to_cpu(cm_id->local_id), cm_id->state);
 		ret = -EINVAL;
 		break;
 	}
@@ -3925,6 +3967,9 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
 		ret = 0;
 		break;
 	default:
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		ret = -EINVAL;
 		break;
 	}
@@ -3972,6 +4017,9 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
 		ret = 0;
 		break;
 	default:
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		ret = -EINVAL;
 		break;
 	}
@@ -4031,6 +4079,9 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
 		ret = 0;
 		break;
 	default:
+		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+			 __func__, be32_to_cpu(cm_id_priv->id.local_id),
+			 cm_id_priv->id.state);
 		ret = -EINVAL;
 		break;
 	}
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-12-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#66 lore raw

Re: [PATCH rdma-next 11/31] IB/cm: Add debug prints to ib_cm

Quoted 4 lines · Leon Romanovsky

From: Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/[email protected]>

Add debug prints to the error paths in the connection manager control flows, to help debug connection management problems.

Sean, the CM author and maintainer since 2.6.12/13 (12 years) is not copied

Quoted 205 lines
---
 drivers/infiniband/core/cm.c | 51 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
drivers/infiniband/core/cm.c +51 -1
index fe7a5e0d79b0..cbb385e02947 100644
@@ -1841,6 +1841,8 @@ static int cm_req_handler(struct cm_work *work)
 
        listen_cm_id_priv = cm_match_req(work, cm_id_priv);
        if (!listen_cm_id_priv) {
+               pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__,
+                        be32_to_cpu(cm_id->local_id));
                ret = -EINVAL;
                goto free_timeinfo;
        }
@@ -1998,6 +2000,8 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id,
        spin_lock_irqsave(&cm_id_priv->lock, flags);
        if (cm_id->state != IB_CM_REQ_RCVD &&
            cm_id->state != IB_CM_MRA_REQ_SENT) {
+               pr_debug("%s: local_comm_id %d, cm_id->state: %d\n", __func__,
+                        be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
                ret = -EINVAL;
                goto out;
        }
@@ -2064,6 +2068,8 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_id,
        spin_lock_irqsave(&cm_id_priv->lock, flags);
        if (cm_id->state != IB_CM_REP_RCVD &&
            cm_id->state != IB_CM_MRA_REP_SENT) {
+               pr_debug("%s: local_id %d, cm_id->state %d\n", __func__,
+                        be32_to_cpu(cm_id->local_id), cm_id->state);
                ret = -EINVAL;
                goto error;
        }
@@ -2171,6 +2177,8 @@ static int cm_rep_handler(struct cm_work *work)
        cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0);
        if (!cm_id_priv) {
                cm_dup_rep_handler(work);
+               pr_debug("%s: remote_comm_id %d, no cm_id_priv\n", __func__,
+                        be32_to_cpu(rep_msg->remote_comm_id));
                return -EINVAL;
        }
 
@@ -2184,6 +2192,10 @@ static int cm_rep_handler(struct cm_work *work)
        default:
                spin_unlock_irq(&cm_id_priv->lock);
                ret = -EINVAL;
+               pr_debug("%s: cm_id_priv->id.state: %d, local_comm_id %d, remote_comm_id %d\n",
+                        __func__, cm_id_priv->id.state,
+                        be32_to_cpu(rep_msg->local_comm_id),
+                        be32_to_cpu(rep_msg->remote_comm_id));
                goto error;
        }
 
@@ -2197,6 +2209,8 @@ static int cm_rep_handler(struct cm_work *work)
                spin_unlock(&cm.lock);
                spin_unlock_irq(&cm_id_priv->lock);
                ret = -EINVAL;
+               pr_debug("%s: Failed to insert remote id %d\n", __func__,
+                        be32_to_cpu(rep_msg->remote_comm_id));
                goto error;
        }
        /* Check for a stale connection. */
@@ -2214,6 +2228,10 @@ static int cm_rep_handler(struct cm_work *work)
                             IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP,
                             NULL, 0);
                ret = -EINVAL;
+               pr_debug("%s: Stale connection. local_comm_id %d, remote_comm_id %d\n",
+                        __func__, be32_to_cpu(rep_msg->local_comm_id),
+                        be32_to_cpu(rep_msg->remote_comm_id));
+
                if (cur_cm_id_priv) {
                        cm_id = &cur_cm_id_priv->id;
                        ib_send_cm_dreq(cm_id, NULL, 0);
@@ -2360,6 +2378,8 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_id,
        cm_id_priv = container_of(cm_id, struct cm_id_private, id);
        spin_lock_irqsave(&cm_id_priv->lock, flags);
        if (cm_id->state != IB_CM_ESTABLISHED) {
+               pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+                        be32_to_cpu(cm_id->local_id), cm_id->state);
                ret = -EINVAL;
                goto out;
        }
@@ -2429,6 +2449,8 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id,
        if (cm_id->state != IB_CM_DREQ_RCVD) {
                spin_unlock_irqrestore(&cm_id_priv->lock, flags);
                kfree(data);
+               pr_debug("%s: local_id %d, cm_idcm_id->state(%d) != IB_CM_DREQ_RCVD\n",
+                        __func__, be32_to_cpu(cm_id->local_id), cm_id->state);
                return -EINVAL;
        }
 
@@ -2494,6 +2516,9 @@ static int cm_dreq_handler(struct cm_work *work)
                atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
                                counter[CM_DREQ_COUNTER]);
                cm_issue_drep(work->port, work->mad_recv_wc);
+               pr_debug("%s: no cm_id_priv, local_comm_id %d, remote_comm_id %d\n",
+                        __func__, be32_to_cpu(dreq_msg->local_comm_id),
+                        be32_to_cpu(dreq_msg->remote_comm_id));
                return -EINVAL;
        }
 
@@ -2536,6 +2561,9 @@ static int cm_dreq_handler(struct cm_work *work)
                                counter[CM_DREQ_COUNTER]);
                goto unlock;
        default:
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                goto unlock;
        }
        cm_id_priv->id.state = IB_CM_DREQ_RCVD;
@@ -2639,6 +2667,8 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id,
                cm_enter_timewait(cm_id_priv);
                break;
        default:
+               pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+                        be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
                ret = -EINVAL;
                goto out;
        }
@@ -2749,6 +2779,9 @@ static int cm_rej_handler(struct cm_work *work)
                /* fall through */
        default:
                spin_unlock_irq(&cm_id_priv->lock);
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                ret = -EINVAL;
                goto out;
        }
@@ -2812,6 +2845,9 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
                }
                /* fall through */
        default:
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                ret = -EINVAL;
                goto error1;
        }
@@ -2913,6 +2949,9 @@ static int cm_mra_handler(struct cm_work *work)
                                counter[CM_MRA_COUNTER]);
                /* fall through */
        default:
+               pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                goto out;
        }
 
@@ -3693,6 +3732,7 @@ static void cm_work_handler(struct work_struct *_work)
                ret = cm_timewait_handler(work);
                break;
        default:
+               pr_debug("cm_event.event: 0x%x\n", work->cm_event.event);
                ret = -EINVAL;
                break;
        }
@@ -3728,6 +3768,8 @@ static int cm_establish(struct ib_cm_id *cm_id)
                ret = -EISCONN;
                break;
        default:
+               pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
+                        be32_to_cpu(cm_id->local_id), cm_id->state);
                ret = -EINVAL;
                break;
        }
@@ -3925,6 +3967,9 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
                ret = 0;
                break;
        default:
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                ret = -EINVAL;
                break;
        }
@@ -3972,6 +4017,9 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
                ret = 0;
                break;
        default:
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                ret = -EINVAL;
                break;
        }
@@ -4031,6 +4079,9 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
                ret = 0;
                break;
        default:
+               pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
+                        __func__, be32_to_cpu(cm_id_priv->id.local_id),
+                        cm_id_priv->id.state);
                ret = -EINVAL;
                break;
        }
--

2.15.0

Quoted 4 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

--
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

#67 lore raw

PATCH 12/31 IB/umem: Fix use of npages/nmap fields

In reply to a message not in the archive

From: Artemy Kovalyov <artemyko-VPRAkNaXOzVWk0Htik3J/[email protected]>

In ib_umem structure npages holds original number of sg entries, while nmap is number of DMA blocks returned by dma_map_sg.

Fixes c5d76f130b28 ('IB/core: Add umem function to read data from user-space')
---
 drivers/infiniband/core/umem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/umem.c +1 -1
index 21e60b1e2ff4..c20f6bf587ec 100644
@@ -352,7 +352,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset,
 		return -EINVAL;
 	}
 
-	ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length,
+	ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length,
 				 offset + ib_umem_offset(umem));
 
 	if (ret < 0)
Signature · 6 lines
2.15.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
#68 lore raw

PATCH 13/31 RDMA/cma: Set default GID type as RoCE when resolving RoCE route

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

As the function name suggests cma_resolve_iboe_route() resolves RoCE route. However, its default GID type is IB_GID_TYPE_IB and not IB_GID_TYPE_ROCE, even though both are mapped to the same enum value. Change default GID type to IB_GID_TYPE_ROCE.

cma_iboe_set_mgid() is updated to reflect the RoCEv2 GID check.

---
 drivers/infiniband/core/cma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +5 -3
index 9841e7ca5c06..e63a51b68ed5 100644
@@ -2528,7 +2528,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	struct cma_work *work;
 	int ret;
 	struct net_device *ndev = NULL;
-	enum ib_gid_type gid_type = IB_GID_TYPE_IB;
+	enum ib_gid_type gid_type = IB_GID_TYPE_ROCE;
 	u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -
 					rdma_start_port(id_priv->cma_dev->device)];
 	u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos;
@@ -4009,8 +4009,10 @@ static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid,
 	} else if (addr->sa_family == AF_INET6) {
 		memcpy(mgid, &sin6->sin6_addr, sizeof *mgid);
 	} else {
-		mgid->raw[0] = (gid_type == IB_GID_TYPE_IB) ? 0xff : 0;
-		mgid->raw[1] = (gid_type == IB_GID_TYPE_IB) ? 0x0e : 0;
+		mgid->raw[0] =
+			(gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? 0 : 0xff;
+		mgid->raw[1] =
+			(gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? 0 : 0x0e;
 		mgid->raw[2] = 0;
 		mgid->raw[3] = 0;
 		mgid->raw[4] = 0;
Signature · 6 lines
2.15.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
#69 lore raw

PATCH 14/31 RDMA/cma: Simplify netdev check

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Current code checks for NULL ndev twice where 2nd check is always invalid given the fact that during route resolving stage, device address must be bound to netdevice interface.

This patch simplifies such check.

---
 drivers/infiniband/core/cma.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/infiniband/core/cma.c +16 -19
index e63a51b68ed5..168f1230756b 100644
@@ -2527,8 +2527,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	struct rdma_addr *addr = &route->addr;
 	struct cma_work *work;
 	int ret;
-	struct net_device *ndev = NULL;
+	struct net_device *ndev;
 	enum ib_gid_type gid_type = IB_GID_TYPE_ROCE;
+	unsigned long supported_gids;
+
 	u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -
 					rdma_start_port(id_priv->cma_dev->device)];
 	u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos;
@@ -2549,30 +2551,25 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 
 	route->num_paths = 1;
 
-	if (addr->dev_addr.bound_dev_if) {
-		unsigned long supported_gids;
-
-		ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
-		if (!ndev) {
-			ret = -ENODEV;
-			goto err2;
-		}
-
-		supported_gids = roce_gid_type_mask_support(id_priv->id.device,
-							    id_priv->id.port_num);
-		gid_type = cma_route_gid_type(addr->dev_addr.network,
-					      supported_gids,
-					      id_priv->gid_type);
-		route->path_rec->rec_type =
-			sa_conv_gid_to_pathrec_type(gid_type);
-		sa_path_set_ndev(route->path_rec, &init_net);
-		sa_path_set_ifindex(route->path_rec, ndev->ifindex);
+	if (!addr->dev_addr.bound_dev_if) {
+		ret = -ENODEV;
+		goto err2;
 	}
+
+	ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
 	if (!ndev) {
 		ret = -ENODEV;
 		goto err2;
 	}
 
+	supported_gids = roce_gid_type_mask_support(id_priv->id.device,
+						    id_priv->id.port_num);
+	gid_type = cma_route_gid_type(addr->dev_addr.network,
+				      supported_gids,
+				      id_priv->gid_type);
+	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
+	sa_path_set_ndev(route->path_rec, &init_net);
+	sa_path_set_ifindex(route->path_rec, ndev->ifindex);
 	sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
 
 	rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-15-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Reviewed-by
#71 lore raw

Re: [PATCH rdma-next 14/31] RDMA/cma: Simplify netdev check

Quoted 76 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Current code checks for NULL ndev twice where 2nd check is always invalid given the fact that during route resolving stage, device address must be bound to netdevice interface.

This patch simplifies such check.

---
 drivers/infiniband/core/cma.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/infiniband/core/cma.c +3 -1
index e63a51b68ed5..168f1230756b 100644
@@ -2527,8 +2527,10 @@ static int cma_resolve_iboe_route(struct rdma_id_private
 *id_priv)
 	struct rdma_addr *addr = &route->addr;
 	struct cma_work *work;
 	int ret;
-	struct net_device *ndev = NULL;
+	struct net_device *ndev;
 	enum ib_gid_type gid_type = IB_GID_TYPE_ROCE;
+	unsigned long supported_gids;
+
 	u8 default_roce_tos = id_priv->cma_dev->default_roce_tos[id_priv->id.port_num -
 					rdma_start_port(id_priv->cma_dev->device)];
drivers/infiniband/core/cma.c +13 -18
 	u8 tos = id_priv->tos_set ? id_priv->tos : default_roce_tos;
@@ -2549,30 +2551,25 @@ static int cma_resolve_iboe_route(struct rdma_id_private
 *id_priv)
 
 	route->num_paths = 1;
 
-	if (addr->dev_addr.bound_dev_if) {
-		unsigned long supported_gids;
-
-		ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
-		if (!ndev) {
-			ret = -ENODEV;
-			goto err2;
-		}
-
-		supported_gids = roce_gid_type_mask_support(id_priv->id.device,
-							    id_priv->id.port_num);
-		gid_type = cma_route_gid_type(addr->dev_addr.network,
-					      supported_gids,
-					      id_priv->gid_type);
-		route->path_rec->rec_type =
-			sa_conv_gid_to_pathrec_type(gid_type);
-		sa_path_set_ndev(route->path_rec, &init_net);
-		sa_path_set_ifindex(route->path_rec, ndev->ifindex);
+	if (!addr->dev_addr.bound_dev_if) {
+		ret = -ENODEV;
+		goto err2;
 	}
+
+	ndev = dev_get_by_index(&init_net, addr->dev_addr.bound_dev_if);
 	if (!ndev) {
 		ret = -ENODEV;
 		goto err2;
 	}
 
+	supported_gids = roce_gid_type_mask_support(id_priv->id.device,
+						    id_priv->id.port_num);
+	gid_type = cma_route_gid_type(addr->dev_addr.network,
+				      supported_gids,
+				      id_priv->gid_type);
+	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
+	sa_path_set_ndev(route->path_rec, &init_net);
+	sa_path_set_ifindex(route->path_rec, ndev->ifindex);
 	sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
 
Quoted 1 line

rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,

Knut
--
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

A message that is not in the archive (sent off-list or not yet received): 1516350659.4593.6.camel-6miFZF/[email protected]

#73 lore raw

Re: [PATCH rdma-next 14/31] RDMA/cma: Simplify netdev check

Quoted 3 lines · Knut Omang
Quoted 1 line

rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,

Hey Knut,

You are a bit lat here, these patches were all applied in Novemeber :)

I welcome your reviews, and recommend you check patchworks for what is current?

https://patchwork.kernel.org/project/linux-rdma/list/

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

#74 lore raw

PATCH 15/31 RDMA/cma: Avoid setting path record type twice

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Avoid setting path record type twice for RoCE.

---
 drivers/infiniband/core/cma.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/infiniband/core/cma.c +4 -5
index 168f1230756b..f986597201fa 100644
@@ -2567,7 +2567,11 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	gid_type = cma_route_gid_type(addr->dev_addr.network,
 				      supported_gids,
 				      id_priv->gid_type);
+	/* Use the hint from IP Stack to select GID Type */
+	if (gid_type < ib_network_to_gid_type(addr->dev_addr.network))
+		gid_type = ib_network_to_gid_type(addr->dev_addr.network);
 	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
+
 	sa_path_set_ndev(route->path_rec, &init_net);
 	sa_path_set_ifindex(route->path_rec, ndev->ifindex);
 	sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
@@ -2577,11 +2581,6 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.dst_addr,
 		    &route->path_rec->dgid);
 
-	/* Use the hint from IP Stack to select GID Type */
-	if (gid_type < ib_network_to_gid_type(addr->dev_addr.network))
-		gid_type = ib_network_to_gid_type(addr->dev_addr.network);
-	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
-
 	if (((struct sockaddr *)&id_priv->id.route.addr.dst_addr)->sa_family != AF_IB)
 		/* TODO: get the hoplimit from the inet/inet6 device */
 		route->path_rec->hop_limit = addr->dev_addr.hoplimit;
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-16-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Reviewed-by
#76 lore raw

Re: [PATCH rdma-next 15/31] RDMA/cma: Avoid setting path record type twice

Quoted 40 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Avoid setting path record type twice for RoCE.

---
 drivers/infiniband/core/cma.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/infiniband/core/cma.c +4 -0
index 168f1230756b..f986597201fa 100644
@@ -2567,7 +2567,11 @@ static int cma_resolve_iboe_route(struct rdma_id_private
 *id_priv)
 	gid_type = cma_route_gid_type(addr->dev_addr.network,
 				      supported_gids,
 				      id_priv->gid_type);
+	/* Use the hint from IP Stack to select GID Type */
+	if (gid_type < ib_network_to_gid_type(addr->dev_addr.network))
+		gid_type = ib_network_to_gid_type(addr->dev_addr.network);
 	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
+
 	sa_path_set_ndev(route->path_rec, &init_net);
 	sa_path_set_ifindex(route->path_rec, ndev->ifindex);
drivers/infiniband/core/cma.c +0 -5
 	sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
@@ -2577,11 +2581,6 @@ static int cma_resolve_iboe_route(struct rdma_id_private
 *id_priv)
 	rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.dst_addr,
 		    &route->path_rec->dgid);
 
-	/* Use the hint from IP Stack to select GID Type */
-	if (gid_type < ib_network_to_gid_type(addr->dev_addr.network))
-		gid_type = ib_network_to_gid_type(addr->dev_addr.network);
-	route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
-
 	if (((struct sockaddr *)&id_priv->id.route.addr.dst_addr)->sa_family != AF_IB)
 		/* TODO: get the hoplimit from the inet/inet6 device */
Quoted 1 line

route->path_rec->hop_limit = addr->dev_addr.hoplimit;

Knut
--
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

#77 lore raw

PATCH 16/31 RDMA/cma: Introduce and use helper functions to init work

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Introduce and user helper functions to initialize work for address resolved and route resolved event that avoid code duplication at few places.

---
 drivers/infiniband/core/cma.c | 53 ++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 28 deletions(-)
drivers/infiniband/core/cma.c +25 -28
index f986597201fa..48f593bafe33 100644
@@ -2413,6 +2413,26 @@ static void cma_ndev_work_handler(struct work_struct *_work)
 	kfree(work);
 }
 
+static void cma_init_resolve_route_work(struct cma_work *work,
+					struct rdma_id_private *id_priv)
+{
+	work->id = id_priv;
+	INIT_WORK(&work->work, cma_work_handler);
+	work->old_state = RDMA_CM_ROUTE_QUERY;
+	work->new_state = RDMA_CM_ROUTE_RESOLVED;
+	work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
+}
+
+static void cma_init_resolve_addr_work(struct cma_work *work,
+				       struct rdma_id_private *id_priv)
+{
+	work->id = id_priv;
+	INIT_WORK(&work->work, cma_work_handler);
+	work->old_state = RDMA_CM_ADDR_QUERY;
+	work->new_state = RDMA_CM_ADDR_RESOLVED;
+	work->event.event = RDMA_CM_EVENT_ADDR_RESOLVED;
+}
+
 static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
 {
 	struct rdma_route *route = &id_priv->id.route;
@@ -2423,11 +2443,7 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
 	if (!work)
 		return -ENOMEM;
 
-	work->id = id_priv;
-	INIT_WORK(&work->work, cma_work_handler);
-	work->old_state = RDMA_CM_ROUTE_QUERY;
-	work->new_state = RDMA_CM_ROUTE_RESOLVED;
-	work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
+	cma_init_resolve_route_work(work, id_priv);
 
 	route->path_rec = kmalloc(sizeof *route->path_rec, GFP_KERNEL);
 	if (!route->path_rec) {
@@ -2482,11 +2498,7 @@ static int cma_resolve_iw_route(struct rdma_id_private *id_priv, int timeout_ms)
 	if (!work)
 		return -ENOMEM;
 
-	work->id = id_priv;
-	INIT_WORK(&work->work, cma_work_handler);
-	work->old_state = RDMA_CM_ROUTE_QUERY;
-	work->new_state = RDMA_CM_ROUTE_RESOLVED;
-	work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
+	cma_init_resolve_route_work(work, id_priv);
 	queue_work(cma_wq, &work->work);
 	return 0;
 }
@@ -2540,9 +2552,6 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 	if (!work)
 		return -ENOMEM;
 
-	work->id = id_priv;
-	INIT_WORK(&work->work, cma_work_handler);
-
 	route->path_rec = kzalloc(sizeof *route->path_rec, GFP_KERNEL);
 	if (!route->path_rec) {
 		ret = -ENOMEM;
@@ -2602,11 +2611,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
 		goto err2;
 	}
 
-	work->old_state = RDMA_CM_ROUTE_QUERY;
-	work->new_state = RDMA_CM_ROUTE_RESOLVED;
-	work->event.event = RDMA_CM_EVENT_ROUTE_RESOLVED;
-	work->event.status = 0;
-
+	cma_init_resolve_route_work(work, id_priv);
 	queue_work(cma_wq, &work->work);
 
 	return 0;
@@ -2786,11 +2791,7 @@ static int cma_resolve_loopback(struct rdma_id_private *id_priv)
 	rdma_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid);
 	rdma_addr_set_dgid(&id_priv->id.route.addr.dev_addr, &gid);
 
-	work->id = id_priv;
-	INIT_WORK(&work->work, cma_work_handler);
-	work->old_state = RDMA_CM_ADDR_QUERY;
-	work->new_state = RDMA_CM_ADDR_RESOLVED;
-	work->event.event = RDMA_CM_EVENT_ADDR_RESOLVED;
+	cma_init_resolve_addr_work(work, id_priv);
 	queue_work(cma_wq, &work->work);
 	return 0;
 err:
@@ -2816,11 +2817,7 @@ static int cma_resolve_ib_addr(struct rdma_id_private *id_priv)
 	rdma_addr_set_dgid(&id_priv->id.route.addr.dev_addr, (union ib_gid *)
 		&(((struct sockaddr_ib *) &id_priv->id.route.addr.dst_addr)->sib_addr));
 
-	work->id = id_priv;
-	INIT_WORK(&work->work, cma_work_handler);
-	work->old_state = RDMA_CM_ADDR_QUERY;
-	work->new_state = RDMA_CM_ADDR_RESOLVED;
-	work->event.event = RDMA_CM_EVENT_ADDR_RESOLVED;
+	cma_init_resolve_addr_work(work, id_priv);
 	queue_work(cma_wq, &work->work);
 	return 0;
 err:
Signature · 6 lines
2.15.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
#78 lore raw

PATCH 17/31 IB/core: Avoid unnecessary type cast

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Type cast from void to struct find_gid_index_context is not needed.

---
 drivers/infiniband/core/verbs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/core/verbs.c +1 -2
index 584b6029cb44..0cac32736189 100644
@@ -421,8 +421,7 @@ static bool find_gid_index(const union ib_gid *gid,
 			   const struct ib_gid_attr *gid_attr,
 			   void *context)
 {
-	struct find_gid_index_context *ctx =
-		(struct find_gid_index_context *)context;
+	struct find_gid_index_context *ctx = context;
 
 	if (ctx->gid_type != gid_attr->gid_type)
 		return false;
Signature · 6 lines
2.15.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
#79 lore raw

PATCH 18/31 IB/core: Refactor to avoid unnecessary check on GID lookup miss

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently on every gid entry comparison miss found variable is checked; which is not needed as those two comparison fail already indicate that GID is not found yet.
So refactor to avoid such check and copy the GID index when found.

---
 drivers/infiniband/core/cache.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/infiniband/core/cache.c +6 -9
index e5bba898741d..72643d5a7f6d 100644
@@ -573,27 +573,24 @@ static int ib_cache_gid_find_by_filter(struct ib_device *ib_dev,
 		struct ib_gid_attr attr;
 
 		if (table->data_vec[i].props & GID_TABLE_ENTRY_INVALID)
-			goto next;
+			continue;
 
 		if (memcmp(gid, &table->data_vec[i].gid, sizeof(*gid)))
-			goto next;
+			continue;
 
 		memcpy(&attr, &table->data_vec[i].attr, sizeof(attr));
 
-		if (filter(gid, &attr, context))
+		if (filter(gid, &attr, context)) {
 			found = true;
-
-next:
-		if (found)
+			if (index)
+				*index = i;
 			break;
+		}
 	}
 	read_unlock_irqrestore(&table->rwlock, flags);
 
 	if (!found)
 		return -ENOENT;
-
-	if (index)
-		*index = i;
 	return 0;
 }
 
Signature · 6 lines
2.15.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
#80 lore raw

PATCH 19/31 IB/rxe: Avoid passing unused index pointer which is optional

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

While searching for GID, returned index is not used, so avoid passing pointer during invocation.

---
 drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +1 -2
index fb8c83e055e1..4c3f899241d4 100644
@@ -336,7 +336,6 @@ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
 {
 	union ib_gid dgid;
 	union ib_gid *pdgid;
-	u16 index;
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		ipv6_addr_set_v4mapped(ip_hdr(skb)->daddr,
@@ -348,7 +347,7 @@ static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
 
 	return ib_find_cached_gid_by_port(&rxe->ib_dev, pdgid,
 					  IB_GID_TYPE_ROCE_UDP_ENCAP,
-					  1, rxe->ndev, &index);
+					  1, rxe->ndev, NULL);
 }
 
 /* rxe_rcv is called from the interface driver */
Signature · 6 lines
2.15.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
#81 lore raw

PATCH 20/31 IB/core: Avoid exporting module internal ib_find_gid_by_filter()

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

ib_find_gid_by_filter() is used only by ib_core, therefore avoid exporting it.

---
 drivers/infiniband/core/cache.c | 1 -
 1 file changed, 1 deletion(-)
drivers/infiniband/core/cache.c +0 -1
index 72643d5a7f6d..e56f9d6893ee 100644
@@ -889,7 +889,6 @@ int ib_find_gid_by_filter(struct ib_device *device,
 					   port_num, filter,
 					   context, index);
 }
-EXPORT_SYMBOL(ib_find_gid_by_filter);
 
 int ib_get_cached_pkey(struct ib_device *device,
 		       u8                port_num,
Signature · 6 lines
2.15.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
#82 lore raw

PATCH 21/31 RDMA/core: Avoid redundant memcpy in resolving address

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

rdma_resolve_ip works on the rdma_dev_addr pointer even from worker thread context. Therefore there is no need to store that in context. At the same time, resolve_cb() callback function invokes memcpy on source and destination addresses which are essentially same. Therefore both are removed.

---
 drivers/infiniband/core/addr.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/infiniband/core/addr.c +0 -5
index da4469c38eac..6679dd43fe08 100644
@@ -744,7 +744,6 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr)
 EXPORT_SYMBOL(rdma_addr_cancel);
 
 struct resolve_cb_context {
-	struct rdma_dev_addr *addr;
 	struct completion comp;
 	int status;
 };
@@ -752,9 +751,6 @@ struct resolve_cb_context {
 static void resolve_cb(int status, struct sockaddr *src_addr,
 	     struct rdma_dev_addr *addr, void *context)
 {
-	if (!status)
-		memcpy(((struct resolve_cb_context *)context)->addr,
-		       addr, sizeof(struct rdma_dev_addr));
 	((struct resolve_cb_context *)context)->status = status;
 	complete(&((struct resolve_cb_context *)context)->comp);
 }
@@ -780,7 +776,6 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 	dev_addr.bound_dev_if = ndev->ifindex;
 	dev_addr.net = &init_net;
 
-	ctx.addr = &dev_addr;
 	init_completion(&ctx.comp);
 	ret = rdma_resolve_ip(&self, &sgid_addr._sockaddr, &dgid_addr._sockaddr,
 			&dev_addr, 1000, resolve_cb, &ctx);
Signature · 6 lines
2.15.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
#83 lore raw

PATCH 22/31 IB/core: Removed unused function

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

rdma_addr_find_smac_by_sgid() is exported symbol not used by any kernel module. Therefore its removed.

---
 drivers/infiniband/core/addr.c | 23 -----------------------
 include/rdma/ib_addr.h         |  1 -
 2 files changed, 24 deletions(-)
drivers/infiniband/core/addr.c +0 -23
index 6679dd43fe08..e0086901d64c 100644
@@ -793,29 +793,6 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 	return 0;
 }
 
-int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id)
-{
-	int ret = 0;
-	struct rdma_dev_addr dev_addr;
-	union {
-		struct sockaddr     _sockaddr;
-		struct sockaddr_in  _sockaddr_in;
-		struct sockaddr_in6 _sockaddr_in6;
-	} gid_addr;
-
-	rdma_gid2ip(&gid_addr._sockaddr, sgid);
-
-	memset(&dev_addr, 0, sizeof(dev_addr));
-	dev_addr.net = &init_net;
-	ret = rdma_translate_ip(&gid_addr._sockaddr, &dev_addr, vlan_id);
-	if (ret)
-		return ret;
-
-	memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN);
-	return ret;
-}
-EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid);
-
 static int netevent_callback(struct notifier_block *self, unsigned long event,
 	void *ctx)
 {
include/rdma/ib_addr.h +0 -1
index d5c3bbb84608..3d17073ea338 100644
@@ -131,7 +131,6 @@ void rdma_copy_addr(struct rdma_dev_addr *dev_addr,
 
 int rdma_addr_size(struct sockaddr *addr);
 
-int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
 int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
 				 const union ib_gid *dgid,
 				 u8 *dmac, const struct net_device *ndev,
Signature · 6 lines
2.15.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
#84 lore raw

PATCH 23/31 RDMA/{core, cma}: Simplify rdma_translate_ip

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Since no caller needs vlan, rdma_translate_ip is simplified to avoid vlan pointer.

---
 drivers/infiniband/core/addr.c | 11 +++--------
 drivers/infiniband/core/cma.c  |  4 ++--
 include/rdma/ib_addr.h         |  2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)
drivers/infiniband/core/addr.c +3 -8
index e0086901d64c..0ae18608761c 100644
@@ -243,8 +243,7 @@ void rdma_copy_addr(struct rdma_dev_addr *dev_addr,
 EXPORT_SYMBOL(rdma_copy_addr);
 
 int rdma_translate_ip(const struct sockaddr *addr,
-		      struct rdma_dev_addr *dev_addr,
-		      u16 *vlan_id)
+		      struct rdma_dev_addr *dev_addr)
 {
 	struct net_device *dev;
 
@@ -267,8 +266,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
 
 		rdma_copy_addr(dev_addr, dev, NULL);
 		dev_addr->bound_dev_if = dev->ifindex;
-		if (vlan_id)
-			*vlan_id = rdma_vlan_dev_vlan_id(dev);
 		dev_put(dev);
 		break;
 #if IS_ENABLED(CONFIG_IPV6)
@@ -280,8 +277,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
 					  dev, 1)) {
 				rdma_copy_addr(dev_addr, dev, NULL);
 				dev_addr->bound_dev_if = dev->ifindex;
-				if (vlan_id)
-					*vlan_id = rdma_vlan_dev_vlan_id(dev);
 				break;
 			}
 		}
@@ -481,7 +476,7 @@ static int addr_resolve_neigh(struct dst_entry *dst,
 	if (dst->dev->flags & IFF_LOOPBACK) {
 		int ret;
 
-		ret = rdma_translate_ip(dst_in, addr, NULL);
+		ret = rdma_translate_ip(dst_in, addr);
 		if (!ret)
 			memcpy(addr->dst_dev_addr, addr->src_dev_addr,
 			       MAX_ADDR_LEN);
@@ -558,7 +553,7 @@ static int addr_resolve(struct sockaddr *src_in,
 	}
 
 	if (ndev->flags & IFF_LOOPBACK) {
-		ret = rdma_translate_ip(dst_in, addr, NULL);
+		ret = rdma_translate_ip(dst_in, addr);
 		/*
 		 * Put the loopback device and get the translated
 		 * device instead.
drivers/infiniband/core/cma.c +2 -2
index 48f593bafe33..19769ea4d71f 100644
@@ -601,7 +601,7 @@ static int cma_translate_addr(struct sockaddr *addr, struct rdma_dev_addr *dev_a
 	int ret;
 
 	if (addr->sa_family != AF_IB) {
-		ret = rdma_translate_ip(addr, dev_addr, NULL);
+		ret = rdma_translate_ip(addr, dev_addr);
 	} else {
 		cma_translate_ib((struct sockaddr_ib *) addr, dev_addr);
 		ret = 0;
@@ -2131,7 +2131,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
 	mutex_lock_nested(&conn_id->handler_mutex, SINGLE_DEPTH_NESTING);
 	conn_id->state = RDMA_CM_CONNECT;
 
-	ret = rdma_translate_ip(laddr, &conn_id->id.route.addr.dev_addr, NULL);
+	ret = rdma_translate_ip(laddr, &conn_id->id.route.addr.dev_addr);
 	if (ret) {
 		mutex_unlock(&conn_id->handler_mutex);
 		rdma_destroy_id(new_cm_id);
include/rdma/ib_addr.h +1 -1
index 3d17073ea338..dc0b642e0175 100644
@@ -94,7 +94,7 @@ struct rdma_dev_addr {
  * The dev_addr->net field must be initialized.
  */
 int rdma_translate_ip(const struct sockaddr *addr,
-		      struct rdma_dev_addr *dev_addr, u16 *vlan_id);
+		      struct rdma_dev_addr *dev_addr);
 
 /**
  * rdma_resolve_ip - Resolve source and destination IP addresses to
Signature · 6 lines
2.15.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
#85 lore raw

PATCH 24/31 RDMA/core: Avoid copying ifindex twice

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

rdma_copy_addr copies the ifndex to bound_dev_if.
Therefore avoid copying it again after rdma_copy_addr call is completed.

---
 drivers/infiniband/core/addr.c | 2 --
 1 file changed, 2 deletions(-)
drivers/infiniband/core/addr.c +0 -2
index 0ae18608761c..a5b4cf030c11 100644
@@ -265,7 +265,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
 			return -EADDRNOTAVAIL;
 
 		rdma_copy_addr(dev_addr, dev, NULL);
-		dev_addr->bound_dev_if = dev->ifindex;
 		dev_put(dev);
 		break;
 #if IS_ENABLED(CONFIG_IPV6)
@@ -276,7 +275,6 @@ int rdma_translate_ip(const struct sockaddr *addr,
 					  &((const struct sockaddr_in6 *)addr)->sin6_addr,
 					  dev, 1)) {
 				rdma_copy_addr(dev_addr, dev, NULL);
-				dev_addr->bound_dev_if = dev->ifindex;
 				break;
 			}
 		}
Signature · 6 lines
2.15.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
#86 lore raw

PATCH 25/31 IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link layer

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently there are no users of ib_find_gid for RoCE transport. It is only used by IPoIB.
Therefore its simplified to ignore RoCE ports and GID type check which was previously done for every port.

---
 drivers/infiniband/core/device.c        | 16 +++-------------
 drivers/infiniband/ulp/ipoib/ipoib_ib.c |  3 +--
 include/rdma/ib_verbs.h                 |  3 +--
 3 files changed, 5 insertions(+), 17 deletions(-)
drivers/infiniband/core/device.c +3 -13
index 84fc32a2c8b3..bb2686d56d3c 100644
@@ -1017,32 +1017,22 @@ EXPORT_SYMBOL(ib_modify_port);
 
 /**
  * ib_find_gid - Returns the port number and GID table index where
- *   a specified GID value occurs.
+ *   a specified GID value occurs. Its searches only for IB link layer.
  * @device: The device to query.
  * @gid: The GID value to search for.
- * @gid_type: Type of GID.
  * @ndev: The ndev related to the GID to search for.
  * @port_num: The port number of the device where the GID value was found.
  * @index: The index into the GID table where the GID was found.  This
  *   parameter may be NULL.
  */
 int ib_find_gid(struct ib_device *device, union ib_gid *gid,
-		enum ib_gid_type gid_type, struct net_device *ndev,
-		u8 *port_num, u16 *index)
+		struct net_device *ndev, u8 *port_num, u16 *index)
 {
 	union ib_gid tmp_gid;
 	int ret, port, i;
 
 	for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) {
-		if (rdma_cap_roce_gid_table(device, port)) {
-			if (!ib_find_cached_gid_by_port(device, gid, gid_type, port,
-							ndev, index)) {
-				*port_num = port;
-				return 0;
-			}
-		}
-
-		if (gid_type != IB_GID_TYPE_IB)
+		if (rdma_cap_roce_gid_table(device, port))
 			continue;
 
 		for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) {
drivers/infiniband/ulp/ipoib/ipoib_ib.c +1 -2
index 3b96cdaf9a83..b9fa21790da9 100644
@@ -1085,8 +1085,7 @@ static bool ipoib_dev_addr_changed_valid(struct ipoib_dev_priv *priv)
 
 	netif_addr_unlock_bh(priv->dev);
 
-	err = ib_find_gid(priv->ca, &search_gid, IB_GID_TYPE_IB,
-			  priv->dev, &port, &index);
+	err = ib_find_gid(priv->ca, &search_gid, priv->dev, &port, &index);
 
 	netif_addr_lock_bh(priv->dev);
 
include/rdma/ib_verbs.h +1 -2
index fd84cda5ed7c..cfd837049a32 100644
@@ -2836,8 +2836,7 @@ int ib_modify_port(struct ib_device *device,
 		   struct ib_port_modify *port_modify);
 
 int ib_find_gid(struct ib_device *device, union ib_gid *gid,
-		enum ib_gid_type gid_type, struct net_device *ndev,
-		u8 *port_num, u16 *index);
+		struct net_device *ndev, u8 *port_num, u16 *index);
 
 int ib_find_pkey(struct ib_device *device,
 		 u8 port_num, u16 pkey, u16 *index);
Signature · 6 lines
2.15.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
#87 lore raw

PATCH 26/31 IB/{cm, umad}: Fix honor av init error

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

cm_init_av_for_response depends on ib_init_ah_from_wc() whose return status is ignored.
ib_init_ah_from_wc() can fail and its return status should be honored as done in this patch.

---
 drivers/infiniband/core/cm.c       | 34 +++++++++++++++++++++-------------
 drivers/infiniband/core/user_mad.c | 10 +++++++---
 2 files changed, 28 insertions(+), 16 deletions(-)
drivers/infiniband/core/cm.c +21 -13
index cbb385e02947..9a60d21ed0c3 100644
@@ -452,13 +452,13 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv,
 	cm_id_priv->private_data_len = private_data_len;
 }
 
-static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
-				    struct ib_grh *grh, struct cm_av *av)
+static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
+				   struct ib_grh *grh, struct cm_av *av)
 {
 	av->port = port;
 	av->pkey_index = wc->pkey_index;
-	ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
-			   grh, &av->ah_attr);
+	return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
+				  grh, &av->ah_attr);
 }
 
 static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
@@ -1826,9 +1826,11 @@ static int cm_req_handler(struct cm_work *work)
 
 	cm_id_priv = container_of(cm_id, struct cm_id_private, id);
 	cm_id_priv->id.remote_id = req_msg->local_comm_id;
-	cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
-				work->mad_recv_wc->recv_buf.grh,
-				&cm_id_priv->av);
+	ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+				      work->mad_recv_wc->recv_buf.grh,
+				      &cm_id_priv->av);
+	if (ret)
+		goto destroy;
 	cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
 							    id.local_id);
 	if (IS_ERR(cm_id_priv->timewait_info)) {
@@ -3171,9 +3173,11 @@ static int cm_lap_handler(struct cm_work *work)
 
 	cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
 	cm_id_priv->tid = lap_msg->hdr.tid;
-	cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
-				work->mad_recv_wc->recv_buf.grh,
-				&cm_id_priv->av);
+	ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+				      work->mad_recv_wc->recv_buf.grh,
+				      &cm_id_priv->av);
+	if (ret)
+		goto unlock;
 	cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av,
 			   cm_id_priv);
 	ret = atomic_inc_and_test(&cm_id_priv->work_count);
@@ -3426,6 +3430,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
 	struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
 	struct cm_sidr_req_msg *sidr_req_msg;
 	struct ib_wc *wc;
+	int ret;
 
 	cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL);
 	if (IS_ERR(cm_id))
@@ -3438,9 +3443,12 @@ static int cm_sidr_req_handler(struct cm_work *work)
 	wc = work->mad_recv_wc->wc;
 	cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid);
 	cm_id_priv->av.dgid.global.interface_id = 0;
-	cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
-				work->mad_recv_wc->recv_buf.grh,
-				&cm_id_priv->av);
+	ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+				      work->mad_recv_wc->recv_buf.grh,
+				      &cm_id_priv->av);
+	if (ret)
+		goto out;
+
 	cm_id_priv->id.remote_id = sidr_req_msg->request_id;
 	cm_id_priv->tid = sidr_req_msg->hdr.tid;
 	atomic_inc(&cm_id_priv->work_count);
drivers/infiniband/core/user_mad.c +7 -3
index 4b64dd02e090..3179fed4b408 100644
@@ -246,10 +246,14 @@ static void recv_handler(struct ib_mad_agent *agent,
 	if (packet->mad.hdr.grh_present) {
 		struct rdma_ah_attr ah_attr;
 		const struct ib_global_route *grh;
+		int ret;
 
-		ib_init_ah_from_wc(agent->device, agent->port_num,
-				   mad_recv_wc->wc, mad_recv_wc->recv_buf.grh,
-				   &ah_attr);
+		ret = ib_init_ah_from_wc(agent->device, agent->port_num,
+					 mad_recv_wc->wc,
+					 mad_recv_wc->recv_buf.grh,
+					 &ah_attr);
+		if (ret)
+			goto err2;
 
 		grh = rdma_ah_read_grh(&ah_attr);
 		packet->mad.hdr.gid_index = grh->sgid_index;
Signature · 6 lines
2.15.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
#88 lore raw

PATCH 27/31 IB/cm: Fix honor address handle attribute init error

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

cm_init_av_by_path depends on ib_init_ah_from_path to initialize ah attribute and ib_init_ah_from_path() can fail, such error should not be ignored.

This patch honors ah attribute init error.

---
 drivers/infiniband/core/cm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +5 -2
index 9a60d21ed0c3..d12c50ee2b89 100644
@@ -494,8 +494,11 @@ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
 		return ret;
 
 	av->port = port;
-	ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
-			     &av->ah_attr);
+	ret = ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
+				   &av->ah_attr);
+	if (ret)
+		return ret;
+
 	av->timeout = path->packet_life_time + 1;
 
 	spin_lock_irqsave(&cm.lock, flags);
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-28-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#90 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 9 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

cm_init_av_by_path depends on ib_init_ah_from_path to initialize ah attribute and ib_init_ah_from_path() can fail, such error should not be ignored.

This patch honors ah attribute init error.

any reason not to point out the commit that introduced the bug? --
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMjPsD7+YnN80A7Z3WjxEey20=TYKpxrRK_mRhKVMEnA8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#92 lore raw

RE: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyAzOjE0IFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJv bWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRt YS1uZXh0IDI3LzMxXSBJQi9jbTogRml4IGhvbm9yIGFkZHJlc3MgaGFuZGxlIGF0dHJpYnV0ZQ0K PiBpbml0IGVycm9yDQo+IA0KPiBPbiBUdWUsIE5vdiAxNCwgMjAxNyBhdCAyOjUyIFBNLCBMZW9u IFJvbWFub3Zza3kgPGxlb25Aa2VybmVsLm9yZz4gd3JvdGU6DQo+ID4gRnJvbTogUGFyYXYgUGFu ZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+ID4NCj4gPiBjbV9pbml0X2F2X2J5X3BhdGggZGVw ZW5kcyBvbiBpYl9pbml0X2FoX2Zyb21fcGF0aCB0byBpbml0aWFsaXplIGFoDQo+ID4gYXR0cmli dXRlIGFuZCBpYl9pbml0X2FoX2Zyb21fcGF0aCgpIGNhbiBmYWlsLCBzdWNoIGVycm9yIHNob3Vs ZCBub3QNCj4gPiBiZSBpZ25vcmVkLg0KPiA+DQo+ID4gVGhpcyBwYXRjaCBob25vcnMgYWggYXR0 cmlidXRlIGluaXQgZXJyb3IuDQo+ID4NCj4gPiBTaWduZWQtb2ZmLWJ5OiBQYXJhdiBQYW5kaXQg PHBhcmF2QG1lbGxhbm94LmNvbT4NCj4gDQo+IGFueSByZWFzb24gbm90IHRvIHBvaW50IG91dCB0 aGUgY29tbWl0IHRoYXQgaW50cm9kdWNlZCB0aGUgYnVnPw0KTm8gcGFydGljdWxhciByZWFzb24u IEkgYW0gbm90IHN1cmUgZmV3IHllYXJzIGJhY2sgaXQgd2FzIGJ1ZyBvciBub3QuIEluIGN1cnJl bnQgY29kZSBpdCBhcHBlYXIgc28uDQpTbyBJIGNvbnRpbnVlZCB3aXRob3V0IEZpeGVzIGNvbW1p dCBsaW5lLg0KDQo=
--
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB3008514AED6DA3E970381088D1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#94 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 5 lines · Parav Pandit
Quoted 3 lines

From: Or Gerlitz [mailto:[email protected]]

any reason not to point out the commit that introduced the bug?

No particular reason. I am not sure few years back it was bug or not. In current code it appear so. So I continued without Fixes commit line.

The idea is that you do the git blaming and such work to get the Fixes line, and later, the maintainer
of the sub-system and maintainers of stable kernel use that to decide if/where they want this to go
beyond the -rc kernel you are fixing
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMg6bJt0obWHrSae86ZUN7RgCYqWJJiQXw9on82P=zO_VA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#96 lore raw

RE: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyA0OjE4IFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJv bWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRt YS1uZXh0IDI3LzMxXSBJQi9jbTogRml4IGhvbm9yIGFkZHJlc3MgaGFuZGxlIGF0dHJpYnV0ZQ0K PiBpbml0IGVycm9yDQo+IA0KPiBPbiBXZWQsIE5vdiAxNSwgMjAxNyBhdCAxMjoxMyBBTSwgUGFy YXYgUGFuZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+IHdyb3RlOg0KPiA+PiBGcm9tOiBPciBH ZXJsaXR6IFttYWlsdG86Z2VybGl0ei5vckBnbWFpbC5jb21dDQo+IA0KPiA+PiBhbnkgcmVhc29u IG5vdCB0byBwb2ludCBvdXQgdGhlIGNvbW1pdCB0aGF0IGludHJvZHVjZWQgdGhlIGJ1Zz8NCj4g PiBObyBwYXJ0aWN1bGFyIHJlYXNvbi4gSSBhbSBub3Qgc3VyZSBmZXcgeWVhcnMgYmFjayBpdCB3 YXMgYnVnIG9yIG5vdC4gSW4gY3VycmVudA0KPiBjb2RlIGl0IGFwcGVhciBzby4NCj4gPiBTbyBJ IGNvbnRpbnVlZCB3aXRob3V0IEZpeGVzIGNvbW1pdCBsaW5lLg0KPiANCj4gDQo+IFRoZSBpZGVh IGlzIHRoYXQgeW91IGRvIHRoZSBnaXQgYmxhbWluZyBhbmQgc3VjaCB3b3JrIHRvIGdldCB0aGUg Rml4ZXMgbGluZSwgYW5kDQo+IGxhdGVyLCB0aGUgbWFpbnRhaW5lciBvZiB0aGUgc3ViLXN5c3Rl bSBhbmQgbWFpbnRhaW5lcnMgb2Ygc3RhYmxlIGtlcm5lbCB1c2UgdGhhdA0KPiB0byBkZWNpZGUg aWYvd2hlcmUgdGhleSB3YW50IHRoaXMgdG8gZ28gYmV5b25kIHRoZSAtcmMga2VybmVsIHlvdSBh cmUgZml4aW5nDQpZZXMsICBJIHVuZGVyc3RhbmQuIEJ1dCB3b3VsZCB0aGF0IGJlIGEgYnVnIGlu IGluaXRpYWwgY29tbWl0LCB3aGljaCB0cmFuc3BvcnQgd2FzIGl0IGhhbmRsaW5nLi4gd2l0aG91 dCBlcnJvciBjb2RlIGNoZWNrIHdoYXQgY291bGQgaGF2ZSBnb25lIHdyb25nLi4NCkkgZG8gbm90 IGhhdmUgYW5zd2VyIGZvciB0aG9zZSBxdWVzdGlvbnMuIFNvIEkgb21pdHRlZCB0aGUgRml4ZXMg bGluZS4NCldoZXJldmVyIEkga25ldyBmb3Igc3VyZSBpbiB0aGlzIG9yIG90aGVyIHNlcmllcywg SSBoYXZlIGFkZGVkLg0K
--
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB300851A707AFA9DEC77B232ED1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#98 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 15 lines · Parav Pandit
Quoted 6 lines
Quoted 4 lines · Parav Pandit
Quoted 3 lines

From: Or Gerlitz [mailto:[email protected]]

any reason not to point out the commit that introduced the bug?

No particular reason. I am not sure few years back it was bug or not. In current

Quoted 8 lines

code it appear so.

Quoted 1 line

So I continued without Fixes commit line.

The idea is that you do the git blaming and such work to get the Fixes line, and later, the maintainer of the sub-system and maintainers of stable kernel use that to decide if/where they want this to go beyond the -rc kernel you are fixing

Quoted 5 lines

Yes, I understand. But would that be a bug in initial commit, which transport was it handling.. without error code check what could have gone wrong.. I do not have answer for those questions. So I omitted the Fixes line. Wherever I knew for sure in this or other series, I have added.

While the fixes line is nice, the more important question is if any of these patches should have a 'Cc: [email protected]' ?

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

A message that is not in the archive (sent off-list or not yet received): 20171114233841.GC25894-uk2M96/[email protected]

#100 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 17 lines · Jason Gunthorpe
Quoted 14 lines · Parav Pandit
Quoted 14 lines
Quoted 4 lines · Parav Pandit
Quoted 3 lines

From: Or Gerlitz [mailto:[email protected]]

any reason not to point out the commit that introduced the bug?

No particular reason. I am not sure few years back it was bug or not. In current

code it appear so.

Quoted 1 line

So I continued without Fixes commit line.

The idea is that you do the git blaming and such work to get the Fixes line, and later, the maintainer of the sub-system and maintainers of stable kernel use that to decide if/where they want this to go beyond the -rc kernel you are fixing

Quoted 8 lines
Quoted 5 lines

Yes, I understand. But would that be a bug in initial commit, which transport was it handling.. without error code check what could have gone wrong.. I do not have answer for those questions. So I omitted the Fixes line. Wherever I knew for sure in this or other series, I have added.

While the fixes line is nice, the more important question is if any of these patches should have a 'Cc: [email protected]' ?

No, this is why I didn't ask to add Fixes line, because stable@ takes patches in semi-automatic mode by looking after Fixes line.

Thanks

Quoted 6 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

A message that is not in the archive (sent off-list or not yet received): 20171115053155.GO18825-U/[email protected]

#102 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 24 lines · Leon Romanovsky
Quoted 23 lines · Jason Gunthorpe
Quoted 20 lines · Parav Pandit
Quoted 6 lines
Quoted 4 lines · Parav Pandit
Quoted 3 lines

From: Or Gerlitz [mailto:[email protected]]

any reason not to point out the commit that introduced the bug?

No particular reason. I am not sure few years back it was bug or not. In current

Quoted 8 lines

code it appear so.

Quoted 1 line

So I continued without Fixes commit line.

The idea is that you do the git blaming and such work to get the Fixes line, and later, the maintainer of the sub-system and maintainers of stable kernel use that to decide if/where they want this to go beyond the -rc kernel you are fixing

Yes, I understand. But would that be a bug in initial commit, which transport was it handling.. without error code check what could have gone wrong.. I do not have answer for those questions. So I omitted the Fixes line. Wherever I knew for sure in this or other series, I have added.

Quoted 5 lines
Quoted 2 lines

While the fixes line is nice, the more important question is if any of these patches should have a 'Cc: [email protected]' ?

No, this is why I didn't ask to add Fixes line, because stable@ takes patches in semi-automatic mode by looking after Fixes line.

And what's wrong with that? IMHO the right thing to do for fixes is

(1) putng the Fixes line
(2) cc the author of the offending patch

This way you can get them a chance to review the fix and point out to you problems in the patch that may e.g introduce a 2nd problem or a side effect you don't envision. This is what we do on netdev, practically always.

Or.
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMiB6VUp1Kb9HBS5jkqnYN61UP6DYNxqs1T8qGLCUGELcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#104 lore raw

Re: [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute init error

Quoted 33 lines · Or Gerlitz
Quoted 24 lines · Leon Romanovsky
Quoted 23 lines · Jason Gunthorpe
Quoted 20 lines · Parav Pandit
Quoted 6 lines
Quoted 4 lines · Parav Pandit
Quoted 3 lines

From: Or Gerlitz [mailto:[email protected]]

any reason not to point out the commit that introduced the bug?

No particular reason. I am not sure few years back it was bug or not. In current

Quoted 8 lines

code it appear so.

Quoted 1 line

So I continued without Fixes commit line.

The idea is that you do the git blaming and such work to get the Fixes line, and later, the maintainer of the sub-system and maintainers of stable kernel use that to decide if/where they want this to go beyond the -rc kernel you are fixing

Yes, I understand. But would that be a bug in initial commit, which transport was it handling.. without error code check what could have gone wrong.. I do not have answer for those questions. So I omitted the Fixes line. Wherever I knew for sure in this or other series, I have added.

Quoted 5 lines
Quoted 2 lines

While the fixes line is nice, the more important question is if any of these patches should have a 'Cc: [email protected]' ?

No, this is why I didn't ask to add Fixes line, because stable@ takes patches in semi-automatic mode by looking after Fixes line.

And what's wrong with that? IMHO the right thing to do for fixes is

Quoted 7 lines

(1) putng the Fixes line
(2) cc the author of the offending patch

This way you can get them a chance to review the fix and point out to you problems in the patch that may e.g introduce a 2nd problem or a side effect you don't envision. This is what we do on netdev, practically always.

Always, are you sure?

In the patch c1c1d86bdea4 ("net/mlxfw: Properly handle dependancy with non-loadable mlx5"), you didn't add Fixes tag and didn't add relevant people (Yotam, Arnd and Jakub).

It is how it looks in my mailer:
Date: Sun, 2 Jul 2017 18:57:28 +0300
From: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/[email protected]>
To: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/[email protected]>
Cc: [email protected], Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/[email protected]>, [email protected], Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/[email protected]>
Subject: [PATCH net-next] net/mlxfw: Properly handle dependancy with non-loadable mlx5

Thanks

Quoted 6 lines

Or.
--
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

#105 lore raw

PATCH 28/31 IB/cm: Fix avoid sleep while spin lock is held

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case of LAP are used for RoCE, it can lead to a problem of sleeping a context while spin lock is held in below flow.

cm_lap_handler

	->spin_lock
	-> <..switch_case..>
	-> cm_init_av_for_response
		-> ib_init_ah_from_wc
			-> rdma_addr_find_l2_eth_by_grh
				wait_for_completion()

Therefore ah attribute initialization is done for incoming lap requests outside of the lock context.

---
 drivers/infiniband/core/cm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/infiniband/core/cm.c +6 -5
index d12c50ee2b89..19fd1699dc52 100644
@@ -3130,6 +3130,12 @@ static int cm_lap_handler(struct cm_work *work)
 	if (!cm_id_priv)
 		return -EINVAL;
 
+	ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+				      work->mad_recv_wc->recv_buf.grh,
+				      &cm_id_priv->av);
+	if (ret)
+		goto deref;
+
 	param = &work->cm_event.param.lap_rcvd;
 	memset(&work->path[0], 0, sizeof(work->path[1]));
 	cm_path_set_rec_type(work->port->cm_dev->ib_device,
@@ -3176,11 +3182,6 @@ static int cm_lap_handler(struct cm_work *work)
 
 	cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
 	cm_id_priv->tid = lap_msg->hdr.tid;
-	ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
-				      work->mad_recv_wc->recv_buf.grh,
-				      &cm_id_priv->av);
-	if (ret)
-		goto unlock;
 	cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av,
 			   cm_id_priv);
 	ret = atomic_inc_and_test(&cm_id_priv->work_count);
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-29-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#107 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 3 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case of LAP are used for RoCE

AFAIK APM is not supported with RoCE, isn't that? if yes, on what HW/RoCE mode and how do you test that?
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMixWZvCVDYTK1-2w0pYdy65HExvN2ae7y=hAkk6htrETg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#109 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyAzOjE2IFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJv bWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRt YS1uZXh0IDI4LzMxXSBJQi9jbTogRml4IGF2b2lkIHNsZWVwIHdoaWxlIHNwaW4gbG9jayBpcw0K PiBoZWxkDQo+IA0KPiBPbiBUdWUsIE5vdiAxNCwgMjAxNyBhdCAyOjUyIFBNLCBMZW9uIFJvbWFu b3Zza3kgPGxlb25Aa2VybmVsLm9yZz4gd3JvdGU6DQo+ID4gRnJvbTogUGFyYXYgUGFuZGl0IDxw YXJhdkBtZWxsYW5veC5jb20+DQo+ID4NCj4gPiBJbiBjYXNlIG9mIExBUCBhcmUgdXNlZCBmb3Ig Um9DRQ0KPiANCj4gQUZBSUsgQVBNIGlzIG5vdCBzdXBwb3J0ZWQgd2l0aCBSb0NFLCBpc24ndCB0 aGF0PyBpZiB5ZXMsIG9uIHdoYXQgSFcvUm9DRQ0KPiBtb2RlIGFuZCBob3cgZG8geW91IHRlc3Qg dGhhdD8NClRoaXMgcGFydGljdWxhciBwYXRjaCBpbiB0aGlzIHNlcmllcyBpcyBub3QgdGVzdGVk IG9uIFJvQ0UuDQpBUE0gaXMgbm90IHN1cHBvcnRlZCBidXQgaW5qZWN0aW5nIHN1Y2ggZnJhbWUg aW4gbmV0d29yayBpcyBub3QgaW1wb3NzaWJsZS4NCldlIGRvbuKAmXQgaGF2ZSBwYXJ0aWN1bGFy IGNoZWNrcyB0byByZWplY3Qgc3VjaCBmcmFtZSBmb3IgUm9DRS4NClNvIEkgcHJlZmVyIHRvIGZp eCB0aGUgaXNzdWUgYmVmb3JlIGdldHRpbmcgc3VjaCBoYW5nL29vcHMgcmVwb3J0IHdoZW4gaXNz dWUgaXMgZXZpZGVudCBpbiBjb2RlLg0K
--
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB3008970D8D6034E4A2D952DED1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#111 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 6 lines · Parav Pandit
Quoted 5 lines

From: Or Gerlitz [mailto:[email protected]]
Subject: Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is

Quoted 3 lines

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case of LAP are used for RoCE

Quoted 7 lines
Quoted 2 lines

AFAIK APM is not supported with RoCE, isn't that? if yes, on what HW/RoCE mode and how do you test that?

This particular patch in this series is not tested on RoCE.
APM is not supported but injecting such frame in network is not impossible.
We don’t have particular checks to reject such frame for RoCE.
So I prefer to fix the issue before getting such hang/oops report when issue is evident in code.

mentioning testing, in this series you did bunch of fixes for the IB core, CM and CMA.

Would be good to add a section in the cover letter mentioning under which type of testing the modified code has gone through.

Seems that you did a hell of hardening to the IB core, cool!! --
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMhdp_2BYPA+s+We5Qgatye8hNLUYGnZu0ZimpPb86U-VQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#113 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyA0OjIxIFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJv bWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRt YS1uZXh0IDI4LzMxXSBJQi9jbTogRml4IGF2b2lkIHNsZWVwIHdoaWxlIHNwaW4gbG9jayBpcw0K PiBoZWxkDQo+IA0KPiBPbiBXZWQsIE5vdiAxNSwgMjAxNyBhdCAxMjoxNiBBTSwgUGFyYXYgUGFu ZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+IHdyb3RlOg0KPiA+PiBGcm9tOiBPciBHZXJsaXR6 IFttYWlsdG86Z2VybGl0ei5vckBnbWFpbC5jb21dDQo+ID4+IFN1YmplY3Q6IFJlOiBbUEFUQ0gg cmRtYS1uZXh0IDI4LzMxXSBJQi9jbTogRml4IGF2b2lkIHNsZWVwIHdoaWxlDQo+ID4+IHNwaW4g bG9jayBpcw0KPiA+Pj4gRnJvbTogUGFyYXYgUGFuZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+ IA0KPiA+Pj4gSW4gY2FzZSBvZiBMQVAgYXJlIHVzZWQgZm9yIFJvQ0UNCj4gDQo+ID4+IEFGQUlL IEFQTSBpcyBub3Qgc3VwcG9ydGVkIHdpdGggUm9DRSwgaXNuJ3QgdGhhdD8gaWYgeWVzLCBvbiB3 aGF0DQo+ID4+IEhXL1JvQ0UgbW9kZSBhbmQgaG93IGRvIHlvdSB0ZXN0IHRoYXQ/DQo+IA0KPiA+ IFRoaXMgcGFydGljdWxhciBwYXRjaCBpbiB0aGlzIHNlcmllcyBpcyBub3QgdGVzdGVkIG9uIFJv Q0UuDQo+ID4gQVBNIGlzIG5vdCBzdXBwb3J0ZWQgYnV0IGluamVjdGluZyBzdWNoIGZyYW1lIGlu IG5ldHdvcmsgaXMgbm90IGltcG9zc2libGUuDQo+ID4gV2UgZG9u4oCZdCBoYXZlIHBhcnRpY3Vs YXIgY2hlY2tzIHRvIHJlamVjdCBzdWNoIGZyYW1lIGZvciBSb0NFLg0KPiA+IFNvIEkgcHJlZmVy IHRvIGZpeCB0aGUgaXNzdWUgYmVmb3JlIGdldHRpbmcgc3VjaCBoYW5nL29vcHMgcmVwb3J0IHdo ZW4gaXNzdWUgaXMNCj4gZXZpZGVudCBpbiBjb2RlLg0KPiANCj4gbWVudGlvbmluZyB0ZXN0aW5n LCBpbiB0aGlzIHNlcmllcyB5b3UgZGlkIGJ1bmNoIG9mIGZpeGVzIGZvciB0aGUgSUIgY29yZSwg Q00gYW5kDQo+IENNQS4NCj4gDQo+IFdvdWxkIGJlIGdvb2QgdG8gYWRkIGEgc2VjdGlvbiBpbiB0 aGUgY292ZXIgbGV0dGVyIG1lbnRpb25pbmcgdW5kZXIgd2hpY2ggdHlwZQ0KPiBvZiB0ZXN0aW5n IHRoZSBtb2RpZmllZCBjb2RlIGhhcyBnb25lIHRocm91Z2guDQpJdCdzIGJlZW4gdGVzdGVkIGZv ciBSb0NFdjEsIHYyLCBJUG9JQiB3aXRoIENvbm5lY3RYNCwgQ29ubmVjdFgzIEhDQSB3aXRoIHBl cmZ0ZXN0LCBycGluZywga3JwaW5nIHRvb2xzLg0KSW4gZmV3IGluZGl2aWR1YWwgcGF0Y2gsIGl0 J3MgYmVlbiBtZW50aW9uZWQgaG93IGlzIHRoaXMgdGVzdGVkLg0KDQo+IA0KPiBTZWVtcyB0aGF0 IHlvdSBkaWQgYSBoZWxsIG9mIGhhcmRlbmluZyB0byB0aGUgSUIgY29yZSwgY29vbCEhDQpUaGFu a3MgT3IuDQo=
--
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB300897A41317A06FFA5CC329D1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#115 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 13 lines · Parav Pandit
Quoted 13 lines

From: Or Gerlitz [mailto:[email protected]]

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

In case of LAP are used for RoCE

AFAIK APM is not supported with RoCE, isn't that? if yes, on what HW/RoCE mode and how do you test that?

This particular patch in this series is not tested on RoCE.
APM is not supported but injecting such frame in network is not impossible. We don’t have particular checks to reject such frame for RoCE.
So I prefer to fix the issue before getting such hang/oops report when issue is

evident in code.

Quoted 8 lines
Quoted 5 lines

mentioning testing, in this series you did bunch of fixes for the IB core, CM and CMA.

Would be good to add a section in the cover letter mentioning under which type of testing the modified code has gone through.

It's been tested for RoCEv1, v2, IPoIB with ConnectX4, ConnectX3 HCA with perftest, rping, krping tools. In few individual patch, it's been mentioned how is this tested.

Please also add more info (and in the cover letter please) on IPv4 vs IPv6, unicast vs multicast, etc.
You touched the CMA and addr modules quite heavily on all these areas, need to cover them in testing.

did you test APM? I don't think it would be correct to change the CM APM code without proper testing.
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMiQc_am=rqYg2TyNqU1s9uGSE-wcVxGmW244x8XJNDuyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#117 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBPciBHZXJsaXR6IFttYWlsdG86 Z2VybGl0ei5vckBnbWFpbC5jb21dDQo+IFNlbnQ6IFdlZG5lc2RheSwgTm92ZW1iZXIgMTUsIDIw MTcgMTo1MyBBTQ0KPiBUbzogUGFyYXYgUGFuZGl0IDxwYXJhdkBtZWxsYW5veC5jb20+DQo+IENj OiBEb3VnIExlZGZvcmQgPGRsZWRmb3JkQHJlZGhhdC5jb20+OyBsaW51eC1yZG1hQHZnZXIua2Vy bmVsLm9yZzsgSGVmdHksDQo+IFNlYW4gPHNlYW4uaGVmdHlAaW50ZWwuY29tPjsgTGVvbiBSb21h bm92c2t5IDxsZW9ucm9AbWVsbGFub3guY29tPg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIHJkbWEt bmV4dCAyOC8zMV0gSUIvY206IEZpeCBhdm9pZCBzbGVlcCB3aGlsZSBzcGluIGxvY2sgaXMNCj4g aGVsZA0KPiANCj4gT24gV2VkLCBOb3YgMTUsIDIwMTcgYXQgMTI6MzIgQU0sIFBhcmF2IFBhbmRp dCA8cGFyYXZAbWVsbGFub3guY29tPg0KPiB3cm90ZToNCj4gPj4gRnJvbTogT3IgR2VybGl0eiBb bWFpbHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiANCj4gPj4gPj4+IEluIGNhc2Ugb2YgTEFQ IGFyZSB1c2VkIGZvciBSb0NFDQo+IA0KPiA+PiA+PiBBRkFJSyBBUE0gaXMgbm90IHN1cHBvcnRl ZCB3aXRoIFJvQ0UsIGlzbid0IHRoYXQ/IGlmIHllcywgb24gd2hhdA0KPiA+PiA+PiBIVy9Sb0NF IG1vZGUgYW5kIGhvdyBkbyB5b3UgdGVzdCB0aGF0Pw0KPiANCj4gPj4gPiBUaGlzIHBhcnRpY3Vs YXIgcGF0Y2ggaW4gdGhpcyBzZXJpZXMgaXMgbm90IHRlc3RlZCBvbiBSb0NFLg0KPiA+PiA+IEFQ TSBpcyBub3Qgc3VwcG9ydGVkIGJ1dCBpbmplY3Rpbmcgc3VjaCBmcmFtZSBpbiBuZXR3b3JrIGlz IG5vdCBpbXBvc3NpYmxlLg0KPiA+PiA+IFdlIGRvbuKAmXQgaGF2ZSBwYXJ0aWN1bGFyIGNoZWNr cyB0byByZWplY3Qgc3VjaCBmcmFtZSBmb3IgUm9DRS4NCj4gPj4gPiBTbyBJIHByZWZlciB0byBm aXggdGhlIGlzc3VlIGJlZm9yZSBnZXR0aW5nIHN1Y2ggaGFuZy9vb3BzIHJlcG9ydA0KPiA+PiA+ IHdoZW4gaXNzdWUgaXMNCj4gPj4gZXZpZGVudCBpbiBjb2RlLg0KPiA+Pg0KPiA+PiBtZW50aW9u aW5nIHRlc3RpbmcsIGluIHRoaXMgc2VyaWVzIHlvdSBkaWQgYnVuY2ggb2YgZml4ZXMgZm9yIHRo ZSBJQg0KPiA+PiBjb3JlLCBDTSBhbmQgQ01BLg0KPiA+Pg0KPiA+PiBXb3VsZCBiZSBnb29kIHRv IGFkZCBhIHNlY3Rpb24gaW4gdGhlIGNvdmVyIGxldHRlciBtZW50aW9uaW5nIHVuZGVyDQo+ID4+ IHdoaWNoIHR5cGUgb2YgdGVzdGluZyB0aGUgbW9kaWZpZWQgY29kZSBoYXMgZ29uZSB0aHJvdWdo Lg0KPiANCj4gPiBJdCdzIGJlZW4gdGVzdGVkIGZvciBSb0NFdjEsIHYyLCBJUG9JQiB3aXRoIENv bm5lY3RYNCwgQ29ubmVjdFgzIEhDQSB3aXRoDQo+IHBlcmZ0ZXN0LCBycGluZywga3JwaW5nIHRv b2xzLg0KPiA+IEluIGZldyBpbmRpdmlkdWFsIHBhdGNoLCBpdCdzIGJlZW4gbWVudGlvbmVkIGhv dyBpcyB0aGlzIHRlc3RlZC4NCj4gDQo+IFBsZWFzZSBhbHNvIGFkZCBtb3JlIGluZm8gKGFuZCBp biB0aGUgY292ZXIgbGV0dGVyIHBsZWFzZSkgb24gSVB2NCB2cyBJUHY2LCB1bmljYXN0DQo+IHZz IG11bHRpY2FzdCwgZXRjLg0KSXMgdGhlcmUgYSB0ZW1wbGF0ZSB0aGF0IHlvdSBjYW4gc2hhcmUg dGhhdCBsaW51eC1yZG1hIGZvbGxvd3MgdGhhdCBJIGNhbiB1c2UgdG8gbWVudGlvbiB3aGF0IHRl c3RzIGFyZSBkb25lPw0KQW55IGV4YW1wbGUgcGFzdCBjb3ZlciBsZXR0ZXJzIHRoYXQgSSBjYW4g cmVmZXIgYXMgcmVmZXJlbmNlPw0KDQpEZXBlbmRpbmcgb24gaG93IG11Y2ggaW5mb3JtYXRpb24g eW91IGV4cGVjdCBpbiBjb3ZlciBsZXR0ZXIsIHRoaXMgcGF0Y2hzZXQgY2FuIGhhdmUgbWFueSBy ZXZpc2lvbnMganVzdCBmb3IgY292ZXIgbGV0dGVyLg0KU28gaXQgd291bGQgYmUgYmVzdCBmb3Ig eW91IHRvIHNoYXJlIHRoZSB0ZW1wbGF0ZSB0aGF0IEkgY2FuIGZpbGwgaW4gZm9yIHYxLg0KDQo+ IFlvdSB0b3VjaGVkIHRoZSBDTUEgYW5kIGFkZHIgbW9kdWxlcyBxdWl0ZSBoZWF2aWx5IG9uIGFs bCB0aGVzZSBhcmVhcywgbmVlZCB0bw0KPiBjb3ZlciB0aGVtIGluIHRlc3RpbmcuDQpXaGljaCBh cmUgdGhvc2UgdGVzdHMgdGhhdCBJIHNob3VsZCBleGVjdXRlIGFwYXJ0IGZyb20gYWJvdmUgc3Vt bWFyeT8NCg0KPiANCj4gZGlkIHlvdSB0ZXN0IEFQTT8gSSBkb24ndCB0aGluayBpdCB3b3VsZCBi ZSBjb3JyZWN0IHRvIGNoYW5nZSB0aGUgQ00gQVBNIGNvZGUNCj4gd2l0aG91dCBwcm9wZXIgdGVz dGluZy4NCkFzIEkgYWxyZWFkeSB0b2xkIHRoaXMgcGFydGljdWxhciBwYXRjaCBpcyBub3QgdGVz dGVkLiBBbGwgb3RoZXJzIGFyZSBuZWVkbGVzcyB0byBzYXkgdGVzdGVkLg0KSSBkbyBub3QgaGF2 ZSBBUE0gc2V0dXAgdG8gdGVzdCB0aGlzIGZpeC4NCkkgYW0gb2sgdG8gZHJvcCB0aGlzIHBhdGNo IGFuZCBwcm92aWRlIGZpeCB3aGVuIGNyYXNoIG9jY3VycyBsYXRlciBvbi4NCg== --
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB30081717A7E8BEC1B7CFD471D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#119 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 35 lines · Parav Pandit
Quoted 35 lines

-----Original Message-----
From: Or Gerlitz [mailto:[email protected]]
Sent: Wednesday, November 15, 2017 1:53 AM
To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc: Doug Ledford <[email protected]>; [email protected]; Hefty, Sean <[email protected]>; Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Subject: Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is
held

Quoted 14 lines · Parav Pandit
Quoted 14 lines

From: Or Gerlitz [mailto:[email protected]]

Quoted 10 lines
Quoted 4 lines
Quoted 1 line

In case of LAP are used for RoCE

AFAIK APM is not supported with RoCE, isn't that? if yes, on what HW/RoCE mode and how do you test that?

This particular patch in this series is not tested on RoCE.
APM is not supported but injecting such frame in network is not impossible. We don’t have particular checks to reject such frame for RoCE. So I prefer to fix the issue before getting such hang/oops report when issue is

evident in code.

Quoted 7 lines
Quoted 5 lines

mentioning testing, in this series you did bunch of fixes for the IB core, CM and CMA.

Would be good to add a section in the cover letter mentioning under which type of testing the modified code has gone through.

It's been tested for RoCEv1, v2, IPoIB with ConnectX4, ConnectX3 HCA with

perftest, rping, krping tools.

Quoted 1 line

In few individual patch, it's been mentioned how is this tested.

Quoted 7 lines
Quoted 2 lines

Please also add more info (and in the cover letter please) on IPv4 vs IPv6, unicast vs multicast, etc.

Is there a template that you can share that linux-rdma follows that I can use to mention what tests are done? Any example past cover letters that I can refer as reference?

Depending on how much information you expect in cover letter, this patchset can have many revisions just for cover letter. So it would be best for you to share the template that I can fill in for v1.

Parav, relax
There is no need to respin.

I reread responses and there are two types of response/disputes:
1. Jason vs. Erez. Jason is in favor of having memory leak as long as IPoIB doesn't filter input (in our case wrong input), Erez in favor of fixing memory leak. I'm with Erez.
2. Or vs. rest of the world. No doubts that the commit messages and cover letter are important, but they are not the most important part of this series to justify resubmission.

And yes, you should listen to the feedback provided here and improve your commit messages in next submissions.

Quoted 11 lines
Quoted 3 lines

You touched the CMA and addr modules quite heavily on all these areas, need to cover them in testing.

Which are those tests that I should execute apart from above summary?

Quoted 3 lines

did you test APM? I don't think it would be correct to change the CM APM code without proper testing.

As I already told this particular patch is not tested. All others are needless to say tested. I do not have APM setup to test this fix.
I am ok to drop this patch and provide fix when crash occurs later on.

Not everything is possible to test, it doesn't mean that we shouldn't fix it.

Thanks

#120 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

In reply to a message not in the archive
Quoted 7 lines · Parav Pandit
Quoted 4 lines

From: Or Gerlitz [mailto:[email protected]]

Please also add more info (and in the cover letter please) on IPv4 vs IPv6, unicast vs multicast, etc.

Is there a template that you can share that linux-rdma follows that I can use to mention what tests are done? Any example past cover letters that I can refer as reference?

I suggest you ask the sub-system maintainers (Doug, Jason) what do they expect for such a heavy duty change set.

Quoted 2 lines

Depending on how much information you expect in cover letter, this patchset can have many revisions just for cover letter. So it would be best for you to share the template that I can fill in for v1.

You are still on V0 and complaining on many revisions...

Quoted 4 lines
Quoted 2 lines

You touched the CMA and addr modules quite heavily on all these areas, need to cover them in testing.

Which are those tests that I should execute apart from above summary?

If there is rdma verification suit @ mlnx that runs rdma user/kernel cm/cma based applications on ib/roce environments, can run through it.

Quoted 6 lines
Quoted 2 lines

did you test APM? I don't think it would be correct to change the CM APM code without proper testing.

As I already told this particular patch is not tested. All others are needless to say tested. I do not have APM setup to test this fix.
I am ok to drop this patch and provide fix when crash occurs later on.

I suggest you ask the CM maintainer (Sean) for his opinion on that matter. --
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMhjV9b5-WVe4QOO41KniK0ogBRukXX1T1bjw-E+Z5QbDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#122 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBPciBHZXJsaXR6IFttYWlsdG86 Z2VybGl0ei5vckBnbWFpbC5jb21dDQo+IFNlbnQ6IFRodXJzZGF5LCBOb3ZlbWJlciAxNiwgMjAx NyA1OjUwIEFNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4gQ2M6 IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5rZXJu ZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJvbWFu b3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRtYS1u ZXh0IDI4LzMxXSBJQi9jbTogRml4IGF2b2lkIHNsZWVwIHdoaWxlIHNwaW4gbG9jayBpcw0KPiBo ZWxkDQo+IA0KPiBPbiBUaHUsIE5vdiAxNiwgMjAxNyBhdCAxOjEwIEFNLCBQYXJhdiBQYW5kaXQg PHBhcmF2QG1lbGxhbm94LmNvbT4gd3JvdGU6DQo+ID4+IEZyb206IE9yIEdlcmxpdHogW21haWx0 bzpnZXJsaXR6Lm9yQGdtYWlsLmNvbV0NCj4gDQo+ID4+IFBsZWFzZSBhbHNvIGFkZCBtb3JlIGlu Zm8gKGFuZCBpbiB0aGUgY292ZXIgbGV0dGVyIHBsZWFzZSkgb24gSVB2NCB2cw0KPiA+PiBJUHY2 LCB1bmljYXN0IHZzIG11bHRpY2FzdCwgZXRjLg0KPiANCj4gPiBJcyB0aGVyZSBhIHRlbXBsYXRl IHRoYXQgeW91IGNhbiBzaGFyZSB0aGF0IGxpbnV4LXJkbWEgZm9sbG93cyB0aGF0IEkgY2FuIHVz ZSB0bw0KPiBtZW50aW9uIHdoYXQgdGVzdHMgYXJlIGRvbmU/DQo+ID4gQW55IGV4YW1wbGUgcGFz dCBjb3ZlciBsZXR0ZXJzIHRoYXQgSSBjYW4gcmVmZXIgYXMgcmVmZXJlbmNlPw0KPiANCj4gSSBz dWdnZXN0IHlvdSBhc2sgdGhlIHN1Yi1zeXN0ZW0gbWFpbnRhaW5lcnMgKERvdWcsIEphc29uKSB3 aGF0IGRvIHRoZXkgZXhwZWN0DQo+IGZvciBzdWNoIGEgaGVhdnkgZHV0eSBjaGFuZ2Ugc2V0Lg0K PiANCj4gDQo+ID4gRGVwZW5kaW5nIG9uIGhvdyBtdWNoIGluZm9ybWF0aW9uIHlvdSBleHBlY3Qg aW4gY292ZXIgbGV0dGVyLCB0aGlzIHBhdGNoc2V0DQo+IGNhbiBoYXZlIG1hbnkgcmV2aXNpb25z IGp1c3QgZm9yIGNvdmVyIGxldHRlci4NCj4gPiBTbyBpdCB3b3VsZCBiZSBiZXN0IGZvciB5b3Ug dG8gc2hhcmUgdGhlIHRlbXBsYXRlIHRoYXQgSSBjYW4gZmlsbCBpbiBmb3IgdjEuDQo+IA0KPiBZ b3UgYXJlIHN0aWxsIG9uIFYwIGFuZCBjb21wbGFpbmluZyBvbiBtYW55IHJldmlzaW9ucy4uLg0K PiANCj4gPj4gWW91IHRvdWNoZWQgdGhlIENNQSBhbmQgYWRkciBtb2R1bGVzIHF1aXRlIGhlYXZp bHkgb24gYWxsIHRoZXNlDQo+ID4+IGFyZWFzLCBuZWVkIHRvIGNvdmVyIHRoZW0gaW4gdGVzdGlu Zy4NCj4gDQo+ID4gV2hpY2ggYXJlIHRob3NlIHRlc3RzIHRoYXQgSSBzaG91bGQgZXhlY3V0ZSBh cGFydCBmcm9tIGFib3ZlIHN1bW1hcnk/DQo+IA0KPiBJZiB0aGVyZSBpcyByZG1hIHZlcmlmaWNh dGlvbiBzdWl0IEAgbWxueCB0aGF0IHJ1bnMgcmRtYSB1c2VyL2tlcm5lbCBjbS9jbWENCj4gYmFz ZWQgYXBwbGljYXRpb25zIG9uIGliL3JvY2UgZW52aXJvbm1lbnRzLCBjYW4gcnVuIHRocm91Z2gg aXQuDQo+IA0KSSBoYXZlIHJ1biBzdWNoIHZlcmlmaWNhdGlvbiBzdWl0IGluIFJvQ0UgZW52aXJv bm1lbnQuDQpJQiB3YXMgbm90IHBvc3NpYmxlIHRvIHJ1biBkdWUgdG8gY2VydGFpbiB0ZW1wb3Jh cnkgc2V0dXAgY29uc3RyYWlucy4NCkhvd2V2ZXIgYXMgSSBtZW50aW9uZWQgYmVmb3JlLA0KSUIs IHBlcmZ0ZXN0cywgcnBpbmcsIGtycGluZywgaXBlcmYgKElQb0lCKSB3ZXJlIGRvbmUgZm9yIElC IGluIFZNIGFuZCBub24gVk0gc2VydmVycy4NClNhbWUgdGVzdHMgd2l0aCBSb0NFdjEsIFJvQ0V2 MiwgSVB2NCBtdWx0aWNhc3Qgd2l0aCBtY2tleSwgYW5kIHRlc3RzIHJlbGF0ZWQgdG8gSVB2NiBi dWcgZml4ZXMgYXJlIGFsc28gcmFuLg0KQ2VydGFpbiBlcnJvcnMgcmVsYXRlZCB0byB0aW1pbmdz IGFyZSBpbmplY3RlZCBpbiBjb2RlIHRvIHRlc3QgdGhlbSBmb3IgZXJyb3IgcGF0aC4NCg0KPiA+ PiBkaWQgeW91IHRlc3QgQVBNPyBJIGRvbid0IHRoaW5rIGl0IHdvdWxkIGJlIGNvcnJlY3QgdG8g Y2hhbmdlIHRoZSBDTQ0KPiA+PiBBUE0gY29kZSB3aXRob3V0IHByb3BlciB0ZXN0aW5nLg0KPiAN Cj4gPiBBcyBJIGFscmVhZHkgdG9sZCB0aGlzIHBhcnRpY3VsYXIgcGF0Y2ggaXMgbm90IHRlc3Rl ZC4gQWxsIG90aGVycyBhcmUgbmVlZGxlc3MgdG8NCj4gc2F5IHRlc3RlZC4NCj4gPiBJIGRvIG5v dCBoYXZlIEFQTSBzZXR1cCB0byB0ZXN0IHRoaXMgZml4Lg0KPiA+IEkgYW0gb2sgdG8gZHJvcCB0 aGlzIHBhdGNoIGFuZCBwcm92aWRlIGZpeCB3aGVuIGNyYXNoIG9jY3VycyBsYXRlciBvbi4NCj4g DQo+IEkgc3VnZ2VzdCB5b3UgYXNrIHRoZSBDTSBtYWludGFpbmVyIChTZWFuKSBmb3IgaGlzIG9w aW5pb24gb24gdGhhdCBtYXR0ZXIuDQpZb3UgaGF2ZSBhbHJlYWR5IGFkZGVkIGhpbSBpbiBDQyBs aXN0IHNvIGlmIGhlIGhhcyBzcGVjaWZpY3MgSSB3aWxsIGxldCBoaW0gcmVzcG9uZC4NCkkgaGF2 ZW4ndCBzZWVuIHRlc3QgY29uZmlybWF0aW9uIGZyb20gUm9sYW5kIGZvciBzaW1pbGFyIGZpeCBz dWJtaXR0ZWQgbGFzdCB0aW1lIGluIG90aGVyIGNtIGhhbmRsZXIuDQoNCkxlb24sDQpPbmNlIGFk ZXF1YXRlIHJldmlldyBpcyBkb25lLCBsZXQgbWUga25vdyBvbiBob3cgdG8gcHJvY2VlZC4NCkkg aGF2ZSBhZGRpdGlvbmFsIDYgcGF0Y2hlcyBpbiBvbmUgcGF0Y2hzZXQgdGhhdCBmaXhlcyB0d28g YnVncyBmb3IgUm9DRTsgd2l0aG91dCB3aGljaCBjZXJ0YWluIHVzZXJzIGFwcGxpY2F0aW9ucyBh cmUgYnJva2VuIGZvciBSb0NFLg0KVGhvc2UgZml4ZXMgZGVwZW5kIG9uIHRoaXMgc2VyaWVzLg0K DQo=
--
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

#123 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

In reply to a message not in the archive
Quoted 13 lines

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case of LAP are used for RoCE, it can lead to a problem of sleeping a context while spin lock is held in below flow.

cm_lap_handler

	->spin_lock
	-> <..switch_case..>
	-> cm_init_av_for_response
		-> ib_init_ah_from_wc
			-> rdma_addr_find_l2_eth_by_grh
				wait_for_completion()
Quoted 6 lines

Therefore ah attribute initialization is done for incoming lap requests outside of the lock context.

Should you add a "Fixes:..."?
Pardon my ignorance, but what is LAP?

Thanks,
Ram

--
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

A message that is not in the archive (sent off-list or not yet received): BN3PR07MB2578DF2F9081ED97D5A4351EF82D0-EldUQEzkDQfpW3VS/[email protected]

#125 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 13 lines · Ram
Quoted 13 lines

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

In case of LAP are used for RoCE, it can lead to a problem of sleeping a context while spin lock is held in below flow.

cm_lap_handler

	->spin_lock
	-> <..switch_case..>
	-> cm_init_av_for_response
		-> ib_init_ah_from_wc
			-> rdma_addr_find_l2_eth_by_grh
				wait_for_completion()
Quoted 8 lines
Quoted 6 lines

Therefore ah attribute initialization is done for incoming lap requests outside of the lock context.

Should you add a "Fixes:..."?

It wasn't clear to us the origin of the problem hence we decided to avoid Fixes line.

Quoted 1 line

Pardon my ignorance, but what is LAP?

It should be LAG.

Quoted 4 lines

Thanks,
Ram

A message that is not in the archive (sent off-list or not yet received): 20171119105211.GW18825-U/[email protected]

#127 lore raw

Re: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

Quoted 5 lines · Leon Romanovsky
Quoted 1 line · Ram

Pardon my ignorance, but what is LAP?

It should be LAG.

No! This is CM LAP (see IBTA spec ch. 12)
--
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMgjE-MyeBSem=35Bn+JM401z3q7HOTb_eiXyAJuS=X=NA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#129 lore raw

RE: [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held

PiBObyEgVGhpcyBpcyBDTSBMQVAgKHNlZSBJQlRBIHNwZWMgY2guIDEyKQ0KDQpHb3QgaXQuIFRo YW5rcy4NCg0KUmFtDQoNCg==
--
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

#130 lore raw

PATCH 29/31 IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to ib_init_ah_attr_from_path

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Since ib_init_ah_from_path initializes the address handle attribute, it is renamed to reflect so.

---
 drivers/infiniband/core/cm.c              |  4 ++--
 drivers/infiniband/core/cma.c             |  7 ++++---
 drivers/infiniband/core/sa_query.c        |  8 ++++----
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  3 ++-
 include/rdma/ib_sa.h                      | 10 +++++-----
 5 files changed, 17 insertions(+), 15 deletions(-)
drivers/infiniband/core/cm.c +2 -2
index 19fd1699dc52..3bb82c6ec88d 100644
@@ -494,8 +494,8 @@ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
 		return ret;
 
 	av->port = port;
-	ret = ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
-				   &av->ah_attr);
+	ret = ib_init_ah_attr_from_path(cm_dev->ib_device, port->port_num, path,
+					&av->ah_attr);
 	if (ret)
 		return ret;
 
drivers/infiniband/core/cma.c +4 -3
index 19769ea4d71f..5ab646a24089 100644
@@ -3396,9 +3396,10 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id,
 			event.status = ret;
 			break;
 		}
-		ib_init_ah_from_path(id_priv->id.device, id_priv->id.port_num,
-				     id_priv->id.route.path_rec,
-				     &event.param.ud.ah_attr);
+		ib_init_ah_attr_from_path(id_priv->id.device,
+					  id_priv->id.port_num,
+					  id_priv->id.route.path_rec,
+					  &event.param.ud.ah_attr);
 		event.param.ud.qp_num = rep->qpn;
 		event.param.ud.qkey = rep->qkey;
 		event.event = RDMA_CM_EVENT_ESTABLISHED;
drivers/infiniband/core/sa_query.c +4 -4
index ab5e1024fea9..7cd37e77debb 100644
@@ -1227,9 +1227,9 @@ static u8 get_src_path_mask(struct ib_device *device, u8 port_num)
 	return src_path_mask;
 }
 
-int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
-			 struct sa_path_rec *rec,
-			 struct rdma_ah_attr *ah_attr)
+int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
+			      struct sa_path_rec *rec,
+			      struct rdma_ah_attr *ah_attr)
 {
 	int ret;
 	u16 gid_index;
@@ -1341,7 +1341,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
 
 	return 0;
 }
-EXPORT_SYMBOL(ib_init_ah_from_path);
+EXPORT_SYMBOL(ib_init_ah_attr_from_path);
 
 static int alloc_mad(struct ib_sa_query *query, gfp_t gfp_mask)
 {
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -1
index 33f592cee5d8..71a66a7d265e 100644
@@ -768,7 +768,8 @@ static void path_rec_completion(int status,
 	if (!status) {
 		struct rdma_ah_attr av;
 
-		if (!ib_init_ah_from_path(priv->ca, priv->port, pathrec, &av))
+		if (!ib_init_ah_attr_from_path(priv->ca, priv->port,
+					       pathrec, &av))
 			ah = ipoib_create_ah(dev, priv->pd, &av);
 	}
 
include/rdma/ib_sa.h +5 -5
index 1f7f604db5aa..811cfcfcbe3d 100644
@@ -549,12 +549,12 @@ int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
 			     struct rdma_ah_attr *ah_attr);
 
 /**
- * ib_init_ah_from_path - Initialize address handle attributes based on an SA
- *   path record.
+ * ib_init_ah_attr_from_path - Initialize address handle attributes based on
+ *   an SA path record.
  */
-int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
-			 struct sa_path_rec *rec,
-			 struct rdma_ah_attr *ah_attr);
+int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
+			      struct sa_path_rec *rec,
+			      struct rdma_ah_attr *ah_attr);
 
 /**
  * ib_sa_pack_path - Conert a path record from struct ib_sa_path_rec
Signature · 6 lines
2.15.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
#131 lore raw

PATCH 30/31 IB/{core, umad, cm}: Rename ib_init_ah_from_wc to ib_init_ah_attr_from_wc

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

Currently ib_init_ah_from_wc initializes address handle attributes and not the address handle object itself.
To avoid confusion between ah_attr vs ah, ib_init_ah_from_wc is renamed to ib_init_ah_attr_from_wc to reflect that its initialzes ah_attr.

---
 drivers/infiniband/core/cm.c       |  5 +++--
 drivers/infiniband/core/user_mad.c |  8 ++++----
 drivers/infiniband/core/verbs.c    | 12 ++++++------
 include/rdma/ib_verbs.h            |  8 ++++----
 4 files changed, 17 insertions(+), 16 deletions(-)
drivers/infiniband/core/cm.c +3 -2
index 3bb82c6ec88d..e5d96bd3c377 100644
@@ -457,8 +457,9 @@ static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
 {
 	av->port = port;
 	av->pkey_index = wc->pkey_index;
-	return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
-				  grh, &av->ah_attr);
+	return ib_init_ah_attr_from_wc(port->cm_dev->ib_device,
+				       port->port_num, wc,
+				       grh, &av->ah_attr);
 }
 
 static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
drivers/infiniband/core/user_mad.c +4 -4
index 3179fed4b408..3ef8ee5d4aa2 100644
@@ -248,10 +248,10 @@ static void recv_handler(struct ib_mad_agent *agent,
 		const struct ib_global_route *grh;
 		int ret;
 
-		ret = ib_init_ah_from_wc(agent->device, agent->port_num,
-					 mad_recv_wc->wc,
-					 mad_recv_wc->recv_buf.grh,
-					 &ah_attr);
+		ret = ib_init_ah_attr_from_wc(agent->device, agent->port_num,
+					      mad_recv_wc->wc,
+					      mad_recv_wc->recv_buf.grh,
+					      &ah_attr);
 		if (ret)
 			goto err2;
 
drivers/infiniband/core/verbs.c +6 -6
index 0cac32736189..b53fb0e98751 100644
@@ -526,7 +526,7 @@ static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
 }
 
 /*
- * This function creates ah from the incoming packet.
+ * This function initializes address handle attributes from the incoming packet.
  * Incoming packet has dgid of the receiver node on which this code is
  * getting executed and, sgid contains the GID of the sender.
  *
@@ -535,9 +535,9 @@ static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
  * GID whom to respond to.
  *
  */
-int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
-		       const struct ib_wc *wc, const struct ib_grh *grh,
-		       struct rdma_ah_attr *ah_attr)
+int ib_init_ah_attr_from_wc(struct ib_device *device, u8 port_num,
+			    const struct ib_wc *wc, const struct ib_grh *grh,
+			    struct rdma_ah_attr *ah_attr)
 {
 	u32 flow_class;
 	u16 gid_index;
@@ -611,7 +611,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
 		return 0;
 	}
 }
-EXPORT_SYMBOL(ib_init_ah_from_wc);
+EXPORT_SYMBOL(ib_init_ah_attr_from_wc);
 
 struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, const struct ib_wc *wc,
 				   const struct ib_grh *grh, u8 port_num)
@@ -619,7 +619,7 @@ struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, const struct ib_wc *wc,
 	struct rdma_ah_attr ah_attr;
 	int ret;
 
-	ret = ib_init_ah_from_wc(pd->device, port_num, wc, grh, &ah_attr);
+	ret = ib_init_ah_attr_from_wc(pd->device, port_num, wc, grh, &ah_attr);
 	if (ret)
 		return ERR_PTR(ret);
 
include/rdma/ib_verbs.h +4 -4
index cfd837049a32..60c3268c8c04 100644
@@ -2904,7 +2904,7 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
 int ib_get_rdma_header_version(const union rdma_network_hdr *hdr);
 
 /**
- * ib_init_ah_from_wc - Initializes address handle attributes from a
+ * ib_init_ah_attr_from_wc - Initializes address handle attributes from a
  *   work completion.
  * @device: Device on which the received message arrived.
  * @port_num: Port on which the received message arrived.
@@ -2914,9 +2914,9 @@ int ib_get_rdma_header_version(const union rdma_network_hdr *hdr);
  * @ah_attr: Returned attributes that can be used when creating an address
  *   handle for replying to the message.
  */
-int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
-		       const struct ib_wc *wc, const struct ib_grh *grh,
-		       struct rdma_ah_attr *ah_attr);
+int ib_init_ah_attr_from_wc(struct ib_device *device, u8 port_num,
+			    const struct ib_wc *wc, const struct ib_grh *grh,
+			    struct rdma_ah_attr *ah_attr);
 
 /**
  * ib_create_ah_from_wc - Creates an address handle associated with the
Signature · 6 lines
2.15.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
#132 lore raw

PATCH 31/31 IB/cm: Refactor to avoid setting path record software only fields

In reply to a message not in the archive

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

When path ah_attr initialization from path record
fails, ib_cm_send_rej() uses av.ah_attr fields to send out reject message. In such cases initialization of path record software fields is not needed. Code is simplified for same.

Additionally in current code in cm_req_handler, when ib_get_cached_gid fails for a given sgid_index of the GID of the GRH of the incoming CM MAD, error code 12 is sent. This error code refers to primary GID in incoming CM REQ and not for the GID in in MAD packet.
Therefore code is refactored to send code 5 (unsupported request) for such error.

---
 drivers/infiniband/core/cm.c | 92 +++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 48 deletions(-)
drivers/infiniband/core/cm.c +44 -48
index e5d96bd3c377..dc61e66ae7e6 100644
@@ -1868,56 +1868,52 @@ static int cm_req_handler(struct cm_work *work)
 				work->port->port_num,
 				grh->sgid_index,
 				&gid, &gid_attr);
-	if (!ret) {
-		if (gid_attr.ndev) {
-			work->path[0].rec_type =
-				sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
-			sa_path_set_ifindex(&work->path[0],
-					    gid_attr.ndev->ifindex);
-			sa_path_set_ndev(&work->path[0],
-					 dev_net(gid_attr.ndev));
+	if (ret) {
+		if (gid_attr.ndev)
 			dev_put(gid_attr.ndev);
-		} else {
-			cm_path_set_rec_type(work->port->cm_dev->ib_device,
-					     work->port->port_num,
-					     &work->path[0],
-					     &req_msg->primary_local_gid);
-		}
-		if (cm_req_has_alt_path(req_msg))
-			work->path[1].rec_type = work->path[0].rec_type;
-		cm_format_paths_from_req(req_msg, &work->path[0],
-					 &work->path[1]);
-		if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
-			sa_path_set_dmac(&work->path[0],
-					 cm_id_priv->av.ah_attr.roce.dmac);
-		work->path[0].hop_limit = grh->hop_limit;
-		ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av,
-					 cm_id_priv);
+		ib_send_cm_rej(cm_id, IB_CM_REJ_UNSUPPORTED, NULL, 0, NULL, 0);
+		goto rejected;
 	}
+
+	if (gid_attr.ndev) {
+		work->path[0].rec_type =
+			sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
+		sa_path_set_ifindex(&work->path[0],
+				    gid_attr.ndev->ifindex);
+		sa_path_set_ndev(&work->path[0],
+				 dev_net(gid_attr.ndev));
+		dev_put(gid_attr.ndev);
+	} else {
+		cm_path_set_rec_type(work->port->cm_dev->ib_device,
+				     work->port->port_num,
+				     &work->path[0],
+				     &req_msg->primary_local_gid);
+	}
+	if (cm_req_has_alt_path(req_msg))
+		work->path[1].rec_type = work->path[0].rec_type;
+	cm_format_paths_from_req(req_msg, &work->path[0],
+				 &work->path[1]);
+	if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
+		sa_path_set_dmac(&work->path[0],
+				 cm_id_priv->av.ah_attr.roce.dmac);
+	work->path[0].hop_limit = grh->hop_limit;
+	ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av,
+				 cm_id_priv);
 	if (ret) {
-		int err = ib_get_cached_gid(work->port->cm_dev->ib_device,
-					    work->port->port_num, 0,
-					    &work->path[0].sgid,
-					    &gid_attr);
-		if (!err && gid_attr.ndev) {
-			work->path[0].rec_type =
-				sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
-			sa_path_set_ifindex(&work->path[0],
-					    gid_attr.ndev->ifindex);
-			sa_path_set_ndev(&work->path[0],
-					 dev_net(gid_attr.ndev));
-			dev_put(gid_attr.ndev);
-		} else {
-			cm_path_set_rec_type(work->port->cm_dev->ib_device,
-					     work->port->port_num,
-					     &work->path[0],
-					     &req_msg->primary_local_gid);
-		}
-		if (cm_req_has_alt_path(req_msg))
-			work->path[1].rec_type = work->path[0].rec_type;
-		ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
-			       &work->path[0].sgid, sizeof work->path[0].sgid,
-			       NULL, 0);
+		int err;
+
+		err = ib_get_cached_gid(work->port->cm_dev->ib_device,
+					work->port->port_num, 0,
+					&work->path[0].sgid,
+					NULL);
+		if (err)
+			ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
+				       NULL, 0, NULL, 0);
+		else
+			ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
+				       &work->path[0].sgid,
+				       sizeof(work->path[0].sgid),
+				       NULL, 0);
 		goto rejected;
 	}
 	if (cm_req_has_alt_path(req_msg)) {
@@ -1926,7 +1922,7 @@ static int cm_req_handler(struct cm_work *work)
 		if (ret) {
 			ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_ALT_GID,
 				       &work->path[0].sgid,
-				       sizeof work->path[0].sgid, NULL, 0);
+				       sizeof(work->path[0].sgid), NULL, 0);
 			goto rejected;
 		}
 	}
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20171114125218.20477-32-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#134 lore raw

Re: [PATCH rdma-next 31/31] IB/cm: Refactor to avoid setting path record software only fields

Quoted 6 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

When path ah_attr initialization from path record
fails, ib_cm_send_rej() uses av.ah_attr fields to send out reject message. In such cases initialization of path record software fields is not needed. Code is simplified for same.

is "Code is simplified for same" cut in the middle, I fail to understand the sentence.

Quoted 6 lines

Additionally in current code in cm_req_handler, when ib_get_cached_gid fails for a given sgid_index of the GID of the GRH of the incoming CM MAD, error code 12 is sent. This error code refers to primary GID in incoming CM REQ and not for the GID in in MAD packet.
Therefore code is refactored to send code 5 (unsupported request) for such error.

You do two logical changes in one patch, doesn't seem right to me. --
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

A message that is not in the archive (sent off-list or not yet received): CAJ3xEMhyZQM5dp2VKoiVDz3Q524d_kO=a0PUMJt_xmQK-nkPsg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#136 lore raw

RE: [PATCH rdma-next 31/31] IB/cm: Refactor to avoid setting path record software only fields

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogT3IgR2VybGl0eiBbbWFp bHRvOmdlcmxpdHoub3JAZ21haWwuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBOb3ZlbWJlciAxNCwg MjAxNyAzOjEzIFBNDQo+IFRvOiBQYXJhdiBQYW5kaXQgPHBhcmF2QG1lbGxhbm94LmNvbT4NCj4g Q2M6IERvdWcgTGVkZm9yZCA8ZGxlZGZvcmRAcmVkaGF0LmNvbT47IGxpbnV4LXJkbWFAdmdlci5r ZXJuZWwub3JnOyBIZWZ0eSwNCj4gU2VhbiA8c2Vhbi5oZWZ0eUBpbnRlbC5jb20+OyBMZW9uIFJv bWFub3Zza3kgPGxlb25yb0BtZWxsYW5veC5jb20+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggcmRt YS1uZXh0IDMxLzMxXSBJQi9jbTogUmVmYWN0b3IgdG8gYXZvaWQgc2V0dGluZyBwYXRoDQo+IHJl Y29yZCBzb2Z0d2FyZSBvbmx5IGZpZWxkcw0KPiANCj4gT24gVHVlLCBOb3YgMTQsIDIwMTcgYXQg Mjo1MiBQTSwgTGVvbiBSb21hbm92c2t5IDxsZW9uQGtlcm5lbC5vcmc+IHdyb3RlOg0KPiA+IEZy b206IFBhcmF2IFBhbmRpdCA8cGFyYXZAbWVsbGFub3guY29tPg0KPiA+DQo+ID4gV2hlbiBwYXRo IGFoX2F0dHIgaW5pdGlhbGl6YXRpb24gZnJvbSBwYXRoIHJlY29yZCBmYWlscywNCj4gPiBpYl9j bV9zZW5kX3JlaigpIHVzZXMgYXYuYWhfYXR0ciBmaWVsZHMgdG8gc2VuZCBvdXQgcmVqZWN0IG1l c3NhZ2UuIEluDQo+ID4gc3VjaCBjYXNlcyBpbml0aWFsaXphdGlvbiBvZiBwYXRoIHJlY29yZCBz b2Z0d2FyZSBmaWVsZHMgaXMgbm90DQo+ID4gbmVlZGVkLiBDb2RlIGlzIHNpbXBsaWZpZWQgZm9y IHNhbWUuDQo+IA0KPiBpcyAiQ29kZSBpcyBzaW1wbGlmaWVkIGZvciBzYW1lIiAgY3V0IGluIHRo ZSBtaWRkbGUsIEkgZmFpbCB0byB1bmRlcnN0YW5kIHRoZQ0KPiBzZW50ZW5jZS4NCj4gDQpDb2Rl IGlzIHNpbXBsaWZpZWQgdG8gYXZvaWQgc3VjaCBpbml0aWFsaXphdGlvbi4NCg0KPiANCj4gPiBB ZGRpdGlvbmFsbHkgaW4gY3VycmVudCBjb2RlIGluIGNtX3JlcV9oYW5kbGVyLCB3aGVuIGliX2dl dF9jYWNoZWRfZ2lkDQo+ID4gZmFpbHMgZm9yIGEgZ2l2ZW4gc2dpZF9pbmRleCBvZiB0aGUgR0lE IG9mIHRoZSBHUkggb2YgdGhlIGluY29taW5nIENNDQo+ID4gTUFELCBlcnJvciBjb2RlIDEyIGlz IHNlbnQuIFRoaXMgZXJyb3IgY29kZSByZWZlcnMgdG8gcHJpbWFyeSBHSUQgaW4NCj4gPiBpbmNv bWluZyBDTSBSRVEgYW5kIG5vdCBmb3IgdGhlIEdJRCBpbiBpbiBNQUQgcGFja2V0Lg0KPiA+IFRo ZXJlZm9yZSBjb2RlIGlzIHJlZmFjdG9yZWQgdG8gc2VuZCBjb2RlIDUgKHVuc3VwcG9ydGVkIHJl cXVlc3QpIGZvcg0KPiA+IHN1Y2ggZXJyb3IuDQo+IA0KPiBZb3UgZG8gdHdvIGxvZ2ljYWwgY2hh bmdlcyBpbiBvbmUgcGF0Y2gsIGRvZXNuJ3Qgc2VlbSByaWdodCB0byBtZS4NCkJvdGggbG9naWNh bCBjaGFuZ2VzIGFyZSBpbiBzYW1lIGZ1bmN0aW9uIGZldyBsaW5lcyBhcGFydCBhcm91bmQgR0lE IGNoZWNrLg0KU28gSGFsIGFuZCBJIGNvbnRpbnVlZCB0byBoYXZlIGluIG9uZSBwYXRjaC4NCg== --
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

A message that is not in the archive (sent off-list or not yet received): VI1PR0502MB3008CEF7DF9257A4D6AFBD1FD1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/[email protected]

#138 lore raw

Re: [PATCH rdma-next 31/31] IB/cm: Refactor to avoid setting path record software only fields

Quoted 10 lines · Parav Pandit
Quoted 10 lines

From: Or Gerlitz [mailto:[email protected]]

Quoted 6 lines · Leon Romanovsky

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/[email protected]>

When path ah_attr initialization from path record fails, ib_cm_send_rej() uses av.ah_attr fields to send out reject message. In such cases initialization of path record software fields is not needed. Code is simplified for same.

Quoted 4 lines
Quoted 3 lines

is "Code is simplified for same" cut in the middle, I fail to understand the sentence.

Code is simplified to avoid such initialization.

so fix that in the next version, ok?

Quoted 4 lines
Quoted 1 line

You do two logical changes in one patch, doesn't seem right to me.

Both logical changes are in same function few lines apart around GID check. So Hal and I continued to have in one patch.

As long as it's not terribly problematic, patch has to carry one logical change, I don't see why not apply this practice here too.
--
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

#139 lore raw
In reply to a message not in the archive
Quoted 8 lines · Leon Romanovsky

Hi Doug,

Please consider to take the following series to your coming pull request.

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-11-14

Thanks

I applied this series excluding:

IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

As noted in my reply to that patch.

I revised many of the commit messages, lets try to improve these please.

I also revised this patch:
IB/ipoib: Avoid memory leak if neigh destination was changed

To use ipoib_debug as noted in my separate message.

Everything is in the wip/jgg-zero-day branch, it will move to for-next my tomorrow. Let me know if there are any serious problems with my edits.

Thanks,
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

A message that is not in the archive (sent off-list or not yet received): 20171218231120.GH19056-uk2M96/[email protected]

#141 lore raw
Quoted 18 lines · Jason Gunthorpe
Quoted 8 lines · Leon Romanovsky

Hi Doug,

Please consider to take the following series to your coming pull request.

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-11-14

Thanks

I applied this series excluding:

IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

As noted in my reply to that patch.

I revised many of the commit messages, lets try to improve these please.

Quoted 8 lines

I also revised this patch:
IB/ipoib: Avoid memory leak if neigh destination was changed

To use ipoib_debug as noted in my separate message.

Everything is in the wip/jgg-zero-day branch, it will move to for-next my tomorrow. Let me know if there are any serious problems with my edits.

I took a glance look on the messages and they seem ok to me.

Thanks a lot.

Quoted 7 lines

Thanks,
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

#142 lore raw
In reply to a message not in the archive
Quoted 18 lines · Jason Gunthorpe
Quoted 8 lines · Leon Romanovsky

Hi Doug,

Please consider to take the following series to your coming pull request.

The patches are available in the git repository at:
git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git tags/rdma-next-2017-11-14

Thanks

I applied this series excluding:

IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled

As noted in my reply to that patch.

I revised many of the commit messages, lets try to improve these please.

Quoted 8 lines

I also revised this patch:
IB/ipoib: Avoid memory leak if neigh destination was changed

To use ipoib_debug as noted in my separate message.

Everything is in the wip/jgg-zero-day branch, it will move to for-next my tomorrow. Let me know if there are any serious problems with my edits.

Jason,

I have a hard time to find the commit 09/31
https://patchwork.kernel.org/patch/10057549/

It is marked as superseded, but I wasn't supposed to send any new version of it.

Thanks

Quoted 7 lines

Thanks,
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

A message that is not in the archive (sent off-list or not yet received): 20171226184914.GF10734-U/[email protected]

#144 lore raw
Quoted 9 lines · Leon Romanovsky
Quoted 3 lines

Everything is in the wip/jgg-zero-day branch, it will move to for-next my tomorrow. Let me know if there are any serious problems with my edits.

I have a hard time to find the commit 09/31
https://patchwork.kernel.org/patch/10057549/

It is marked as superseded, but I wasn't supposed to send any new version of it.

I must have confused it with the other PSN patch you re-sent to go to -rc (RDMA/cma: Make sure that PSN is not over max allowed)

Can you just mark it as New in patchworks?

Thanks,
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

A message that is not in the archive (sent off-list or not yet received): 20171226194926.GH30884-uk2M96/[email protected]

#146 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 7 lines · Leon Romanovsky
Quoted 3 lines

Everything is in the wip/jgg-zero-day branch, it will move to for-next my tomorrow. Let me know if there are any serious problems with my edits.

I have a hard time to find the commit 09/31
https://patchwork.kernel.org/patch/10057549/

Quoted 7 lines
Quoted 2 lines

It is marked as superseded, but I wasn't supposed to send any new version of it.

I must have confused it with the other PSN patch you re-sent to go to -rc (RDMA/cma: Make sure that PSN is not over max allowed)

Can you just mark it as New in patchworks?

Done, thanks

Quoted 3 lines

Thanks,
Jason