All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled
Date: Tue, 14 Nov 2017 14:51:48 +0200	[thread overview]
Message-ID: <20171114125218.20477-2-leon@kernel.org> (raw)
In-Reply-To: <20171114125218.20477-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

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.

Signed-off-by: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Eli Cohen <eli-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/cache.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 77515638c55c..e5bba898741d 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -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;
-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-11-14 12:51 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 12:51 [PATCH rdma-next 00/31] RDMA fixes and refactoring for 4.15 Leon Romanovsky
     [not found] ` <20171114125218.20477-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 12:51   ` Leon Romanovsky [this message]
     [not found]     ` <20171114125218.20477-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:25       ` [PATCH rdma-next 01/31] IB/core: Fix do not add RoCEv2 default GID when IPv6 is disabled Or Gerlitz
     [not found]         ` <CAJ3xEMgZBzak5V68AV4VFsPgrKOueXcCduHWBJQ-j=1+TBT+iA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:17           ` Parav Pandit
2017-11-15  0:18       ` Jason Gunthorpe
     [not found]         ` <20171115001817.GH25894-uk2M96/98Pc@public.gmane.org>
2017-11-15  3:59           ` Parav Pandit
     [not found]             ` <VI1PR0502MB300800ABA04E768A68684608D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-15  4:40               ` Jason Gunthorpe
     [not found]                 ` <20171115044049.GK25894-uk2M96/98Pc@public.gmane.org>
2017-11-17  2:40                   ` Parav Pandit
2017-12-18 20:48       ` [rdma-next, " Jason Gunthorpe
     [not found]         ` <20171218204818.GA18725-uk2M96/98Pc@public.gmane.org>
2017-12-19 13:11           ` Leon Romanovsky
2017-11-14 12:51   ` [PATCH rdma-next 02/31] IB/{core/cm}: Fix dmac query for IPv6 link local destination Leon Romanovsky
     [not found]     ` <20171114125218.20477-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-12-18 20:38       ` [rdma-next, " Jason Gunthorpe
2017-11-14 12:51   ` [PATCH rdma-next 03/31] IB/core: Depend on IPv6 stack to resolve link local address Leon Romanovsky
     [not found]     ` <20171114125218.20477-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-15  0:32       ` Jason Gunthorpe
     [not found]         ` <20171115003238.GI25894-uk2M96/98Pc@public.gmane.org>
2017-11-15  4:04           ` Parav Pandit
     [not found]             ` <VI1PR0502MB30080133A617972DC6F362F1D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-15  4:41               ` Jason Gunthorpe
     [not found]                 ` <20171115044129.GL25894-uk2M96/98Pc@public.gmane.org>
2017-11-16  2:21                   ` Parav Pandit
2017-11-14 12:51   ` [PATCH rdma-next 04/31] IB/core: Avoid exporting module internal function Leon Romanovsky
2017-11-14 12:51   ` [PATCH rdma-next 05/31] IB/mlx4: Remove unused ibpd parameter Leon Romanovsky
2017-11-14 12:51   ` [PATCH rdma-next 06/31] IB/ipoib: Avoid memory leak if neigh destination was changed Leon Romanovsky
     [not found]     ` <20171114125218.20477-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:51       ` Or Gerlitz
     [not found]         ` <CAJ3xEMjPD-MwKHknnYVBzzhSoxCFWE2i9jOCC500yEn5pFXarg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15  5:11           ` Leon Romanovsky
2017-11-15  0:15       ` Jason Gunthorpe
     [not found]         ` <20171115001510.GG25894-uk2M96/98Pc@public.gmane.org>
2017-11-15  7:01           ` Erez Shitrit
     [not found]             ` <CAAk-MO-QQj3_H2CZuCCOCU51tWwdCfkvhh-Q3LqrKM=Su2Q+Kg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15 15:39               ` Jason Gunthorpe
     [not found]                 ` <20171115153946.GP25894-uk2M96/98Pc@public.gmane.org>
2017-11-16  8:30                   ` Erez Shitrit
     [not found]                     ` <CAAk-MO-nMs-+RtK_QOxPzq7uCA9hpG30ho52v4CSRPZ6769=1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-16 17:28                       ` Håkon Bugge
     [not found]                         ` <3321F53B-3534-4433-B627-80959DEA1850-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-11-16 18:17                           ` Jason Gunthorpe
2017-11-16 18:13                       ` Jason Gunthorpe
2017-12-18 22:40       ` [rdma-next, " Jason Gunthorpe
2017-11-14 12:51   ` [PATCH rdma-next 07/31] IB/ipoib: Update pathrec field if not valid record Leon Romanovsky
2017-11-14 12:51   ` [PATCH rdma-next 08/31] RDMA/cma: Fix consider size of destination address Leon Romanovsky
     [not found]     ` <20171114125218.20477-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:18       ` Or Gerlitz
     [not found]         ` <CAJ3xEMiA7G48_boRVJK336n2DNT8voJVJMiT-qhqpfXqz7aNxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15  5:25           ` Leon Romanovsky
2017-11-14 12:51   ` [PATCH rdma-next 09/31] IB/core: Make sure that PSN does not overflow Leon Romanovsky
     [not found]     ` <20171114125218.20477-10-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:23       ` Or Gerlitz
     [not found]         ` <CAJ3xEMj+QYJs7cTaP7-Z2WGoPZN2ujh+_2sQhW7ZKg0ZGjQacg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 23:44           ` Jason Gunthorpe
2017-12-27 22:44       ` Jason Gunthorpe
2017-11-14 12:51   ` [PATCH rdma-next 10/31] IB/core: Fix memory leak in cm_req_handler error flows Leon Romanovsky
     [not found]     ` <20171114125218.20477-11-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:27       ` Or Gerlitz
2017-11-14 12:51   ` [PATCH rdma-next 11/31] IB/cm: Add debug prints to ib_cm Leon Romanovsky
     [not found]     ` <20171114125218.20477-12-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:10       ` Or Gerlitz
2017-11-14 12:51   ` [PATCH rdma-next 12/31] IB/umem: Fix use of npages/nmap fields Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 13/31] RDMA/cma: Set default GID type as RoCE when resolving RoCE route Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 14/31] RDMA/cma: Simplify netdev check Leon Romanovsky
     [not found]     ` <20171114125218.20477-15-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-19  8:30       ` Knut Omang
     [not found]         ` <1516350659.4593.6.camel-6miFZF/5cTBuMpJDpNschA@public.gmane.org>
2018-01-19 19:38           ` Jason Gunthorpe
2017-11-14 12:52   ` [PATCH rdma-next 15/31] RDMA/cma: Avoid setting path record type twice Leon Romanovsky
     [not found]     ` <20171114125218.20477-16-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-19  8:33       ` Knut Omang
2017-11-14 12:52   ` [PATCH rdma-next 16/31] RDMA/cma: Introduce and use helper functions to init work Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 17/31] IB/core: Avoid unnecessary type cast Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 18/31] IB/core: Refactor to avoid unnecessary check on GID lookup miss Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 19/31] IB/rxe: Avoid passing unused index pointer which is optional Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 20/31] IB/core: Avoid exporting module internal ib_find_gid_by_filter() Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 21/31] RDMA/core: Avoid redundant memcpy in resolving address Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 22/31] IB/core: Removed unused function Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 23/31] RDMA/{core, cma}: Simplify rdma_translate_ip Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 24/31] RDMA/core: Avoid copying ifindex twice Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 25/31] IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link layer Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 26/31] IB/{cm, umad}: Fix honor av init error Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 27/31] IB/cm: Fix honor address handle attribute " Leon Romanovsky
     [not found]     ` <20171114125218.20477-28-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:14       ` Or Gerlitz
     [not found]         ` <CAJ3xEMjPsD7+YnN80A7Z3WjxEey20=TYKpxrRK_mRhKVMEnA8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:13           ` Parav Pandit
     [not found]             ` <VI1PR0502MB3008514AED6DA3E970381088D1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-14 22:18               ` Or Gerlitz
     [not found]                 ` <CAJ3xEMg6bJt0obWHrSae86ZUN7RgCYqWJJiQXw9on82P=zO_VA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:27                   ` Parav Pandit
     [not found]                     ` <VI1PR0502MB300851A707AFA9DEC77B232ED1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-14 23:38                       ` Jason Gunthorpe
     [not found]                         ` <20171114233841.GC25894-uk2M96/98Pc@public.gmane.org>
2017-11-15  5:31                           ` Leon Romanovsky
     [not found]                             ` <20171115053155.GO18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-15  7:59                               ` Or Gerlitz
     [not found]                                 ` <CAJ3xEMiB6VUp1Kb9HBS5jkqnYN61UP6DYNxqs1T8qGLCUGELcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15  8:20                                   ` Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 28/31] IB/cm: Fix avoid sleep while spin lock is held Leon Romanovsky
     [not found]     ` <20171114125218.20477-29-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:15       ` Or Gerlitz
     [not found]         ` <CAJ3xEMixWZvCVDYTK1-2w0pYdy65HExvN2ae7y=hAkk6htrETg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:16           ` Parav Pandit
     [not found]             ` <VI1PR0502MB3008970D8D6034E4A2D952DED1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-14 22:21               ` Or Gerlitz
     [not found]                 ` <CAJ3xEMhdp_2BYPA+s+We5Qgatye8hNLUYGnZu0ZimpPb86U-VQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:32                   ` Parav Pandit
     [not found]                     ` <VI1PR0502MB300897A41317A06FFA5CC329D1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-15  7:52                       ` Or Gerlitz
     [not found]                         ` <CAJ3xEMiQc_am=rqYg2TyNqU1s9uGSE-wcVxGmW244x8XJNDuyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-15 23:10                           ` Parav Pandit
     [not found]                             ` <VI1PR0502MB30081717A7E8BEC1B7CFD471D1290-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-16  4:48                               ` Leon Romanovsky
2017-11-16 11:50                               ` Or Gerlitz
     [not found]                                 ` <CAJ3xEMhjV9b5-WVe4QOO41KniK0ogBRukXX1T1bjw-E+Z5QbDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-18  6:29                                   ` Parav Pandit
2017-11-19  8:42       ` Amrani, Ram
     [not found]         ` <BN3PR07MB2578DF2F9081ED97D5A4351EF82D0-EldUQEzkDQfpW3VS/XPqkOFPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-11-19 10:52           ` Leon Romanovsky
     [not found]             ` <20171119105211.GW18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-19 11:06               ` Or Gerlitz
     [not found]                 ` <CAJ3xEMgjE-MyeBSem=35Bn+JM401z3q7HOTb_eiXyAJuS=X=NA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-19 11:48                   ` Amrani, Ram
2017-11-14 12:52   ` [PATCH rdma-next 29/31] IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to ib_init_ah_attr_from_path Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 30/31] IB/{core, umad, cm}: Rename ib_init_ah_from_wc to ib_init_ah_attr_from_wc Leon Romanovsky
2017-11-14 12:52   ` [PATCH rdma-next 31/31] IB/cm: Refactor to avoid setting path record software only fields Leon Romanovsky
     [not found]     ` <20171114125218.20477-32-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-14 21:13       ` Or Gerlitz
     [not found]         ` <CAJ3xEMhyZQM5dp2VKoiVDz3Q524d_kO=a0PUMJt_xmQK-nkPsg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-14 22:11           ` Parav Pandit
     [not found]             ` <VI1PR0502MB3008CEF7DF9257A4D6AFBD1FD1280-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-15  7:56               ` Or Gerlitz
2017-12-18 23:11   ` [PATCH rdma-next 00/31] RDMA fixes and refactoring for 4.15 Jason Gunthorpe
     [not found]     ` <20171218231120.GH19056-uk2M96/98Pc@public.gmane.org>
2017-12-19 13:35       ` Leon Romanovsky
2017-12-26 18:49       ` Leon Romanovsky
     [not found]         ` <20171226184914.GF10734-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-12-26 19:49           ` Jason Gunthorpe
     [not found]             ` <20171226194926.GH30884-uk2M96/98Pc@public.gmane.org>
2017-12-27  4:58               ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171114125218.20477-2-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.