Commit 170003c8 authored by Steve Wise's avatar Steve Wise Committed by Doug Ledford

iw_cxgb4: remove port mapper related code

Now that most of the port mapper code been moved to iwcm, we can remove
it from iw_cxgb4.
Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 6a0dde89
...@@ -302,7 +302,7 @@ void _c4iw_free_ep(struct kref *kref) ...@@ -302,7 +302,7 @@ void _c4iw_free_ep(struct kref *kref)
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *) (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
cxgb4_clip_release( cxgb4_clip_release(
ep->com.dev->rdev.lldi.ports[0], ep->com.dev->rdev.lldi.ports[0],
...@@ -314,12 +314,6 @@ void _c4iw_free_ep(struct kref *kref) ...@@ -314,12 +314,6 @@ void _c4iw_free_ep(struct kref *kref)
dst_release(ep->dst); dst_release(ep->dst);
cxgb4_l2t_release(ep->l2t); cxgb4_l2t_release(ep->l2t);
} }
if (test_bit(RELEASE_MAPINFO, &ep->com.flags)) {
print_addr(&ep->com, __func__, "remove_mapinfo/mapping");
iwpm_remove_mapinfo(&ep->com.local_addr,
&ep->com.mapped_local_addr);
iwpm_remove_mapping(&ep->com.local_addr, RDMA_NL_C4IW);
}
kfree(ep); kfree(ep);
} }
...@@ -455,7 +449,7 @@ static void act_open_req_arp_failure(void *handle, struct sk_buff *skb) ...@@ -455,7 +449,7 @@ static void act_open_req_arp_failure(void *handle, struct sk_buff *skb)
state_set(&ep->com, DEAD); state_set(&ep->com, DEAD);
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *)&ep->com.mapped_local_addr; (struct sockaddr_in6 *)&ep->com.local_addr;
cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1); (const u32 *)&sin6->sin6_addr.s6_addr, 1);
} }
...@@ -568,54 +562,6 @@ static int send_abort(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) ...@@ -568,54 +562,6 @@ static int send_abort(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp)
return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t); return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
} }
/*
* c4iw_form_pm_msg - Form a port mapper message with mapping info
*/
static void c4iw_form_pm_msg(struct c4iw_ep *ep,
struct iwpm_sa_data *pm_msg)
{
memcpy(&pm_msg->loc_addr, &ep->com.local_addr,
sizeof(ep->com.local_addr));
memcpy(&pm_msg->rem_addr, &ep->com.remote_addr,
sizeof(ep->com.remote_addr));
}
/*
* c4iw_form_reg_msg - Form a port mapper message with dev info
*/
static void c4iw_form_reg_msg(struct c4iw_dev *dev,
struct iwpm_dev_data *pm_msg)
{
memcpy(pm_msg->dev_name, dev->ibdev.name, IWPM_DEVNAME_SIZE);
memcpy(pm_msg->if_name, dev->rdev.lldi.ports[0]->name,
IWPM_IFNAME_SIZE);
}
static void c4iw_record_pm_msg(struct c4iw_ep *ep,
struct iwpm_sa_data *pm_msg)
{
memcpy(&ep->com.mapped_local_addr, &pm_msg->mapped_loc_addr,
sizeof(ep->com.mapped_local_addr));
memcpy(&ep->com.mapped_remote_addr, &pm_msg->mapped_rem_addr,
sizeof(ep->com.mapped_remote_addr));
}
static int get_remote_addr(struct c4iw_ep *parent_ep, struct c4iw_ep *child_ep)
{
int ret;
print_addr(&parent_ep->com, __func__, "get_remote_addr parent_ep ");
print_addr(&child_ep->com, __func__, "get_remote_addr child_ep ");
ret = iwpm_get_remote_info(&parent_ep->com.mapped_local_addr,
&child_ep->com.mapped_remote_addr,
&child_ep->com.remote_addr, RDMA_NL_C4IW);
if (ret)
PDBG("Unable to find remote peer addr info - err %d\n", ret);
return ret;
}
static void best_mtu(const unsigned short *mtus, unsigned short mtu, static void best_mtu(const unsigned short *mtus, unsigned short mtu,
unsigned int *idx, int use_ts, int ipv6) unsigned int *idx, int use_ts, int ipv6)
{ {
...@@ -645,13 +591,13 @@ static int send_connect(struct c4iw_ep *ep) ...@@ -645,13 +591,13 @@ static int send_connect(struct c4iw_ep *ep)
int wscale; int wscale;
int win, sizev4, sizev6, wrlen; int win, sizev4, sizev6, wrlen;
struct sockaddr_in *la = (struct sockaddr_in *) struct sockaddr_in *la = (struct sockaddr_in *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
struct sockaddr_in *ra = (struct sockaddr_in *) struct sockaddr_in *ra = (struct sockaddr_in *)
&ep->com.mapped_remote_addr; &ep->com.remote_addr;
struct sockaddr_in6 *la6 = (struct sockaddr_in6 *) struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *) struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)
&ep->com.mapped_remote_addr; &ep->com.remote_addr;
int ret; int ret;
enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type; enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
u32 isn = (prandom_u32() & ~7UL) - 1; u32 isn = (prandom_u32() & ~7UL) - 1;
...@@ -1829,10 +1775,10 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) ...@@ -1829,10 +1775,10 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
req->le.filter = cpu_to_be32(cxgb4_select_ntuple( req->le.filter = cpu_to_be32(cxgb4_select_ntuple(
ep->com.dev->rdev.lldi.ports[0], ep->com.dev->rdev.lldi.ports[0],
ep->l2t)); ep->l2t));
sin = (struct sockaddr_in *)&ep->com.mapped_local_addr; sin = (struct sockaddr_in *)&ep->com.local_addr;
req->le.lport = sin->sin_port; req->le.lport = sin->sin_port;
req->le.u.ipv4.lip = sin->sin_addr.s_addr; req->le.u.ipv4.lip = sin->sin_addr.s_addr;
sin = (struct sockaddr_in *)&ep->com.mapped_remote_addr; sin = (struct sockaddr_in *)&ep->com.remote_addr;
req->le.pport = sin->sin_port; req->le.pport = sin->sin_port;
req->le.u.ipv4.pip = sin->sin_addr.s_addr; req->le.u.ipv4.pip = sin->sin_addr.s_addr;
req->tcb.t_state_to_astid = req->tcb.t_state_to_astid =
...@@ -2013,13 +1959,13 @@ static int c4iw_reconnect(struct c4iw_ep *ep) ...@@ -2013,13 +1959,13 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
{ {
int err = 0; int err = 0;
struct sockaddr_in *laddr = (struct sockaddr_in *) struct sockaddr_in *laddr = (struct sockaddr_in *)
&ep->com.cm_id->local_addr; &ep->com.cm_id->m_local_addr;
struct sockaddr_in *raddr = (struct sockaddr_in *) struct sockaddr_in *raddr = (struct sockaddr_in *)
&ep->com.cm_id->remote_addr; &ep->com.cm_id->m_remote_addr;
struct sockaddr_in6 *laddr6 = (struct sockaddr_in6 *) struct sockaddr_in6 *laddr6 = (struct sockaddr_in6 *)
&ep->com.cm_id->local_addr; &ep->com.cm_id->m_local_addr;
struct sockaddr_in6 *raddr6 = (struct sockaddr_in6 *) struct sockaddr_in6 *raddr6 = (struct sockaddr_in6 *)
&ep->com.cm_id->remote_addr; &ep->com.cm_id->m_remote_addr;
int iptype; int iptype;
__u8 *ra; __u8 *ra;
...@@ -2038,7 +1984,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep) ...@@ -2038,7 +1984,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
insert_handle(ep->com.dev, &ep->com.dev->atid_idr, ep, ep->atid); insert_handle(ep->com.dev, &ep->com.dev->atid_idr, ep, ep->atid);
/* find a route */ /* find a route */
if (ep->com.cm_id->local_addr.ss_family == AF_INET) { if (ep->com.cm_id->m_local_addr.ss_family == AF_INET) {
ep->dst = find_route(ep->com.dev, laddr->sin_addr.s_addr, ep->dst = find_route(ep->com.dev, laddr->sin_addr.s_addr,
raddr->sin_addr.s_addr, laddr->sin_port, raddr->sin_addr.s_addr, laddr->sin_port,
raddr->sin_port, 0); raddr->sin_port, 0);
...@@ -2109,10 +2055,10 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2109,10 +2055,10 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
struct sockaddr_in6 *ra6; struct sockaddr_in6 *ra6;
ep = lookup_atid(t, atid); ep = lookup_atid(t, atid);
la = (struct sockaddr_in *)&ep->com.mapped_local_addr; la = (struct sockaddr_in *)&ep->com.local_addr;
ra = (struct sockaddr_in *)&ep->com.mapped_remote_addr; ra = (struct sockaddr_in *)&ep->com.remote_addr;
la6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr; la6 = (struct sockaddr_in6 *)&ep->com.local_addr;
ra6 = (struct sockaddr_in6 *)&ep->com.mapped_remote_addr; ra6 = (struct sockaddr_in6 *)&ep->com.remote_addr;
PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid, PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid,
status, status2errno(status)); status, status2errno(status));
...@@ -2154,7 +2100,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2154,7 +2100,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *) (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
cxgb4_clip_release( cxgb4_clip_release(
ep->com.dev->rdev.lldi.ports[0], ep->com.dev->rdev.lldi.ports[0],
(const u32 *) (const u32 *)
...@@ -2189,7 +2135,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2189,7 +2135,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *)&ep->com.mapped_local_addr; (struct sockaddr_in6 *)&ep->com.local_addr;
cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1); (const u32 *)&sin6->sin6_addr.s6_addr, 1);
} }
...@@ -2459,18 +2405,9 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2459,18 +2405,9 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
child_ep->com.dev = dev; child_ep->com.dev = dev;
child_ep->com.cm_id = NULL; child_ep->com.cm_id = NULL;
/*
* The mapped_local and mapped_remote addresses get setup with
* the actual 4-tuple. The local address will be based on the
* actual local address of the connection, but on the port number
* of the parent listening endpoint. The remote address is
* setup based on a query to the IWPM since we don't know what it
* originally was before mapping. If no mapping was done, then
* mapped_remote == remote, and mapped_local == local.
*/
if (iptype == 4) { if (iptype == 4) {
struct sockaddr_in *sin = (struct sockaddr_in *) struct sockaddr_in *sin = (struct sockaddr_in *)
&child_ep->com.mapped_local_addr; &child_ep->com.local_addr;
sin->sin_family = PF_INET; sin->sin_family = PF_INET;
sin->sin_port = local_port; sin->sin_port = local_port;
...@@ -2482,12 +2419,12 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2482,12 +2419,12 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
&parent_ep->com.local_addr)->sin_port; &parent_ep->com.local_addr)->sin_port;
sin->sin_addr.s_addr = *(__be32 *)local_ip; sin->sin_addr.s_addr = *(__be32 *)local_ip;
sin = (struct sockaddr_in *)&child_ep->com.mapped_remote_addr; sin = (struct sockaddr_in *)&child_ep->com.remote_addr;
sin->sin_family = PF_INET; sin->sin_family = PF_INET;
sin->sin_port = peer_port; sin->sin_port = peer_port;
sin->sin_addr.s_addr = *(__be32 *)peer_ip; sin->sin_addr.s_addr = *(__be32 *)peer_ip;
} else { } else {
sin6 = (struct sockaddr_in6 *)&child_ep->com.mapped_local_addr; sin6 = (struct sockaddr_in6 *)&child_ep->com.local_addr;
sin6->sin6_family = PF_INET6; sin6->sin6_family = PF_INET6;
sin6->sin6_port = local_port; sin6->sin6_port = local_port;
memcpy(sin6->sin6_addr.s6_addr, local_ip, 16); memcpy(sin6->sin6_addr.s6_addr, local_ip, 16);
...@@ -2498,14 +2435,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2498,14 +2435,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
&parent_ep->com.local_addr)->sin6_port; &parent_ep->com.local_addr)->sin6_port;
memcpy(sin6->sin6_addr.s6_addr, local_ip, 16); memcpy(sin6->sin6_addr.s6_addr, local_ip, 16);
sin6 = (struct sockaddr_in6 *)&child_ep->com.mapped_remote_addr; sin6 = (struct sockaddr_in6 *)&child_ep->com.remote_addr;
sin6->sin6_family = PF_INET6; sin6->sin6_family = PF_INET6;
sin6->sin6_port = peer_port; sin6->sin6_port = peer_port;
memcpy(sin6->sin6_addr.s6_addr, peer_ip, 16); memcpy(sin6->sin6_addr.s6_addr, peer_ip, 16);
} }
memcpy(&child_ep->com.remote_addr, &child_ep->com.mapped_remote_addr,
sizeof(child_ep->com.remote_addr));
get_remote_addr(parent_ep, child_ep);
c4iw_get_ep(&parent_ep->com); c4iw_get_ep(&parent_ep->com);
child_ep->parent_ep = parent_ep; child_ep->parent_ep = parent_ep;
...@@ -2522,7 +2456,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2522,7 +2456,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
accept_cr(child_ep, skb, req); accept_cr(child_ep, skb, req);
set_bit(PASS_ACCEPT_REQ, &child_ep->com.history); set_bit(PASS_ACCEPT_REQ, &child_ep->com.history);
if (iptype == 6) { if (iptype == 6) {
sin6 = (struct sockaddr_in6 *)&child_ep->com.mapped_local_addr; sin6 = (struct sockaddr_in6 *)&child_ep->com.local_addr;
cxgb4_clip_get(child_ep->com.dev->rdev.lldi.ports[0], cxgb4_clip_get(child_ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1); (const u32 *)&sin6->sin6_addr.s6_addr, 1);
} }
...@@ -2765,7 +2699,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2765,7 +2699,7 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *) (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
cxgb4_clip_release( cxgb4_clip_release(
ep->com.dev->rdev.lldi.ports[0], ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, (const u32 *)&sin6->sin6_addr.s6_addr,
...@@ -3026,8 +2960,8 @@ static int pick_local_ipaddrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id) ...@@ -3026,8 +2960,8 @@ static int pick_local_ipaddrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id)
{ {
struct in_device *ind; struct in_device *ind;
int found = 0; int found = 0;
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr; struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr; struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
ind = in_dev_get(dev->rdev.lldi.ports[0]); ind = in_dev_get(dev->rdev.lldi.ports[0]);
if (!ind) if (!ind)
...@@ -3072,8 +3006,8 @@ static int get_lladdr(struct net_device *dev, struct in6_addr *addr, ...@@ -3072,8 +3006,8 @@ static int get_lladdr(struct net_device *dev, struct in6_addr *addr,
static int pick_local_ip6addrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id) static int pick_local_ip6addrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id)
{ {
struct in6_addr uninitialized_var(addr); struct in6_addr uninitialized_var(addr);
struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)&cm_id->local_addr; struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)&cm_id->m_local_addr;
struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)&cm_id->remote_addr; struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)&cm_id->m_remote_addr;
if (!get_lladdr(dev->rdev.lldi.ports[0], &addr, IFA_F_TENTATIVE)) { if (!get_lladdr(dev->rdev.lldi.ports[0], &addr, IFA_F_TENTATIVE)) {
memcpy(la6->sin6_addr.s6_addr, &addr, 16); memcpy(la6->sin6_addr.s6_addr, &addr, 16);
...@@ -3092,11 +3026,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -3092,11 +3026,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
struct sockaddr_in *raddr; struct sockaddr_in *raddr;
struct sockaddr_in6 *laddr6; struct sockaddr_in6 *laddr6;
struct sockaddr_in6 *raddr6; struct sockaddr_in6 *raddr6;
struct iwpm_dev_data pm_reg_msg;
struct iwpm_sa_data pm_msg;
__u8 *ra; __u8 *ra;
int iptype; int iptype;
int iwpm_err = 0;
if ((conn_param->ord > cur_max_read_depth(dev)) || if ((conn_param->ord > cur_max_read_depth(dev)) ||
(conn_param->ird > cur_max_read_depth(dev))) { (conn_param->ird > cur_max_read_depth(dev))) {
...@@ -3144,47 +3075,17 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -3144,47 +3075,17 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
} }
insert_handle(dev, &dev->atid_idr, ep, ep->atid); insert_handle(dev, &dev->atid_idr, ep, ep->atid);
memcpy(&ep->com.local_addr, &cm_id->local_addr, memcpy(&ep->com.local_addr, &cm_id->m_local_addr,
sizeof(ep->com.local_addr)); sizeof(ep->com.local_addr));
memcpy(&ep->com.remote_addr, &cm_id->remote_addr, memcpy(&ep->com.remote_addr, &cm_id->m_remote_addr,
sizeof(ep->com.remote_addr)); sizeof(ep->com.remote_addr));
/* No port mapper available, go with the specified peer information */ laddr = (struct sockaddr_in *)&ep->com.local_addr;
memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr, raddr = (struct sockaddr_in *)&ep->com.remote_addr;
sizeof(ep->com.mapped_local_addr)); laddr6 = (struct sockaddr_in6 *)&ep->com.local_addr;
memcpy(&ep->com.mapped_remote_addr, &cm_id->remote_addr, raddr6 = (struct sockaddr_in6 *) &ep->com.remote_addr;
sizeof(ep->com.mapped_remote_addr));
c4iw_form_reg_msg(dev, &pm_reg_msg);
iwpm_err = iwpm_register_pid(&pm_reg_msg, RDMA_NL_C4IW);
if (iwpm_err) {
PDBG("%s: Port Mapper reg pid fail (err = %d).\n",
__func__, iwpm_err);
}
if (iwpm_valid_pid() && !iwpm_err) {
c4iw_form_pm_msg(ep, &pm_msg);
iwpm_err = iwpm_add_and_query_mapping(&pm_msg, RDMA_NL_C4IW);
if (iwpm_err)
PDBG("%s: Port Mapper query fail (err = %d).\n",
__func__, iwpm_err);
else
c4iw_record_pm_msg(ep, &pm_msg);
}
if (iwpm_create_mapinfo(&ep->com.local_addr,
&ep->com.mapped_local_addr, RDMA_NL_C4IW)) {
iwpm_remove_mapping(&ep->com.local_addr, RDMA_NL_C4IW);
err = -ENOMEM;
goto fail1;
}
print_addr(&ep->com, __func__, "add_query/create_mapinfo");
set_bit(RELEASE_MAPINFO, &ep->com.flags);
laddr = (struct sockaddr_in *)&ep->com.mapped_local_addr; if (cm_id->m_remote_addr.ss_family == AF_INET) {
raddr = (struct sockaddr_in *)&ep->com.mapped_remote_addr;
laddr6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr;
raddr6 = (struct sockaddr_in6 *) &ep->com.mapped_remote_addr;
if (cm_id->remote_addr.ss_family == AF_INET) {
iptype = 4; iptype = 4;
ra = (__u8 *)&raddr->sin_addr; ra = (__u8 *)&raddr->sin_addr;
...@@ -3269,7 +3170,7 @@ static int create_server6(struct c4iw_dev *dev, struct c4iw_listen_ep *ep) ...@@ -3269,7 +3170,7 @@ static int create_server6(struct c4iw_dev *dev, struct c4iw_listen_ep *ep)
{ {
int err; int err;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
if (ipv6_addr_type(&sin6->sin6_addr) != IPV6_ADDR_ANY) { if (ipv6_addr_type(&sin6->sin6_addr) != IPV6_ADDR_ANY) {
err = cxgb4_clip_get(ep->com.dev->rdev.lldi.ports[0], err = cxgb4_clip_get(ep->com.dev->rdev.lldi.ports[0],
...@@ -3302,7 +3203,7 @@ static int create_server4(struct c4iw_dev *dev, struct c4iw_listen_ep *ep) ...@@ -3302,7 +3203,7 @@ static int create_server4(struct c4iw_dev *dev, struct c4iw_listen_ep *ep)
{ {
int err; int err;
struct sockaddr_in *sin = (struct sockaddr_in *) struct sockaddr_in *sin = (struct sockaddr_in *)
&ep->com.mapped_local_addr; &ep->com.local_addr;
if (dev->rdev.lldi.enable_fw_ofld_conn) { if (dev->rdev.lldi.enable_fw_ofld_conn) {
do { do {
...@@ -3343,9 +3244,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ...@@ -3343,9 +3244,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
int err = 0; int err = 0;
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_listen_ep *ep; struct c4iw_listen_ep *ep;
struct iwpm_dev_data pm_reg_msg;
struct iwpm_sa_data pm_msg;
int iwpm_err = 0;
might_sleep(); might_sleep();
...@@ -3360,7 +3258,7 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ...@@ -3360,7 +3258,7 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
ep->com.cm_id = cm_id; ep->com.cm_id = cm_id;
ep->com.dev = dev; ep->com.dev = dev;
ep->backlog = backlog; ep->backlog = backlog;
memcpy(&ep->com.local_addr, &cm_id->local_addr, memcpy(&ep->com.local_addr, &cm_id->m_local_addr,
sizeof(ep->com.local_addr)); sizeof(ep->com.local_addr));
/* /*
...@@ -3369,10 +3267,10 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ...@@ -3369,10 +3267,10 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
if (dev->rdev.lldi.enable_fw_ofld_conn && if (dev->rdev.lldi.enable_fw_ofld_conn &&
ep->com.local_addr.ss_family == AF_INET) ep->com.local_addr.ss_family == AF_INET)
ep->stid = cxgb4_alloc_sftid(dev->rdev.lldi.tids, ep->stid = cxgb4_alloc_sftid(dev->rdev.lldi.tids,
cm_id->local_addr.ss_family, ep); cm_id->m_local_addr.ss_family, ep);
else else
ep->stid = cxgb4_alloc_stid(dev->rdev.lldi.tids, ep->stid = cxgb4_alloc_stid(dev->rdev.lldi.tids,
cm_id->local_addr.ss_family, ep); cm_id->m_local_addr.ss_family, ep);
if (ep->stid == -1) { if (ep->stid == -1) {
printk(KERN_ERR MOD "%s - cannot alloc stid.\n", __func__); printk(KERN_ERR MOD "%s - cannot alloc stid.\n", __func__);
...@@ -3381,36 +3279,9 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ...@@ -3381,36 +3279,9 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
} }
insert_handle(dev, &dev->stid_idr, ep, ep->stid); insert_handle(dev, &dev->stid_idr, ep, ep->stid);
/* No port mapper available, go with the specified info */ memcpy(&ep->com.local_addr, &cm_id->m_local_addr,
memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr, sizeof(ep->com.local_addr));
sizeof(ep->com.mapped_local_addr));
c4iw_form_reg_msg(dev, &pm_reg_msg);
iwpm_err = iwpm_register_pid(&pm_reg_msg, RDMA_NL_C4IW);
if (iwpm_err) {
PDBG("%s: Port Mapper reg pid fail (err = %d).\n",
__func__, iwpm_err);
}
if (iwpm_valid_pid() && !iwpm_err) {
memcpy(&pm_msg.loc_addr, &ep->com.local_addr,
sizeof(ep->com.local_addr));
iwpm_err = iwpm_add_mapping(&pm_msg, RDMA_NL_C4IW);
if (iwpm_err)
PDBG("%s: Port Mapper query fail (err = %d).\n",
__func__, iwpm_err);
else
memcpy(&ep->com.mapped_local_addr,
&pm_msg.mapped_loc_addr,
sizeof(ep->com.mapped_local_addr));
}
if (iwpm_create_mapinfo(&ep->com.local_addr,
&ep->com.mapped_local_addr, RDMA_NL_C4IW)) {
err = -ENOMEM;
goto fail3;
}
print_addr(&ep->com, __func__, "add_mapping/create_mapinfo");
set_bit(RELEASE_MAPINFO, &ep->com.flags);
state_set(&ep->com, LISTEN); state_set(&ep->com, LISTEN);
if (ep->com.local_addr.ss_family == AF_INET) if (ep->com.local_addr.ss_family == AF_INET)
err = create_server4(dev, ep); err = create_server4(dev, ep);
...@@ -3421,7 +3292,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) ...@@ -3421,7 +3292,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
goto out; goto out;
} }
fail3:
cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid, cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid,
ep->com.local_addr.ss_family); ep->com.local_addr.ss_family);
fail2: fail2:
...@@ -3456,7 +3326,7 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) ...@@ -3456,7 +3326,7 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id)
goto done; goto done;
err = c4iw_wait_for_reply(&ep->com.dev->rdev, &ep->com.wr_wait, err = c4iw_wait_for_reply(&ep->com.dev->rdev, &ep->com.wr_wait,
0, 0, __func__); 0, 0, __func__);
sin6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr; sin6 = (struct sockaddr_in6 *)&ep->com.local_addr;
cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1); (const u32 *)&sin6->sin6_addr.s6_addr, 1);
} }
...@@ -3580,7 +3450,7 @@ static void active_ofld_conn_reply(struct c4iw_dev *dev, struct sk_buff *skb, ...@@ -3580,7 +3450,7 @@ static void active_ofld_conn_reply(struct c4iw_dev *dev, struct sk_buff *skb,
state_set(&ep->com, DEAD); state_set(&ep->com, DEAD);
if (ep->com.remote_addr.ss_family == AF_INET6) { if (ep->com.remote_addr.ss_family == AF_INET6) {
struct sockaddr_in6 *sin6 = struct sockaddr_in6 *sin6 =
(struct sockaddr_in6 *)&ep->com.mapped_local_addr; (struct sockaddr_in6 *)&ep->com.local_addr;
cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0], cxgb4_clip_release(ep->com.dev->rdev.lldi.ports[0],
(const u32 *)&sin6->sin6_addr.s6_addr, 1); (const u32 *)&sin6->sin6_addr.s6_addr, 1);
} }
......
...@@ -87,17 +87,6 @@ struct c4iw_debugfs_data { ...@@ -87,17 +87,6 @@ struct c4iw_debugfs_data {
int pos; int pos;
}; };
/* registered cxgb4 netlink callbacks */
static struct ibnl_client_cbs c4iw_nl_cb_table[] = {
[RDMA_NL_IWPM_REG_PID] = {.dump = iwpm_register_pid_cb},
[RDMA_NL_IWPM_ADD_MAPPING] = {.dump = iwpm_add_mapping_cb},
[RDMA_NL_IWPM_QUERY_MAPPING] = {.dump = iwpm_add_and_query_mapping_cb},
[RDMA_NL_IWPM_HANDLE_ERR] = {.dump = iwpm_mapping_error_cb},
[RDMA_NL_IWPM_REMOTE_INFO] = {.dump = iwpm_remote_info_cb},
[RDMA_NL_IWPM_MAPINFO] = {.dump = iwpm_mapping_info_cb},
[RDMA_NL_IWPM_MAPINFO_NUM] = {.dump = iwpm_ack_mapping_info_cb}
};
static int count_idrs(int id, void *p, void *data) static int count_idrs(int id, void *p, void *data)
{ {
int *countp = data; int *countp = data;
...@@ -242,13 +231,13 @@ static int dump_qp(int id, void *p, void *data) ...@@ -242,13 +231,13 @@ static int dump_qp(int id, void *p, void *data)
if (qp->ep) { if (qp->ep) {
if (qp->ep->com.local_addr.ss_family == AF_INET) { if (qp->ep->com.local_addr.ss_family == AF_INET) {
struct sockaddr_in *lsin = (struct sockaddr_in *) struct sockaddr_in *lsin = (struct sockaddr_in *)
&qp->ep->com.local_addr; &qp->ep->com.cm_id->local_addr;
struct sockaddr_in *rsin = (struct sockaddr_in *) struct sockaddr_in *rsin = (struct sockaddr_in *)
&qp->ep->com.remote_addr; &qp->ep->com.cm_id->remote_addr;
struct sockaddr_in *mapped_lsin = (struct sockaddr_in *) struct sockaddr_in *mapped_lsin = (struct sockaddr_in *)
&qp->ep->com.mapped_local_addr; &qp->ep->com.cm_id->m_local_addr;
struct sockaddr_in *mapped_rsin = (struct sockaddr_in *) struct sockaddr_in *mapped_rsin = (struct sockaddr_in *)
&qp->ep->com.mapped_remote_addr; &qp->ep->com.cm_id->m_remote_addr;
cc = snprintf(qpd->buf + qpd->pos, space, cc = snprintf(qpd->buf + qpd->pos, space,
"rc qp sq id %u rq id %u state %u " "rc qp sq id %u rq id %u state %u "
...@@ -264,15 +253,15 @@ static int dump_qp(int id, void *p, void *data) ...@@ -264,15 +253,15 @@ static int dump_qp(int id, void *p, void *data)
ntohs(mapped_rsin->sin_port)); ntohs(mapped_rsin->sin_port));
} else { } else {
struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)
&qp->ep->com.local_addr; &qp->ep->com.cm_id->local_addr;
struct sockaddr_in6 *rsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *rsin6 = (struct sockaddr_in6 *)
&qp->ep->com.remote_addr; &qp->ep->com.cm_id->remote_addr;
struct sockaddr_in6 *mapped_lsin6 = struct sockaddr_in6 *mapped_lsin6 =
(struct sockaddr_in6 *) (struct sockaddr_in6 *)
&qp->ep->com.mapped_local_addr; &qp->ep->com.cm_id->m_local_addr;
struct sockaddr_in6 *mapped_rsin6 = struct sockaddr_in6 *mapped_rsin6 =
(struct sockaddr_in6 *) (struct sockaddr_in6 *)
&qp->ep->com.mapped_remote_addr; &qp->ep->com.cm_id->m_remote_addr;
cc = snprintf(qpd->buf + qpd->pos, space, cc = snprintf(qpd->buf + qpd->pos, space,
"rc qp sq id %u rq id %u state %u " "rc qp sq id %u rq id %u state %u "
...@@ -545,13 +534,13 @@ static int dump_ep(int id, void *p, void *data) ...@@ -545,13 +534,13 @@ static int dump_ep(int id, void *p, void *data)
if (ep->com.local_addr.ss_family == AF_INET) { if (ep->com.local_addr.ss_family == AF_INET) {
struct sockaddr_in *lsin = (struct sockaddr_in *) struct sockaddr_in *lsin = (struct sockaddr_in *)
&ep->com.local_addr; &ep->com.cm_id->local_addr;
struct sockaddr_in *rsin = (struct sockaddr_in *) struct sockaddr_in *rsin = (struct sockaddr_in *)
&ep->com.remote_addr; &ep->com.cm_id->remote_addr;
struct sockaddr_in *mapped_lsin = (struct sockaddr_in *) struct sockaddr_in *mapped_lsin = (struct sockaddr_in *)
&ep->com.mapped_local_addr; &ep->com.cm_id->m_local_addr;
struct sockaddr_in *mapped_rsin = (struct sockaddr_in *) struct sockaddr_in *mapped_rsin = (struct sockaddr_in *)
&ep->com.mapped_remote_addr; &ep->com.cm_id->m_remote_addr;
cc = snprintf(epd->buf + epd->pos, space, cc = snprintf(epd->buf + epd->pos, space,
"ep %p cm_id %p qp %p state %d flags 0x%lx " "ep %p cm_id %p qp %p state %d flags 0x%lx "
...@@ -569,13 +558,13 @@ static int dump_ep(int id, void *p, void *data) ...@@ -569,13 +558,13 @@ static int dump_ep(int id, void *p, void *data)
ntohs(mapped_rsin->sin_port)); ntohs(mapped_rsin->sin_port));
} else { } else {
struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)
&ep->com.local_addr; &ep->com.cm_id->local_addr;
struct sockaddr_in6 *rsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *rsin6 = (struct sockaddr_in6 *)
&ep->com.remote_addr; &ep->com.cm_id->remote_addr;
struct sockaddr_in6 *mapped_lsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *mapped_lsin6 = (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.cm_id->m_local_addr;
struct sockaddr_in6 *mapped_rsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *mapped_rsin6 = (struct sockaddr_in6 *)
&ep->com.mapped_remote_addr; &ep->com.cm_id->m_remote_addr;
cc = snprintf(epd->buf + epd->pos, space, cc = snprintf(epd->buf + epd->pos, space,
"ep %p cm_id %p qp %p state %d flags 0x%lx " "ep %p cm_id %p qp %p state %d flags 0x%lx "
...@@ -610,9 +599,9 @@ static int dump_listen_ep(int id, void *p, void *data) ...@@ -610,9 +599,9 @@ static int dump_listen_ep(int id, void *p, void *data)
if (ep->com.local_addr.ss_family == AF_INET) { if (ep->com.local_addr.ss_family == AF_INET) {
struct sockaddr_in *lsin = (struct sockaddr_in *) struct sockaddr_in *lsin = (struct sockaddr_in *)
&ep->com.local_addr; &ep->com.cm_id->local_addr;
struct sockaddr_in *mapped_lsin = (struct sockaddr_in *) struct sockaddr_in *mapped_lsin = (struct sockaddr_in *)
&ep->com.mapped_local_addr; &ep->com.cm_id->m_local_addr;
cc = snprintf(epd->buf + epd->pos, space, cc = snprintf(epd->buf + epd->pos, space,
"ep %p cm_id %p state %d flags 0x%lx stid %d " "ep %p cm_id %p state %d flags 0x%lx stid %d "
...@@ -623,9 +612,9 @@ static int dump_listen_ep(int id, void *p, void *data) ...@@ -623,9 +612,9 @@ static int dump_listen_ep(int id, void *p, void *data)
ntohs(mapped_lsin->sin_port)); ntohs(mapped_lsin->sin_port));
} else { } else {
struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)
&ep->com.local_addr; &ep->com.cm_id->local_addr;
struct sockaddr_in6 *mapped_lsin6 = (struct sockaddr_in6 *) struct sockaddr_in6 *mapped_lsin6 = (struct sockaddr_in6 *)
&ep->com.mapped_local_addr; &ep->com.cm_id->m_local_addr;
cc = snprintf(epd->buf + epd->pos, space, cc = snprintf(epd->buf + epd->pos, space,
"ep %p cm_id %p state %d flags 0x%lx stid %d " "ep %p cm_id %p state %d flags 0x%lx stid %d "
...@@ -1506,20 +1495,6 @@ static int __init c4iw_init_module(void) ...@@ -1506,20 +1495,6 @@ static int __init c4iw_init_module(void)
printk(KERN_WARNING MOD printk(KERN_WARNING MOD
"could not create debugfs entry, continuing\n"); "could not create debugfs entry, continuing\n");
if (ibnl_add_client(RDMA_NL_C4IW, RDMA_NL_IWPM_NUM_OPS,
c4iw_nl_cb_table))
pr_err("%s[%u]: Failed to add netlink callback\n"
, __func__, __LINE__);
err = iwpm_init(RDMA_NL_C4IW);
if (err) {
pr_err("port mapper initialization failed with %d\n", err);
ibnl_remove_client(RDMA_NL_C4IW);
c4iw_cm_term();
debugfs_remove_recursive(c4iw_debugfs_root);
return err;
}
cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info); cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info);
return 0; return 0;
...@@ -1537,8 +1512,6 @@ static void __exit c4iw_exit_module(void) ...@@ -1537,8 +1512,6 @@ static void __exit c4iw_exit_module(void)
} }
mutex_unlock(&dev_mutex); mutex_unlock(&dev_mutex);
cxgb4_unregister_uld(CXGB4_ULD_RDMA); cxgb4_unregister_uld(CXGB4_ULD_RDMA);
iwpm_exit(RDMA_NL_C4IW);
ibnl_remove_client(RDMA_NL_C4IW);
c4iw_cm_term(); c4iw_cm_term();
debugfs_remove_recursive(c4iw_debugfs_root); debugfs_remove_recursive(c4iw_debugfs_root);
} }
......
...@@ -753,7 +753,6 @@ enum c4iw_ep_flags { ...@@ -753,7 +753,6 @@ enum c4iw_ep_flags {
CLOSE_SENT = 3, CLOSE_SENT = 3,
TIMEOUT = 4, TIMEOUT = 4,
QP_REFERENCED = 5, QP_REFERENCED = 5,
RELEASE_MAPINFO = 6,
}; };
enum c4iw_ep_history { enum c4iw_ep_history {
...@@ -790,8 +789,6 @@ struct c4iw_ep_common { ...@@ -790,8 +789,6 @@ struct c4iw_ep_common {
struct mutex mutex; struct mutex mutex;
struct sockaddr_storage local_addr; struct sockaddr_storage local_addr;
struct sockaddr_storage remote_addr; struct sockaddr_storage remote_addr;
struct sockaddr_storage mapped_local_addr;
struct sockaddr_storage mapped_remote_addr;
struct c4iw_wr_wait wr_wait; struct c4iw_wr_wait wr_wait;
unsigned long flags; unsigned long flags;
unsigned long history; unsigned long history;
...@@ -843,45 +840,6 @@ struct c4iw_ep { ...@@ -843,45 +840,6 @@ struct c4iw_ep {
struct c4iw_ep_stats stats; struct c4iw_ep_stats stats;
}; };
static inline void print_addr(struct c4iw_ep_common *epc, const char *func,
const char *msg)
{
#define SINA(a) (&(((struct sockaddr_in *)(a))->sin_addr.s_addr))
#define SINP(a) ntohs(((struct sockaddr_in *)(a))->sin_port)
#define SIN6A(a) (&(((struct sockaddr_in6 *)(a))->sin6_addr))
#define SIN6P(a) ntohs(((struct sockaddr_in6 *)(a))->sin6_port)
if (c4iw_debug) {
switch (epc->local_addr.ss_family) {
case AF_INET:
PDBG("%s %s %pI4:%u/%u <-> %pI4:%u/%u\n",
func, msg, SINA(&epc->local_addr),
SINP(&epc->local_addr),
SINP(&epc->mapped_local_addr),
SINA(&epc->remote_addr),
SINP(&epc->remote_addr),
SINP(&epc->mapped_remote_addr));
break;
case AF_INET6:
PDBG("%s %s %pI6:%u/%u <-> %pI6:%u/%u\n",
func, msg, SIN6A(&epc->local_addr),
SIN6P(&epc->local_addr),
SIN6P(&epc->mapped_local_addr),
SIN6A(&epc->remote_addr),
SIN6P(&epc->remote_addr),
SIN6P(&epc->mapped_remote_addr));
break;
default:
break;
}
}
#undef SINA
#undef SINP
#undef SIN6A
#undef SIN6P
}
static inline struct c4iw_ep *to_ep(struct iw_cm_id *cm_id) static inline struct c4iw_ep *to_ep(struct iw_cm_id *cm_id)
{ {
return cm_id->provider_data; return cm_id->provider_data;
......
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