Re: [PATCH] cxgb4i: add support for t5 adapter

2013-06-26 Thread Mike Christie
On 05/29/2013 07:13 PM, k...@chelsio.com wrote:
 [PATCH] cxgb4i: add support for T5 adapter
 
 From: Karen Xie k...@chelsio.com
 
 Adds support for Chelsio T5 adapter.
 
 Signed-off-by: Karen Xie k...@chelsio.com


Sorry for the late reply on this. I thought it got merged already.

Patch looks ok.

Reviewed-by: Mike Christie micha...@cs.wisc.edu

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


[PATCH] cxgb4i: add support for t5 adapter

2013-05-29 Thread kxie
[PATCH] cxgb4i: add support for T5 adapter

From: Karen Xie k...@chelsio.com

Adds support for Chelsio T5 adapter.

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  159 +---
 1 files changed, 128 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 3fecf35..e659feb 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -20,6 +20,7 @@
 #include net/dst.h
 #include linux/netdevice.h
 
+#include t4_regs.h
 #include t4_msg.h
 #include cxgb4.h
 #include cxgb4_uld.h
@@ -32,13 +33,12 @@ static unsigned int dbg_level;
 #include ../libcxgbi.h
 
 #defineDRV_MODULE_NAME cxgb4i
-#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
-#defineDRV_MODULE_VERSION  0.9.1
-#defineDRV_MODULE_RELDATE  Aug. 2010
+#define DRV_MODULE_DESCChelsio T4/T5 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.4
 
 static char version[] =
DRV_MODULE_DESC   DRV_MODULE_NAME
-v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+v DRV_MODULE_VERSION \n;
 
 MODULE_AUTHOR(Chelsio Communications, Inc.);
 MODULE_DESCRIPTION(DRV_MODULE_DESC);
@@ -175,10 +175,56 @@ static inline int is_ofld_imm(const struct sk_buff *skb)
sizeof(struct fw_ofld_tx_data_wr));
 }
 
+
+#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 cxgbi_device *cdev,
+   struct l2t_entry *l2t)
+{
+   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+   unsigned int ntuple = 0;
+   u32 viid;
+
+   switch (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 void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
struct l2t_entry *e)
 {
-   struct cpl_act_open_req *req;
+   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk-cdev);
int wscale = cxgbi_sock_compute_wscale(csk-mss_idx);
unsigned long long opt0;
unsigned int opt2;
@@ -195,29 +241,58 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
RCV_BUFSIZ(cxgb4i_rcv_win  10);
opt2 = RX_CHANNEL(0) |
RSS_QUEUE_VALID |
-   (1  20) | (1  22) |
+   (1  20) |
RSS_QUEUE(csk-rss_qid);
 
-   set_wr_txq(skb, CPL_PRIORITY_SETUP, csk-port_id);
-   req = (struct cpl_act_open_req *)skb-head;
+   if (is_t4(lldi-adapter_type)) {
+   struct cpl_act_open_req *req =
+   (struct cpl_act_open_req *)skb-head;
 
-   INIT_TP_WR(req, 0);
-   OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
+   req = (struct cpl_act_open_req *)skb-head;
+
+   INIT_TP_WR(req, 0);
+   OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
qid_atid));
-   req-local_port = csk-saddr.sin_port;
-   req-peer_port = csk-daddr.sin_port;
-   req-local_ip = csk-saddr.sin_addr.s_addr;
-   req-peer_ip = csk-daddr.sin_addr.s_addr;
-   req-opt0 = cpu_to_be64(opt0);
-   req-params = 0;
-   req-opt2 = cpu_to_be32(opt2);
+   req-local_port = csk-saddr.sin_port;
+   req-peer_port = csk-daddr.sin_port;
+   req-local_ip = csk-saddr.sin_addr.s_addr;
+   req-peer_ip = csk-daddr.sin_addr.s_addr;
+   req-opt0 = cpu_to_be64(opt0