> -----Original Message----- > From: Chuck Lever <cel@xxxxxxxxxx> > Sent: Thursday, 27 April 2023 19:15 > To: Bernard Metzler <BMT@xxxxxxxxxxxxxx> > Cc: linux-rdma@xxxxxxxxxxxxxxx; linux-nfs@xxxxxxxxxxxxxxx > Subject: [EXTERNAL] [PATCH RFC] RDMA/core: Store zero GIDs in some cases > > From: Bernard Metzler <bmt@xxxxxxxxxxxxxx> > > Tunnel devices have zero GIDs, so skip the zero GID check when > setting up soft iWARP over a tunnel device. > > Suggested-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx> > Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> > --- > drivers/infiniband/core/cache.c | 4 +++- > drivers/infiniband/sw/siw/siw_main.c | 1 + > include/rdma/iw_cm.h | 9 ++++++++- > 3 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/core/cache.c > b/drivers/infiniband/core/cache.c > index 2e91d8879326..2493ca4f2739 100644 > --- a/drivers/infiniband/core/cache.c > +++ b/drivers/infiniband/core/cache.c > @@ -41,6 +41,7 @@ > #include <net/addrconf.h> > > #include <rdma/ib_cache.h> > +#include <rdma/iw_cm.h> > > #include "core_priv.h" > > @@ -441,7 +442,8 @@ static int add_modify_gid(struct ib_gid_table *table, > * leave other unused entries as the zero GID. Convert zero GIDs to > * empty table entries instead of storing them. > */ > - if (rdma_is_zero_gid(&attr->gid)) > + if (rdma_is_zero_gid(&attr->gid) && > + !(attr->device->iw_driver_flags & IW_F_STORE_0GID)) > return 0; > > entry = alloc_gid_entry(attr); > diff --git a/drivers/infiniband/sw/siw/siw_main.c > b/drivers/infiniband/sw/siw/siw_main.c > index dacc174604bf..842a039fa457 100644 > --- a/drivers/infiniband/sw/siw/siw_main.c > +++ b/drivers/infiniband/sw/siw/siw_main.c > @@ -359,6 +359,7 @@ static struct siw_device *siw_device_create(struct > net_device *netdev) > > /* Disable TCP port mapping */ > base_dev->iw_driver_flags = IW_F_NO_PORT_MAP; > + base_dev->iw_driver_flags = IW_F_STORE_0GID; > That overwrites the first assignment. Probably better '|= IW_F_STORE_0GID;' ? Or put them on one line... > sdev->attrs.max_qp = SIW_MAX_QP; > sdev->attrs.max_qp_wr = SIW_MAX_QP_WR; > diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h > index 03abd30e6c8c..c48f2cbe37b5 100644 > --- a/include/rdma/iw_cm.h > +++ b/include/rdma/iw_cm.h > @@ -90,7 +90,14 @@ enum iw_flags { > * reserve the port. This is required for soft iwarp > * to play in the port mapped iwarp space. > */ > - IW_F_NO_PORT_MAP = (1 << 0), > + IW_F_NO_PORT_MAP = BIT(0), > + > + /* > + * This flag allows the insertion of zero GIDs into the > + * stored GID table. That is needed to enable soft iWARP > + * on tunnel devices. > + */ > + IW_F_STORE_0GID = BIT(1), > }; > > /** >