summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorZhu Yanjun <yanjun.zhu@linux.dev>2022-02-22 21:42:52 -0500
committerJason Gunthorpe <jgg@nvidia.com>2022-02-23 20:38:56 -0400
commit884194ef264e140a6d22f7a5de2b76765d17734a (patch)
tree14e2f96301281859638b75a5db4f8e6ebf8a0b33 /drivers/infiniband
parent8627da62cc3b9de4d299f2558a9f16b4c3c13a5d (diff)
downloadlinux-stable-884194ef264e140a6d22f7a5de2b76765d17734a.tar.gz
linux-stable-884194ef264e140a6d22f7a5de2b76765d17734a.tar.bz2
linux-stable-884194ef264e140a6d22f7a5de2b76765d17734a.zip
RDMA/irdma: Move union irdma_sockaddr to header file
The union irdma_sockaddr is used frequently. So move it to the header file. Link: https://lore.kernel.org/r/20220223024252.3873736-4-yanjun.zhu@linux.dev Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/irdma/verbs.c17
-rw-r--r--drivers/infiniband/hw/irdma/verbs.h11
2 files changed, 10 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 84be23b44e28..ad57c53f2aed 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3882,11 +3882,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);
@@ -4022,11 +4018,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))
@@ -4104,10 +4096,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;
};