Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull infiniband updates from Roland Dreier: "First batch of InfiniBand/RDMA changes for the 3.7 merge window: - mlx4 IB support for SR-IOV - A couple of SRP initiator fixes - Batch of nes hardware driver fixes - Fix for long-standing use-after-free crash in IPoIB - Other miscellaneous fixes" This merge also removes a new use of __cancel_delayed_work(), and replaces it with the regular cancel_delayed_work() that is now irq-safe thanks to the workqueue updates. That said, I suspect the sequence in question should probably use "mod_delayed_work()". I just did the minimal "don't use deprecated functions" fixup, though. * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (45 commits) IB/qib: Fix local access validation for user MRs mlx4_core: Disable SENSE_PORT for multifunction devices mlx4_core: Clean up enabling of SENSE_PORT for older (ConnectX-1/-2) HCAs mlx4_core: Stash PCI ID driver_data in mlx4_priv structure IB/srp: Avoid having aborted requests hang IB/srp: Fix use-after-free in srp_reset_req() IB/qib: Add a qib driver version RDMA/nes: Fix compilation error when nes_debug is enabled RDMA/nes: Print hardware resource type RDMA/nes: Fix for crash when TX checksum offload is off RDMA/nes: Cosmetic changes RDMA/nes: Fix for incorrect MSS when TSO is on RDMA/nes: Fix incorrect resolving of the loopback MAC address mlx4_core: Fix crash on uninitialized priv->cmd.slave_sem mlx4_core: Trivial cleanups to driver log messages mlx4_core: Trivial readability fix: "0X30" -> "0x30" IB/mlx4: Create paravirt contexts for VFs when master IB driver initializes mlx4: Modify proxy/tunnel QP mechanism so that guests do no calculations mlx4: Paravirtualize Node Guids for slaves mlx4: Activate SR-IOV mode for IB ...
This commit is contained in:
@@ -399,11 +399,20 @@ static inline void nes_write8(void __iomem *addr, u8 val)
|
||||
writeb(val, addr);
|
||||
}
|
||||
|
||||
|
||||
enum nes_resource {
|
||||
NES_RESOURCE_MW = 1,
|
||||
NES_RESOURCE_FAST_MR,
|
||||
NES_RESOURCE_PHYS_MR,
|
||||
NES_RESOURCE_USER_MR,
|
||||
NES_RESOURCE_PD,
|
||||
NES_RESOURCE_QP,
|
||||
NES_RESOURCE_CQ,
|
||||
NES_RESOURCE_ARP
|
||||
};
|
||||
|
||||
static inline int nes_alloc_resource(struct nes_adapter *nesadapter,
|
||||
unsigned long *resource_array, u32 max_resources,
|
||||
u32 *req_resource_num, u32 *next)
|
||||
u32 *req_resource_num, u32 *next, enum nes_resource resource_type)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 resource_num;
|
||||
@@ -414,7 +423,7 @@ static inline int nes_alloc_resource(struct nes_adapter *nesadapter,
|
||||
if (resource_num >= max_resources) {
|
||||
resource_num = find_first_zero_bit(resource_array, max_resources);
|
||||
if (resource_num >= max_resources) {
|
||||
printk(KERN_ERR PFX "%s: No available resourcess.\n", __func__);
|
||||
printk(KERN_ERR PFX "%s: No available resources [type=%u].\n", __func__, resource_type);
|
||||
spin_unlock_irqrestore(&nesadapter->resource_lock, flags);
|
||||
return -EMFILE;
|
||||
}
|
||||
|
@@ -430,6 +430,8 @@ static void form_cm_frame(struct sk_buff *skb,
|
||||
buf += sizeof(*tcph);
|
||||
|
||||
skb->ip_summed = CHECKSUM_PARTIAL;
|
||||
if (!(cm_node->netdev->features & NETIF_F_IP_CSUM))
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
skb->protocol = htons(0x800);
|
||||
skb->data_len = 0;
|
||||
skb->mac_len = ETH_HLEN;
|
||||
@@ -1356,7 +1358,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
|
||||
else
|
||||
netdev = nesvnic->netdev;
|
||||
|
||||
neigh = dst_neigh_lookup(&rt->dst, &dst_ip);
|
||||
neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);
|
||||
|
||||
rcu_read_lock();
|
||||
if (neigh) {
|
||||
@@ -1465,12 +1467,8 @@ 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 */
|
||||
if (ipv4_is_loopback(htonl(cm_node->rem_addr))) {
|
||||
arpindex = nes_arp_table(nesdev, ntohl(nesvnic->local_ipaddr), NULL, NES_ARP_RESOLVE);
|
||||
} else {
|
||||
oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
|
||||
arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
|
||||
}
|
||||
oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
|
||||
arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
|
||||
if (arpindex < 0) {
|
||||
kfree(cm_node);
|
||||
return NULL;
|
||||
@@ -3153,11 +3151,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
|
||||
nesqp->nesqp_context->tcpPorts[1] =
|
||||
cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
|
||||
|
||||
if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr))
|
||||
nesqp->nesqp_context->ip0 =
|
||||
cpu_to_le32(ntohl(nesvnic->local_ipaddr));
|
||||
else
|
||||
nesqp->nesqp_context->ip0 =
|
||||
nesqp->nesqp_context->ip0 =
|
||||
cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
|
||||
|
||||
nesqp->nesqp_context->misc2 |= cpu_to_le32(
|
||||
@@ -3182,10 +3176,7 @@ 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);
|
||||
if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr))
|
||||
nes_quad.SrcIpadr = nesvnic->local_ipaddr;
|
||||
else
|
||||
nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
|
||||
nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
|
||||
nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
|
||||
nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
|
||||
|
||||
@@ -3538,11 +3529,7 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
cpu_to_le16(ntohs(cm_id->local_addr.sin_port));
|
||||
nesqp->nesqp_context->tcpPorts[1] =
|
||||
cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
|
||||
if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr))
|
||||
nesqp->nesqp_context->ip0 =
|
||||
cpu_to_le32(ntohl(nesvnic->local_ipaddr));
|
||||
else
|
||||
nesqp->nesqp_context->ip0 =
|
||||
nesqp->nesqp_context->ip0 =
|
||||
cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
|
||||
|
||||
nesqp->nesqp_context->misc2 |= cpu_to_le32(
|
||||
@@ -3571,10 +3558,7 @@ static void cm_event_connected(struct nes_cm_event *event)
|
||||
|
||||
nes_quad.DstIpAdrIndex =
|
||||
cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
|
||||
if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr))
|
||||
nes_quad.SrcIpadr = nesvnic->local_ipaddr;
|
||||
else
|
||||
nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
|
||||
nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
|
||||
nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
|
||||
nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
|
||||
|
||||
|
@@ -3575,10 +3575,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev,
|
||||
tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT;
|
||||
iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT;
|
||||
nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p,"
|
||||
" Tcp state = %s, iWARP state = %s\n",
|
||||
" Tcp state = %d, iWARP state = %d\n",
|
||||
async_event_id,
|
||||
le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe,
|
||||
nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]);
|
||||
tcp_state, iwarp_state);
|
||||
|
||||
aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]);
|
||||
if (aeq_info & NES_AEQE_QP) {
|
||||
|
@@ -384,24 +384,20 @@ static int nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
|
||||
/* bump past the vlan tag */
|
||||
wqe_fragment_length++;
|
||||
/* wqe_fragment_address = (u64 *)&nic_sqe->wqe_words[NES_NIC_SQ_WQE_FRAG0_LOW_IDX]; */
|
||||
wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
|
||||
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
tcph = tcp_hdr(skb);
|
||||
if (1) {
|
||||
if (skb_is_gso(skb)) {
|
||||
/* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... seg size = %u\n",
|
||||
netdev->name, skb_is_gso(skb)); */
|
||||
wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE |
|
||||
NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb);
|
||||
set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX,
|
||||
((u32)tcph->doff) |
|
||||
(((u32)(((unsigned char *)tcph) - skb->data)) << 4));
|
||||
} else {
|
||||
wqe_misc |= NES_NIC_SQ_WQE_COMPLETION;
|
||||
}
|
||||
if (skb_is_gso(skb)) {
|
||||
tcph = tcp_hdr(skb);
|
||||
/* nes_debug(NES_DBG_NIC_TX, "%s: TSO request... is_gso = %u seg size = %u\n",
|
||||
netdev->name, skb_is_gso(skb), skb_shinfo(skb)->gso_size); */
|
||||
wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE | (u16)skb_shinfo(skb)->gso_size;
|
||||
set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_LSO_INFO_IDX,
|
||||
((u32)tcph->doff) |
|
||||
(((u32)(((unsigned char *)tcph) - skb->data)) << 4));
|
||||
}
|
||||
} else { /* CHECKSUM_HW */
|
||||
wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM | NES_NIC_SQ_WQE_COMPLETION;
|
||||
wqe_misc |= NES_NIC_SQ_WQE_DISABLE_CHKSUM;
|
||||
}
|
||||
|
||||
set_wqe_32bit_value(nic_sqe->wqe_words, NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX,
|
||||
@@ -596,10 +592,10 @@ tso_sq_no_longer_full:
|
||||
nes_debug(NES_DBG_NIC_TX, "ERROR: SKB header too big, headlen=%u, FIRST_FRAG_SIZE=%u\n",
|
||||
original_first_length, NES_FIRST_FRAG_SIZE);
|
||||
nes_debug(NES_DBG_NIC_TX, "%s Request to tx NIC packet length %u, headlen %u,"
|
||||
" (%u frags), tso_size=%u\n",
|
||||
" (%u frags), is_gso = %u tso_size=%u\n",
|
||||
netdev->name,
|
||||
skb->len, skb_headlen(skb),
|
||||
skb_shinfo(skb)->nr_frags, skb_is_gso(skb));
|
||||
skb_shinfo(skb)->nr_frags, skb_is_gso(skb), skb_shinfo(skb)->gso_size);
|
||||
}
|
||||
memcpy(&nesnic->first_frag_vbase[nesnic->sq_head].buffer,
|
||||
skb->data, min(((unsigned int)NES_FIRST_FRAG_SIZE),
|
||||
@@ -651,8 +647,8 @@ tso_sq_no_longer_full:
|
||||
} else {
|
||||
nesnic->tx_skb[nesnic->sq_head] = NULL;
|
||||
}
|
||||
wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_is_gso(skb);
|
||||
if ((tso_wqe_length + original_first_length) > skb_is_gso(skb)) {
|
||||
wqe_misc |= NES_NIC_SQ_WQE_COMPLETION | (u16)skb_shinfo(skb)->gso_size;
|
||||
if ((tso_wqe_length + original_first_length) > skb_shinfo(skb)->gso_size) {
|
||||
wqe_misc |= NES_NIC_SQ_WQE_LSO_ENABLE;
|
||||
} else {
|
||||
iph->tot_len = htons(tso_wqe_length + original_first_length - nhoffset);
|
||||
@@ -1678,12 +1674,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
|
||||
netdev->hard_header_len = ETH_HLEN;
|
||||
netdev->addr_len = ETH_ALEN;
|
||||
netdev->type = ARPHRD_ETHER;
|
||||
netdev->features = NETIF_F_HIGHDMA;
|
||||
netdev->netdev_ops = &nes_netdev_ops;
|
||||
netdev->ethtool_ops = &nes_ethtool_ops;
|
||||
netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
|
||||
nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
|
||||
netdev->features |= NETIF_F_HW_VLAN_TX;
|
||||
|
||||
/* Fill in the port structure */
|
||||
nesvnic->netdev = netdev;
|
||||
@@ -1710,11 +1704,11 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
|
||||
netdev->dev_addr[5] = (u8)u64temp;
|
||||
memcpy(netdev->perm_addr, netdev->dev_addr, 6);
|
||||
|
||||
netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM |
|
||||
NETIF_F_HW_VLAN_RX;
|
||||
netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
|
||||
if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
|
||||
netdev->hw_features |= NETIF_F_TSO;
|
||||
netdev->features |= netdev->hw_features;
|
||||
|
||||
netdev->features = netdev->hw_features | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX;
|
||||
netdev->hw_features |= NETIF_F_LRO;
|
||||
|
||||
nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
|
||||
|
@@ -699,7 +699,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
|
||||
|
||||
arp_index = 0;
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_arps,
|
||||
nesadapter->arp_table_size, (u32 *)&arp_index, &nesadapter->next_arp_index);
|
||||
nesadapter->arp_table_size, (u32 *)&arp_index, &nesadapter->next_arp_index, NES_RESOURCE_ARP);
|
||||
if (err) {
|
||||
nes_debug(NES_DBG_NETDEV, "nes_alloc_resource returned error = %u\n", err);
|
||||
return err;
|
||||
|
@@ -80,7 +80,7 @@ static struct ib_mw *nes_alloc_mw(struct ib_pd *ibpd) {
|
||||
next_stag_index %= nesadapter->max_mr;
|
||||
|
||||
ret = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
|
||||
nesadapter->max_mr, &stag_index, &next_stag_index);
|
||||
nesadapter->max_mr, &stag_index, &next_stag_index, NES_RESOURCE_MW);
|
||||
if (ret) {
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
@@ -404,7 +404,7 @@ static struct ib_mr *nes_alloc_fast_reg_mr(struct ib_pd *ibpd, int max_page_list
|
||||
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
|
||||
nesadapter->max_mr, &stag_index,
|
||||
&next_stag_index);
|
||||
&next_stag_index, NES_RESOURCE_FAST_MR);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
@@ -780,7 +780,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev,
|
||||
netdev_refcnt_read(nesvnic->netdev));
|
||||
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_pds,
|
||||
nesadapter->max_pd, &pd_num, &nesadapter->next_pd);
|
||||
nesadapter->max_pd, &pd_num, &nesadapter->next_pd, NES_RESOURCE_PD);
|
||||
if (err) {
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
|
||||
nes_debug(NES_DBG_QP, "RQ size=%u, SQ Size=%u\n", rq_size, sq_size);
|
||||
|
||||
ret = nes_alloc_resource(nesadapter, nesadapter->allocated_qps,
|
||||
nesadapter->max_qp, &qp_num, &nesadapter->next_qp);
|
||||
nesadapter->max_qp, &qp_num, &nesadapter->next_qp, NES_RESOURCE_QP);
|
||||
if (ret) {
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
@@ -1546,7 +1546,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs,
|
||||
nesadapter->max_cq, &cq_num, &nesadapter->next_cq);
|
||||
nesadapter->max_cq, &cq_num, &nesadapter->next_cq, NES_RESOURCE_CQ);
|
||||
if (err) {
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -2129,7 +2129,7 @@ static struct ib_mr *nes_reg_phys_mr(struct ib_pd *ib_pd,
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs, nesadapter->max_mr,
|
||||
&stag_index, &next_stag_index);
|
||||
&stag_index, &next_stag_index, NES_RESOURCE_PHYS_MR);
|
||||
if (err) {
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
@@ -2360,7 +2360,7 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
|
||||
next_stag_index %= nesadapter->max_mr;
|
||||
|
||||
err = nes_alloc_resource(nesadapter, nesadapter->allocated_mrs,
|
||||
nesadapter->max_mr, &stag_index, &next_stag_index);
|
||||
nesadapter->max_mr, &stag_index, &next_stag_index, NES_RESOURCE_USER_MR);
|
||||
if (err) {
|
||||
ib_umem_release(region);
|
||||
return ERR_PTR(err);
|
||||
|
Reference in New Issue
Block a user