Commit 721675fc authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford:
 "A few more minor fixes for rc3:

   - One fix to ipoib
   - One fix to core sysfs code
   - Four patches that resolve an oops found in testing of ocrdma and a
     couple other ocrdma issues"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
  RDMA/ocrdma: Fixing ocrdma debugfs directory remove
  RDMA/ocrdma: Fix pkey_index returned by driver in rq work completion
  RDMA/ocrdma: populate max_sge_rd in device attributes
  RDMA/ocrdma: Initialize stats resources in the driver before ib device registration.
  IB/sysfs: remove unused va_list args
  IB/IPoIB: Do not set skb truesize since using one linearskb
parents 74c7b2af 7425f410
...@@ -336,7 +336,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p, ...@@ -336,7 +336,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p,
union ib_gid gid; union ib_gid gid;
struct ib_gid_attr gid_attr = {}; struct ib_gid_attr gid_attr = {};
ssize_t ret; ssize_t ret;
va_list args;
ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid, ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid,
&gid_attr); &gid_attr);
...@@ -348,7 +347,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p, ...@@ -348,7 +347,6 @@ static ssize_t _show_port_gid_attr(struct ib_port *p,
err: err:
if (gid_attr.ndev) if (gid_attr.ndev)
dev_put(gid_attr.ndev); dev_put(gid_attr.ndev);
va_end(args);
return ret; return ret;
} }
......
...@@ -228,6 +228,11 @@ static int ocrdma_alloc_resources(struct ocrdma_dev *dev) ...@@ -228,6 +228,11 @@ static int ocrdma_alloc_resources(struct ocrdma_dev *dev)
ocrdma_alloc_pd_pool(dev); ocrdma_alloc_pd_pool(dev);
if (!ocrdma_alloc_stats_resources(dev)) {
pr_err("%s: stats resource allocation failed\n", __func__);
goto alloc_err;
}
spin_lock_init(&dev->av_tbl.lock); spin_lock_init(&dev->av_tbl.lock);
spin_lock_init(&dev->flush_q_lock); spin_lock_init(&dev->flush_q_lock);
return 0; return 0;
...@@ -238,6 +243,7 @@ static int ocrdma_alloc_resources(struct ocrdma_dev *dev) ...@@ -238,6 +243,7 @@ static int ocrdma_alloc_resources(struct ocrdma_dev *dev)
static void ocrdma_free_resources(struct ocrdma_dev *dev) static void ocrdma_free_resources(struct ocrdma_dev *dev)
{ {
ocrdma_release_stats_resources(dev);
kfree(dev->stag_arr); kfree(dev->stag_arr);
kfree(dev->qp_tbl); kfree(dev->qp_tbl);
kfree(dev->cq_tbl); kfree(dev->cq_tbl);
......
...@@ -64,10 +64,11 @@ static int ocrdma_add_stat(char *start, char *pcur, ...@@ -64,10 +64,11 @@ static int ocrdma_add_stat(char *start, char *pcur,
return cpy_len; return cpy_len;
} }
static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev) bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev)
{ {
struct stats_mem *mem = &dev->stats_mem; struct stats_mem *mem = &dev->stats_mem;
mutex_init(&dev->stats_lock);
/* Alloc mbox command mem*/ /* Alloc mbox command mem*/
mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req), mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req),
sizeof(struct ocrdma_rdma_stats_resp)); sizeof(struct ocrdma_rdma_stats_resp));
...@@ -91,13 +92,14 @@ static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev) ...@@ -91,13 +92,14 @@ static bool ocrdma_alloc_stats_mem(struct ocrdma_dev *dev)
return true; return true;
} }
static void ocrdma_release_stats_mem(struct ocrdma_dev *dev) void ocrdma_release_stats_resources(struct ocrdma_dev *dev)
{ {
struct stats_mem *mem = &dev->stats_mem; struct stats_mem *mem = &dev->stats_mem;
if (mem->va) if (mem->va)
dma_free_coherent(&dev->nic_info.pdev->dev, mem->size, dma_free_coherent(&dev->nic_info.pdev->dev, mem->size,
mem->va, mem->pa); mem->va, mem->pa);
mem->va = NULL;
kfree(mem->debugfs_mem); kfree(mem->debugfs_mem);
} }
...@@ -838,15 +840,9 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev) ...@@ -838,15 +840,9 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev)
&dev->reset_stats, &ocrdma_dbg_ops)) &dev->reset_stats, &ocrdma_dbg_ops))
goto err; goto err;
/* Now create dma_mem for stats mbx command */
if (!ocrdma_alloc_stats_mem(dev))
goto err;
mutex_init(&dev->stats_lock);
return; return;
err: err:
ocrdma_release_stats_mem(dev);
debugfs_remove_recursive(dev->dir); debugfs_remove_recursive(dev->dir);
dev->dir = NULL; dev->dir = NULL;
} }
...@@ -855,9 +851,7 @@ void ocrdma_rem_port_stats(struct ocrdma_dev *dev) ...@@ -855,9 +851,7 @@ void ocrdma_rem_port_stats(struct ocrdma_dev *dev)
{ {
if (!dev->dir) if (!dev->dir)
return; return;
debugfs_remove(dev->dir); debugfs_remove_recursive(dev->dir);
mutex_destroy(&dev->stats_lock);
ocrdma_release_stats_mem(dev);
} }
void ocrdma_init_debugfs(void) void ocrdma_init_debugfs(void)
......
...@@ -65,6 +65,8 @@ enum OCRDMA_STATS_TYPE { ...@@ -65,6 +65,8 @@ enum OCRDMA_STATS_TYPE {
void ocrdma_rem_debugfs(void); void ocrdma_rem_debugfs(void);
void ocrdma_init_debugfs(void); void ocrdma_init_debugfs(void);
bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev);
void ocrdma_release_stats_resources(struct ocrdma_dev *dev);
void ocrdma_rem_port_stats(struct ocrdma_dev *dev); void ocrdma_rem_port_stats(struct ocrdma_dev *dev);
void ocrdma_add_port_stats(struct ocrdma_dev *dev); void ocrdma_add_port_stats(struct ocrdma_dev *dev);
int ocrdma_pma_counters(struct ocrdma_dev *dev, int ocrdma_pma_counters(struct ocrdma_dev *dev,
......
...@@ -125,8 +125,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr, ...@@ -125,8 +125,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr,
IB_DEVICE_SYS_IMAGE_GUID | IB_DEVICE_SYS_IMAGE_GUID |
IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_LOCAL_DMA_LKEY |
IB_DEVICE_MEM_MGT_EXTENSIONS; IB_DEVICE_MEM_MGT_EXTENSIONS;
attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_srq_sge); attr->max_sge = dev->attr.max_send_sge;
attr->max_sge_rd = 0; attr->max_sge_rd = attr->max_sge;
attr->max_cq = dev->attr.max_cq; attr->max_cq = dev->attr.max_cq;
attr->max_cqe = dev->attr.max_cqe; attr->max_cqe = dev->attr.max_cqe;
attr->max_mr = dev->attr.max_mr; attr->max_mr = dev->attr.max_mr;
...@@ -2726,8 +2726,7 @@ static int ocrdma_update_ud_rcqe(struct ib_wc *ibwc, struct ocrdma_cqe *cqe) ...@@ -2726,8 +2726,7 @@ static int ocrdma_update_ud_rcqe(struct ib_wc *ibwc, struct ocrdma_cqe *cqe)
OCRDMA_CQE_UD_STATUS_MASK) >> OCRDMA_CQE_UD_STATUS_SHIFT; OCRDMA_CQE_UD_STATUS_MASK) >> OCRDMA_CQE_UD_STATUS_SHIFT;
ibwc->src_qp = le32_to_cpu(cqe->flags_status_srcqpn) & ibwc->src_qp = le32_to_cpu(cqe->flags_status_srcqpn) &
OCRDMA_CQE_SRCQP_MASK; OCRDMA_CQE_SRCQP_MASK;
ibwc->pkey_index = le32_to_cpu(cqe->ud.rxlen_pkey) & ibwc->pkey_index = 0;
OCRDMA_CQE_PKEY_MASK;
ibwc->wc_flags = IB_WC_GRH; ibwc->wc_flags = IB_WC_GRH;
ibwc->byte_len = (le32_to_cpu(cqe->ud.rxlen_pkey) >> ibwc->byte_len = (le32_to_cpu(cqe->ud.rxlen_pkey) >>
OCRDMA_CQE_UD_XFER_LEN_SHIFT); OCRDMA_CQE_UD_XFER_LEN_SHIFT);
......
...@@ -245,8 +245,6 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) ...@@ -245,8 +245,6 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb_pull(skb, IPOIB_ENCAP_LEN); skb_pull(skb, IPOIB_ENCAP_LEN);
skb->truesize = SKB_TRUESIZE(skb->len);
++dev->stats.rx_packets; ++dev->stats.rx_packets;
dev->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment