[PATCH V3 0/5] Add LE hash collision bug fix for active and passive offloaded connections

2012-12-03 Thread Vipul Pandya
This patch series fixes the LE hash collision issue in cxgb4 and RDMA/cxgb4
drivers in kernel.org.

If the hash functionality is enabled in T4 then tuple information of active and
passive offloaded connections are stored in DDR3 memory. LE (Lookup Engine)
implements the interface to search this tuple entries using hash algorithm. To
avoid LE hash collision, firmware provides new mechanisms to setup active and
passive open connections.

In case of active open connection, firmware detects LE hash collision situation
and notifies driver. Driver uses fw_ofld_connection work request to offload
that connection. Its tuple information will be stored in TCAM memory array. 

In case of passive open connection, server filter region is created in TCAM.
This region stores the filter which will redirect the incoming SYN packet to
offload queues. After this driver tries to establish the connection using
firmware work request.

This patch series also adds framework for managing filters and to use T4's
filter capabilities.

Following testing has been carried out successfully on this patch series.
1. 1000 active open connections created and saw that tcam_full counter is
getting incremented through debugfs file.
2. Multiple passive open connections were created and ran the same test
repetatively to verify server filter is getting created and deleted properly.

The patch-series is based on Roland's infiniband tree (for-next branch),
and involves changes on cxgb4 and RDMA/cxgb4 drivers. Both linux-rdma and netdev
are included in this post for review.

We have some more bug fixes in RDMA/cxgb4 after this patch series. So, we would
like to request this series to get mereged through Roland's infiniband for-next
tree.

V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

Thanks,
Vipul Pandya

Vipul Pandya (5):
  cxgb4: Add T4 filter support
  cxgb4: Add LE hash collision bug fix path in LLD driver
  RDMA/cxgb4: Fix LE hash collision bug for active open connection
  RDMA/cxgb4: Fix LE hash collision bug for passive open connection
  RDMA/cxgb4: Fix bug for active and passive LE hash collision path

 drivers/infiniband/hw/cxgb4/cm.c|  789 +++---
 drivers/infiniband/hw/cxgb4/device.c|  210 ++-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h  |   33 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |  146 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  473 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |   23 +-
 drivers/net/ethernet/chelsio/cxgb4/l2t.c|   34 +
 drivers/net/ethernet/chelsio/cxgb4/l2t.h|3 +
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c  |   23 +-
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |   66 ++
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h|   37 ++
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   |  388 +++
 12 files changed, 2100 insertions(+), 125 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 V3 1/5] cxgb4: Add T4 filter support

2012-12-03 Thread Vipul Pandya
The T4 architecture is capable of filtering ingress packets at line rate
using the rule in TCAM. If packet hits a rule in the TCAM then it can be either
dropped or passed to the receive queues based on a rule settings.

This patch adds framework for managing filters and to use T4's filter
capabilities. It constructs a Firmware Filter Work Request which writes the
filter at a specified index to get the work done. It hosts shadow copy of
ingress filter entry to check field size limitations and save memory in the
case where the filter table is large.

Signed-off-by: Vipul Pandya vi...@chelsio.com
---
V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |  134 ++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  301 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |2 +
 drivers/net/ethernet/chelsio/cxgb4/l2t.c|   33 +++
 drivers/net/ethernet/chelsio/cxgb4/l2t.h|3 +
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c  |   23 ++-
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |1 +
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   |  279 +
 8 files changed, 770 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 378988b..b6403d1 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -545,6 +545,132 @@ struct adapter {
spinlock_t stats_lock;
 };
 
+/*
+ * Defined bit width of user definable filter tuples
+ */
+#define ETHTYPE_BITWIDTH 16
+#define FRAG_BITWIDTH 1
+#define MACIDX_BITWIDTH 9
+#define FCOE_BITWIDTH 1
+#define IPORT_BITWIDTH 3
+#define MATCHTYPE_BITWIDTH 3
+#define PROTO_BITWIDTH 8
+#define TOS_BITWIDTH 8
+#define PF_BITWIDTH 8
+#define VF_BITWIDTH 8
+#define IVLAN_BITWIDTH 16
+#define OVLAN_BITWIDTH 16
+
+/* Filter matching rules.  These consist of a set of ingress packet field
+ * (value, mask) tuples.  The associated ingress packet field matches the
+ * tuple when ((field  mask) == value).  (Thus a wildcard don't care field
+ * rule can be constructed by specifying a tuple of (0, 0).)  A filter rule
+ * matches an ingress packet when all of the individual individual field
+ * matching rules are true.
+ *
+ * Partial field masks are always valid, however, while it may be easy to
+ * understand their meanings for some fields (e.g. IP address to match a
+ * subnet), for others making sensible partial masks is less intuitive (e.g.
+ * MPS match type) ...
+ *
+ * Most of the following data structures are modeled on T4 capabilities.
+ * Drivers for earlier chips use the subsets which make sense for those chips.
+ * We really need to come up with a hardware-independent mechanism to
+ * represent hardware filter capabilities ...
+ */
+struct ch_filter_tuple {
+   /*
+* Compressed header matching field rules.  The TP_VLAN_PRI_MAP
+* register selects which of these fields will participate in the
+* filter match rules -- up to a maximum of 36 bits.  Because
+* TP_VLAN_PRI_MAP is a global register, all filters must use the same
+* set of fields.
+*/
+   uint32_t ethtype:ETHTYPE_BITWIDTH;  /* Ethernet type */
+   uint32_t frag:FRAG_BITWIDTH;/* IP fragmentation header */
+   uint32_t ivlan_vld:1;   /* inner VLAN valid */
+   uint32_t ovlan_vld:1;   /* outer VLAN valid */
+   uint32_t pfvf_vld:1;/* PF/VF valid */
+   uint32_t macidx:MACIDX_BITWIDTH;/* exact match MAC index */
+   uint32_t fcoe:FCOE_BITWIDTH;/* FCoE packet */
+   uint32_t iport:IPORT_BITWIDTH;  /* ingress port */
+   uint32_t matchtype:MATCHTYPE_BITWIDTH;  /* MPS match type */
+   uint32_t proto:PROTO_BITWIDTH;  /* protocol type */
+   uint32_t tos:TOS_BITWIDTH;  /* TOS/Traffic Type */
+   uint32_t pf:PF_BITWIDTH;/* PCI-E PF ID */
+   uint32_t vf:VF_BITWIDTH;/* PCI-E VF ID */
+   uint32_t ivlan:IVLAN_BITWIDTH;  /* inner VLAN */
+   uint32_t ovlan:OVLAN_BITWIDTH;  /* outer VLAN */
+
+   /* Uncompressed header matching field rules.  These are always
+* available for field rules.
+*/
+   uint8_t lip[16];/* local IP address (IPv4 in [3:0]) */
+   uint8_t fip[16];/* foreign IP address (IPv4 in [3:0]) */
+   uint16_t lport; /* local port */
+   uint16_t fport; /* foreign port */
+};
+
+/* A filter ioctl command.
+ */
+struct ch_filter_specification {
+   /*
+* Administrative fields for filter.
+*/
+   uint32_t hitcnts:1; /* count filter hits in TCB */
+   uint32_t prio:1;/* filter has priority over active/server */
+

[PATCH V3 2/5] cxgb4: Add LE hash collision bug fix path in LLD driver

2012-12-03 Thread Vipul Pandya
It supports establishing passive open connection through firmware filter work
request. Passive open connection will go through this path as now instead of
listening server we create a server filter which will redirect the incoming SYN
packet to the offload queue.

It divides filter region into regular filters and server filter portion. It
introduces new server filter region which will be exclusively used for creating
server filters. This region will not overlap with regular filter region.

It provides new API cxgb4_alloc_sftid in LLD for getting stid in case of LE
hash collision path. This new stid will be used to open server filter in the
filter region.

Signed-off-by: Vipul Pandya vi...@chelsio.com
---
V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |4 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |  150 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |   15 ++-
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h|   33 +
 4 files changed, 193 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index b6403d1..868acde 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -35,6 +35,8 @@
 #ifndef __CXGB4_H__
 #define __CXGB4_H__
 
+#include t4_hw.h
+
 #include linux/bitops.h
 #include linux/cache.h
 #include linux/interrupt.h
@@ -212,6 +214,8 @@ struct tp_err_stats {
 struct tp_params {
unsigned int ntxchan;/* # of Tx channels */
unsigned int tre;/* log2 of core clocks per TP tick */
+   unsigned short tx_modq_map;  /* TX modulation scheduler queue to */
+/* channel map */
 
uint32_t dack_re;/* DACK timer resolution */
unsigned short tx_modq[NCHAN];  /* channel to modulation queue map */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index a678287..f55386b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2489,7 +2489,34 @@ int cxgb4_alloc_stid(struct tid_info *t, int family, 
void *data)
 EXPORT_SYMBOL(cxgb4_alloc_stid);
 
 /*
- * Release a server TID.
+ * Allocate a server filter TID and set it to the supplied value.
+ */
+int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data)
+{
+   int stid;
+
+   spin_lock_bh(t-stid_lock);
+   if (family == PF_INET) {
+   stid = find_next_zero_bit(t-stid_bmap,
+   t-nstids + t-nsftids, t-nstids);
+   if (stid  (t-nstids + t-nsftids))
+   __set_bit(stid, t-stid_bmap);
+   else
+   stid = -1;
+   } else {
+   stid = -1;
+   }
+   if (stid = 0) {
+   t-stid_tab[stid].data = data;
+   stid += t-stid_base;
+   t-stids_in_use++;
+   }
+   spin_unlock_bh(t-stid_lock);
+   return stid;
+}
+EXPORT_SYMBOL(cxgb4_alloc_sftid);
+
+/* Release a server TID.
  */
 void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family)
 {
@@ -2604,12 +2631,14 @@ static int tid_init(struct tid_info *t)
unsigned int stid_bmap_size;
unsigned int natids = t-natids;
 
-   stid_bmap_size = BITS_TO_LONGS(t-nstids);
+   stid_bmap_size = BITS_TO_LONGS(t-nstids + t-nsftids);
size = t-ntids * sizeof(*t-tid_tab) +
   natids * sizeof(*t-atid_tab) +
   t-nstids * sizeof(*t-stid_tab) +
+  t-nsftids * sizeof(*t-stid_tab) +
   stid_bmap_size * sizeof(long) +
-  t-nftids * sizeof(*t-ftid_tab);
+  t-nftids * sizeof(*t-ftid_tab) +
+  t-nsftids * sizeof(*t-ftid_tab);
 
t-tid_tab = t4_alloc_mem(size);
if (!t-tid_tab)
@@ -2617,7 +2646,7 @@ static int tid_init(struct tid_info *t)
 
t-atid_tab = (union aopen_entry *)t-tid_tab[t-ntids];
t-stid_tab = (struct serv_entry *)t-atid_tab[natids];
-   t-stid_bmap = (unsigned long *)t-stid_tab[t-nstids];
+   t-stid_bmap = (unsigned long *)t-stid_tab[t-nstids + t-nsftids];
t-ftid_tab = (struct filter_entry *)t-stid_bmap[stid_bmap_size];
spin_lock_init(t-stid_lock);
spin_lock_init(t-atid_lock);
@@ -2633,7 +2662,7 @@ static int tid_init(struct tid_info *t)
t-atid_tab[natids - 1].next = t-atid_tab[natids];
t-afree = t-atid_tab;
}
-   bitmap_zero(t-stid_bmap, t-nstids);
+   bitmap_zero(t-stid_bmap, t-nstids + t-nsftids);
return 0;
 }
 
@@ -2995,6 +3024,7 @@ static void uld_attach(struct adapter *adap, unsigned int 
uld)
 {
void *handle;
struct cxgb4_lld_info lli;
+   unsigned 

[PATCH V3 5/5] RDMA/cxgb4: Fix bug for active and passive LE hash collision path

2012-12-03 Thread Vipul Pandya
Retries active opens for INUSE errors.

Logs any active ofld_connect_wr error replies.

Sends ofld_connect_wr on same ctrlq. It needs to go  on the same control txq as
regular CPL active/passive messages.

Retries on active open replies with EADDRINUSE.

Uses active open fw wr only if active filter region is set.

Adds stat for ofld_connect_wr failures.

This patch also adds debugfs file to show endpoints.

Signed-off-by: Vipul Pandya vi...@chelsio.com
---
V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

 drivers/infiniband/hw/cxgb4/cm.c|  277 ---
 drivers/infiniband/hw/cxgb4/device.c|  125 ++
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h  |   32 +++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |   19 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h  |8 +-
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h|2 +
 7 files changed, 376 insertions(+), 88 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 2ac6a2c..b2ea840 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -275,6 +275,7 @@ void _c4iw_free_ep(struct kref *kref)
cxgb4_remove_tid(ep-com.dev-rdev.lldi.tids, 0, ep-hwtid);
dst_release(ep-dst);
cxgb4_l2t_release(ep-l2t);
+   remove_handle(ep-com.dev, ep-com.dev-hwtid_idr, ep-hwtid);
}
kfree(ep);
 }
@@ -550,6 +551,7 @@ static int send_connect(struct c4iw_ep *ep)
req-opt0 = cpu_to_be64(opt0);
req-params = cpu_to_be32(select_ntuple(ep-com.dev, ep-dst, ep-l2t));
req-opt2 = cpu_to_be32(opt2);
+   set_bit(ACT_OPEN_REQ, ep-com.history);
return c4iw_l2t_send(ep-com.dev-rdev, skb, ep-l2t);
 }
 
@@ -826,6 +828,7 @@ static int act_establish(struct c4iw_dev *dev, struct 
sk_buff *skb)
/* setup the hwtid for this connection */
ep-hwtid = tid;
cxgb4_insert_tid(t, ep, tid);
+   insert_handle(dev, dev-hwtid_idr, ep, ep-hwtid);
 
ep-snd_seq = be32_to_cpu(req-snd_isn);
ep-rcv_seq = be32_to_cpu(req-rcv_isn);
@@ -833,7 +836,9 @@ static int act_establish(struct c4iw_dev *dev, struct 
sk_buff *skb)
set_emss(ep, ntohs(req-tcp_opt));
 
/* dealloc the atid */
+   remove_handle(ep-com.dev, ep-com.dev-atid_idr, atid);
cxgb4_free_atid(t, atid);
+   set_bit(ACT_ESTAB, ep-com.history);
 
/* start MPA negotiation */
send_flowc(ep, NULL);
@@ -859,6 +864,7 @@ static void close_complete_upcall(struct c4iw_ep *ep)
ep-com.cm_id-rem_ref(ep-com.cm_id);
ep-com.cm_id = NULL;
ep-com.qp = NULL;
+   set_bit(CLOSE_UPCALL, ep-com.history);
}
 }
 
@@ -867,6 +873,7 @@ static int abort_connection(struct c4iw_ep *ep, struct 
sk_buff *skb, gfp_t gfp)
PDBG(%s ep %p tid %u\n, __func__, ep, ep-hwtid);
close_complete_upcall(ep);
state_set(ep-com, ABORTING);
+   set_bit(ABORT_CONN, ep-com.history);
return send_abort(ep, skb, gfp);
 }
 
@@ -881,6 +888,7 @@ static void peer_close_upcall(struct c4iw_ep *ep)
PDBG(peer close delivered ep %p cm_id %p tid %u\n,
 ep, ep-com.cm_id, ep-hwtid);
ep-com.cm_id-event_handler(ep-com.cm_id, event);
+   set_bit(DISCONN_UPCALL, ep-com.history);
}
 }
 
@@ -899,6 +907,7 @@ static void peer_abort_upcall(struct c4iw_ep *ep)
ep-com.cm_id-rem_ref(ep-com.cm_id);
ep-com.cm_id = NULL;
ep-com.qp = NULL;
+   set_bit(ABORT_UPCALL, ep-com.history);
}
 }
 
@@ -931,6 +940,7 @@ static void connect_reply_upcall(struct c4iw_ep *ep, int 
status)
 
PDBG(%s ep %p tid %u status %d\n, __func__, ep,
 ep-hwtid, status);
+   set_bit(CONN_RPL_UPCALL, ep-com.history);
ep-com.cm_id-event_handler(ep-com.cm_id, event);
 
if (status  0) {
@@ -971,6 +981,7 @@ static void connect_request_upcall(struct c4iw_ep *ep)
ep-parent_ep-com.cm_id,
event);
}
+   set_bit(CONNREQ_UPCALL, ep-com.history);
c4iw_put_ep(ep-parent_ep-com);
ep-parent_ep = NULL;
 }
@@ -987,6 +998,7 @@ static void established_upcall(struct c4iw_ep *ep)
if (ep-com.cm_id) {
PDBG(%s ep %p tid %u\n, __func__, ep, ep-hwtid);
ep-com.cm_id-event_handler(ep-com.cm_id, event);
+   set_bit(ESTAB_UPCALL, ep-com.history);
}
 }
 
@@ -1372,6 +1384,7 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff 
*skb)
unsigned int dlen = ntohs(hdr-len);
unsigned int tid = GET_TID(hdr);
struct tid_info *t = 

[PATCH V3 3/5] RDMA/cxgb4: Fix LE hash collision bug for active open connection

2012-12-03 Thread Vipul Pandya
It enables establishing active open connection using fw_ofld_connection work
request when cpl_act_open_rpl says TCAM full error which may be because
of LE hash collision. Current support is only for IPv4 active open connections.

Sets ntuple bits in active open requests. For T4 firmware greater than 1.4.10.0
ntuple bits are required to be set.

Adds nocong and enable_ecn module parameter options.

Signed-off-by: Vipul Pandya vi...@chelsio.com
---
V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

 drivers/infiniband/hw/cxgb4/cm.c  |  158 -
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h|1 +
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h   |   19 +++
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h  |2 +
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h |  109 +
 5 files changed, 283 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 5de8696..4878704 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -61,6 +61,14 @@ static char *states[] = {
NULL,
 };
 
+static int nocong;
+module_param(nocong, int, 0644);
+MODULE_PARM_DESC(nocong, Turn of congestion control (default=0));
+
+static int enable_ecn;
+module_param(enable_ecn, int, 0644);
+MODULE_PARM_DESC(enable_ecn, Enable ECN (default=0/disabled));
+
 static int dack_mode = 1;
 module_param(dack_mode, int, 0644);
 MODULE_PARM_DESC(dack_mode, Delayed ack mode (default=1));
@@ -441,6 +449,50 @@ 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);
 }
 
+#define VLAN_NONE 0xfff
+#define FILTER_SEL_VLAN_NONE 0x
+#define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */
+#define FILTER_SEL_WIDTH_VIN_P_FC \
+   (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/
+#define FILTER_SEL_WIDTH_TAG_P_FC \
+   (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */
+#define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC)
+
+static unsigned int select_ntuple(struct c4iw_dev *dev, struct dst_entry *dst,
+ struct l2t_entry *l2t)
+{
+   unsigned int ntuple = 0;
+   u32 viid;
+
+   switch (dev-rdev.lldi.filt_mode) {
+
+   /* default filter mode */
+   case HW_TPL_FR_MT_PR_IV_P_FC:
+   if (l2t-vlan == VLAN_NONE)
+   ntuple |= FILTER_SEL_VLAN_NONE  FILTER_SEL_WIDTH_P_FC;
+   else {
+   ntuple |= l2t-vlan  FILTER_SEL_WIDTH_P_FC;
+   ntuple |= 1  FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   }
+   ntuple |= l2t-lport  S_PORT | IPPROTO_TCP 
+ FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   break;
+   case HW_TPL_FR_MT_PR_OV_P_FC: {
+   viid = cxgb4_port_viid(l2t-neigh-dev);
+
+   ntuple |= FW_VIID_VIN_GET(viid)  FILTER_SEL_WIDTH_P_FC;
+   ntuple |= FW_VIID_PFN_GET(viid)  FILTER_SEL_WIDTH_VIN_P_FC;
+   ntuple |= FW_VIID_VIVLD_GET(viid)  FILTER_SEL_WIDTH_TAG_P_FC;
+   ntuple |= l2t-lport  S_PORT | IPPROTO_TCP 
+ FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   break;
+   }
+   default:
+   break;
+   }
+   return ntuple;
+}
+
 static int send_connect(struct c4iw_ep *ep)
 {
struct cpl_act_open_req *req;
@@ -463,7 +515,8 @@ static int send_connect(struct c4iw_ep *ep)
 
cxgb4_best_mtu(ep-com.dev-rdev.lldi.mtus, ep-mtu, mtu_idx);
wscale = compute_wscale(rcv_win);
-   opt0 = KEEP_ALIVE(1) |
+   opt0 = (nocong ? NO_CONG(1) : 0) |
+  KEEP_ALIVE(1) |
   DELACK(1) |
   WND_SCALE(wscale) |
   MSS_IDX(mtu_idx) |
@@ -474,6 +527,7 @@ static int send_connect(struct c4iw_ep *ep)
   ULP_MODE(ULP_MODE_TCPDDP) |
   RCV_BUFSIZ(rcv_win10);
opt2 = RX_CHANNEL(0) |
+  CCTRL_ECN(enable_ecn) |
   RSS_QUEUE_VALID | RSS_QUEUE(ep-rss_qid);
if (enable_tcp_timestamps)
opt2 |= TSTAMPS_EN(1);
@@ -492,7 +546,7 @@ static int send_connect(struct c4iw_ep *ep)
req-local_ip = ep-com.local_addr.sin_addr.s_addr;
req-peer_ip = ep-com.remote_addr.sin_addr.s_addr;
req-opt0 = cpu_to_be64(opt0);
-   req-params = 0;
+   req-params = cpu_to_be32(select_ntuple(ep-com.dev, ep-dst, ep-l2t));
req-opt2 = cpu_to_be32(opt2);
return c4iw_l2t_send(ep-com.dev-rdev, skb, ep-l2t);
 }
@@ -1383,6 +1437,61 @@ static int abort_rpl(struct c4iw_dev *dev, struct 
sk_buff *skb)
return 0;
 }
 
+static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
+{
+   struct sk_buff *skb;
+   struct fw_ofld_connection_wr *req;
+   unsigned int mtu_idx;
+ 

[PATCH V3 4/5] RDMA/cxgb4: Fix LE hash collision bug for passive open connection

2012-12-03 Thread Vipul Pandya
It establishes passive open connection through firmware work request. Passive
open connection will go through this path as now instead of listening server we
create a server filter which will redirect the incoming SYN packet to the
offload queue. After this driver tries to establish the connection using
firmware work request.

Signed-off-by: Vipul Pandya vi...@chelsio.com
---
V2: Changed commenting style from kernel-doc format('/**') to normal
V3: Resending the whole patch series again with the missing patches in V2

 drivers/infiniband/hw/cxgb4/cm.c|  411 ---
 drivers/infiniband/hw/cxgb4/device.c|   85 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |9 +
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h |   46 +++
 4 files changed, 496 insertions(+), 55 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 4878704..2ac6a2c 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -38,10 +38,12 @@
 #include linux/inetdevice.h
 #include linux/ip.h
 #include linux/tcp.h
+#include linux/if_vlan.h
 
 #include net/neighbour.h
 #include net/netevent.h
 #include net/route.h
+#include net/tcp.h
 
 #include iw_cxgb4.h
 
@@ -1569,13 +1571,14 @@ static int pass_open_rpl(struct c4iw_dev *dev, struct 
sk_buff *skb)
struct c4iw_listen_ep *ep = lookup_stid(t, stid);
 
if (!ep) {
-   printk(KERN_ERR MOD stid %d lookup failure!\n, stid);
-   return 0;
+   PDBG(%s stid %d lookup failure!\n, __func__, stid);
+   goto out;
}
PDBG(%s ep %p status %d error %d\n, __func__, ep,
 rpl-status, status2errno(rpl-status));
c4iw_wake_up(ep-com.wr_wait, status2errno(rpl-status));
 
+out:
return 0;
 }
 
@@ -1779,15 +1782,23 @@ static int pass_accept_req(struct c4iw_dev *dev, struct 
sk_buff *skb)
unsigned int hwtid = GET_TID(req);
struct dst_entry *dst;
struct rtable *rt;
-   __be32 local_ip, peer_ip;
+   __be32 local_ip, peer_ip = 0;
__be16 local_port, peer_port;
int err;
+   u16 peer_mss = ntohs(req-tcpopt.mss);
 
parent_ep = lookup_stid(t, stid);
-   PDBG(%s parent ep %p tid %u\n, __func__, parent_ep, hwtid);
-
+   if (!parent_ep) {
+   PDBG(%s connect request on invalid stid %d\n, __func__, stid);
+   goto reject;
+   }
get_4tuple(req, local_ip, peer_ip, local_port, peer_port);
 
+   PDBG(%s parent ep %p hwtid %u laddr 0x%x raddr 0x%x lport %d  \
+rport %d peer_mss %d\n, __func__, parent_ep, hwtid,
+ntohl(local_ip), ntohl(peer_ip), ntohs(local_port),
+ntohs(peer_port), peer_mss);
+
if (state_read(parent_ep-com) != LISTEN) {
printk(KERN_ERR %s - listening ep not in LISTEN\n,
   __func__);
@@ -1821,6 +1832,9 @@ static int pass_accept_req(struct c4iw_dev *dev, struct 
sk_buff *skb)
goto reject;
}
 
+   if (peer_mss  child_ep-mtu  (peer_mss + 40))
+   child_ep-mtu = peer_mss + 40;
+
state_set(child_ep-com, CONNECTING);
child_ep-com.dev = dev;
child_ep-com.cm_id = NULL;
@@ -1861,6 +1875,9 @@ static int pass_establish(struct c4iw_dev *dev, struct 
sk_buff *skb)
ep-snd_seq = be32_to_cpu(req-snd_isn);
ep-rcv_seq = be32_to_cpu(req-rcv_isn);
 
+   PDBG(%s ep %p hwtid %u tcp_opt 0x%02x\n, __func__, ep, tid,
+ntohs(req-tcp_opt));
+
set_emss(ep, ntohs(req-tcp_opt));
 
dst_confirm(ep-dst);
@@ -2478,7 +2495,6 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int 
backlog)
struct c4iw_dev *dev = to_c4iw_dev(cm_id-device);
struct c4iw_listen_ep *ep;
 
-
might_sleep();
 
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
@@ -2497,30 +2513,49 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int 
backlog)
/*
 * Allocate a server TID.
 */
-   ep-stid = cxgb4_alloc_stid(dev-rdev.lldi.tids, PF_INET, ep);
+   if (dev-rdev.lldi.enable_fw_ofld_conn)
+   ep-stid = cxgb4_alloc_sftid(dev-rdev.lldi.tids, PF_INET, ep);
+   else
+   ep-stid = cxgb4_alloc_stid(dev-rdev.lldi.tids, PF_INET, ep);
+
if (ep-stid == -1) {
printk(KERN_ERR MOD %s - cannot alloc stid.\n, __func__);
err = -ENOMEM;
goto fail2;
}
-
state_set(ep-com, LISTEN);
-   c4iw_init_wr_wait(ep-com.wr_wait);
-   err = cxgb4_create_server(ep-com.dev-rdev.lldi.ports[0], ep-stid,
- ep-com.local_addr.sin_addr.s_addr,
- ep-com.local_addr.sin_port,
- ep-com.dev-rdev.lldi.rxq_ids[0]);
-   if (err)
-   goto fail3;
-
-   /* wait for pass_open_rpl */
-   err = c4iw_wait_for_reply(ep-com.dev-rdev, 

Re: Dapltest test error DAT_CONN_QUAL_IN_USE

2012-12-03 Thread Vipul Pandya
Hi Arlin,

There was already a bug logged in openfabrics bugzilla regarding this.
Following is a link for the same.
http://bugs.openfabrics.org/bugzilla/show_bug.cgi?id=2400

I have assigned this bug to your name.

Thanks,
Vipul

On 01-12-2012 01:46, Davis, Arlin R wrote:
 http://openfabrics.org/bugzilla/index.cgi
 
 
 -Original Message-
 From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
 ow...@vger.kernel.org] On Behalf Of Vipul Pandya
 Sent: Friday, November 30, 2012 7:12 AM
 To: Davis, Arlin R
 Cc: Steve Wise; linux-rdma@vger.kernel.org; Kumar A S; Abhishek
 Agrawal; Divy Le Ray
 Subject: Re: Dapltest test error DAT_CONN_QUAL_IN_USE

 Arlin,

 Can you please refer to which bugzilla I should log a bug? Can you
 please provide me the url?

 Thanks,
 Vipul

 On 30-11-2012 05:21, Davis, Arlin R wrote:
 Vipul,

 Can you submit a bug in bugzilla for tracking? I will try to get to
 this next couple of days.

 -arlin

 -Original Message-
 From: Vipul Pandya [mailto:vi...@chelsio.com]
 Sent: Thursday, November 29, 2012 5:34 AM
 To: Davis, Arlin R
 Cc: Steve Wise; linux-rdma@vger.kernel.org; Kumar A S; Abhishek
 Agrawal; Divy Le Ray
 Subject: Re: Dapltest test error DAT_CONN_QUAL_IN_USE

 Hi Arlin,

 This issue is happening because there is a port collision between
 dapltest server port space and host TCP stack. The port collision
 happens because rdma_bind_addr is getting called from the two
 different places with different port arguments from dapltest.
 rdma_bind_addr is getting called from the following two places:

 1. Once it is getting called from dapls_ib_setup_conn_listener
 function with starting port as 45278. Based on number of threads and
 eps, in subsequent call of dapls_ib_setup_conn_listener this port
 number will keep getting incremented.

 2. 2nd time it is getting called from dapls_ib_qp_alloc function
 with
 port number as always 0. Now, when rdma_bind_addr gets called with
 port number 0 it will allocate any free random port number.

 Then when dapls_ib_setup_conn_listener calls the rdma_bind_addr with
 fix port number which is already allocate via dapls_ib_qp_alloc
 function rdma_bind_addr will return EADDRINUSE error, which in turn
 will result in DAT_CONN_QUAL_IN_USE error.

 I think solution here would be to call rdma_bind_addr from both the
 location passing port number from the same port range.

 Please let me know your thoughts on this.

 Our testing has been blocked because of this issue. We would like to
 get this fixed. Please let us know if we need to log a bug anywhere
 for this.

 Thanks,
 Vipul

 On 27-11-2012 01:24, Steve Wise wrote:
 Perhaps the port is in use by the host TCP stack?


 On 11/26/2012 1:30 PM, Davis, Arlin R wrote:
 dapltest server will start with port 45278 and increase by client
 thread count during each new client connection. If you never restart
 the server it will continue to increase the listen port based on new
 clients connecting. If you restart dapltest it will restart back at
 port 45278. I am not familiar with iWarp CM but the error is coming
 from rdma_bind_addr (EADDRINUSE|EBUSY|EADDRNOTAVAIL). I will have to
 defer to Steve for this error.

 -arlin


 -Original Message-
 From: linux-rdma-ow...@vger.kernel.org [mailto:linux-rdma-
 ow...@vger.kernel.org] On Behalf Of Vipul Pandya
 Sent: Friday, November 23, 2012 5:54 AM
 To: linux-rdma@vger.kernel.org
 Cc: Kumar A S; Steve Wise; Abhishek Agrawal; Davis, Arlin R; Divy
 Le
 Ray
 Subject: Dapltest test error DAT_CONN_QUAL_IN_USE

 Hi All,

 I was running dapltest between my client and server machines with
 OFED- 3.5. While running the test it dapltest server throws an
 error
 DAT_CONN_QUAL_IN_USE if I increase number of threads and
 endpoints.

 Dapltest server:
 ---
 dapltest -T S -D chelsio1

 Dapltest client:
 ---
 dapltest -T T -s 102.1.1.2 -D chelsio1 -R BE -i 1 -t 16 -w 8
 server SR
 8192 4 client SR 8192 4


 Once I run the above test i get the following error on server
 side
 and client side stalls.

 $# dapltest -T S -D chelsio1
 Dapltest: Service Point Ready - chelsio1
 Test[b13f]: dat_psp_create #6 error: DAT_CONN_QUAL_IN_USE
 Test[b13f]: Warning: dat_ep_disconnect (abrupt) #0 error
 DAT_INVALID_STATE DAT_INVALID_STATE_EP_UNCONNECTED
 Test[b13f]: dat_evd_free (creq) error: DAT_INVALID_STATE
 DAT_INVALID_STATE_EVD_IN_USE
 Test[b13f]: Warning: dat_ep_disconnect (abrupt) #1 error
 DAT_INVALID_STATE DAT_INVALID_STATE_EP_UNCONNECTED
 Test[b13f]: dat_evd_free (creq) error: DAT_INVALID_STATE
 DAT_INVALID_STATE_EVD_IN_USE
 Test[b13f]: Warning: dat_ep_disconnect (abrupt) #2 error
 DAT_INVALID_STATE DAT_INVALID_STATE_EP_UNCONNECTED
 Test[b13f]: dat_evd_free (creq) error: DAT_INVALID_STATE
 DAT_INVALID_STATE_EVD_IN_USE
 Test[b13f]: Warning: dat_ep_disconnect (abrupt) #3 error
 DAT_INVALID_STATE DAT_INVALID_STATE_EP_UNCONNECTED
 Test[b13f]: dat_evd_free (creq) error: DAT_INVALID_STATE
 DAT_INVALID_STATE_EVD_IN_USE
 Test[b13f]: Warning: 

[PATCH] opensm/osm_req.c: In req_determine_mkey, add more info when ERR 1107 occurs

2012-12-03 Thread Hal Rosenstock

Also dump DR path of SM class query

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_req.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index 1c3c172..1f5db3f 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -106,6 +106,7 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
OSM_LOG(sm-p_log, OSM_LOG_ERROR,
req_determine_mkey: ERR 1107: 
Outgoing physp is null on non-hop_0!\n);
+   osm_dump_dr_path_v2(sm-p_log, p_path, FILE_ID, OSM_LOG_ERROR);
dest_port_guid = 0;
goto Remote_Guid;
}
-- 
1.7.8.2

--
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 1/2] opensm/osm_req.c: In req_determine_mkey, fix DR algorithm

2012-12-03 Thread Hal Rosenstock

so that it works regardless of SM port type
Now works on switch port 0 as well as CA and router ports

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_req.c |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index 1f5db3f..b48be48 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -87,16 +87,20 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
goto Remote_Guid;
}
 
-   if (p_sm_port)
+   if (p_sm_port) {
+   /* get the node for the SM */
+   p_node = p_sm_port-p_node;
p_physp = p_sm_port-p_physp;
+   }
 
-   /* hop_count == 1: outgoing physp is SM physp */
-   for (hop = 2; p_physp  hop = p_path-hop_count; hop++) {
+   for (hop = 1; p_physp  hop = p_path-hop_count; hop++) {
+   p_physp = osm_node_get_physp_ptr(p_node, p_path-path[hop]);
+   if (!p_physp)
+   break;
p_physp = p_physp-p_remote_physp;
if (!p_physp)
break;
p_node = p_physp-p_node;
-   p_physp = osm_node_get_physp_ptr(p_node, p_path-path[hop]);
}
 
/* At this point, p_physp points at the outgoing physp on the
-- 
1.7.8.2

--
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 2/2] opensm/osm_req.c: In req_determine_mkey, use osm_physp APIs

2012-12-03 Thread Hal Rosenstock

rather tha direct accesses to physp struct

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_req.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index b48be48..caf94fb 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -97,10 +97,10 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
p_physp = osm_node_get_physp_ptr(p_node, p_path-path[hop]);
if (!p_physp)
break;
-   p_physp = p_physp-p_remote_physp;
+   p_physp = osm_physp_get_remote(p_physp);
if (!p_physp)
break;
-   p_node = p_physp-p_node;
+   p_node = osm_physp_get_node_ptr(p_physp);
}
 
/* At this point, p_physp points at the outgoing physp on the
-- 
1.7.8.2

--
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] opensm/osm_subnet.c: Improve error messages in subn_validate_neighbor

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_subnet.c |   22 --
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index a3fc0b5..c716839 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -946,7 +946,8 @@ static void subn_validate_neighbor(osm_subn_t *p_subn)
valid_entry = TRUE;
 
OSM_LOG((p_subn-p_osm-log), OSM_LOG_DEBUG,
-   Validating neighbor for 0x%016 PRIx64 , port %d\n,
+   Validating neighbor for guid:0x%016 PRIx64
+   , port %d\n,
p_item-guid, p_item-portnum);
if (p_item-guid == 0) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
@@ -954,31 +955,40 @@ static void subn_validate_neighbor(osm_subn_t *p_subn)
valid_entry = FALSE;
} else if (p_item-portnum == 0) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
-   ERR 7514: found invalid zero port\n);
+   ERR 7514: found invalid zero port for 
+   guid: 0x%016 PRIx64 \n,
+   p_item-guid);
valid_entry = FALSE;
} else if (osm_db_neighbor_get(p_subn-p_neighbor,
   p_item-guid, p_item-portnum,
   guid, port)) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
ERR 7515: could not find neighbor for 
-   guid: 0x%016 PRIx64 \n, p_item-guid);
+   guid: 0x%016 PRIx64 , port %d\n,
+   p_item-guid, p_item-portnum);
valid_entry = FALSE;
} else if (guid == 0) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
ERR 7516: found invalid neighbor 
-   zero guid);
+   zero guid for guid: 0x%016 PRIx64
+   , port %d\n,
+   p_item-guid, p_item-portnum);
valid_entry = FALSE;
} else if (port == 0) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
ERR 7517: found invalid neighbor 
-   zero port\n);
+   zero port for guid: 0x%016 PRIx64
+   , port %d\n,
+   p_item-guid, p_item-portnum);
valid_entry = FALSE;
} else if (osm_db_neighbor_get(p_subn-p_neighbor,
   guid, port, guid, port) ||
guid != p_item-guid || port != p_item-portnum) {
OSM_LOG((p_subn-p_osm-log), OSM_LOG_ERROR,
ERR 7518: neighbor does not point 
-   back at us\n);
+   back at us (guid: 0x%016 PRIx64
+   , port %d)\n,
+   p_item-guid, p_item-portnum);
valid_entry = FALSE;
}
 
-- 
1.7.8.2

--
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] opensm/osm_ucast_ftree.c: Remove duplicate free in fabric_create_leaf_switch_array

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Dan Ben-Yosef da...@mellanox.com
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_ucast_ftree.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 532a29f..133fd4f 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -1689,7 +1689,6 @@ static int fabric_create_leaf_switch_array(IN 
ftree_fabric_t * p_ftree)
if (!p_ftree-leaf_switches) {
osm_log_v2(p_ftree-p_osm-log, OSM_LOG_SYS, FILE_ID,
   Fat-tree routing: Memory allocation failed\n);
-   free(all_switches_at_leaf_level);
res = -1;
goto Exit;
}
-- 
1.7.8.2

--
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] opensm/osm_ucast_ftree.c: Eliminate unneeded NULL pointer checks prior to calls to free

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_ucast_ftree.c |   20 ++--
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 133fd4f..d58fff1 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -341,8 +341,6 @@ static ftree_sw_tbl_element_t *sw_tbl_element_create(IN 
ftree_sw_t * p_sw)
 
 static void sw_tbl_element_destroy(IN ftree_sw_tbl_element_t * p_element)
 {
-   if (!p_element)
-   return;
free(p_element);
 }
 
@@ -370,8 +368,7 @@ static ftree_port_t *port_create(IN uint8_t port_num,
 
 static void port_destroy(IN ftree_port_t * p_port)
 {
-   if (p_port)
-   free(p_port);
+   free(p_port);
 }
 
 /***
@@ -609,12 +606,9 @@ static void sw_destroy(IN ftree_fabric_t * p_ftree, IN 
ftree_sw_t * p_sw)
port_group_destroy(p_sw-sibling_port_groups[i]);
for (i = 0; i  p_sw-up_port_groups_num; i++)
port_group_destroy(p_sw-up_port_groups[i]);
-   if (p_sw-down_port_groups)
-   free(p_sw-down_port_groups);
-   if (p_sw-sibling_port_groups)
-   free(p_sw-sibling_port_groups);
-   if (p_sw-up_port_groups)
-   free(p_sw-up_port_groups);
+   free(p_sw-down_port_groups);
+   free(p_sw-sibling_port_groups);
+   free(p_sw-up_port_groups);
 
free(p_sw);
 }  /* sw_destroy() */
@@ -829,8 +823,7 @@ static void hca_destroy(IN ftree_hca_t * p_hca)
for (i = 0; i  p_hca-up_port_groups_num; i++)
port_group_destroy(p_hca-up_port_groups[i]);
 
-   if (p_hca-up_port_groups)
-   free(p_hca-up_port_groups);
+   free(p_hca-up_port_groups);
 
free(p_hca);
 }
@@ -1702,8 +1695,7 @@ static int fabric_create_leaf_switch_array(IN 
ftree_fabric_t * p_ftree)
p_ftree-leaf_switches_num);
 
 Exit:
-   if (all_switches_at_leaf_level)
-   free(all_switches_at_leaf_level);
+   free(all_switches_at_leaf_level);
OSM_LOG_EXIT(p_ftree-p_osm-log);
return res;
 }  /* fabric_create_leaf_switch_array() */
-- 
1.7.8.2

--
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] opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Alex Netes ale...@mellanox.com
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_torus.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index c06f8d4..075f84a 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t 
*osm_phys_port,
 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 * and compress out the zero entries to the end.
 */
-   if (!sw || !port_num ||
+   if (!sw || !port_num || sw-port[port_num] ||
sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
return;
  
-- 
1.7.8.2

--
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


Re: [PATCH V3 1/5] cxgb4: Add T4 filter support

2012-12-03 Thread David Miller
From: Vipul Pandya vi...@chelsio.com
Date: Mon,  3 Dec 2012 16:52:57 +0530

 + /*
 +  * If the new or old filter have loopback rewriteing rules then we'll
 +  * need to free any existing Layer Two Table (L2T) entries of the old
 +  * filter rule.  The firmware will handle freeing up any Source MAC
 +  * Table (SMT) entries used for rewriting Source MAC Addresses in
 +  * loopback rules.
 +  */
 + if (f-l2t)
 + cxgb4_l2t_release(f-l2t);
 +
 + /* The zeroing of the filter rule below clears the filter valid,
 +  * pending, locked flags, l2t pointer, etc. so it's all we need for
 +  * this operation.
 +  */

My greatest amusement is achieved when someone gets a code formatting
rule both correct and wrong in the same patch, as you have done here.

Format comments in the networking:

/* Like
 * this.
 */

 /*
  * Never,
  * like this.
  */

Thanks.
--
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


RE: [PATCH librdmacm] Fixed build problem due to missing macro

2012-12-03 Thread Hefty, Sean
Thanks - applied.

I'm using a locally modified version of verbs, so I don't end up seeing this 
error.
--
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


Re: [PATCH librdmacm] Fixed build problem due to missing macro

2012-12-03 Thread Or Gerlitz
On Mon, Dec 3, 2012 at 9:35 PM, Hefty, Sean sean.he...@intel.com wrote:
 I'm using a locally modified version of verbs, so I don't end up seeing this 
 error.

could this be related to different results while running netperf .w
fork in our setup vs. yours?

Or.
--
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


RE: [PATCH librdmacm] Fixed build problem due to missing macro

2012-12-03 Thread Hefty, Sean
  I'm using a locally modified version of verbs, so I don't end up seeing this
 error.
 
 could this be related to different results while running netperf .w
 fork in our setup vs. yours?

I was referring to the build issue, not the fork problem.

According to my notes, I ran netperf with fork support using this:

server
--
export RDMAV_FORK_SAFE=1
LD_PRELOAD=/usr/local/lib/rsocket/librspreload.so netserver

client
--
export RDMAV_FORK_SAFE=1
LD_PRELOAD=/usr/local/lib/rsocket/librspreload.so netperf -H ip-address
--
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-diags: Remove Red Hat-ism.

2012-12-03 Thread Jon Stanley
Future release of Fedora are going to remove /etc/sysconfig/network
which we source to get $HOSTNAME. Bash (and sh) set $HOSTNAME in
the shell by default, so we should be safe to use that here. This
adds the benefit of working across multiple distributions if that
is required in the future.

Related: rhbz881917

Signed-off-by: Jon Stanley jonstan...@gmail.com
Cc: Doug Ledford dledf...@redhat.com
Cc: Ira Weiny wei...@llnl.gov
---
 scripts/set_nodedesc.sh |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/scripts/set_nodedesc.sh b/scripts/set_nodedesc.sh
index 1e42ac8..3d2e406 100755
--- a/scripts/set_nodedesc.sh
+++ b/scripts/set_nodedesc.sh
@@ -1,8 +1,5 @@
 #!/bin/sh
 
-if [ -f /etc/sysconfig/network ]; then
-. /etc/sysconfig/network
-fi
 
 ib_sysfs=/sys/class/infiniband
 newname=$HOSTNAME
-- 
1.7.1

--
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


Re: [PATCH] opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Hal Rosenstock
On 12/3/2012 4:09 PM, Jim Schutt wrote:
 On 12/03/2012 08:26 AM, Hal Rosenstock wrote:

 Signed-off-by: Alex Netesale...@mellanox.com
 Signed-off-by: Hal Rosenstockh...@mellanox.com
 ---
   opensm/osm_torus.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
 index c06f8d4..075f84a 100644
 --- a/opensm/osm_torus.c
 +++ b/opensm/osm_torus.c
 @@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context,
 osm_physp_t *osm_phys_port,
* So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
* and compress out the zero entries to the end.
*/
 -if (!sw || !port_num ||
 +if (!sw || !port_num || sw-port[port_num] ||
   sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
   return;

 
 With the patch as-is, if torus_update_osm_vlarb() returns early
 for any non-NULL switch port, it will never do any updates.
 
 If the crash was that sw-port[port_num] was NULL,
 shouldn't the check be !sw-port[port_num] ?
 
 Can you tell me more about the test case that leads to the crash?
 
 Is it that there's a switch with a port that's not connected
 to anything, and torus_update_osm_vlarb() was called for it?
 
 Testing for a non-NULL sw-port[port_num] is definitely the right
 thing to do to handle that case, and I'm sorry I missed it earlier.
 
 If not, then something else is likely broken, and we need to find
 and fix that.

Yes, it was meant to be NULL pointer check. v2 of patch coming soon.

-- Hal

 
 -- Jim
 
 

--
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


opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Alex Netes ale...@mellanox.com
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
Change since v1:
Fixed NULL pointer check on sw-port[port_num]
Pointed out by: Jim Schutt jasc...@sandia.gov

 opensm/osm_torus.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index c06f8d4..075f84a 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t 
*osm_phys_port,
 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 * and compress out the zero entries to the end.
 */
-   if (!sw || !port_num ||
+   if (!sw || !port_num || !sw-port[port_num] ||
sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
return;
  
-- 
1.7.8.2


--
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


[PATCHv2} opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Hal Rosenstock

Signed-off-by: Alex Netes ale...@mellanox.com
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
Change since v1:
Fixed NULL pointer check on sw-port[port_num]
Pointed out by: Jim Schutt jasc...@sandia.gov

 opensm/osm_torus.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index c06f8d4..075f84a 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t 
*osm_phys_port,
 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 * and compress out the zero entries to the end.
 */
-   if (!sw || !port_num ||
+   if (!sw || !port_num || !sw-port[port_num] ||
sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
return;
  
-- 
1.7.8.2

--
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] opensm/osm_port_info_rcv.c: Don't modify subnet minimal values when PortState DOWN

2012-12-03 Thread Hal Rosenstock
as they are vendor dependent fields in PortInfo and can't be relied on due to:

C14-24.2.1: If PortInfo:Portstate=Down, then
o a SubnGet(PortInfo) shall produce valid data for PortInfo:PortState
  and PortInfo:PortPhysicalState; whether any other component has
  valid data is vendor-dependent.

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
index 6f6922c..859a6be 100644
--- a/opensm/osm_port_info_rcv.c
+++ b/opensm/osm_port_info_rcv.c
@@ -94,7 +94,8 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN 
osm_physp_t * p_physp,
port_guid = osm_physp_get_port_guid(p_physp);
 
/* HACK extended port 0 should be handled too! */
-   if (osm_physp_get_port_num(p_physp) != 0) {
+   if (osm_physp_get_port_num(p_physp) != 0 
+   ib_port_info_get_port_state(p_pi) != IB_LINK_DOWN) {
/* track the minimal endport MTU, rate, and operational VLs */
mtu = ib_port_info_get_mtu_cap(p_pi);
if (mtu  sm-p_subn-min_ca_mtu) {
@@ -323,6 +324,9 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN 
osm_node_t * p_node,
p_physp-port_info = *p_pi;
pi_rcv_process_endport(sm, p_physp, p_pi);
} else {
+   if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN)
+   goto Exit;
+
/* track the minimal switch ext port MTU, rate, and operational 
VLs */
mtu = ib_port_info_get_mtu_cap(p_pi);
if (mtu  sm-p_subn-min_sw_mtu) {
@@ -358,6 +362,7 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN 
osm_node_t * p_node,
}
}
 
+Exit:
OSM_LOG_EXIT(sm-p_log);
 }
 
--
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


Re: [PATCH] opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Jim Schutt

On 12/03/2012 08:26 AM, Hal Rosenstock wrote:


Signed-off-by: Alex Netesale...@mellanox.com
Signed-off-by: Hal Rosenstockh...@mellanox.com
---
  opensm/osm_torus.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index c06f8d4..075f84a 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t 
*osm_phys_port,
 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 * and compress out the zero entries to the end.
 */
-   if (!sw || !port_num ||
+   if (!sw || !port_num || sw-port[port_num] ||
sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
return;



With the patch as-is, if torus_update_osm_vlarb() returns early
for any non-NULL switch port, it will never do any updates.

If the crash was that sw-port[port_num] was NULL,
shouldn't the check be !sw-port[port_num] ?

Can you tell me more about the test case that leads to the crash?

Is it that there's a switch with a port that's not connected
to anything, and torus_update_osm_vlarb() was called for it?

Testing for a non-NULL sw-port[port_num] is definitely the right
thing to do to handle that case, and I'm sorry I missed it earlier.

If not, then something else is likely broken, and we need to find
and fix that.

-- Jim

--
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


Re: [PATCHv2} opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

2012-12-03 Thread Jim Schutt

On 12/03/2012 02:25 PM, Hal Rosenstock wrote:


Signed-off-by: Alex Netesale...@mellanox.com
Signed-off-by: Hal Rosenstockh...@mellanox.com


Acked-by: Jim Schutt jasc...@sandia.gov


---
Change since v1:
Fixed NULL pointer check on sw-port[port_num]
Pointed out by: Jim Schuttjasc...@sandia.gov

  opensm/osm_torus.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index c06f8d4..075f84a 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t 
*osm_phys_port,
 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 * and compress out the zero entries to the end.
 */
-   if (!sw || !port_num ||
+   if (!sw || !port_num || !sw-port[port_num] ||
sw-port[port_num]-pgrp-port_grp != 2 * TORUS_MAX_DIM)
return;




--
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


Re: [PATCH] infiniband-diags: Remove Red Hat-ism.

2012-12-03 Thread Jason Gunthorpe
On Mon, Dec 03, 2012 at 03:28:18PM -0500, Jon Stanley wrote:
 Future release of Fedora are going to remove /etc/sysconfig/network
 which we source to get $HOSTNAME. Bash (and sh) set $HOSTNAME in
 the shell by default, so we should be safe to use that here. This
 adds the benefit of working across multiple distributions if that
 is required in the future.

This looks like it is a bashism (ie dash does not do this), so you
should update the #! to use /bin/bash not /bin/sh...

$ HOSTNAME= /bin/dash 
\h{\u}\w#echo $HOSTNAME

\h{\u}\w#

Jason
--
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