Merge branches 'nes', 'cxgb4' and 'iwpm' into k.o/for-4.6
This commit is contained in:
commit
082eaa5083
@ -50,6 +50,8 @@
|
||||
|
||||
#include <rdma/iw_cm.h>
|
||||
#include <rdma/ib_addr.h>
|
||||
#include <rdma/iw_portmap.h>
|
||||
#include <rdma/rdma_netlink.h>
|
||||
|
||||
#include "iwcm.h"
|
||||
|
||||
@ -57,6 +59,16 @@ MODULE_AUTHOR("Tom Tucker");
|
||||
MODULE_DESCRIPTION("iWARP CM");
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
|
||||
static struct ibnl_client_cbs iwcm_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_REMOTE_INFO] = {.dump = iwpm_remote_info_cb},
|
||||
[RDMA_NL_IWPM_HANDLE_ERR] = {.dump = iwpm_mapping_error_cb},
|
||||
[RDMA_NL_IWPM_MAPINFO] = {.dump = iwpm_mapping_info_cb},
|
||||
[RDMA_NL_IWPM_MAPINFO_NUM] = {.dump = iwpm_ack_mapping_info_cb}
|
||||
};
|
||||
|
||||
static struct workqueue_struct *iwcm_wq;
|
||||
struct iwcm_work {
|
||||
struct work_struct work;
|
||||
@ -402,6 +414,11 @@ static void destroy_cm_id(struct iw_cm_id *cm_id)
|
||||
}
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
|
||||
if (cm_id->mapped) {
|
||||
iwpm_remove_mapinfo(&cm_id->local_addr, &cm_id->m_local_addr);
|
||||
iwpm_remove_mapping(&cm_id->local_addr, RDMA_NL_IWCM);
|
||||
}
|
||||
|
||||
(void)iwcm_deref_id(cm_id_priv);
|
||||
}
|
||||
|
||||
@ -426,6 +443,97 @@ void iw_destroy_cm_id(struct iw_cm_id *cm_id)
|
||||
}
|
||||
EXPORT_SYMBOL(iw_destroy_cm_id);
|
||||
|
||||
/**
|
||||
* iw_cm_check_wildcard - If IP address is 0 then use original
|
||||
* @pm_addr: sockaddr containing the ip to check for wildcard
|
||||
* @cm_addr: sockaddr containing the actual IP address
|
||||
* @cm_outaddr: sockaddr to set IP addr which leaving port
|
||||
*
|
||||
* Checks the pm_addr for wildcard and then sets cm_outaddr's
|
||||
* IP to the actual (cm_addr).
|
||||
*/
|
||||
static void iw_cm_check_wildcard(struct sockaddr_storage *pm_addr,
|
||||
struct sockaddr_storage *cm_addr,
|
||||
struct sockaddr_storage *cm_outaddr)
|
||||
{
|
||||
if (pm_addr->ss_family == AF_INET) {
|
||||
struct sockaddr_in *pm4_addr = (struct sockaddr_in *)pm_addr;
|
||||
|
||||
if (pm4_addr->sin_addr.s_addr == INADDR_ANY) {
|
||||
struct sockaddr_in *cm4_addr =
|
||||
(struct sockaddr_in *)cm_addr;
|
||||
struct sockaddr_in *cm4_outaddr =
|
||||
(struct sockaddr_in *)cm_outaddr;
|
||||
|
||||
cm4_outaddr->sin_addr = cm4_addr->sin_addr;
|
||||
}
|
||||
} else {
|
||||
struct sockaddr_in6 *pm6_addr = (struct sockaddr_in6 *)pm_addr;
|
||||
|
||||
if (ipv6_addr_type(&pm6_addr->sin6_addr) == IPV6_ADDR_ANY) {
|
||||
struct sockaddr_in6 *cm6_addr =
|
||||
(struct sockaddr_in6 *)cm_addr;
|
||||
struct sockaddr_in6 *cm6_outaddr =
|
||||
(struct sockaddr_in6 *)cm_outaddr;
|
||||
|
||||
cm6_outaddr->sin6_addr = cm6_addr->sin6_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* iw_cm_map - Use portmapper to map the ports
|
||||
* @cm_id: connection manager pointer
|
||||
* @active: Indicates the active side when true
|
||||
* returns nonzero for error only if iwpm_create_mapinfo() fails
|
||||
*
|
||||
* Tries to add a mapping for a port using the Portmapper. If
|
||||
* successful in mapping the IP/Port it will check the remote
|
||||
* mapped IP address for a wildcard IP address and replace the
|
||||
* zero IP address with the remote_addr.
|
||||
*/
|
||||
static int iw_cm_map(struct iw_cm_id *cm_id, bool active)
|
||||
{
|
||||
struct iwpm_dev_data pm_reg_msg;
|
||||
struct iwpm_sa_data pm_msg;
|
||||
int status;
|
||||
|
||||
cm_id->m_local_addr = cm_id->local_addr;
|
||||
cm_id->m_remote_addr = cm_id->remote_addr;
|
||||
|
||||
memcpy(pm_reg_msg.dev_name, cm_id->device->name,
|
||||
sizeof(pm_reg_msg.dev_name));
|
||||
memcpy(pm_reg_msg.if_name, cm_id->device->iwcm->ifname,
|
||||
sizeof(pm_reg_msg.if_name));
|
||||
|
||||
if (iwpm_register_pid(&pm_reg_msg, RDMA_NL_IWCM) ||
|
||||
!iwpm_valid_pid())
|
||||
return 0;
|
||||
|
||||
cm_id->mapped = true;
|
||||
pm_msg.loc_addr = cm_id->local_addr;
|
||||
pm_msg.rem_addr = cm_id->remote_addr;
|
||||
if (active)
|
||||
status = iwpm_add_and_query_mapping(&pm_msg,
|
||||
RDMA_NL_IWCM);
|
||||
else
|
||||
status = iwpm_add_mapping(&pm_msg, RDMA_NL_IWCM);
|
||||
|
||||
if (!status) {
|
||||
cm_id->m_local_addr = pm_msg.mapped_loc_addr;
|
||||
if (active) {
|
||||
cm_id->m_remote_addr = pm_msg.mapped_rem_addr;
|
||||
iw_cm_check_wildcard(&pm_msg.mapped_rem_addr,
|
||||
&cm_id->remote_addr,
|
||||
&cm_id->m_remote_addr);
|
||||
}
|
||||
}
|
||||
|
||||
return iwpm_create_mapinfo(&cm_id->local_addr,
|
||||
&cm_id->m_local_addr,
|
||||
RDMA_NL_IWCM);
|
||||
}
|
||||
|
||||
/*
|
||||
* CM_ID <-- LISTEN
|
||||
*
|
||||
@ -452,7 +560,9 @@ int iw_cm_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
case IW_CM_STATE_IDLE:
|
||||
cm_id_priv->state = IW_CM_STATE_LISTEN;
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
ret = cm_id->device->iwcm->create_listen(cm_id, backlog);
|
||||
ret = iw_cm_map(cm_id, false);
|
||||
if (!ret)
|
||||
ret = cm_id->device->iwcm->create_listen(cm_id, backlog);
|
||||
if (ret)
|
||||
cm_id_priv->state = IW_CM_STATE_IDLE;
|
||||
spin_lock_irqsave(&cm_id_priv->lock, flags);
|
||||
@ -582,39 +692,37 @@ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param)
|
||||
spin_lock_irqsave(&cm_id_priv->lock, flags);
|
||||
|
||||
if (cm_id_priv->state != IW_CM_STATE_IDLE) {
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
|
||||
wake_up_all(&cm_id_priv->connect_wait);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Get the ib_qp given the QPN */
|
||||
qp = cm_id->device->iwcm->get_qp(cm_id->device, iw_param->qpn);
|
||||
if (!qp) {
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
|
||||
wake_up_all(&cm_id_priv->connect_wait);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
cm_id->device->iwcm->add_ref(qp);
|
||||
cm_id_priv->qp = qp;
|
||||
cm_id_priv->state = IW_CM_STATE_CONN_SENT;
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
|
||||
ret = cm_id->device->iwcm->connect(cm_id, iw_param);
|
||||
if (ret) {
|
||||
spin_lock_irqsave(&cm_id_priv->lock, flags);
|
||||
if (cm_id_priv->qp) {
|
||||
cm_id->device->iwcm->rem_ref(qp);
|
||||
cm_id_priv->qp = NULL;
|
||||
}
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_SENT);
|
||||
cm_id_priv->state = IW_CM_STATE_IDLE;
|
||||
clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
|
||||
wake_up_all(&cm_id_priv->connect_wait);
|
||||
}
|
||||
ret = iw_cm_map(cm_id, true);
|
||||
if (!ret)
|
||||
ret = cm_id->device->iwcm->connect(cm_id, iw_param);
|
||||
if (!ret)
|
||||
return 0; /* success */
|
||||
|
||||
spin_lock_irqsave(&cm_id_priv->lock, flags);
|
||||
if (cm_id_priv->qp) {
|
||||
cm_id->device->iwcm->rem_ref(qp);
|
||||
cm_id_priv->qp = NULL;
|
||||
}
|
||||
cm_id_priv->state = IW_CM_STATE_IDLE;
|
||||
err:
|
||||
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
|
||||
clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
|
||||
wake_up_all(&cm_id_priv->connect_wait);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(iw_cm_connect);
|
||||
@ -656,8 +764,23 @@ static void cm_conn_req_handler(struct iwcm_id_private *listen_id_priv,
|
||||
goto out;
|
||||
|
||||
cm_id->provider_data = iw_event->provider_data;
|
||||
cm_id->local_addr = iw_event->local_addr;
|
||||
cm_id->remote_addr = iw_event->remote_addr;
|
||||
cm_id->m_local_addr = iw_event->local_addr;
|
||||
cm_id->m_remote_addr = iw_event->remote_addr;
|
||||
cm_id->local_addr = listen_id_priv->id.local_addr;
|
||||
|
||||
ret = iwpm_get_remote_info(&listen_id_priv->id.m_local_addr,
|
||||
&iw_event->remote_addr,
|
||||
&cm_id->remote_addr,
|
||||
RDMA_NL_IWCM);
|
||||
if (ret) {
|
||||
cm_id->remote_addr = iw_event->remote_addr;
|
||||
} else {
|
||||
iw_cm_check_wildcard(&listen_id_priv->id.m_local_addr,
|
||||
&iw_event->local_addr,
|
||||
&cm_id->local_addr);
|
||||
iw_event->local_addr = cm_id->local_addr;
|
||||
iw_event->remote_addr = cm_id->remote_addr;
|
||||
}
|
||||
|
||||
cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
|
||||
cm_id_priv->state = IW_CM_STATE_CONN_RECV;
|
||||
@ -753,8 +876,10 @@ static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv,
|
||||
clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags);
|
||||
BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_SENT);
|
||||
if (iw_event->status == 0) {
|
||||
cm_id_priv->id.local_addr = iw_event->local_addr;
|
||||
cm_id_priv->id.remote_addr = iw_event->remote_addr;
|
||||
cm_id_priv->id.m_local_addr = iw_event->local_addr;
|
||||
cm_id_priv->id.m_remote_addr = iw_event->remote_addr;
|
||||
iw_event->local_addr = cm_id_priv->id.local_addr;
|
||||
iw_event->remote_addr = cm_id_priv->id.remote_addr;
|
||||
cm_id_priv->state = IW_CM_STATE_ESTABLISHED;
|
||||
} else {
|
||||
/* REJECTED or RESET */
|
||||
@ -1044,6 +1169,17 @@ EXPORT_SYMBOL(iw_cm_init_qp_attr);
|
||||
|
||||
static int __init iw_cm_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = iwpm_init(RDMA_NL_IWCM);
|
||||
if (ret)
|
||||
pr_err("iw_cm: couldn't init iwpm\n");
|
||||
|
||||
ret = ibnl_add_client(RDMA_NL_IWCM, RDMA_NL_IWPM_NUM_OPS,
|
||||
iwcm_nl_cb_table);
|
||||
if (ret)
|
||||
pr_err("iw_cm: couldn't register netlink callbacks\n");
|
||||
|
||||
iwcm_wq = create_singlethread_workqueue("iw_cm_wq");
|
||||
if (!iwcm_wq)
|
||||
return -ENOMEM;
|
||||
@ -1063,6 +1199,8 @@ static void __exit iw_cm_cleanup(void)
|
||||
{
|
||||
unregister_net_sysctl_table(iwcm_ctl_table_hdr);
|
||||
destroy_workqueue(iwcm_wq);
|
||||
ibnl_remove_client(RDMA_NL_IWCM);
|
||||
iwpm_exit(RDMA_NL_IWCM);
|
||||
}
|
||||
|
||||
module_init(iw_cm_init);
|
||||
|
@ -88,8 +88,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
|
||||
ret = ibnl_put_attr(skb, nlh, sizeof(u32), &msg_seq, IWPM_NLA_REG_PID_SEQ);
|
||||
if (ret)
|
||||
goto pid_query_error;
|
||||
ret = ibnl_put_attr(skb, nlh, IWPM_IFNAME_SIZE,
|
||||
pm_msg->if_name, IWPM_NLA_REG_IF_NAME);
|
||||
ret = ibnl_put_attr(skb, nlh, IFNAMSIZ,
|
||||
pm_msg->if_name, IWPM_NLA_REG_IF_NAME);
|
||||
if (ret)
|
||||
goto pid_query_error;
|
||||
ret = ibnl_put_attr(skb, nlh, IWPM_DEVNAME_SIZE,
|
||||
@ -394,7 +394,7 @@ register_pid_response_exit:
|
||||
/* always for found nlmsg_request */
|
||||
kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request);
|
||||
barrier();
|
||||
wake_up(&nlmsg_request->waitq);
|
||||
up(&nlmsg_request->sem);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwpm_register_pid_cb);
|
||||
@ -463,7 +463,7 @@ add_mapping_response_exit:
|
||||
/* always for found request */
|
||||
kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request);
|
||||
barrier();
|
||||
wake_up(&nlmsg_request->waitq);
|
||||
up(&nlmsg_request->sem);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwpm_add_mapping_cb);
|
||||
@ -555,7 +555,7 @@ query_mapping_response_exit:
|
||||
/* always for found request */
|
||||
kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request);
|
||||
barrier();
|
||||
wake_up(&nlmsg_request->waitq);
|
||||
up(&nlmsg_request->sem);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwpm_add_and_query_mapping_cb);
|
||||
@ -749,7 +749,7 @@ int iwpm_mapping_error_cb(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
/* always for found request */
|
||||
kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request);
|
||||
barrier();
|
||||
wake_up(&nlmsg_request->waitq);
|
||||
up(&nlmsg_request->sem);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(iwpm_mapping_error_cb);
|
||||
|
@ -254,9 +254,9 @@ void iwpm_add_remote_info(struct iwpm_remote_info *rem_info)
|
||||
}
|
||||
|
||||
int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
|
||||
struct sockaddr_storage *mapped_rem_addr,
|
||||
struct sockaddr_storage *remote_addr,
|
||||
u8 nl_client)
|
||||
struct sockaddr_storage *mapped_rem_addr,
|
||||
struct sockaddr_storage *remote_addr,
|
||||
u8 nl_client)
|
||||
{
|
||||
struct hlist_node *tmp_hlist_node;
|
||||
struct hlist_head *hash_bucket_head;
|
||||
@ -322,6 +322,8 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
|
||||
nlmsg_request->nl_client = nl_client;
|
||||
nlmsg_request->request_done = 0;
|
||||
nlmsg_request->err_code = 0;
|
||||
sema_init(&nlmsg_request->sem, 1);
|
||||
down(&nlmsg_request->sem);
|
||||
return nlmsg_request;
|
||||
}
|
||||
|
||||
@ -364,11 +366,9 @@ struct iwpm_nlmsg_request *iwpm_find_nlmsg_request(__u32 echo_seq)
|
||||
int iwpm_wait_complete_req(struct iwpm_nlmsg_request *nlmsg_request)
|
||||
{
|
||||
int ret;
|
||||
init_waitqueue_head(&nlmsg_request->waitq);
|
||||
|
||||
ret = wait_event_timeout(nlmsg_request->waitq,
|
||||
(nlmsg_request->request_done != 0), IWPM_NL_TIMEOUT);
|
||||
if (!ret) {
|
||||
ret = down_timeout(&nlmsg_request->sem, IWPM_NL_TIMEOUT);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
pr_info("%s: Timeout %d sec for netlink request (seq = %u)\n",
|
||||
__func__, (IWPM_NL_TIMEOUT/HZ), nlmsg_request->nlmsg_seq);
|
||||
|
@ -69,7 +69,7 @@ struct iwpm_nlmsg_request {
|
||||
u8 nl_client;
|
||||
u8 request_done;
|
||||
u16 err_code;
|
||||
wait_queue_head_t waitq;
|
||||
struct semaphore sem;
|
||||
struct kref kref;
|
||||
};
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ err:
|
||||
static int is_loopback_dst(struct iw_cm_id *cm_id)
|
||||
{
|
||||
struct net_device *dev;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
|
||||
dev = ip_dev_find(&init_net, raddr->sin_addr.s_addr);
|
||||
if (!dev)
|
||||
@ -1892,10 +1892,10 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
struct iwch_ep *ep;
|
||||
struct rtable *rt;
|
||||
int err = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
|
||||
if (cm_id->remote_addr.ss_family != PF_INET) {
|
||||
if (cm_id->m_remote_addr.ss_family != PF_INET) {
|
||||
err = -ENOSYS;
|
||||
goto out;
|
||||
}
|
||||
@ -1961,9 +1961,9 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
|
||||
state_set(&ep->com, CONNECTING);
|
||||
ep->tos = IPTOS_LOWDELAY;
|
||||
memcpy(&ep->com.local_addr, &cm_id->local_addr,
|
||||
memcpy(&ep->com.local_addr, &cm_id->m_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));
|
||||
|
||||
/* send connect request to rnic */
|
||||
@ -1992,7 +1992,7 @@ int iwch_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
|
||||
might_sleep();
|
||||
|
||||
if (cm_id->local_addr.ss_family != PF_INET) {
|
||||
if (cm_id->m_local_addr.ss_family != PF_INET) {
|
||||
err = -ENOSYS;
|
||||
goto fail1;
|
||||
}
|
||||
@ -2008,7 +2008,7 @@ int iwch_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
cm_id->add_ref(cm_id);
|
||||
ep->com.cm_id = cm_id;
|
||||
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));
|
||||
|
||||
/*
|
||||
|
@ -302,7 +302,7 @@ void _c4iw_free_ep(struct kref *kref)
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 =
|
||||
(struct sockaddr_in6 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
|
||||
cxgb4_clip_release(
|
||||
ep->com.dev->rdev.lldi.ports[0],
|
||||
@ -314,12 +314,6 @@ void _c4iw_free_ep(struct kref *kref)
|
||||
dst_release(ep->dst);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -455,7 +449,7 @@ static void act_open_req_arp_failure(void *handle, struct sk_buff *skb)
|
||||
state_set(&ep->com, DEAD);
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
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],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
|
||||
}
|
||||
@ -485,12 +479,19 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
unsigned int flowclen = 80;
|
||||
struct fw_flowc_wr *flowc;
|
||||
int i;
|
||||
u16 vlan = ep->l2t->vlan;
|
||||
int nparams;
|
||||
|
||||
if (vlan == CPL_L2T_VLAN_NONE)
|
||||
nparams = 8;
|
||||
else
|
||||
nparams = 9;
|
||||
|
||||
skb = get_skb(skb, flowclen, GFP_KERNEL);
|
||||
flowc = (struct fw_flowc_wr *)__skb_put(skb, flowclen);
|
||||
|
||||
flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
|
||||
FW_FLOWC_WR_NPARAMS_V(8));
|
||||
FW_FLOWC_WR_NPARAMS_V(nparams));
|
||||
flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(DIV_ROUND_UP(flowclen,
|
||||
16)) | FW_WR_FLOWID_V(ep->hwtid));
|
||||
|
||||
@ -511,9 +512,17 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb)
|
||||
flowc->mnemval[6].val = cpu_to_be32(ep->snd_win);
|
||||
flowc->mnemval[7].mnemonic = FW_FLOWC_MNEM_MSS;
|
||||
flowc->mnemval[7].val = cpu_to_be32(ep->emss);
|
||||
/* Pad WR to 16 byte boundary */
|
||||
flowc->mnemval[8].mnemonic = 0;
|
||||
flowc->mnemval[8].val = 0;
|
||||
if (nparams == 9) {
|
||||
u16 pri;
|
||||
|
||||
pri = (vlan & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
|
||||
flowc->mnemval[8].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
|
||||
flowc->mnemval[8].val = cpu_to_be32(pri);
|
||||
} else {
|
||||
/* Pad WR to 16 byte boundary */
|
||||
flowc->mnemval[8].mnemonic = 0;
|
||||
flowc->mnemval[8].val = 0;
|
||||
}
|
||||
for (i = 0; i < 9; i++) {
|
||||
flowc->mnemval[i].r4[0] = 0;
|
||||
flowc->mnemval[i].r4[1] = 0;
|
||||
@ -568,54 +577,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);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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,
|
||||
unsigned int *idx, int use_ts, int ipv6)
|
||||
{
|
||||
@ -645,13 +606,13 @@ static int send_connect(struct c4iw_ep *ep)
|
||||
int wscale;
|
||||
int win, sizev4, sizev6, wrlen;
|
||||
struct sockaddr_in *la = (struct sockaddr_in *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
struct sockaddr_in *ra = (struct sockaddr_in *)
|
||||
&ep->com.mapped_remote_addr;
|
||||
&ep->com.remote_addr;
|
||||
struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)
|
||||
&ep->com.mapped_remote_addr;
|
||||
&ep->com.remote_addr;
|
||||
int ret;
|
||||
enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type;
|
||||
u32 isn = (prandom_u32() & ~7UL) - 1;
|
||||
@ -710,7 +671,7 @@ static int send_connect(struct c4iw_ep *ep)
|
||||
L2T_IDX_V(ep->l2t->idx) |
|
||||
TX_CHAN_V(ep->tx_chan) |
|
||||
SMAC_SEL_V(ep->smac_idx) |
|
||||
DSCP_V(ep->tos) |
|
||||
DSCP_V(ep->tos >> 2) |
|
||||
ULP_MODE_V(ULP_MODE_TCPDDP) |
|
||||
RCV_BUFSIZ_V(win);
|
||||
opt2 = RX_CHANNEL_V(0) |
|
||||
@ -1829,10 +1790,10 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
|
||||
req->le.filter = cpu_to_be32(cxgb4_select_ntuple(
|
||||
ep->com.dev->rdev.lldi.ports[0],
|
||||
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.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.u.ipv4.pip = sin->sin_addr.s_addr;
|
||||
req->tcb.t_state_to_astid =
|
||||
@ -1864,7 +1825,7 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
|
||||
L2T_IDX_V(ep->l2t->idx) |
|
||||
TX_CHAN_V(ep->tx_chan) |
|
||||
SMAC_SEL_V(ep->smac_idx) |
|
||||
DSCP_V(ep->tos) |
|
||||
DSCP_V(ep->tos >> 2) |
|
||||
ULP_MODE_V(ULP_MODE_TCPDDP) |
|
||||
RCV_BUFSIZ_V(win));
|
||||
req->tcb.opt2 = (__force __be32) (PACE_V(1) |
|
||||
@ -1928,7 +1889,7 @@ static void set_tcp_window(struct c4iw_ep *ep, struct port_info *pi)
|
||||
|
||||
static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip,
|
||||
struct dst_entry *dst, struct c4iw_dev *cdev,
|
||||
bool clear_mpa_v1, enum chip_type adapter_type)
|
||||
bool clear_mpa_v1, enum chip_type adapter_type, u8 tos)
|
||||
{
|
||||
struct neighbour *n;
|
||||
int err, step;
|
||||
@ -1958,7 +1919,7 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip,
|
||||
goto out;
|
||||
}
|
||||
ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t,
|
||||
n, pdev, 0);
|
||||
n, pdev, rt_tos2priority(tos));
|
||||
if (!ep->l2t)
|
||||
goto out;
|
||||
ep->mtu = pdev->mtu;
|
||||
@ -2013,13 +1974,13 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
|
||||
{
|
||||
int err = 0;
|
||||
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 *)
|
||||
&ep->com.cm_id->remote_addr;
|
||||
&ep->com.cm_id->m_remote_addr;
|
||||
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 *)
|
||||
&ep->com.cm_id->remote_addr;
|
||||
&ep->com.cm_id->m_remote_addr;
|
||||
int iptype;
|
||||
__u8 *ra;
|
||||
|
||||
@ -2038,10 +1999,10 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
|
||||
insert_handle(ep->com.dev, &ep->com.dev->atid_idr, ep, ep->atid);
|
||||
|
||||
/* 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,
|
||||
raddr->sin_addr.s_addr, laddr->sin_port,
|
||||
raddr->sin_port, 0);
|
||||
raddr->sin_port, ep->com.cm_id->tos);
|
||||
iptype = 4;
|
||||
ra = (__u8 *)&raddr->sin_addr;
|
||||
} else {
|
||||
@ -2058,7 +2019,8 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
|
||||
goto fail3;
|
||||
}
|
||||
err = import_ep(ep, iptype, ra, ep->dst, ep->com.dev, false,
|
||||
ep->com.dev->rdev.lldi.adapter_type);
|
||||
ep->com.dev->rdev.lldi.adapter_type,
|
||||
ep->com.cm_id->tos);
|
||||
if (err) {
|
||||
pr_err("%s - cannot alloc l2e.\n", __func__);
|
||||
goto fail4;
|
||||
@ -2069,7 +2031,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
|
||||
ep->l2t->idx);
|
||||
|
||||
state_set(&ep->com, CONNECTING);
|
||||
ep->tos = 0;
|
||||
ep->tos = ep->com.cm_id->tos;
|
||||
|
||||
/* send connect request to rnic */
|
||||
err = send_connect(ep);
|
||||
@ -2109,10 +2071,10 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
struct sockaddr_in6 *ra6;
|
||||
|
||||
ep = lookup_atid(t, atid);
|
||||
la = (struct sockaddr_in *)&ep->com.mapped_local_addr;
|
||||
ra = (struct sockaddr_in *)&ep->com.mapped_remote_addr;
|
||||
la6 = (struct sockaddr_in6 *)&ep->com.mapped_local_addr;
|
||||
ra6 = (struct sockaddr_in6 *)&ep->com.mapped_remote_addr;
|
||||
la = (struct sockaddr_in *)&ep->com.local_addr;
|
||||
ra = (struct sockaddr_in *)&ep->com.remote_addr;
|
||||
la6 = (struct sockaddr_in6 *)&ep->com.local_addr;
|
||||
ra6 = (struct sockaddr_in6 *)&ep->com.remote_addr;
|
||||
|
||||
PDBG("%s ep %p atid %u status %u errno %d\n", __func__, ep, atid,
|
||||
status, status2errno(status));
|
||||
@ -2154,7 +2116,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 =
|
||||
(struct sockaddr_in6 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
cxgb4_clip_release(
|
||||
ep->com.dev->rdev.lldi.ports[0],
|
||||
(const u32 *)
|
||||
@ -2189,7 +2151,7 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
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],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
|
||||
}
|
||||
@ -2391,6 +2353,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
u16 peer_mss = ntohs(req->tcpopt.mss);
|
||||
int iptype;
|
||||
unsigned short hdrs;
|
||||
u8 tos = PASS_OPEN_TOS_G(ntohl(req->tos_stid));
|
||||
|
||||
parent_ep = lookup_stid(t, stid);
|
||||
if (!parent_ep) {
|
||||
@ -2399,8 +2362,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
if (state_read(&parent_ep->com) != LISTEN) {
|
||||
printk(KERN_ERR "%s - listening ep not in LISTEN\n",
|
||||
__func__);
|
||||
PDBG("%s - listening ep not in LISTEN\n", __func__);
|
||||
goto reject;
|
||||
}
|
||||
|
||||
@ -2415,7 +2377,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
ntohs(peer_port), peer_mss);
|
||||
dst = find_route(dev, *(__be32 *)local_ip, *(__be32 *)peer_ip,
|
||||
local_port, peer_port,
|
||||
PASS_OPEN_TOS_G(ntohl(req->tos_stid)));
|
||||
tos);
|
||||
} else {
|
||||
PDBG("%s parent ep %p hwtid %u laddr %pI6 raddr %pI6 lport %d rport %d peer_mss %d\n"
|
||||
, __func__, parent_ep, hwtid,
|
||||
@ -2441,7 +2403,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
err = import_ep(child_ep, iptype, peer_ip, dst, dev, false,
|
||||
parent_ep->com.dev->rdev.lldi.adapter_type);
|
||||
parent_ep->com.dev->rdev.lldi.adapter_type, tos);
|
||||
if (err) {
|
||||
printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
|
||||
__func__);
|
||||
@ -2459,18 +2421,9 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
child_ep->com.dev = dev;
|
||||
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) {
|
||||
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_port = local_port;
|
||||
@ -2482,12 +2435,12 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
&parent_ep->com.local_addr)->sin_port;
|
||||
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_port = peer_port;
|
||||
sin->sin_addr.s_addr = *(__be32 *)peer_ip;
|
||||
} 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_port = local_port;
|
||||
memcpy(sin6->sin6_addr.s6_addr, local_ip, 16);
|
||||
@ -2498,18 +2451,15 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
&parent_ep->com.local_addr)->sin6_port;
|
||||
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_port = peer_port;
|
||||
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);
|
||||
child_ep->parent_ep = parent_ep;
|
||||
child_ep->tos = PASS_OPEN_TOS_G(ntohl(req->tos_stid));
|
||||
child_ep->tos = tos;
|
||||
child_ep->dst = dst;
|
||||
child_ep->hwtid = hwtid;
|
||||
|
||||
@ -2522,7 +2472,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
|
||||
accept_cr(child_ep, skb, req);
|
||||
set_bit(PASS_ACCEPT_REQ, &child_ep->com.history);
|
||||
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],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
|
||||
}
|
||||
@ -2765,7 +2715,7 @@ out:
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 =
|
||||
(struct sockaddr_in6 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
cxgb4_clip_release(
|
||||
ep->com.dev->rdev.lldi.ports[0],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr,
|
||||
@ -3026,8 +2976,8 @@ static int pick_local_ipaddrs(struct c4iw_dev *dev, struct iw_cm_id *cm_id)
|
||||
{
|
||||
struct in_device *ind;
|
||||
int found = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
|
||||
ind = in_dev_get(dev->rdev.lldi.ports[0]);
|
||||
if (!ind)
|
||||
@ -3072,8 +3022,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)
|
||||
{
|
||||
struct in6_addr uninitialized_var(addr);
|
||||
struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)&cm_id->local_addr;
|
||||
struct sockaddr_in6 *ra6 = (struct sockaddr_in6 *)&cm_id->remote_addr;
|
||||
struct sockaddr_in6 *la6 = (struct sockaddr_in6 *)&cm_id->m_local_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)) {
|
||||
memcpy(la6->sin6_addr.s6_addr, &addr, 16);
|
||||
@ -3092,11 +3042,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
struct sockaddr_in *raddr;
|
||||
struct sockaddr_in6 *laddr6;
|
||||
struct sockaddr_in6 *raddr6;
|
||||
struct iwpm_dev_data pm_reg_msg;
|
||||
struct iwpm_sa_data pm_msg;
|
||||
__u8 *ra;
|
||||
int iptype;
|
||||
int iwpm_err = 0;
|
||||
|
||||
if ((conn_param->ord > cur_max_read_depth(dev)) ||
|
||||
(conn_param->ird > cur_max_read_depth(dev))) {
|
||||
@ -3144,47 +3091,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);
|
||||
|
||||
memcpy(&ep->com.local_addr, &cm_id->local_addr,
|
||||
memcpy(&ep->com.local_addr, &cm_id->m_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));
|
||||
|
||||
/* No port mapper available, go with the specified peer information */
|
||||
memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr,
|
||||
sizeof(ep->com.mapped_local_addr));
|
||||
memcpy(&ep->com.mapped_remote_addr, &cm_id->remote_addr,
|
||||
sizeof(ep->com.mapped_remote_addr));
|
||||
laddr = (struct sockaddr_in *)&ep->com.local_addr;
|
||||
raddr = (struct sockaddr_in *)&ep->com.remote_addr;
|
||||
laddr6 = (struct sockaddr_in6 *)&ep->com.local_addr;
|
||||
raddr6 = (struct sockaddr_in6 *) &ep->com.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;
|
||||
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) {
|
||||
if (cm_id->m_remote_addr.ss_family == AF_INET) {
|
||||
iptype = 4;
|
||||
ra = (__u8 *)&raddr->sin_addr;
|
||||
|
||||
@ -3203,7 +3120,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
ra, ntohs(raddr->sin_port));
|
||||
ep->dst = find_route(dev, laddr->sin_addr.s_addr,
|
||||
raddr->sin_addr.s_addr, laddr->sin_port,
|
||||
raddr->sin_port, 0);
|
||||
raddr->sin_port, cm_id->tos);
|
||||
} else {
|
||||
iptype = 6;
|
||||
ra = (__u8 *)&raddr6->sin6_addr;
|
||||
@ -3234,7 +3151,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
}
|
||||
|
||||
err = import_ep(ep, iptype, ra, ep->dst, ep->com.dev, true,
|
||||
ep->com.dev->rdev.lldi.adapter_type);
|
||||
ep->com.dev->rdev.lldi.adapter_type, cm_id->tos);
|
||||
if (err) {
|
||||
printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
|
||||
goto fail3;
|
||||
@ -3245,7 +3162,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
ep->l2t->idx);
|
||||
|
||||
state_set(&ep->com, CONNECTING);
|
||||
ep->tos = 0;
|
||||
ep->tos = cm_id->tos;
|
||||
|
||||
/* send connect request to rnic */
|
||||
err = send_connect(ep);
|
||||
@ -3269,7 +3186,7 @@ static int create_server6(struct c4iw_dev *dev, struct c4iw_listen_ep *ep)
|
||||
{
|
||||
int err;
|
||||
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) {
|
||||
err = cxgb4_clip_get(ep->com.dev->rdev.lldi.ports[0],
|
||||
@ -3302,7 +3219,7 @@ static int create_server4(struct c4iw_dev *dev, struct c4iw_listen_ep *ep)
|
||||
{
|
||||
int err;
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.local_addr;
|
||||
|
||||
if (dev->rdev.lldi.enable_fw_ofld_conn) {
|
||||
do {
|
||||
@ -3343,9 +3260,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
int err = 0;
|
||||
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
|
||||
struct c4iw_listen_ep *ep;
|
||||
struct iwpm_dev_data pm_reg_msg;
|
||||
struct iwpm_sa_data pm_msg;
|
||||
int iwpm_err = 0;
|
||||
|
||||
might_sleep();
|
||||
|
||||
@ -3360,7 +3274,7 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
ep->com.cm_id = cm_id;
|
||||
ep->com.dev = dev;
|
||||
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));
|
||||
|
||||
/*
|
||||
@ -3369,10 +3283,10 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
if (dev->rdev.lldi.enable_fw_ofld_conn &&
|
||||
ep->com.local_addr.ss_family == AF_INET)
|
||||
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
|
||||
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) {
|
||||
printk(KERN_ERR MOD "%s - cannot alloc stid.\n", __func__);
|
||||
@ -3381,36 +3295,9 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
}
|
||||
insert_handle(dev, &dev->stid_idr, ep, ep->stid);
|
||||
|
||||
/* No port mapper available, go with the specified info */
|
||||
memcpy(&ep->com.mapped_local_addr, &cm_id->local_addr,
|
||||
sizeof(ep->com.mapped_local_addr));
|
||||
memcpy(&ep->com.local_addr, &cm_id->m_local_addr,
|
||||
sizeof(ep->com.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);
|
||||
if (ep->com.local_addr.ss_family == AF_INET)
|
||||
err = create_server4(dev, ep);
|
||||
@ -3421,7 +3308,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
goto out;
|
||||
}
|
||||
|
||||
fail3:
|
||||
cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid,
|
||||
ep->com.local_addr.ss_family);
|
||||
fail2:
|
||||
@ -3456,7 +3342,7 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id)
|
||||
goto done;
|
||||
err = c4iw_wait_for_reply(&ep->com.dev->rdev, &ep->com.wr_wait,
|
||||
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],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
|
||||
}
|
||||
@ -3580,7 +3466,7 @@ static void active_ofld_conn_reply(struct c4iw_dev *dev, struct sk_buff *skb,
|
||||
state_set(&ep->com, DEAD);
|
||||
if (ep->com.remote_addr.ss_family == AF_INET6) {
|
||||
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],
|
||||
(const u32 *)&sin6->sin6_addr.s6_addr, 1);
|
||||
}
|
||||
|
@ -87,17 +87,6 @@ struct c4iw_debugfs_data {
|
||||
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)
|
||||
{
|
||||
int *countp = data;
|
||||
@ -242,13 +231,13 @@ static int dump_qp(int id, void *p, void *data)
|
||||
if (qp->ep) {
|
||||
if (qp->ep->com.local_addr.ss_family == AF_INET) {
|
||||
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 *)
|
||||
&qp->ep->com.remote_addr;
|
||||
&qp->ep->com.cm_id->remote_addr;
|
||||
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 *)
|
||||
&qp->ep->com.mapped_remote_addr;
|
||||
&qp->ep->com.cm_id->m_remote_addr;
|
||||
|
||||
cc = snprintf(qpd->buf + qpd->pos, space,
|
||||
"rc qp sq id %u rq id %u state %u "
|
||||
@ -264,15 +253,15 @@ static int dump_qp(int id, void *p, void *data)
|
||||
ntohs(mapped_rsin->sin_port));
|
||||
} else {
|
||||
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 *)
|
||||
&qp->ep->com.remote_addr;
|
||||
&qp->ep->com.cm_id->remote_addr;
|
||||
struct sockaddr_in6 *mapped_lsin6 =
|
||||
(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 *)
|
||||
&qp->ep->com.mapped_remote_addr;
|
||||
&qp->ep->com.cm_id->m_remote_addr;
|
||||
|
||||
cc = snprintf(qpd->buf + qpd->pos, space,
|
||||
"rc qp sq id %u rq id %u state %u "
|
||||
@ -545,13 +534,13 @@ static int dump_ep(int id, void *p, void *data)
|
||||
|
||||
if (ep->com.local_addr.ss_family == AF_INET) {
|
||||
struct sockaddr_in *lsin = (struct sockaddr_in *)
|
||||
&ep->com.local_addr;
|
||||
&ep->com.cm_id->local_addr;
|
||||
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 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.cm_id->m_local_addr;
|
||||
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,
|
||||
"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)
|
||||
ntohs(mapped_rsin->sin_port));
|
||||
} else {
|
||||
struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)
|
||||
&ep->com.local_addr;
|
||||
&ep->com.cm_id->local_addr;
|
||||
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 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.cm_id->m_local_addr;
|
||||
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,
|
||||
"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)
|
||||
|
||||
if (ep->com.local_addr.ss_family == AF_INET) {
|
||||
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 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.cm_id->m_local_addr;
|
||||
|
||||
cc = snprintf(epd->buf + epd->pos, space,
|
||||
"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)
|
||||
ntohs(mapped_lsin->sin_port));
|
||||
} else {
|
||||
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 *)
|
||||
&ep->com.mapped_local_addr;
|
||||
&ep->com.cm_id->m_local_addr;
|
||||
|
||||
cc = snprintf(epd->buf + epd->pos, space,
|
||||
"ep %p cm_id %p state %d flags 0x%lx stid %d "
|
||||
@ -801,10 +790,9 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
|
||||
rdev->lldi.vr->qp.size,
|
||||
rdev->lldi.vr->cq.start,
|
||||
rdev->lldi.vr->cq.size);
|
||||
PDBG("udb len 0x%x udb base %p db_reg %p gts_reg %p "
|
||||
PDBG("udb %pR db_reg %p gts_reg %p "
|
||||
"qpmask 0x%x cqmask 0x%x\n",
|
||||
(unsigned)pci_resource_len(rdev->lldi.pdev, 2),
|
||||
(void *)pci_resource_start(rdev->lldi.pdev, 2),
|
||||
&rdev->lldi.pdev->resource[2],
|
||||
rdev->lldi.db_reg, rdev->lldi.gts_reg,
|
||||
rdev->qpmask, rdev->cqmask);
|
||||
|
||||
@ -1506,20 +1494,6 @@ static int __init c4iw_init_module(void)
|
||||
printk(KERN_WARNING MOD
|
||||
"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);
|
||||
|
||||
return 0;
|
||||
@ -1537,8 +1511,6 @@ static void __exit c4iw_exit_module(void)
|
||||
}
|
||||
mutex_unlock(&dev_mutex);
|
||||
cxgb4_unregister_uld(CXGB4_ULD_RDMA);
|
||||
iwpm_exit(RDMA_NL_C4IW);
|
||||
ibnl_remove_client(RDMA_NL_C4IW);
|
||||
c4iw_cm_term();
|
||||
debugfs_remove_recursive(c4iw_debugfs_root);
|
||||
}
|
||||
|
@ -755,7 +755,6 @@ enum c4iw_ep_flags {
|
||||
CLOSE_SENT = 3,
|
||||
TIMEOUT = 4,
|
||||
QP_REFERENCED = 5,
|
||||
RELEASE_MAPINFO = 6,
|
||||
};
|
||||
|
||||
enum c4iw_ep_history {
|
||||
@ -792,8 +791,6 @@ struct c4iw_ep_common {
|
||||
struct mutex mutex;
|
||||
struct sockaddr_storage local_addr;
|
||||
struct sockaddr_storage remote_addr;
|
||||
struct sockaddr_storage mapped_local_addr;
|
||||
struct sockaddr_storage mapped_remote_addr;
|
||||
struct c4iw_wr_wait wr_wait;
|
||||
unsigned long flags;
|
||||
unsigned long history;
|
||||
@ -845,45 +842,6 @@ struct c4iw_ep {
|
||||
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)
|
||||
{
|
||||
return cm_id->provider_data;
|
||||
|
@ -619,12 +619,14 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
|
||||
int ret = 0;
|
||||
int length = roundup(max_num_sg * sizeof(u64), 32);
|
||||
|
||||
if (mr_type != IB_MR_TYPE_MEM_REG ||
|
||||
max_num_sg > t4_max_fr_depth(use_dsgl))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
php = to_c4iw_pd(pd);
|
||||
rhp = php->rhp;
|
||||
|
||||
if (mr_type != IB_MR_TYPE_MEM_REG ||
|
||||
max_num_sg > t4_max_fr_depth(&rhp->rdev.lldi.ulptx_memwrite_dsgl &&
|
||||
use_dsgl))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
mhp = kzalloc(sizeof(*mhp), GFP_KERNEL);
|
||||
if (!mhp) {
|
||||
ret = -ENOMEM;
|
||||
|
@ -339,7 +339,8 @@ static int c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *pro
|
||||
props->max_mr = c4iw_num_stags(&dev->rdev);
|
||||
props->max_pd = T4_MAX_NUM_PD;
|
||||
props->local_ca_ack_delay = 0;
|
||||
props->max_fast_reg_page_list_len = t4_max_fr_depth(use_dsgl);
|
||||
props->max_fast_reg_page_list_len =
|
||||
t4_max_fr_depth(dev->rdev.lldi.ulptx_memwrite_dsgl && use_dsgl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ static int build_rdma_recv(struct c4iw_qp *qhp, union t4_recv_wr *wqe,
|
||||
}
|
||||
|
||||
static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
|
||||
struct ib_reg_wr *wr, u8 *len16, u8 t5dev)
|
||||
struct ib_reg_wr *wr, u8 *len16, bool dsgl_supported)
|
||||
{
|
||||
struct c4iw_mr *mhp = to_c4iw_mr(wr->mr);
|
||||
struct fw_ri_immd *imdp;
|
||||
@ -615,7 +615,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
|
||||
int pbllen = roundup(mhp->mpl_len * sizeof(u64), 32);
|
||||
int rem;
|
||||
|
||||
if (mhp->mpl_len > t4_max_fr_depth(use_dsgl))
|
||||
if (mhp->mpl_len > t4_max_fr_depth(dsgl_supported && use_dsgl))
|
||||
return -EINVAL;
|
||||
|
||||
wqe->fr.qpbinde_to_dcacpu = 0;
|
||||
@ -629,7 +629,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
|
||||
wqe->fr.va_lo_fbo = cpu_to_be32(mhp->ibmr.iova &
|
||||
0xffffffff);
|
||||
|
||||
if (t5dev && use_dsgl && (pbllen > max_fr_immd)) {
|
||||
if (dsgl_supported && use_dsgl && (pbllen > max_fr_immd)) {
|
||||
struct fw_ri_dsgl *sglp;
|
||||
|
||||
for (i = 0; i < mhp->mpl_len; i++)
|
||||
@ -808,9 +808,7 @@ int c4iw_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||
fw_opcode = FW_RI_FR_NSMR_WR;
|
||||
swsqe->opcode = FW_RI_FAST_REGISTER;
|
||||
err = build_memreg(&qhp->wq.sq, wqe, reg_wr(wr), &len16,
|
||||
is_t5(
|
||||
qhp->rhp->rdev.lldi.adapter_type) ?
|
||||
1 : 0);
|
||||
qhp->rhp->rdev.lldi.ulptx_memwrite_dsgl);
|
||||
break;
|
||||
case IB_WR_LOCAL_INV:
|
||||
if (wr->send_flags & IB_SEND_FENCE)
|
||||
@ -1621,7 +1619,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
unsigned int sqsize, rqsize;
|
||||
struct c4iw_ucontext *ucontext;
|
||||
int ret;
|
||||
struct c4iw_mm_entry *mm1, *mm2, *mm3, *mm4, *mm5 = NULL;
|
||||
struct c4iw_mm_entry *sq_key_mm, *rq_key_mm = NULL, *sq_db_key_mm;
|
||||
struct c4iw_mm_entry *rq_db_key_mm = NULL, *ma_sync_key_mm = NULL;
|
||||
|
||||
PDBG("%s ib_pd %p\n", __func__, pd);
|
||||
|
||||
@ -1708,29 +1707,30 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
goto err2;
|
||||
|
||||
if (udata) {
|
||||
mm1 = kmalloc(sizeof *mm1, GFP_KERNEL);
|
||||
if (!mm1) {
|
||||
sq_key_mm = kmalloc(sizeof(*sq_key_mm), GFP_KERNEL);
|
||||
if (!sq_key_mm) {
|
||||
ret = -ENOMEM;
|
||||
goto err3;
|
||||
}
|
||||
mm2 = kmalloc(sizeof *mm2, GFP_KERNEL);
|
||||
if (!mm2) {
|
||||
rq_key_mm = kmalloc(sizeof(*rq_key_mm), GFP_KERNEL);
|
||||
if (!rq_key_mm) {
|
||||
ret = -ENOMEM;
|
||||
goto err4;
|
||||
}
|
||||
mm3 = kmalloc(sizeof *mm3, GFP_KERNEL);
|
||||
if (!mm3) {
|
||||
sq_db_key_mm = kmalloc(sizeof(*sq_db_key_mm), GFP_KERNEL);
|
||||
if (!sq_db_key_mm) {
|
||||
ret = -ENOMEM;
|
||||
goto err5;
|
||||
}
|
||||
mm4 = kmalloc(sizeof *mm4, GFP_KERNEL);
|
||||
if (!mm4) {
|
||||
rq_db_key_mm = kmalloc(sizeof(*rq_db_key_mm), GFP_KERNEL);
|
||||
if (!rq_db_key_mm) {
|
||||
ret = -ENOMEM;
|
||||
goto err6;
|
||||
}
|
||||
if (t4_sq_onchip(&qhp->wq.sq)) {
|
||||
mm5 = kmalloc(sizeof *mm5, GFP_KERNEL);
|
||||
if (!mm5) {
|
||||
ma_sync_key_mm = kmalloc(sizeof(*ma_sync_key_mm),
|
||||
GFP_KERNEL);
|
||||
if (!ma_sync_key_mm) {
|
||||
ret = -ENOMEM;
|
||||
goto err7;
|
||||
}
|
||||
@ -1745,7 +1745,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
uresp.rq_size = qhp->wq.rq.size;
|
||||
uresp.rq_memsize = qhp->wq.rq.memsize;
|
||||
spin_lock(&ucontext->mmap_lock);
|
||||
if (mm5) {
|
||||
if (ma_sync_key_mm) {
|
||||
uresp.ma_sync_key = ucontext->key;
|
||||
ucontext->key += PAGE_SIZE;
|
||||
} else {
|
||||
@ -1763,28 +1763,29 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
ret = ib_copy_to_udata(udata, &uresp, sizeof uresp);
|
||||
if (ret)
|
||||
goto err8;
|
||||
mm1->key = uresp.sq_key;
|
||||
mm1->addr = qhp->wq.sq.phys_addr;
|
||||
mm1->len = PAGE_ALIGN(qhp->wq.sq.memsize);
|
||||
insert_mmap(ucontext, mm1);
|
||||
mm2->key = uresp.rq_key;
|
||||
mm2->addr = virt_to_phys(qhp->wq.rq.queue);
|
||||
mm2->len = PAGE_ALIGN(qhp->wq.rq.memsize);
|
||||
insert_mmap(ucontext, mm2);
|
||||
mm3->key = uresp.sq_db_gts_key;
|
||||
mm3->addr = (__force unsigned long)qhp->wq.sq.bar2_pa;
|
||||
mm3->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, mm3);
|
||||
mm4->key = uresp.rq_db_gts_key;
|
||||
mm4->addr = (__force unsigned long)qhp->wq.rq.bar2_pa;
|
||||
mm4->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, mm4);
|
||||
if (mm5) {
|
||||
mm5->key = uresp.ma_sync_key;
|
||||
mm5->addr = (pci_resource_start(rhp->rdev.lldi.pdev, 0)
|
||||
+ PCIE_MA_SYNC_A) & PAGE_MASK;
|
||||
mm5->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, mm5);
|
||||
sq_key_mm->key = uresp.sq_key;
|
||||
sq_key_mm->addr = qhp->wq.sq.phys_addr;
|
||||
sq_key_mm->len = PAGE_ALIGN(qhp->wq.sq.memsize);
|
||||
insert_mmap(ucontext, sq_key_mm);
|
||||
rq_key_mm->key = uresp.rq_key;
|
||||
rq_key_mm->addr = virt_to_phys(qhp->wq.rq.queue);
|
||||
rq_key_mm->len = PAGE_ALIGN(qhp->wq.rq.memsize);
|
||||
insert_mmap(ucontext, rq_key_mm);
|
||||
sq_db_key_mm->key = uresp.sq_db_gts_key;
|
||||
sq_db_key_mm->addr = (u64)(unsigned long)qhp->wq.sq.bar2_pa;
|
||||
sq_db_key_mm->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, sq_db_key_mm);
|
||||
rq_db_key_mm->key = uresp.rq_db_gts_key;
|
||||
rq_db_key_mm->addr = (u64)(unsigned long)qhp->wq.rq.bar2_pa;
|
||||
rq_db_key_mm->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, rq_db_key_mm);
|
||||
if (ma_sync_key_mm) {
|
||||
ma_sync_key_mm->key = uresp.ma_sync_key;
|
||||
ma_sync_key_mm->addr =
|
||||
(pci_resource_start(rhp->rdev.lldi.pdev, 0) +
|
||||
PCIE_MA_SYNC_A) & PAGE_MASK;
|
||||
ma_sync_key_mm->len = PAGE_SIZE;
|
||||
insert_mmap(ucontext, ma_sync_key_mm);
|
||||
}
|
||||
}
|
||||
qhp->ibqp.qp_num = qhp->wq.sq.qid;
|
||||
@ -1797,15 +1798,15 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
|
||||
qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
|
||||
return &qhp->ibqp;
|
||||
err8:
|
||||
kfree(mm5);
|
||||
kfree(ma_sync_key_mm);
|
||||
err7:
|
||||
kfree(mm4);
|
||||
kfree(rq_db_key_mm);
|
||||
err6:
|
||||
kfree(mm3);
|
||||
kfree(sq_db_key_mm);
|
||||
err5:
|
||||
kfree(mm2);
|
||||
kfree(rq_key_mm);
|
||||
err4:
|
||||
kfree(mm1);
|
||||
kfree(sq_key_mm);
|
||||
err3:
|
||||
remove_handle(rhp, &rhp->qpidr, qhp->wq.sq.qid);
|
||||
err2:
|
||||
|
@ -2,7 +2,6 @@ config INFINIBAND_NES
|
||||
tristate "NetEffect RNIC Driver"
|
||||
depends on PCI && INET && INFINIBAND
|
||||
select LIBCRC32C
|
||||
select INET_LRO
|
||||
---help---
|
||||
This is the RDMA Network Interface Card (RNIC) driver for
|
||||
NetEffect Ethernet Cluster Server Adapters.
|
||||
|
@ -111,17 +111,6 @@ static struct pci_device_id nes_pci_table[] = {
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, nes_pci_table);
|
||||
|
||||
/* registered nes netlink callbacks */
|
||||
static struct ibnl_client_cbs nes_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_REMOTE_INFO] = {.dump = iwpm_remote_info_cb},
|
||||
[RDMA_NL_IWPM_HANDLE_ERR] = {.dump = iwpm_mapping_error_cb},
|
||||
[RDMA_NL_IWPM_MAPINFO] = {.dump = iwpm_mapping_info_cb},
|
||||
[RDMA_NL_IWPM_MAPINFO_NUM] = {.dump = iwpm_ack_mapping_info_cb}
|
||||
};
|
||||
|
||||
static int nes_inetaddr_event(struct notifier_block *, unsigned long, void *);
|
||||
static int nes_net_event(struct notifier_block *, unsigned long, void *);
|
||||
static int nes_notifiers_registered;
|
||||
@ -682,17 +671,6 @@ static int nes_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
|
||||
}
|
||||
nes_notifiers_registered++;
|
||||
|
||||
if (ibnl_add_client(RDMA_NL_NES, RDMA_NL_IWPM_NUM_OPS, nes_nl_cb_table))
|
||||
printk(KERN_ERR PFX "%s[%u]: Failed to add netlink callback\n",
|
||||
__func__, __LINE__);
|
||||
|
||||
ret = iwpm_init(RDMA_NL_NES);
|
||||
if (ret) {
|
||||
printk(KERN_ERR PFX "%s: port mapper initialization failed\n",
|
||||
pci_name(pcidev));
|
||||
goto bail7;
|
||||
}
|
||||
|
||||
INIT_DELAYED_WORK(&nesdev->work, nes_recheck_link_status);
|
||||
|
||||
/* Initialize network devices */
|
||||
@ -731,7 +709,6 @@ static int nes_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
|
||||
|
||||
nes_debug(NES_DBG_INIT, "netdev_count=%d, nesadapter->netdev_count=%d\n",
|
||||
nesdev->netdev_count, nesdev->nesadapter->netdev_count);
|
||||
ibnl_remove_client(RDMA_NL_NES);
|
||||
|
||||
nes_notifiers_registered--;
|
||||
if (nes_notifiers_registered == 0) {
|
||||
@ -795,8 +772,6 @@ static void nes_remove(struct pci_dev *pcidev)
|
||||
nesdev->nesadapter->netdev_count--;
|
||||
}
|
||||
}
|
||||
ibnl_remove_client(RDMA_NL_NES);
|
||||
iwpm_exit(RDMA_NL_NES);
|
||||
|
||||
nes_notifiers_registered--;
|
||||
if (nes_notifiers_registered == 0) {
|
||||
|
@ -482,11 +482,11 @@ static void form_cm_frame(struct sk_buff *skb,
|
||||
iph->ttl = 0x40;
|
||||
iph->protocol = 0x06; /* IPPROTO_TCP */
|
||||
|
||||
iph->saddr = htonl(cm_node->mapped_loc_addr);
|
||||
iph->daddr = htonl(cm_node->mapped_rem_addr);
|
||||
iph->saddr = htonl(cm_node->loc_addr);
|
||||
iph->daddr = htonl(cm_node->rem_addr);
|
||||
|
||||
tcph->source = htons(cm_node->mapped_loc_port);
|
||||
tcph->dest = htons(cm_node->mapped_rem_port);
|
||||
tcph->source = htons(cm_node->loc_port);
|
||||
tcph->dest = htons(cm_node->rem_port);
|
||||
tcph->seq = htonl(cm_node->tcp_cntxt.loc_seq_num);
|
||||
|
||||
if (flags & SET_ACK) {
|
||||
@ -525,125 +525,6 @@ static void form_cm_frame(struct sk_buff *skb,
|
||||
cm_packets_created++;
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_create_sockaddr - Record ip addr and tcp port in a sockaddr struct
|
||||
*/
|
||||
static void nes_create_sockaddr(__be32 ip_addr, __be16 port,
|
||||
struct sockaddr_storage *addr)
|
||||
{
|
||||
struct sockaddr_in *nes_sockaddr = (struct sockaddr_in *)addr;
|
||||
nes_sockaddr->sin_family = AF_INET;
|
||||
memcpy(&nes_sockaddr->sin_addr.s_addr, &ip_addr, sizeof(__be32));
|
||||
nes_sockaddr->sin_port = port;
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_create_mapinfo - Create a mapinfo object in the port mapper data base
|
||||
*/
|
||||
static int nes_create_mapinfo(struct nes_cm_info *cm_info)
|
||||
{
|
||||
struct sockaddr_storage local_sockaddr;
|
||||
struct sockaddr_storage mapped_sockaddr;
|
||||
|
||||
nes_create_sockaddr(htonl(cm_info->loc_addr), htons(cm_info->loc_port),
|
||||
&local_sockaddr);
|
||||
nes_create_sockaddr(htonl(cm_info->mapped_loc_addr),
|
||||
htons(cm_info->mapped_loc_port), &mapped_sockaddr);
|
||||
|
||||
return iwpm_create_mapinfo(&local_sockaddr,
|
||||
&mapped_sockaddr, RDMA_NL_NES);
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_remove_mapinfo - Remove a mapinfo object from the port mapper data base
|
||||
* and send a remove mapping op message to
|
||||
* the userspace port mapper
|
||||
*/
|
||||
static int nes_remove_mapinfo(u32 loc_addr, u16 loc_port,
|
||||
u32 mapped_loc_addr, u16 mapped_loc_port)
|
||||
{
|
||||
struct sockaddr_storage local_sockaddr;
|
||||
struct sockaddr_storage mapped_sockaddr;
|
||||
|
||||
nes_create_sockaddr(htonl(loc_addr), htons(loc_port), &local_sockaddr);
|
||||
nes_create_sockaddr(htonl(mapped_loc_addr), htons(mapped_loc_port),
|
||||
&mapped_sockaddr);
|
||||
|
||||
iwpm_remove_mapinfo(&local_sockaddr, &mapped_sockaddr);
|
||||
return iwpm_remove_mapping(&local_sockaddr, RDMA_NL_NES);
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_form_pm_msg - Form a port mapper message with mapping info
|
||||
*/
|
||||
static void nes_form_pm_msg(struct nes_cm_info *cm_info,
|
||||
struct iwpm_sa_data *pm_msg)
|
||||
{
|
||||
nes_create_sockaddr(htonl(cm_info->loc_addr), htons(cm_info->loc_port),
|
||||
&pm_msg->loc_addr);
|
||||
nes_create_sockaddr(htonl(cm_info->rem_addr), htons(cm_info->rem_port),
|
||||
&pm_msg->rem_addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_form_reg_msg - Form a port mapper message with dev info
|
||||
*/
|
||||
static void nes_form_reg_msg(struct nes_vnic *nesvnic,
|
||||
struct iwpm_dev_data *pm_msg)
|
||||
{
|
||||
memcpy(pm_msg->dev_name, nesvnic->nesibdev->ibdev.name,
|
||||
IWPM_DEVNAME_SIZE);
|
||||
memcpy(pm_msg->if_name, nesvnic->netdev->name, IWPM_IFNAME_SIZE);
|
||||
}
|
||||
|
||||
static void record_sockaddr_info(struct sockaddr_storage *addr_info,
|
||||
nes_addr_t *ip_addr, u16 *port_num)
|
||||
{
|
||||
struct sockaddr_in *in_addr = (struct sockaddr_in *)addr_info;
|
||||
|
||||
if (in_addr->sin_family == AF_INET) {
|
||||
*ip_addr = ntohl(in_addr->sin_addr.s_addr);
|
||||
*port_num = ntohs(in_addr->sin_port);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_record_pm_msg - Save the received mapping info
|
||||
*/
|
||||
static void nes_record_pm_msg(struct nes_cm_info *cm_info,
|
||||
struct iwpm_sa_data *pm_msg)
|
||||
{
|
||||
record_sockaddr_info(&pm_msg->mapped_loc_addr,
|
||||
&cm_info->mapped_loc_addr, &cm_info->mapped_loc_port);
|
||||
|
||||
record_sockaddr_info(&pm_msg->mapped_rem_addr,
|
||||
&cm_info->mapped_rem_addr, &cm_info->mapped_rem_port);
|
||||
}
|
||||
|
||||
/*
|
||||
* nes_get_reminfo - Get the address info of the remote connecting peer
|
||||
*/
|
||||
static int nes_get_remote_addr(struct nes_cm_node *cm_node)
|
||||
{
|
||||
struct sockaddr_storage mapped_loc_addr, mapped_rem_addr;
|
||||
struct sockaddr_storage remote_addr;
|
||||
int ret;
|
||||
|
||||
nes_create_sockaddr(htonl(cm_node->mapped_loc_addr),
|
||||
htons(cm_node->mapped_loc_port), &mapped_loc_addr);
|
||||
nes_create_sockaddr(htonl(cm_node->mapped_rem_addr),
|
||||
htons(cm_node->mapped_rem_port), &mapped_rem_addr);
|
||||
|
||||
ret = iwpm_get_remote_info(&mapped_loc_addr, &mapped_rem_addr,
|
||||
&remote_addr, RDMA_NL_NES);
|
||||
if (ret)
|
||||
nes_debug(NES_DBG_CM, "Unable to find remote peer address info\n");
|
||||
else
|
||||
record_sockaddr_info(&remote_addr, &cm_node->rem_addr,
|
||||
&cm_node->rem_port);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* print_core - dump a cm core
|
||||
*/
|
||||
@ -1266,11 +1147,10 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
|
||||
loc_addr, loc_port,
|
||||
cm_node->rem_addr, cm_node->rem_port,
|
||||
rem_addr, rem_port);
|
||||
if ((cm_node->mapped_loc_addr == loc_addr) &&
|
||||
(cm_node->mapped_loc_port == loc_port) &&
|
||||
(cm_node->mapped_rem_addr == rem_addr) &&
|
||||
(cm_node->mapped_rem_port == rem_port)) {
|
||||
|
||||
if ((cm_node->loc_addr == loc_addr) &&
|
||||
(cm_node->loc_port == loc_port) &&
|
||||
(cm_node->rem_addr == rem_addr) &&
|
||||
(cm_node->rem_port == rem_port)) {
|
||||
add_ref_cm_node(cm_node);
|
||||
spin_unlock_irqrestore(&cm_core->ht_lock, flags);
|
||||
return cm_node;
|
||||
@ -1287,8 +1167,8 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
|
||||
* find_listener - find a cm node listening on this addr-port pair
|
||||
*/
|
||||
static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
|
||||
nes_addr_t dst_addr, u16 dst_port,
|
||||
enum nes_cm_listener_state listener_state, int local)
|
||||
nes_addr_t dst_addr, u16 dst_port,
|
||||
enum nes_cm_listener_state listener_state)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct nes_cm_listener *listen_node;
|
||||
@ -1298,13 +1178,9 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
|
||||
/* walk list and find cm_node associated with this session ID */
|
||||
spin_lock_irqsave(&cm_core->listen_list_lock, flags);
|
||||
list_for_each_entry(listen_node, &cm_core->listen_list.list, list) {
|
||||
if (local) {
|
||||
listen_addr = listen_node->loc_addr;
|
||||
listen_port = listen_node->loc_port;
|
||||
} else {
|
||||
listen_addr = listen_node->mapped_loc_addr;
|
||||
listen_port = listen_node->mapped_loc_port;
|
||||
}
|
||||
listen_addr = listen_node->loc_addr;
|
||||
listen_port = listen_node->loc_port;
|
||||
|
||||
/* compare node pair, return node handle if a match */
|
||||
if (((listen_addr == dst_addr) ||
|
||||
listen_addr == 0x00000000) &&
|
||||
@ -1443,17 +1319,13 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core,
|
||||
|
||||
if (listener->nesvnic) {
|
||||
nes_manage_apbvt(listener->nesvnic,
|
||||
listener->mapped_loc_port,
|
||||
listener->loc_port,
|
||||
PCI_FUNC(listener->nesvnic->nesdev->pcidev->devfn),
|
||||
NES_MANAGE_APBVT_DEL);
|
||||
|
||||
nes_remove_mapinfo(listener->loc_addr,
|
||||
listener->loc_port,
|
||||
listener->mapped_loc_addr,
|
||||
listener->mapped_loc_port);
|
||||
nes_debug(NES_DBG_NLMSG,
|
||||
"Delete APBVT mapped_loc_port = %04X\n",
|
||||
listener->mapped_loc_port);
|
||||
"Delete APBVT loc_port = %04X\n",
|
||||
listener->loc_port);
|
||||
}
|
||||
|
||||
nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener);
|
||||
@ -1602,11 +1474,6 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
|
||||
cm_node->rem_addr = cm_info->rem_addr;
|
||||
cm_node->rem_port = cm_info->rem_port;
|
||||
|
||||
cm_node->mapped_loc_addr = cm_info->mapped_loc_addr;
|
||||
cm_node->mapped_rem_addr = cm_info->mapped_rem_addr;
|
||||
cm_node->mapped_loc_port = cm_info->mapped_loc_port;
|
||||
cm_node->mapped_rem_port = cm_info->mapped_rem_port;
|
||||
|
||||
cm_node->mpa_frame_rev = mpa_version;
|
||||
cm_node->send_rdma0_op = SEND_RDMA_READ_ZERO;
|
||||
cm_node->mpav2_ird_ord = 0;
|
||||
@ -1655,10 +1522,10 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
|
||||
cm_node->loopbackpartner = NULL;
|
||||
|
||||
/* get the mac addr for the remote node */
|
||||
oldarpindex = nes_arp_table(nesdev, cm_node->mapped_rem_addr,
|
||||
NULL, NES_ARP_RESOLVE);
|
||||
arpindex = nes_addr_resolve_neigh(nesvnic,
|
||||
cm_node->mapped_rem_addr, oldarpindex);
|
||||
oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr,
|
||||
NULL, NES_ARP_RESOLVE);
|
||||
arpindex = nes_addr_resolve_neigh(nesvnic, cm_node->rem_addr,
|
||||
oldarpindex);
|
||||
if (arpindex < 0) {
|
||||
kfree(cm_node);
|
||||
return NULL;
|
||||
@ -1720,14 +1587,12 @@ static int rem_ref_cm_node(struct nes_cm_core *cm_core,
|
||||
mini_cm_dec_refcnt_listen(cm_core, cm_node->listener, 0);
|
||||
} else {
|
||||
if (cm_node->apbvt_set && cm_node->nesvnic) {
|
||||
nes_manage_apbvt(cm_node->nesvnic, cm_node->mapped_loc_port,
|
||||
nes_manage_apbvt(cm_node->nesvnic, cm_node->loc_port,
|
||||
PCI_FUNC(cm_node->nesvnic->nesdev->pcidev->devfn),
|
||||
NES_MANAGE_APBVT_DEL);
|
||||
}
|
||||
nes_debug(NES_DBG_NLMSG, "Delete APBVT mapped_loc_port = %04X\n",
|
||||
cm_node->mapped_loc_port);
|
||||
nes_remove_mapinfo(cm_node->loc_addr, cm_node->loc_port,
|
||||
cm_node->mapped_loc_addr, cm_node->mapped_loc_port);
|
||||
nes_debug(NES_DBG_NLMSG, "Delete APBVT loc_port = %04X\n",
|
||||
cm_node->loc_port);
|
||||
}
|
||||
|
||||
atomic_dec(&cm_core->node_cnt);
|
||||
@ -2184,7 +2049,6 @@ static int handle_ack_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
|
||||
cm_node->state = NES_CM_STATE_ESTABLISHED;
|
||||
if (datasize) {
|
||||
cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
|
||||
nes_get_remote_addr(cm_node);
|
||||
handle_rcv_mpa(cm_node, skb);
|
||||
} else { /* rcvd ACK only */
|
||||
dev_kfree_skb_any(skb);
|
||||
@ -2399,17 +2263,14 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
|
||||
struct nes_vnic *nesvnic, struct nes_cm_info *cm_info)
|
||||
{
|
||||
struct nes_cm_listener *listener;
|
||||
struct iwpm_dev_data pm_reg_msg;
|
||||
struct iwpm_sa_data pm_msg;
|
||||
unsigned long flags;
|
||||
int iwpm_err = 0;
|
||||
|
||||
nes_debug(NES_DBG_CM, "Search for 0x%08x : 0x%04x\n",
|
||||
cm_info->loc_addr, cm_info->loc_port);
|
||||
|
||||
/* cannot have multiple matching listeners */
|
||||
listener = find_listener(cm_core, cm_info->loc_addr, cm_info->loc_port,
|
||||
NES_CM_LISTENER_EITHER_STATE, 1);
|
||||
NES_CM_LISTENER_EITHER_STATE);
|
||||
|
||||
if (listener && listener->listener_state == NES_CM_LISTENER_ACTIVE_STATE) {
|
||||
/* find automatically incs ref count ??? */
|
||||
@ -2419,22 +2280,6 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
|
||||
}
|
||||
|
||||
if (!listener) {
|
||||
nes_form_reg_msg(nesvnic, &pm_reg_msg);
|
||||
iwpm_err = iwpm_register_pid(&pm_reg_msg, RDMA_NL_NES);
|
||||
if (iwpm_err) {
|
||||
nes_debug(NES_DBG_NLMSG,
|
||||
"Port Mapper reg pid fail (err = %d).\n", iwpm_err);
|
||||
}
|
||||
if (iwpm_valid_pid() && !iwpm_err) {
|
||||
nes_form_pm_msg(cm_info, &pm_msg);
|
||||
iwpm_err = iwpm_add_mapping(&pm_msg, RDMA_NL_NES);
|
||||
if (iwpm_err)
|
||||
nes_debug(NES_DBG_NLMSG,
|
||||
"Port Mapper query fail (err = %d).\n", iwpm_err);
|
||||
else
|
||||
nes_record_pm_msg(cm_info, &pm_msg);
|
||||
}
|
||||
|
||||
/* create a CM listen node (1/2 node to compare incoming traffic to) */
|
||||
listener = kzalloc(sizeof(*listener), GFP_ATOMIC);
|
||||
if (!listener) {
|
||||
@ -2444,8 +2289,6 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,
|
||||
|
||||
listener->loc_addr = cm_info->loc_addr;
|
||||
listener->loc_port = cm_info->loc_port;
|
||||
listener->mapped_loc_addr = cm_info->mapped_loc_addr;
|
||||
listener->mapped_loc_port = cm_info->mapped_loc_port;
|
||||
listener->reused_node = 0;
|
||||
|
||||
atomic_set(&listener->ref_count, 1);
|
||||
@ -2507,18 +2350,18 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
|
||||
|
||||
if (cm_info->loc_addr == cm_info->rem_addr) {
|
||||
loopbackremotelistener = find_listener(cm_core,
|
||||
cm_node->mapped_loc_addr, cm_node->mapped_rem_port,
|
||||
NES_CM_LISTENER_ACTIVE_STATE, 0);
|
||||
cm_node->loc_addr, cm_node->rem_port,
|
||||
NES_CM_LISTENER_ACTIVE_STATE);
|
||||
if (loopbackremotelistener == NULL) {
|
||||
create_event(cm_node, NES_CM_EVENT_ABORTED);
|
||||
} else {
|
||||
loopback_cm_info = *cm_info;
|
||||
loopback_cm_info.loc_port = cm_info->rem_port;
|
||||
loopback_cm_info.rem_port = cm_info->loc_port;
|
||||
loopback_cm_info.mapped_loc_port =
|
||||
cm_info->mapped_rem_port;
|
||||
loopback_cm_info.mapped_rem_port =
|
||||
cm_info->mapped_loc_port;
|
||||
loopback_cm_info.loc_port =
|
||||
cm_info->rem_port;
|
||||
loopback_cm_info.rem_port =
|
||||
cm_info->loc_port;
|
||||
loopback_cm_info.cm_id = loopbackremotelistener->cm_id;
|
||||
loopbackremotenode = make_cm_node(cm_core, nesvnic,
|
||||
&loopback_cm_info, loopbackremotelistener);
|
||||
@ -2747,12 +2590,6 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
|
||||
nfo.rem_addr = ntohl(iph->saddr);
|
||||
nfo.rem_port = ntohs(tcph->source);
|
||||
|
||||
/* If port mapper is available these should be mapped address info */
|
||||
nfo.mapped_loc_addr = ntohl(iph->daddr);
|
||||
nfo.mapped_loc_port = ntohs(tcph->dest);
|
||||
nfo.mapped_rem_addr = ntohl(iph->saddr);
|
||||
nfo.mapped_rem_port = ntohs(tcph->source);
|
||||
|
||||
tmp_daddr = cpu_to_be32(iph->daddr);
|
||||
tmp_saddr = cpu_to_be32(iph->saddr);
|
||||
|
||||
@ -2761,8 +2598,8 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
|
||||
|
||||
do {
|
||||
cm_node = find_node(cm_core,
|
||||
nfo.mapped_rem_port, nfo.mapped_rem_addr,
|
||||
nfo.mapped_loc_port, nfo.mapped_loc_addr);
|
||||
nfo.rem_port, nfo.rem_addr,
|
||||
nfo.loc_port, nfo.loc_addr);
|
||||
|
||||
if (!cm_node) {
|
||||
/* Only type of packet accepted are for */
|
||||
@ -2771,9 +2608,9 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
|
||||
skb_handled = 0;
|
||||
break;
|
||||
}
|
||||
listener = find_listener(cm_core, nfo.mapped_loc_addr,
|
||||
nfo.mapped_loc_port,
|
||||
NES_CM_LISTENER_ACTIVE_STATE, 0);
|
||||
listener = find_listener(cm_core, nfo.loc_addr,
|
||||
nfo.loc_port,
|
||||
NES_CM_LISTENER_ACTIVE_STATE);
|
||||
if (!listener) {
|
||||
nfo.cm_id = NULL;
|
||||
nfo.conn_type = 0;
|
||||
@ -2856,12 +2693,22 @@ static struct nes_cm_core *nes_cm_alloc_core(void)
|
||||
|
||||
nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n");
|
||||
cm_core->event_wq = create_singlethread_workqueue("nesewq");
|
||||
if (!cm_core->event_wq)
|
||||
goto out_free_cmcore;
|
||||
cm_core->post_event = nes_cm_post_event;
|
||||
nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n");
|
||||
cm_core->disconn_wq = create_singlethread_workqueue("nesdwq");
|
||||
if (!cm_core->disconn_wq)
|
||||
goto out_free_wq;
|
||||
|
||||
print_core(cm_core);
|
||||
return cm_core;
|
||||
|
||||
out_free_wq:
|
||||
destroy_workqueue(cm_core->event_wq);
|
||||
out_free_cmcore:
|
||||
kfree(cm_core);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -3121,8 +2968,8 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
|
||||
atomic_inc(&cm_disconnects);
|
||||
cm_event.event = IW_CM_EVENT_DISCONNECT;
|
||||
cm_event.status = disconn_status;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
|
||||
@ -3148,8 +2995,8 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
|
||||
cm_event.event = IW_CM_EVENT_CLOSE;
|
||||
cm_event.status = 0;
|
||||
cm_event.provider_data = cm_id->provider_data;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
|
||||
@ -3240,8 +3087,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
u8 *start_ptr = &start_addr;
|
||||
u8 **start_buff = &start_ptr;
|
||||
u16 buff_len = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
|
||||
ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
|
||||
if (!ibqp)
|
||||
@ -3378,11 +3225,11 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
nes_cm_init_tsa_conn(nesqp, cm_node);
|
||||
|
||||
nesqp->nesqp_context->tcpPorts[0] =
|
||||
cpu_to_le16(cm_node->mapped_loc_port);
|
||||
cpu_to_le16(cm_node->loc_port);
|
||||
nesqp->nesqp_context->tcpPorts[1] =
|
||||
cpu_to_le16(cm_node->mapped_rem_port);
|
||||
cpu_to_le16(cm_node->rem_port);
|
||||
|
||||
nesqp->nesqp_context->ip0 = cpu_to_le32(cm_node->mapped_rem_addr);
|
||||
nesqp->nesqp_context->ip0 = cpu_to_le32(cm_node->rem_addr);
|
||||
|
||||
nesqp->nesqp_context->misc2 |= cpu_to_le32(
|
||||
(u32)PCI_FUNC(nesdev->pcidev->devfn) <<
|
||||
@ -3406,9 +3253,9 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
memset(&nes_quad, 0, sizeof(nes_quad));
|
||||
nes_quad.DstIpAdrIndex =
|
||||
cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
|
||||
nes_quad.SrcIpadr = htonl(cm_node->mapped_rem_addr);
|
||||
nes_quad.TcpPorts[0] = htons(cm_node->mapped_rem_port);
|
||||
nes_quad.TcpPorts[1] = htons(cm_node->mapped_loc_port);
|
||||
nes_quad.SrcIpadr = htonl(cm_node->rem_addr);
|
||||
nes_quad.TcpPorts[0] = htons(cm_node->rem_port);
|
||||
nes_quad.TcpPorts[1] = htons(cm_node->loc_port);
|
||||
|
||||
/* Produce hash key */
|
||||
crc_value = get_crc_value(&nes_quad);
|
||||
@ -3437,8 +3284,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
cm_event.event = IW_CM_EVENT_ESTABLISHED;
|
||||
cm_event.status = 0;
|
||||
cm_event.provider_data = (void *)nesqp;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
cm_event.ird = cm_node->ird_size;
|
||||
@ -3508,11 +3355,8 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
struct nes_cm_node *cm_node;
|
||||
struct nes_cm_info cm_info;
|
||||
int apbvt_set = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
struct iwpm_dev_data pm_reg_msg;
|
||||
struct iwpm_sa_data pm_msg;
|
||||
int iwpm_err = 0;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
|
||||
if (cm_id->remote_addr.ss_family != AF_INET)
|
||||
return -ENOSYS;
|
||||
@ -3558,37 +3402,13 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
cm_info.cm_id = cm_id;
|
||||
cm_info.conn_type = NES_CM_IWARP_CONN_TYPE;
|
||||
|
||||
/* No port mapper available, go with the specified peer information */
|
||||
cm_info.mapped_loc_addr = cm_info.loc_addr;
|
||||
cm_info.mapped_loc_port = cm_info.loc_port;
|
||||
cm_info.mapped_rem_addr = cm_info.rem_addr;
|
||||
cm_info.mapped_rem_port = cm_info.rem_port;
|
||||
|
||||
nes_form_reg_msg(nesvnic, &pm_reg_msg);
|
||||
iwpm_err = iwpm_register_pid(&pm_reg_msg, RDMA_NL_NES);
|
||||
if (iwpm_err) {
|
||||
nes_debug(NES_DBG_NLMSG,
|
||||
"Port Mapper reg pid fail (err = %d).\n", iwpm_err);
|
||||
}
|
||||
if (iwpm_valid_pid() && !iwpm_err) {
|
||||
nes_form_pm_msg(&cm_info, &pm_msg);
|
||||
iwpm_err = iwpm_add_and_query_mapping(&pm_msg, RDMA_NL_NES);
|
||||
if (iwpm_err)
|
||||
nes_debug(NES_DBG_NLMSG,
|
||||
"Port Mapper query fail (err = %d).\n", iwpm_err);
|
||||
else
|
||||
nes_record_pm_msg(&cm_info, &pm_msg);
|
||||
}
|
||||
|
||||
if (laddr->sin_addr.s_addr != raddr->sin_addr.s_addr) {
|
||||
nes_manage_apbvt(nesvnic, cm_info.mapped_loc_port,
|
||||
PCI_FUNC(nesdev->pcidev->devfn), NES_MANAGE_APBVT_ADD);
|
||||
nes_manage_apbvt(nesvnic, cm_info.loc_port,
|
||||
PCI_FUNC(nesdev->pcidev->devfn),
|
||||
NES_MANAGE_APBVT_ADD);
|
||||
apbvt_set = 1;
|
||||
}
|
||||
|
||||
if (nes_create_mapinfo(&cm_info))
|
||||
return -ENOMEM;
|
||||
|
||||
cm_id->add_ref(cm_id);
|
||||
|
||||
/* create a connect CM node connection */
|
||||
@ -3597,14 +3417,12 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
&cm_info);
|
||||
if (!cm_node) {
|
||||
if (apbvt_set)
|
||||
nes_manage_apbvt(nesvnic, cm_info.mapped_loc_port,
|
||||
nes_manage_apbvt(nesvnic, cm_info.loc_port,
|
||||
PCI_FUNC(nesdev->pcidev->devfn),
|
||||
NES_MANAGE_APBVT_DEL);
|
||||
|
||||
nes_debug(NES_DBG_NLMSG, "Delete mapped_loc_port = %04X\n",
|
||||
cm_info.mapped_loc_port);
|
||||
nes_remove_mapinfo(cm_info.loc_addr, cm_info.loc_port,
|
||||
cm_info.mapped_loc_addr, cm_info.mapped_loc_port);
|
||||
nes_debug(NES_DBG_NLMSG, "Delete loc_port = %04X\n",
|
||||
cm_info.loc_port);
|
||||
cm_id->rem_ref(cm_id);
|
||||
return -ENOMEM;
|
||||
}
|
||||
@ -3633,12 +3451,12 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
struct nes_cm_listener *cm_node;
|
||||
struct nes_cm_info cm_info;
|
||||
int err;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
|
||||
nes_debug(NES_DBG_CM, "cm_id = %p, local port = 0x%04X.\n",
|
||||
cm_id, ntohs(laddr->sin_port));
|
||||
|
||||
if (cm_id->local_addr.ss_family != AF_INET)
|
||||
if (cm_id->m_local_addr.ss_family != AF_INET)
|
||||
return -ENOSYS;
|
||||
nesvnic = to_nesvnic(cm_id->device);
|
||||
if (!nesvnic)
|
||||
@ -3658,10 +3476,6 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
|
||||
cm_info.conn_type = NES_CM_IWARP_CONN_TYPE;
|
||||
|
||||
/* No port mapper available, go with the specified info */
|
||||
cm_info.mapped_loc_addr = cm_info.loc_addr;
|
||||
cm_info.mapped_loc_port = cm_info.loc_port;
|
||||
|
||||
cm_node = g_cm_core->api->listen(g_cm_core, nesvnic, &cm_info);
|
||||
if (!cm_node) {
|
||||
printk(KERN_ERR "%s[%u] Error returned from listen API call\n",
|
||||
@ -3673,10 +3487,7 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
|
||||
cm_node->tos = cm_id->tos;
|
||||
|
||||
if (!cm_node->reused_node) {
|
||||
if (nes_create_mapinfo(&cm_info))
|
||||
return -ENOMEM;
|
||||
|
||||
err = nes_manage_apbvt(nesvnic, cm_node->mapped_loc_port,
|
||||
err = nes_manage_apbvt(nesvnic, cm_node->loc_port,
|
||||
PCI_FUNC(nesvnic->nesdev->pcidev->devfn),
|
||||
NES_MANAGE_APBVT_ADD);
|
||||
if (err) {
|
||||
@ -3786,8 +3597,8 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
nesvnic = to_nesvnic(nesqp->ibqp.device);
|
||||
nesdev = nesvnic->nesdev;
|
||||
nesadapter = nesdev->nesadapter;
|
||||
laddr = (struct sockaddr_in *)&cm_id->local_addr;
|
||||
raddr = (struct sockaddr_in *)&cm_id->remote_addr;
|
||||
laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
|
||||
raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
|
||||
cm_event_laddr = (struct sockaddr_in *)&cm_event.local_addr;
|
||||
|
||||
if (nesqp->destroyed)
|
||||
@ -3802,10 +3613,10 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
|
||||
/* set the QP tsa context */
|
||||
nesqp->nesqp_context->tcpPorts[0] =
|
||||
cpu_to_le16(cm_node->mapped_loc_port);
|
||||
cpu_to_le16(cm_node->loc_port);
|
||||
nesqp->nesqp_context->tcpPorts[1] =
|
||||
cpu_to_le16(cm_node->mapped_rem_port);
|
||||
nesqp->nesqp_context->ip0 = cpu_to_le32(cm_node->mapped_rem_addr);
|
||||
cpu_to_le16(cm_node->rem_port);
|
||||
nesqp->nesqp_context->ip0 = cpu_to_le32(cm_node->rem_addr);
|
||||
|
||||
nesqp->nesqp_context->misc2 |= cpu_to_le32(
|
||||
(u32)PCI_FUNC(nesdev->pcidev->devfn) <<
|
||||
@ -3835,9 +3646,9 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
|
||||
nes_quad.DstIpAdrIndex =
|
||||
cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
|
||||
nes_quad.SrcIpadr = htonl(cm_node->mapped_rem_addr);
|
||||
nes_quad.TcpPorts[0] = htons(cm_node->mapped_rem_port);
|
||||
nes_quad.TcpPorts[1] = htons(cm_node->mapped_loc_port);
|
||||
nes_quad.SrcIpadr = htonl(cm_node->rem_addr);
|
||||
nes_quad.TcpPorts[0] = htons(cm_node->rem_port);
|
||||
nes_quad.TcpPorts[1] = htons(cm_node->loc_port);
|
||||
|
||||
/* Produce hash key */
|
||||
crc_value = get_crc_value(&nes_quad);
|
||||
@ -3858,14 +3669,14 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
cm_event.provider_data = cm_id->provider_data;
|
||||
cm_event_laddr->sin_family = AF_INET;
|
||||
cm_event_laddr->sin_port = laddr->sin_port;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
|
||||
cm_event.private_data = (void *)event->cm_node->mpa_frame_buf;
|
||||
cm_event.private_data_len = (u8)event->cm_node->mpa_frame_size;
|
||||
cm_event.ird = cm_node->ird_size;
|
||||
cm_event.ord = cm_node->ord_size;
|
||||
|
||||
cm_event_laddr->sin_addr.s_addr = htonl(event->cm_info.rem_addr);
|
||||
cm_event_laddr->sin_addr.s_addr = htonl(event->cm_info.loc_addr);
|
||||
ret = cm_id->event_handler(cm_id, &cm_event);
|
||||
nes_debug(NES_DBG_CM, "OFA CM event_handler returned, ret=%d\n", ret);
|
||||
|
||||
@ -3913,8 +3724,8 @@ static void cm_event_connect_error(struct nes_cm_event *event)
|
||||
cm_event.event = IW_CM_EVENT_CONNECT_REPLY;
|
||||
cm_event.status = -ECONNRESET;
|
||||
cm_event.provider_data = cm_id->provider_data;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
|
||||
@ -3970,8 +3781,8 @@ static void cm_event_reset(struct nes_cm_event *event)
|
||||
cm_event.event = IW_CM_EVENT_DISCONNECT;
|
||||
cm_event.status = -ECONNRESET;
|
||||
cm_event.provider_data = cm_id->provider_data;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
|
||||
@ -3981,8 +3792,8 @@ static void cm_event_reset(struct nes_cm_event *event)
|
||||
cm_event.event = IW_CM_EVENT_CLOSE;
|
||||
cm_event.status = 0;
|
||||
cm_event.provider_data = cm_id->provider_data;
|
||||
cm_event.local_addr = cm_id->local_addr;
|
||||
cm_event.remote_addr = cm_id->remote_addr;
|
||||
cm_event.local_addr = cm_id->m_local_addr;
|
||||
cm_event.remote_addr = cm_id->m_remote_addr;
|
||||
cm_event.private_data = NULL;
|
||||
cm_event.private_data_len = 0;
|
||||
nes_debug(NES_DBG_CM, "NODE %p Generating CLOSE\n", event->cm_node);
|
||||
|
@ -293,8 +293,8 @@ struct nes_cm_listener {
|
||||
struct list_head list;
|
||||
struct nes_cm_core *cm_core;
|
||||
u8 loc_mac[ETH_ALEN];
|
||||
nes_addr_t loc_addr, mapped_loc_addr;
|
||||
u16 loc_port, mapped_loc_port;
|
||||
nes_addr_t loc_addr;
|
||||
u16 loc_port;
|
||||
struct iw_cm_id *cm_id;
|
||||
enum nes_cm_conn_type conn_type;
|
||||
atomic_t ref_count;
|
||||
@ -309,9 +309,7 @@ struct nes_cm_listener {
|
||||
/* per connection node and node state information */
|
||||
struct nes_cm_node {
|
||||
nes_addr_t loc_addr, rem_addr;
|
||||
nes_addr_t mapped_loc_addr, mapped_rem_addr;
|
||||
u16 loc_port, rem_port;
|
||||
u16 mapped_loc_port, mapped_rem_port;
|
||||
|
||||
u8 loc_mac[ETH_ALEN];
|
||||
u8 rem_mac[ETH_ALEN];
|
||||
@ -368,11 +366,6 @@ struct nes_cm_info {
|
||||
u16 rem_port;
|
||||
nes_addr_t loc_addr;
|
||||
nes_addr_t rem_addr;
|
||||
u16 mapped_loc_port;
|
||||
u16 mapped_rem_port;
|
||||
nes_addr_t mapped_loc_addr;
|
||||
nes_addr_t mapped_rem_addr;
|
||||
|
||||
enum nes_cm_conn_type conn_type;
|
||||
int backlog;
|
||||
};
|
||||
|
@ -35,18 +35,11 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/inet_lro.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "nes.h"
|
||||
|
||||
static unsigned int nes_lro_max_aggr = NES_LRO_MAX_AGGR;
|
||||
module_param(nes_lro_max_aggr, uint, 0444);
|
||||
MODULE_PARM_DESC(nes_lro_max_aggr, "NIC LRO max packet aggregation");
|
||||
|
||||
static int wide_ppm_offset;
|
||||
module_param(wide_ppm_offset, int, 0644);
|
||||
MODULE_PARM_DESC(wide_ppm_offset, "Increase CX4 interface clock ppm offset, 0=100ppm (default), 1=300ppm");
|
||||
@ -1642,25 +1635,6 @@ static void nes_rq_wqes_timeout(unsigned long parm)
|
||||
}
|
||||
|
||||
|
||||
static int nes_lro_get_skb_hdr(struct sk_buff *skb, void **iphdr,
|
||||
void **tcph, u64 *hdr_flags, void *priv)
|
||||
{
|
||||
unsigned int ip_len;
|
||||
struct iphdr *iph;
|
||||
skb_reset_network_header(skb);
|
||||
iph = ip_hdr(skb);
|
||||
if (iph->protocol != IPPROTO_TCP)
|
||||
return -1;
|
||||
ip_len = ip_hdrlen(skb);
|
||||
skb_set_transport_header(skb, ip_len);
|
||||
*tcph = tcp_hdr(skb);
|
||||
|
||||
*hdr_flags = LRO_IPV4 | LRO_TCP;
|
||||
*iphdr = iph;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* nes_init_nic_qp
|
||||
*/
|
||||
@ -1895,14 +1869,6 @@ int nes_init_nic_qp(struct nes_device *nesdev, struct net_device *netdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
nesvnic->lro_mgr.max_aggr = nes_lro_max_aggr;
|
||||
nesvnic->lro_mgr.max_desc = NES_MAX_LRO_DESCRIPTORS;
|
||||
nesvnic->lro_mgr.lro_arr = nesvnic->lro_desc;
|
||||
nesvnic->lro_mgr.get_skb_header = nes_lro_get_skb_hdr;
|
||||
nesvnic->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID;
|
||||
nesvnic->lro_mgr.dev = netdev;
|
||||
nesvnic->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
|
||||
nesvnic->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2809,13 +2775,10 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
|
||||
u16 pkt_type;
|
||||
u16 rqes_processed = 0;
|
||||
u8 sq_cqes = 0;
|
||||
u8 nes_use_lro = 0;
|
||||
|
||||
head = cq->cq_head;
|
||||
cq_size = cq->cq_size;
|
||||
cq->cqes_pending = 1;
|
||||
if (nesvnic->netdev->features & NETIF_F_LRO)
|
||||
nes_use_lro = 1;
|
||||
do {
|
||||
if (le32_to_cpu(cq->cq_vbase[head].cqe_words[NES_NIC_CQE_MISC_IDX]) &
|
||||
NES_NIC_CQE_VALID) {
|
||||
@ -2950,10 +2913,7 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
|
||||
|
||||
__vlan_hwaccel_put_tag(rx_skb, htons(ETH_P_8021Q), vlan_tag);
|
||||
}
|
||||
if (nes_use_lro)
|
||||
lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL);
|
||||
else
|
||||
netif_receive_skb(rx_skb);
|
||||
napi_gro_receive(&nesvnic->napi, rx_skb);
|
||||
|
||||
skip_rx_indicate0:
|
||||
;
|
||||
@ -2984,8 +2944,6 @@ skip_rx_indicate0:
|
||||
|
||||
} while (1);
|
||||
|
||||
if (nes_use_lro)
|
||||
lro_flush_all(&nesvnic->lro_mgr);
|
||||
if (sq_cqes) {
|
||||
barrier();
|
||||
/* restart the queue if it had been stopped */
|
||||
|
@ -33,8 +33,6 @@
|
||||
#ifndef __NES_HW_H
|
||||
#define __NES_HW_H
|
||||
|
||||
#include <linux/inet_lro.h>
|
||||
|
||||
#define NES_PHY_TYPE_CX4 1
|
||||
#define NES_PHY_TYPE_1G 2
|
||||
#define NES_PHY_TYPE_ARGUS 4
|
||||
@ -1049,8 +1047,6 @@ struct nes_hw_tune_timer {
|
||||
#define NES_TIMER_ENABLE_LIMIT 4
|
||||
#define NES_MAX_LINK_INTERRUPTS 128
|
||||
#define NES_MAX_LINK_CHECK 200
|
||||
#define NES_MAX_LRO_DESCRIPTORS 32
|
||||
#define NES_LRO_MAX_AGGR 64
|
||||
|
||||
struct nes_adapter {
|
||||
u64 fw_ver;
|
||||
@ -1263,9 +1259,6 @@ struct nes_vnic {
|
||||
u8 next_qp_nic_index;
|
||||
u8 of_device_registered;
|
||||
u8 rdma_enabled;
|
||||
u32 lro_max_aggr;
|
||||
struct net_lro_mgr lro_mgr;
|
||||
struct net_lro_desc lro_desc[NES_MAX_LRO_DESCRIPTORS];
|
||||
struct timer_list event_timer;
|
||||
enum ib_event_type delayed_event;
|
||||
enum ib_event_type last_dispatched_event;
|
||||
|
@ -1085,9 +1085,6 @@ static const char nes_ethtool_stringset[][ETH_GSTRING_LEN] = {
|
||||
"Free 4Kpbls",
|
||||
"Free 256pbls",
|
||||
"Timer Inits",
|
||||
"LRO aggregated",
|
||||
"LRO flushed",
|
||||
"LRO no_desc",
|
||||
"PAU CreateQPs",
|
||||
"PAU DestroyQPs",
|
||||
};
|
||||
@ -1302,9 +1299,6 @@ static void nes_netdev_get_ethtool_stats(struct net_device *netdev,
|
||||
target_stat_values[++index] = nesadapter->free_4kpbl;
|
||||
target_stat_values[++index] = nesadapter->free_256pbl;
|
||||
target_stat_values[++index] = int_mod_timer_init;
|
||||
target_stat_values[++index] = nesvnic->lro_mgr.stats.aggregated;
|
||||
target_stat_values[++index] = nesvnic->lro_mgr.stats.flushed;
|
||||
target_stat_values[++index] = nesvnic->lro_mgr.stats.no_desc;
|
||||
target_stat_values[++index] = atomic_read(&pau_qps_created);
|
||||
target_stat_values[++index] = atomic_read(&pau_qps_destroyed);
|
||||
}
|
||||
@ -1709,7 +1703,6 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
|
||||
netdev->hw_features |= NETIF_F_TSO;
|
||||
|
||||
netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX;
|
||||
netdev->hw_features |= NETIF_F_LRO;
|
||||
|
||||
nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
|
||||
" nic_index = %d, logical_port = %d, mac_index = %d.\n",
|
||||
|
@ -3769,6 +3769,8 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
|
||||
nesibdev->ibdev.iwcm->create_listen = nes_create_listen;
|
||||
nesibdev->ibdev.iwcm->destroy_listen = nes_destroy_listen;
|
||||
nesibdev->ibdev.get_port_immutable = nes_port_immutable;
|
||||
memcpy(nesibdev->ibdev.iwcm->ifname, netdev->name,
|
||||
sizeof(nesibdev->ibdev.iwcm->ifname));
|
||||
|
||||
return nesibdev;
|
||||
}
|
||||
|
@ -1021,6 +1021,8 @@ struct cpl_l2t_write_req {
|
||||
#define L2T_W_NOREPLY_V(x) ((x) << L2T_W_NOREPLY_S)
|
||||
#define L2T_W_NOREPLY_F L2T_W_NOREPLY_V(1U)
|
||||
|
||||
#define CPL_L2T_VLAN_NONE 0xfff
|
||||
|
||||
struct cpl_l2t_write_rpl {
|
||||
union opcode_tid ot;
|
||||
u8 status;
|
||||
|
@ -561,6 +561,7 @@ enum fw_flowc_mnem {
|
||||
FW_FLOWC_MNEM_SNDBUF,
|
||||
FW_FLOWC_MNEM_MSS,
|
||||
FW_FLOWC_MNEM_TXDATAPLEN_MAX,
|
||||
FW_FLOWC_MNEM_SCHEDCLASS = 11,
|
||||
};
|
||||
|
||||
struct fw_flowc_mnemval {
|
||||
|
@ -83,8 +83,10 @@ struct iw_cm_id {
|
||||
iw_cm_handler cm_handler; /* client callback function */
|
||||
void *context; /* client cb context */
|
||||
struct ib_device *device;
|
||||
struct sockaddr_storage local_addr;
|
||||
struct sockaddr_storage local_addr; /* local addr */
|
||||
struct sockaddr_storage remote_addr;
|
||||
struct sockaddr_storage m_local_addr; /* nmapped local addr */
|
||||
struct sockaddr_storage m_remote_addr; /* nmapped rem addr */
|
||||
void *provider_data; /* provider private data */
|
||||
iw_event_handler event_handler; /* cb for provider
|
||||
events */
|
||||
@ -92,6 +94,7 @@ struct iw_cm_id {
|
||||
void (*add_ref)(struct iw_cm_id *);
|
||||
void (*rem_ref)(struct iw_cm_id *);
|
||||
u8 tos;
|
||||
bool mapped;
|
||||
};
|
||||
|
||||
struct iw_cm_conn_param {
|
||||
@ -123,6 +126,7 @@ struct iw_cm_verbs {
|
||||
int backlog);
|
||||
|
||||
int (*destroy_listen)(struct iw_cm_id *cm_id);
|
||||
char ifname[IFNAMSIZ];
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
enum {
|
||||
RDMA_NL_RDMA_CM = 1,
|
||||
RDMA_NL_NES,
|
||||
RDMA_NL_C4IW,
|
||||
RDMA_NL_IWCM,
|
||||
RDMA_NL_RSVD,
|
||||
RDMA_NL_LS, /* RDMA Local Services */
|
||||
RDMA_NL_NUM_CLIENTS
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user