[PATCH net-next 0/4] Adds support for CIQ and other misc. fixes for rdma/cxgb4

2014-06-06 Thread Hariprasad Shenai
Hi All,

This patch series adds support to allocate and use IQs specifically for
indirect interrupts, adds fixes to align ISS for iWARP connections  fixes
related to tcp snd/rvd window for Chelsio T4/T5 adapters on iw_cxgb4.
Also changes Interrupt Holdoff Packet Count threshold of response queues for
cxgb4 driver.

The patches series is created against 'net-next' tree.
And includes patches on cxgb4 and iw_cxgb4 driver.

Since this patch-series contains cxgb4 and iw_cxgb4 patches, we would like to
request this patch series to get merged via David Miller's 'net-next' tree.

We have included all the maintainers of respective drivers. Kindly review the
change and let us know in case of any review comments.

Thanks 

Hariprasad Shenai (4):
  iw_cxgb4: Allocate and use IQs specifically for indirect interrupts
  iw_cxgb4: Choose appropriate hw mtu index and ISS for iWARP
connections
  iw_cxgb4: don't truncate the recv window size
  cxgb4: Change default Interrupt Holdoff Packet Count Threshold

 drivers/infiniband/hw/cxgb4/cm.c|  127 +++--
 drivers/infiniband/hw/cxgb4/cq.c|7 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h  |2 +
 drivers/infiniband/hw/cxgb4/provider.c  |2 +-
 drivers/infiniband/hw/cxgb4/t4.h|1 +
 drivers/infiniband/hw/cxgb4/t4fw_ri_api.h   |1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |   14 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  236 +++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |7 +
 drivers/net/ethernet/chelsio/cxgb4/sge.c|5 +-
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.h  |1 +
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |   10 +
 12 files changed, 356 insertions(+), 57 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 4/4] cxgb4: Change default Interrupt Holdoff Packet Count Threshold

2014-06-06 Thread Hariprasad Shenai
Based on original work by Casey Leedom lee...@chelsio.com

Signed-off-by: Casey Leedom lee...@chelsio.com
Signed-off-by: Hariprasad Shenai haripra...@chelsio.com
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |   69 +--
 drivers/net/ethernet/chelsio/cxgb4/sge.c|1 -
 2 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 5fa5f2a..2f8d6b9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2503,8 +2503,7 @@ static unsigned int qtimer_val(const struct adapter *adap,
 }
 
 /**
- * set_rxq_intr_params - set a queue's interrupt holdoff parameters
- * @adap: the adapter
+ * set_rspq_intr_params - set a queue's interrupt holdoff parameters
  * @q: the Rx queue
  * @us: the hold-off time in us, or 0 to disable timer
  * @cnt: the hold-off packet count, or 0 to disable counter
@@ -2512,9 +2511,11 @@ static unsigned int qtimer_val(const struct adapter 
*adap,
  * Sets an Rx queue's interrupt hold-off time and packet count.  At least
  * one of the two needs to be enabled for the queue to generate interrupts.
  */
-static int set_rxq_intr_params(struct adapter *adap, struct sge_rspq *q,
-  unsigned int us, unsigned int cnt)
+static int set_rspq_intr_params(struct sge_rspq *q,
+   unsigned int us, unsigned int cnt)
 {
+   struct adapter *adap = q-adap;
+
if ((us | cnt) == 0)
cnt = 1;
 
@@ -2541,24 +2542,34 @@ static int set_rxq_intr_params(struct adapter *adap, 
struct sge_rspq *q,
return 0;
 }
 
-static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
+/**
+ * set_rx_intr_params - set a net devices's RX interrupt holdoff paramete!
+ * @dev: the network device
+ * @us: the hold-off time in us, or 0 to disable timer
+ * @cnt: the hold-off packet count, or 0 to disable counter
+ *
+ * Set the RX interrupt hold-off parameters for a network device.
+ */
+static int set_rx_intr_params(struct net_device *dev,
+ unsigned int us, unsigned int cnt)
 {
-   const struct port_info *pi = netdev_priv(dev);
+   int i, err;
+   struct port_info *pi = netdev_priv(dev);
struct adapter *adap = pi-adapter;
-   struct sge_rspq *q;
-   int i;
-   int r = 0;
-
-   for (i = pi-first_qset; i  pi-first_qset + pi-nqsets; i++) {
-   q = adap-sge.ethrxq[i].rspq;
-   r = set_rxq_intr_params(adap, q, c-rx_coalesce_usecs,
-   c-rx_max_coalesced_frames);
-   if (r) {
-   dev_err(dev-dev, failed to set coalesce %d\n, r);
-   break;
-   }
+   struct sge_eth_rxq *q = adap-sge.ethrxq[pi-first_qset];
+
+   for (i = 0; i  pi-nqsets; i++, q++) {
+   err = set_rspq_intr_params(q-rspq, us, cnt);
+   if (err)
+   return err;
}
-   return r;
+   return 0;
+}
+
+static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
+{
+   return set_rx_intr_params(dev, c-rx_coalesce_usecs,
+ c-rx_max_coalesced_frames);
 }
 
 static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
@@ -5812,12 +5823,12 @@ static inline bool is_x_10g_port(const struct 
link_config *lc)
   (lc-supported  FW_PORT_CAP_SPEED_40G) != 0;
 }
 
-static inline void init_rspq(struct sge_rspq *q, u8 timer_idx, u8 pkt_cnt_idx,
+static inline void init_rspq(struct adapter *adap, struct sge_rspq *q,
+unsigned int us, unsigned int cnt,
 unsigned int size, unsigned int iqe_size)
 {
-   q-intr_params = QINTR_TIMER_IDX(timer_idx) |
-(pkt_cnt_idx  SGE_NCOUNTERS ? QINTR_CNT_EN : 0);
-   q-pktcnt_idx = pkt_cnt_idx  SGE_NCOUNTERS ? pkt_cnt_idx : 0;
+   q-adap = adap;
+   set_rspq_intr_params(q, us, cnt);
q-iqe_len = iqe_size;
q-size = size;
 }
@@ -5876,7 +5887,7 @@ static void cfg_queues(struct adapter *adap)
for (i = 0; i  ARRAY_SIZE(s-ethrxq); i++) {
struct sge_eth_rxq *r = s-ethrxq[i];
 
-   init_rspq(r-rspq, 0, 0, 1024, 64);
+   init_rspq(adap, r-rspq, 5, 10, 1024, 64);
r-fl.size = 72;
}
 
@@ -5892,7 +5903,7 @@ static void cfg_queues(struct adapter *adap)
for (i = 0; i  ARRAY_SIZE(s-ofldrxq); i++) {
struct sge_ofld_rxq *r = s-ofldrxq[i];
 
-   init_rspq(r-rspq, 0, 0, 1024, 64);
+   init_rspq(adap, r-rspq, 5, 1, 1024, 64);
r-rspq.uld = CXGB4_ULD_ISCSI;
r-fl.size = 72;
}
@@ -5900,7 +5911,7 @@ static void cfg_queues(struct adapter *adap)
for (i = 0; i  

[RESEND PATCH] IB/umad: Fix a use-after-free

2014-06-06 Thread Yann Droneaud
From: Bart Van Assche bvanass...@acm.org

Avoid that closing /dev/infiniband/umadn or /dev/infiniband/issmn
triggers a use-after-free. __fput() in fs/file_table.c invokes
f_op-release() before it invokes cdev_put(). Make sure that the
ib_umad_device structure is freed by the cdev_put() call instead of
f_op-release(). This avoids that changing the port mode from IB into
Ethernet and back to IB followed by restarting opensmd triggers the
following kernel oops:

general protection fault:  [#1] PREEMPT SMP
RIP: 0010:[810cc65c]  [810cc65c] module_put+0x2c/0x170
Call Trace:
 [81190f20] cdev_put+0x20/0x30
 [8118e2ce] __fput+0x1ae/0x1f0
 [8118e35e] fput+0xe/0x10
 [810723bc] task_work_run+0xac/0xe0
 [81002a9f] do_notify_resume+0x9f/0xc0
 [814b8398] int_signal+0x12/0x17

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=75051
Signed-off-by: Bart Van Assche bvanass...@acm.org
Reviewed-by: Yann Droneaud ydrone...@opteya.com
Cc: Alex Chiang achi...@canonical.com
Cc: sta...@vger.kernel.org # 3.x: 8ec0a0e6b58: IB/umad: Fix error handling
---
Hi Bart and Roland,

It seems this one was not rolled in your latest katamari[1].
Since the original patch didn't apply on top of commit
8ec0a0e6b58 ('IB/umad: Fix error handling'), I've applied it
manually and resend it for review and inclusion.

I hope having correctly set the Cc: sta...@vger.kernel.org
tag to state the dependency on earlier patch.

[1] this term is actually used by Xorg to team to describe
the process of gathering each little tiny piece needed
for a release :) By the way, it's also a video game.

Regards.

 drivers/infiniband/core/user_mad.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/core/user_mad.c 
b/drivers/infiniband/core/user_mad.c
index 9bdf576cd4ab..1acb99100556 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -98,7 +98,7 @@ struct ib_umad_port {
 
 struct ib_umad_device {
int  start_port, end_port;
-   struct kref  ref;
+   struct kobject   kobj;
struct ib_umad_port  port[0];
 };
 
@@ -134,14 +134,18 @@ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
 static void ib_umad_add_one(struct ib_device *device);
 static void ib_umad_remove_one(struct ib_device *device);
 
-static void ib_umad_release_dev(struct kref *ref)
+static void ib_umad_release_dev(struct kobject *kobj)
 {
struct ib_umad_device *dev =
-   container_of(ref, struct ib_umad_device, ref);
+   container_of(kobj, struct ib_umad_device, kobj);
 
kfree(dev);
 }
 
+static struct kobj_type ib_umad_dev_ktype = {
+   .release = ib_umad_release_dev,
+};
+
 static int hdr_size(struct ib_umad_file *file)
 {
return file-use_pkey_index ? sizeof (struct ib_user_mad_hdr) :
@@ -812,7 +816,7 @@ static int ib_umad_open(struct inode *inode, struct file 
*filp)
goto out;
}
 
-   kref_get(port-umad_dev-ref);
+   kobject_get(port-umad_dev-kobj);
 
 out:
mutex_unlock(port-file_mutex);
@@ -851,7 +855,7 @@ static int ib_umad_close(struct inode *inode, struct file 
*filp)
mutex_unlock(file-port-file_mutex);
 
kfree(file);
-   kref_put(dev-ref, ib_umad_release_dev);
+   kobject_put(dev-kobj);
 
return 0;
 }
@@ -902,7 +906,7 @@ static int ib_umad_sm_open(struct inode *inode, struct file 
*filp)
if (ret)
goto err_clr_sm_cap;
 
-   kref_get(port-umad_dev-ref);
+   kobject_get(port-umad_dev-kobj);
 
return 0;
 
@@ -932,7 +936,7 @@ static int ib_umad_sm_close(struct inode *inode, struct 
file *filp)
 
up(port-sm_sem);
 
-   kref_put(port-umad_dev-ref, ib_umad_release_dev);
+   kobject_put(port-umad_dev-kobj);
 
return ret;
 }
@@ -1000,6 +1004,7 @@ static int find_overflow_devnum(void)
 }
 
 static int ib_umad_init_port(struct ib_device *device, int port_num,
+struct ib_umad_device *umad_dev,
 struct ib_umad_port *port)
 {
int devnum;
@@ -1032,6 +1037,7 @@ static int ib_umad_init_port(struct ib_device *device, 
int port_num,
 
cdev_init(port-cdev, umad_fops);
port-cdev.owner = THIS_MODULE;
+   port-cdev.kobj.parent = umad_dev-kobj;
kobject_set_name(port-cdev.kobj, umad%d, port-dev_num);
if (cdev_add(port-cdev, base, 1))
goto err_cdev;
@@ -1050,6 +1056,7 @@ static int ib_umad_init_port(struct ib_device *device, 
int port_num,
base += IB_UMAD_MAX_PORTS;
cdev_init(port-sm_cdev, umad_sm_fops);
port-sm_cdev.owner = THIS_MODULE;
+   port-sm_cdev.kobj.parent = umad_dev-kobj;
kobject_set_name(port-sm_cdev.kobj, issm%d, port-dev_num);
if (cdev_add(port-sm_cdev, base, 1))
goto err_sm_cdev;
@@ -1143,7 +1150,7 @@ static void 

[PATCH net-next 1/4] iw_cxgb4: Allocate and use IQs specifically for indirect interrupts

2014-06-06 Thread Hariprasad Shenai
Currently indirect interrupts for RDMA CQs funnel through the LLD's RDMA
RXQs, which also handle direct interrupts for offload CPLs during RDMA
connection setup/teardown.  The intended T4 usage model, however, is to
have indirect interrupts flow through dedicated IQs. IE not to mix
indirect interrupts with CPL messages in an IQ.  This patch adds the
concept of RDMA concentrator IQs, or CIQs, setup and maintained by the
LLD and exported to iw_cxgb4 for use when creating CQs. RDMA CPLs will
flow through the LLD's RDMA RXQs, and CQ interrupts flow through the
CIQs.

Design:

cxgb4 creates and exports an array of CIQs for the RDMA ULD.  These IQs
are sized according to the max available CQs available at adapter init.
In addition, these IQs don't need FL buffers since they only service
indirect interrupts.  One CIQ is setup per RX channel similar to the
RDMA RXQs.

iw_cxgb4 will utilize these CIQs based on the vector value passed into
create_cq().  The num_comp_vectors advertised by iw_cxgb4 will be the
number of CIQs configured, and thus the vector value will be the index
into the array of CIQs.

Based on original work by Steve Wise sw...@opengridcomputing.com

Signed-off-by: Steve Wise sw...@opengridcomputing.com
Signed-off-by: Hariprasad Shenai haripra...@chelsio.com
---
 drivers/infiniband/hw/cxgb4/cq.c|7 ++-
 drivers/infiniband/hw/cxgb4/provider.c  |2 +-
 drivers/infiniband/hw/cxgb4/t4.h|1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |   14 -
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |   62 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |2 +
 drivers/net/ethernet/chelsio/cxgb4/sge.c|4 ++
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.h  |1 +
 8 files changed, 84 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index cfaa56a..71fc2ef 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -134,7 +134,8 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq 
*cq,
V_FW_RI_RES_WR_IQANUS(0) |
V_FW_RI_RES_WR_IQANUD(1) |
F_FW_RI_RES_WR_IQANDST |
-   V_FW_RI_RES_WR_IQANDSTINDEX(*rdev-lldi.rxq_ids));
+   V_FW_RI_RES_WR_IQANDSTINDEX(
+   rdev-lldi.ciq_ids[cq-vector]));
res-u.cq.iqdroprss_to_iqesize = cpu_to_be16(
F_FW_RI_RES_WR_IQDROPRSS |
V_FW_RI_RES_WR_IQPCIECH(2) |
@@ -870,6 +871,9 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int 
entries,
 
rhp = to_c4iw_dev(ibdev);
 
+   if (vector = rhp-rdev.lldi.nciq)
+   return ERR_PTR(-EINVAL);
+
chp = kzalloc(sizeof(*chp), GFP_KERNEL);
if (!chp)
return ERR_PTR(-ENOMEM);
@@ -915,6 +919,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int 
entries,
}
chp-cq.size = hwentries;
chp-cq.memsize = memsize;
+   chp-cq.vector = vector;
 
ret = create_cq(rhp-rdev, chp-cq,
ucontext ? ucontext-uctx : rhp-rdev.uctx);
diff --git a/drivers/infiniband/hw/cxgb4/provider.c 
b/drivers/infiniband/hw/cxgb4/provider.c
index a94a3e1..31cd188 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -499,7 +499,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
dev-ibdev.node_type = RDMA_NODE_RNIC;
memcpy(dev-ibdev.node_desc, C4IW_NODE_DESC, sizeof(C4IW_NODE_DESC));
dev-ibdev.phys_port_cnt = dev-rdev.lldi.nports;
-   dev-ibdev.num_comp_vectors = 1;
+   dev-ibdev.num_comp_vectors =  dev-rdev.lldi.nciq;
dev-ibdev.dma_device = (dev-rdev.lldi.pdev-dev);
dev-ibdev.query_device = c4iw_query_device;
dev-ibdev.query_port = c4iw_query_port;
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
index 2178f31..68b0a6b 100644
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -542,6 +542,7 @@ struct t4_cq {
size_t memsize;
__be64 bits_type_ts;
u32 cqid;
+   int vector;
u16 size; /* including status page */
u16 cidx;
u16 sw_pidx;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 32db377..f503dce 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -357,11 +357,17 @@ enum {
MAX_OFLD_QSETS = 16,  /* # of offload Tx/Rx queue sets */
MAX_CTRL_QUEUES = NCHAN,  /* # of control Tx queues */
MAX_RDMA_QUEUES = NCHAN,  /* # of streaming RDMA Rx queues */
+   MAX_RDMA_CIQS = NCHAN,/* # of  RDMA concentrator IQs */
+   MAX_ISCSI_QUEUES = NCHAN, /* # of streaming iSCSI Rx queues */
 };
 
 enum {
-   

[PATCH net-next 2/4] iw_cxgb4: Choose appropriate hw mtu index and ISS for iWARP connections

2014-06-06 Thread Hariprasad Shenai
Select the appropriate hw mtu index and initial sequence number to optimize
hw memory performance.

Add new cxgb4_best_aligned_mtu() which allows callers to provide enough
information to be used to [possibly] select an MTU which will result in the
TCP Data Segment Size (AKA Maximum Segment Size) to be an aligned value.

If an RTR message exhange is required, then align the ISS to 8B - 1 + 4, so
that after the SYN the send seqno will align on a 4B boundary. The RTR
message exchange will leave the send seqno aligned on an 8B boundary.
If an RTR is not required, then align the ISS to 8B - 1.  The goal is
to have the send seqno be 8B aligned when we send the first FPDU.

Based on original work by Casey Leedom leee...@chelsio.com and
Steve Wise sw...@opengridcomputing.com

Signed-off-by: Casey Leedom lee...@chelsio.com
Signed-off-by: Steve Wise sw...@opengridcomputing.com
Signed-off-by: Hariprasad Shenai haripra...@chelsio.com
---
 drivers/infiniband/hw/cxgb4/cm.c|   73 +---
 drivers/infiniband/hw/cxgb4/t4fw_ri_api.h   |1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  107 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |5 +
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |9 ++
 5 files changed, 180 insertions(+), 15 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 1f863a9..d2e9f72 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -232,12 +232,16 @@ static void release_tid(struct c4iw_rdev *rdev, u32 
hwtid, struct sk_buff *skb)
 
 static void set_emss(struct c4iw_ep *ep, u16 opt)
 {
-   ep-emss = ep-com.dev-rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] - 40;
+   ep-emss = ep-com.dev-rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] -
+  sizeof(struct iphdr) - sizeof(struct tcphdr);
ep-mss = ep-emss;
if (GET_TCPOPT_TSTAMP(opt))
ep-emss -= 12;
if (ep-emss  128)
ep-emss = 128;
+   if (ep-emss  7)
+   PDBG(Warning: misaligned mtu idx %u mss %u emss=%u\n,
+GET_TCPOPT_MSS(opt), ep-mss, ep-emss);
PDBG(%s mss_idx %u mss %u emss=%u\n, __func__, GET_TCPOPT_MSS(opt),
 ep-mss, ep-emss);
 }
@@ -528,6 +532,17 @@ 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);
 }
 
+static void best_mtu(const unsigned short *mtus, unsigned short mtu,
+unsigned int *idx, int use_ts)
+{
+   unsigned short hdr_size = sizeof(struct iphdr) +
+ sizeof(struct tcphdr) +
+ (use_ts ? 12 : 0);
+   unsigned short data_size = mtu - hdr_size;
+
+   cxgb4_best_aligned_mtu(mtus, hdr_size, data_size, 8, idx);
+}
+
 static int send_connect(struct c4iw_ep *ep)
 {
struct cpl_act_open_req *req;
@@ -565,7 +580,8 @@ static int send_connect(struct c4iw_ep *ep)
}
set_wr_txq(skb, CPL_PRIORITY_SETUP, ep-ctrlq_idx);
 
-   cxgb4_best_mtu(ep-com.dev-rdev.lldi.mtus, ep-mtu, mtu_idx);
+   best_mtu(ep-com.dev-rdev.lldi.mtus, ep-mtu, mtu_idx,
+enable_tcp_timestamps);
wscale = compute_wscale(rcv_win);
opt0 = (nocong ? NO_CONG(1) : 0) |
   KEEP_ALIVE(1) |
@@ -633,6 +649,13 @@ static int send_connect(struct c4iw_ep *ep)
req6-opt2 = cpu_to_be32(opt2);
}
} else {
+   u32 isn = (prandom_u32()  ~7UL) - 1;
+
+   opt2 |= T5_OPT_2_VALID;
+   opt2 |= CONG_CNTRL_VALID; /* OPT_2_ISS for T5 */
+   if (peer2peer)
+   isn += 4;
+
if (ep-com.remote_addr.ss_family == AF_INET) {
t5_req = (struct cpl_t5_act_open_req *)
 skb_put(skb, wrlen);
@@ -649,6 +672,9 @@ static int send_connect(struct c4iw_ep *ep)
 cxgb4_select_ntuple(
 ep-com.dev-rdev.lldi.ports[0],
 ep-l2t)));
+   t5_req-rsvd = cpu_to_be32(isn);
+   PDBG(%s snd_isn %u\n, __func__,
+be32_to_cpu(t5_req-rsvd));
t5_req-opt2 = cpu_to_be32(opt2);
} else {
t5_req6 = (struct cpl_t5_act_open_req6 *)
@@ -672,6 +698,9 @@ static int send_connect(struct c4iw_ep *ep)
cxgb4_select_ntuple(
ep-com.dev-rdev.lldi.ports[0],
ep-l2t));
+   t5_req6-rsvd = cpu_to_be32(isn);
+   PDBG(%s snd_isn %u\n, __func__,
+be32_to_cpu(t5_req6-rsvd));

Re: [RESEND PATCH] IB/umad: Fix a use-after-free

2014-06-06 Thread Roland Dreier
On Fri, Jun 6, 2014 at 9:25 AM, Yann Droneaud ydrone...@opteya.com wrote:
 It seems this one was not rolled in your latest katamari[1].


Thanks, picked it up this time around.

 - R.
--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rdma-cma/iw_cm: export tos field to iwarp providers

2014-06-06 Thread Steve Wise
Signed-off-by: Steve Wise sw...@opengridcomputing.com
---

 drivers/infiniband/core/cma.c |2 ++
 include/rdma/iw_cm.h  |1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d570030..beda319 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1593,6 +1593,7 @@ static int cma_iw_listen(struct rdma_id_private *id_priv, 
int backlog)
if (IS_ERR(id))
return PTR_ERR(id);
 
+   id-tos = id_priv-tos;
id_priv-cm_id.iw = id;
 
memcpy(id_priv-cm_id.iw-local_addr, cma_src_addr(id_priv),
@@ -2840,6 +2841,7 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
if (IS_ERR(cm_id))
return PTR_ERR(cm_id);
 
+   cm_id-tos = id_priv-tos;
id_priv-cm_id.iw = cm_id;
 
memcpy(cm_id-local_addr, cma_src_addr(id_priv),
diff --git a/include/rdma/iw_cm.h b/include/rdma/iw_cm.h
index 1017e0b..036bd27 100644
--- a/include/rdma/iw_cm.h
+++ b/include/rdma/iw_cm.h
@@ -91,6 +91,7 @@ struct iw_cm_id {
/* Used by provider to add and remove refs on IW cm_id */
void (*add_ref)(struct iw_cm_id *);
void (*rem_ref)(struct iw_cm_id *);
+   u8  tos;
 };
 
 struct iw_cm_conn_param {

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] infiniband: hw: ipath: ipath_diag.c: Cleaning up code that is not handled properly.

2014-06-06 Thread Rickard Strandqvist
None of the code is adapted to handle a struct ipath_diag_pkt.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
---
 drivers/infiniband/hw/ipath/ipath_diag.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c 
b/drivers/infiniband/hw/ipath/ipath_diag.c
index e2f9a51..39ba797 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -327,7 +327,6 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
 {
u32 __iomem *piobuf;
u32 plen, pbufn, maxlen_reserve;
-   struct ipath_diag_pkt odp;
struct ipath_diag_xpkt dp;
u32 *tmpbuf = NULL;
struct ipath_devdata *dd;
@@ -341,11 +340,6 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
ret = -EFAULT;
goto bail;
}
-   } else if (count == sizeof(odp)) {
-   if (copy_from_user(odp, data, sizeof(odp))) {
-   ret = -EFAULT;
-   goto bail;
-   }
} else {
ret = -EINVAL;
goto bail;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-rdma in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html