Commit 884194ef authored by Zhu Yanjun's avatar Zhu Yanjun Committed by Jason Gunthorpe

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.devSigned-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 8627da62
...@@ -3882,11 +3882,7 @@ static int irdma_attach_mcast(struct ib_qp *ibqp, union ib_gid *ibgid, u16 lid) ...@@ -3882,11 +3882,7 @@ static int irdma_attach_mcast(struct ib_qp *ibqp, union ib_gid *ibgid, u16 lid)
int ret = 0; int ret = 0;
bool ipv4; bool ipv4;
u16 vlan_id; u16 vlan_id;
union { union irdma_sockaddr sgid_addr;
struct sockaddr saddr;
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
} sgid_addr;
unsigned char dmac[ETH_ALEN]; unsigned char dmac[ETH_ALEN];
rdma_gid2ip((struct sockaddr *)&sgid_addr, ibgid); 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) ...@@ -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 = {}; struct irdma_mcast_grp_ctx_entry_info mcg_info = {};
int ret; int ret;
unsigned long flags; unsigned long flags;
union { union irdma_sockaddr sgid_addr;
struct sockaddr saddr;
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
} sgid_addr;
rdma_gid2ip((struct sockaddr *)&sgid_addr, ibgid); rdma_gid2ip((struct sockaddr *)&sgid_addr, ibgid);
if (!ipv6_addr_v4mapped((struct in6_addr *)ibgid)) if (!ipv6_addr_v4mapped((struct in6_addr *)ibgid))
...@@ -4104,10 +4096,7 @@ static int irdma_create_ah(struct ib_ah *ibah, ...@@ -4104,10 +4096,7 @@ static int irdma_create_ah(struct ib_ah *ibah,
u32 ah_id = 0; u32 ah_id = 0;
struct irdma_ah_info *ah_info; struct irdma_ah_info *ah_info;
struct irdma_create_ah_resp uresp; struct irdma_create_ah_resp uresp;
union { union irdma_sockaddr sgid_addr, dgid_addr;
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
} sgid_addr, dgid_addr;
int err; int err;
u8 dmac[ETH_ALEN]; u8 dmac[ETH_ALEN];
......
...@@ -25,13 +25,16 @@ struct irdma_pd { ...@@ -25,13 +25,16 @@ struct irdma_pd {
struct irdma_sc_pd sc_pd; struct irdma_sc_pd sc_pd;
}; };
union irdma_sockaddr {
struct sockaddr_in saddr_in;
struct sockaddr_in6 saddr_in6;
};
struct irdma_av { struct irdma_av {
u8 macaddr[16]; u8 macaddr[16];
struct rdma_ah_attr attrs; struct rdma_ah_attr attrs;
union { union irdma_sockaddr sgid_addr;
struct sockaddr_in saddr_in; union irdma_sockaddr dgid_addr;
struct sockaddr_in6 saddr_in6;
} sgid_addr, dgid_addr;
u8 net_type; u8 net_type;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment