* RE: [PATCHv2 0/3] Use net_type to check network type
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
@ 2022-02-22 15:00 ` Saleem, Shiraz
2022-02-23 2:42 ` [PATCHv2 1/3] RDMA/irdma: " yanjun.zhu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Saleem, Shiraz @ 2022-02-22 15:00 UTC (permalink / raw)
To: yanjun.zhu@linux.dev, Ismail, Mustafa, jgg@ziepe.ca,
linux-rdma@vger.kernel.org, leon@kernel.org
> Subject: [PATCHv2 0/3] Use net_type to check network type
>
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> The member variable net_type already exists. Now it is used to check network
> type. As such, the variable saddr is redundant.
> So it is removed.
>
> The union irdma_sockaddr is used in several functions. So it is moved into header
> file.
>
> Zhu Yanjun (3):
> RDMA/irdma: Use net_type to check network type
> RDMA/irdma: Remove the unnecessary variable saddr
> RDMA/irdma: Move union irdma_sockaddr to header file
>
> drivers/infiniband/hw/irdma/verbs.c | 26 ++++++--------------------
> drivers/infiniband/hw/irdma/verbs.h | 12 +++++++-----
> 2 files changed, 13 insertions(+), 25 deletions(-)
>
> --
> V1-->V2: Modify the commit log.
Thanks for the clean up.
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCHv2 0/3] Use net_type to check network type
@ 2022-02-23 2:42 yanjun.zhu
2022-02-22 15:00 ` Saleem, Shiraz
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: yanjun.zhu @ 2022-02-23 2:42 UTC (permalink / raw)
To: mustafa.ismail, shiraz.saleem, jgg, linux-rdma, yanjun.zhu, leon
From: Zhu Yanjun <yanjun.zhu@linux.dev>
The member variable net_type already exists. Now it is used
to check network type. As such, the variable saddr is redundant.
So it is removed.
The union irdma_sockaddr is used in several functions. So it is
moved into header file.
Zhu Yanjun (3):
RDMA/irdma: Use net_type to check network type
RDMA/irdma: Remove the unnecessary variable saddr
RDMA/irdma: Move union irdma_sockaddr to header file
drivers/infiniband/hw/irdma/verbs.c | 26 ++++++--------------------
drivers/infiniband/hw/irdma/verbs.h | 12 +++++++-----
2 files changed, 13 insertions(+), 25 deletions(-)
--
V1-->V2: Modify the commit log.
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCHv2 1/3] RDMA/irdma: Use net_type to check network type
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
2022-02-22 15:00 ` Saleem, Shiraz
@ 2022-02-23 2:42 ` yanjun.zhu
2022-02-23 2:42 ` [PATCHv2 2/3] RDMA/irdma: Remove the unnecessary variable saddr yanjun.zhu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: yanjun.zhu @ 2022-02-23 2:42 UTC (permalink / raw)
To: mustafa.ismail, shiraz.saleem, jgg, linux-rdma, yanjun.zhu, leon
From: Zhu Yanjun <yanjun.zhu@linux.dev>
The member variable net_type is to check the type of network.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/hw/irdma/verbs.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 460e757d3fe6..b306c50d0f8e 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1202,7 +1202,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
av->attrs = attr->ah_attr;
rdma_gid2ip((struct sockaddr *)&av->sgid_addr, &sgid_attr->gid);
rdma_gid2ip((struct sockaddr *)&av->dgid_addr, &attr->ah_attr.grh.dgid);
- if (av->sgid_addr.saddr.sa_family == AF_INET6) {
+ if (av->net_type == RDMA_NETWORK_IPV6) {
__be32 *daddr =
av->dgid_addr.saddr_in6.sin6_addr.in6_u.u6_addr32;
__be32 *saddr =
@@ -1218,7 +1218,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
&local_ip[0],
false, NULL,
IRDMA_ARP_RESOLVE);
- } else {
+ } else if (av->net_type == RDMA_NETWORK_IPV4) {
__be32 saddr = av->sgid_addr.saddr_in.sin_addr.s_addr;
__be32 daddr = av->dgid_addr.saddr_in.sin_addr.s_addr;
@@ -4179,8 +4179,6 @@ static int irdma_create_ah(struct ib_ah *ibah,
rdma_gid2ip((struct sockaddr *)&dgid_addr, &ah_attr->grh.dgid);
ah->av.attrs = *ah_attr;
ah->av.net_type = rdma_gid_attr_network_type(sgid_attr);
- ah->av.sgid_addr.saddr = sgid_addr.saddr;
- ah->av.dgid_addr.saddr = dgid_addr.saddr;
ah_info = &sc_ah->ah_info;
ah_info->ah_idx = ah_id;
ah_info->pd_idx = pd->sc_pd.pd_id;
@@ -4191,7 +4189,7 @@ static int irdma_create_ah(struct ib_ah *ibah,
}
ether_addr_copy(dmac, ah_attr->roce.dmac);
- if (rdma_gid_attr_network_type(sgid_attr) == RDMA_NETWORK_IPV4) {
+ if (ah->av.net_type == RDMA_NETWORK_IPV4) {
ah_info->ipv4_valid = true;
ah_info->dest_ip_addr[0] =
ntohl(dgid_addr.saddr_in.sin_addr.s_addr);
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCHv2 2/3] RDMA/irdma: Remove the unnecessary variable saddr
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
2022-02-22 15:00 ` Saleem, Shiraz
2022-02-23 2:42 ` [PATCHv2 1/3] RDMA/irdma: " yanjun.zhu
@ 2022-02-23 2:42 ` yanjun.zhu
2022-02-23 2:42 ` [PATCHv2 3/3] RDMA/irdma: Move union irdma_sockaddr to header file yanjun.zhu
2022-02-24 0:40 ` [PATCHv2 0/3] Use net_type to check network type Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: yanjun.zhu @ 2022-02-23 2:42 UTC (permalink / raw)
To: mustafa.ismail, shiraz.saleem, jgg, linux-rdma, yanjun.zhu, leon
From: Zhu Yanjun <yanjun.zhu@linux.dev>
Firstly the variable saddr was to check the type of a network. Now the
variable net_type is used to do the same work. So it is removed.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/hw/irdma/verbs.c | 1 -
drivers/infiniband/hw/irdma/verbs.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index b306c50d0f8e..7e4d0cc9222f 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -4155,7 +4155,6 @@ static int irdma_create_ah(struct ib_ah *ibah,
struct irdma_ah_info *ah_info;
struct irdma_create_ah_resp uresp;
union {
- struct sockaddr saddr;
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
} sgid_addr, dgid_addr;
diff --git a/drivers/infiniband/hw/irdma/verbs.h b/drivers/infiniband/hw/irdma/verbs.h
index d0fdef8d09ea..d2d4a7e5f954 100644
--- a/drivers/infiniband/hw/irdma/verbs.h
+++ b/drivers/infiniband/hw/irdma/verbs.h
@@ -29,7 +29,6 @@ struct irdma_av {
u8 macaddr[16];
struct rdma_ah_attr attrs;
union {
- struct sockaddr saddr;
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
} sgid_addr, dgid_addr;
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCHv2 3/3] RDMA/irdma: Move union irdma_sockaddr to header file
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
` (2 preceding siblings ...)
2022-02-23 2:42 ` [PATCHv2 2/3] RDMA/irdma: Remove the unnecessary variable saddr yanjun.zhu
@ 2022-02-23 2:42 ` yanjun.zhu
2022-02-24 0:40 ` [PATCHv2 0/3] Use net_type to check network type Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: yanjun.zhu @ 2022-02-23 2:42 UTC (permalink / raw)
To: mustafa.ismail, shiraz.saleem, jgg, linux-rdma, yanjun.zhu, leon
From: Zhu Yanjun <yanjun.zhu@linux.dev>
The union irdma_sockaddr is used frequently. So move it to the
header file.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/hw/irdma/verbs.c | 17 +++--------------
drivers/infiniband/hw/irdma/verbs.h | 11 +++++++----
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 7e4d0cc9222f..93cf4ad0d2a6 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3932,11 +3932,7 @@ static int irdma_attach_mcast(struct ib_qp *ibqp, union ib_gid *ibgid, u16 lid)
int ret = 0;
bool ipv4;
u16 vlan_id;
- union {
- struct sockaddr saddr;
- struct sockaddr_in saddr_in;
- struct sockaddr_in6 saddr_in6;
- } sgid_addr;
+ union irdma_sockaddr sgid_addr;
unsigned char dmac[ETH_ALEN];
rdma_gid2ip((struct sockaddr *)&sgid_addr, ibgid);
@@ -4072,11 +4068,7 @@ static int irdma_detach_mcast(struct ib_qp *ibqp, union ib_gid *ibgid, u16 lid)
struct irdma_mcast_grp_ctx_entry_info mcg_info = {};
int ret;
unsigned long flags;
- union {
- struct sockaddr saddr;
- struct sockaddr_in saddr_in;
- struct sockaddr_in6 saddr_in6;
- } sgid_addr;
+ union irdma_sockaddr sgid_addr;
rdma_gid2ip((struct sockaddr *)&sgid_addr, ibgid);
if (!ipv6_addr_v4mapped((struct in6_addr *)ibgid))
@@ -4154,10 +4146,7 @@ static int irdma_create_ah(struct ib_ah *ibah,
u32 ah_id = 0;
struct irdma_ah_info *ah_info;
struct irdma_create_ah_resp uresp;
- union {
- struct sockaddr_in saddr_in;
- struct sockaddr_in6 saddr_in6;
- } sgid_addr, dgid_addr;
+ union irdma_sockaddr sgid_addr, dgid_addr;
int err;
u8 dmac[ETH_ALEN];
diff --git a/drivers/infiniband/hw/irdma/verbs.h b/drivers/infiniband/hw/irdma/verbs.h
index d2d4a7e5f954..541105b728e3 100644
--- a/drivers/infiniband/hw/irdma/verbs.h
+++ b/drivers/infiniband/hw/irdma/verbs.h
@@ -25,13 +25,16 @@ struct irdma_pd {
struct irdma_sc_pd sc_pd;
};
+union irdma_sockaddr {
+ struct sockaddr_in saddr_in;
+ struct sockaddr_in6 saddr_in6;
+};
+
struct irdma_av {
u8 macaddr[16];
struct rdma_ah_attr attrs;
- union {
- struct sockaddr_in saddr_in;
- struct sockaddr_in6 saddr_in6;
- } sgid_addr, dgid_addr;
+ union irdma_sockaddr sgid_addr;
+ union irdma_sockaddr dgid_addr;
u8 net_type;
};
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCHv2 0/3] Use net_type to check network type
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
` (3 preceding siblings ...)
2022-02-23 2:42 ` [PATCHv2 3/3] RDMA/irdma: Move union irdma_sockaddr to header file yanjun.zhu
@ 2022-02-24 0:40 ` Jason Gunthorpe
4 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2022-02-24 0:40 UTC (permalink / raw)
To: yanjun.zhu; +Cc: mustafa.ismail, shiraz.saleem, linux-rdma, leon
On Tue, Feb 22, 2022 at 09:42:49PM -0500, yanjun.zhu@linux.dev wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> The member variable net_type already exists. Now it is used
> to check network type. As such, the variable saddr is redundant.
> So it is removed.
>
> The union irdma_sockaddr is used in several functions. So it is
> moved into header file.
>
> Zhu Yanjun (3):
> RDMA/irdma: Use net_type to check network type
> RDMA/irdma: Remove the unnecessary variable saddr
> RDMA/irdma: Move union irdma_sockaddr to header file
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-24 0:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 2:42 [PATCHv2 0/3] Use net_type to check network type yanjun.zhu
2022-02-22 15:00 ` Saleem, Shiraz
2022-02-23 2:42 ` [PATCHv2 1/3] RDMA/irdma: " yanjun.zhu
2022-02-23 2:42 ` [PATCHv2 2/3] RDMA/irdma: Remove the unnecessary variable saddr yanjun.zhu
2022-02-23 2:42 ` [PATCHv2 3/3] RDMA/irdma: Move union irdma_sockaddr to header file yanjun.zhu
2022-02-24 0:40 ` [PATCHv2 0/3] Use net_type to check network type Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).