Skip to contentSkip to conversation

cxgb4: use new fw interface to get the VIN and smt index

PATCH Applied Ganesh Goudar 3 participants 5 messages Nov 21, 2018 – Nov 23, 2018

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgb4: use new fw interface to get the VIN and smt index

From: Santosh Rastapur <[email protected]>

If the fw supports returning VIN/VIVLD in FW_VI_CMD save it in port_info structure else retrieve these from viid and save them in port_info structure. Do the same for smt_idx from FW_VI_MAC_CMD

---
 drivers/crypto/chelsio/chtls/chtls_cm.c         |  3 +-
 drivers/infiniband/hw/cxgb4/cm.c                |  6 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 12 ++++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 58 ++++++++++++-------------
 drivers/net/ethernet/chelsio/cxgb4/l2t.c        | 13 +++---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c      | 46 ++++++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   | 20 +++++++++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c              |  3 +-
 drivers/target/iscsi/cxgbit/cxgbit_cm.c         |  8 ++--
 9 files changed, 114 insertions(+), 55 deletions(-)
drivers/crypto/chelsio/chtls/chtls_cm.c +1 -2
index 20209e2..228b91b 100644
@@ -1074,8 +1074,7 @@ static struct sock *chtls_recv_sock(struct sock *lsk,
 	csk->txq_idx = (rxq_idx < cdev->lldi->ntxq) ? rxq_idx :
 			port_id * step;
 	csk->sndbuf = newsk->sk_sndbuf;
-	csk->smac_idx = cxgb4_tp_smt_idx(cdev->lldi->adapter_type,
-					 cxgb4_port_viid(ndev));
+	csk->smac_idx = ((struct port_info *)netdev_priv(ndev))->smt_idx;
 	tp->rcv_wnd = select_rcv_wnd(csk);
 	RCV_WSCALE(tp) = select_rcv_wscale(tcp_full_space(newsk),
 					   WSCALE_OK(tp),
drivers/infiniband/hw/cxgb4/cm.c +2 -4
index 8ed01e0..97ecc8c 100644
@@ -2058,8 +2058,7 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip,
 		}
 		ep->mtu = pdev->mtu;
 		ep->tx_chan = cxgb4_port_chan(pdev);
-		ep->smac_idx = cxgb4_tp_smt_idx(adapter_type,
-						cxgb4_port_viid(pdev));
+		ep->smac_idx = ((struct port_info *)netdev_priv(pdev))->smt_idx;
 		step = cdev->rdev.lldi.ntxq /
 			cdev->rdev.lldi.nchan;
 		ep->txq_idx = cxgb4_port_idx(pdev) * step;
@@ -2078,8 +2077,7 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip,
 			goto out;
 		ep->mtu = dst_mtu(dst);
 		ep->tx_chan = cxgb4_port_chan(pdev);
-		ep->smac_idx = cxgb4_tp_smt_idx(adapter_type,
-						cxgb4_port_viid(pdev));
+		ep->smac_idx = ((struct port_info *)netdev_priv(pdev))->smt_idx;
 		step = cdev->rdev.lldi.ntxq /
 			cdev->rdev.lldi.nchan;
 		ep->txq_idx = cxgb4_port_idx(pdev) * step;
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +10 -2
index b16f4b3e..2d1ca92 100644
@@ -404,6 +404,7 @@ struct adapter_params {
 	bool fr_nsmr_tpte_wr_support;	  /* FW support for FR_NSMR_TPTE_WR */
 	u8 fw_caps_support;		/* 32-bit Port Capabilities */
 	bool filter2_wr_support;	/* FW support for FILTER2_WR */
+	unsigned int viid_smt_extn_support:1; /* FW returns vin and smt index */
 
 	/* MPS Buffer Group Map[per Port].  Bit i is set if buffer group i is
 	 * used by the Port
@@ -592,6 +593,13 @@ struct port_info {
 	bool ptp_enable;
 	struct sched_table *sched_tbl;
 	u32 eth_flags;
+
+	/* viid and smt fields either returned by fw
+	 * or decoded by parsing viid by driver.
+	 */
+	u8 vin;
+	u8 vivld;
+	u8 smt_idx;
 };
 
 struct dentry;
@@ -1757,7 +1765,7 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
 		unsigned int nexact, unsigned int rcaps, unsigned int wxcaps);
 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
 		unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
-		unsigned int *rss_size);
+		unsigned int *rss_size, u8 *vivld, u8 *vin);
 int t4_free_vi(struct adapter *adap, unsigned int mbox,
 	       unsigned int pf, unsigned int vf,
 	       unsigned int viid);
@@ -1783,7 +1791,7 @@ int t4_free_mac_filt(struct adapter *adap, unsigned int mbox,
 		     unsigned int viid, unsigned int naddr,
 		     const u8 **addr, bool sleep_ok);
 int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
-		  int idx, const u8 *addr, bool persist, bool add_smt);
+		  int idx, const u8 *addr, bool persist, u8 *smt_idx);
 int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid,
 		     bool ucast, u64 vec, bool sleep_ok);
 int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +29 -29

91 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/l2t.c +5 -8
index 99022c0..4852feb 100644
@@ -495,14 +495,11 @@ u64 cxgb4_select_ntuple(struct net_device *dev,
 		ntuple |= (u64)IPPROTO_TCP << tp->protocol_shift;
 
 	if (tp->vnic_shift >= 0 && (tp->ingress_config & VNIC_F)) {
-		u32 viid = cxgb4_port_viid(dev);
-		u32 vf = FW_VIID_VIN_G(viid);
-		u32 pf = FW_VIID_PFN_G(viid);
-		u32 vld = FW_VIID_VIVLD_G(viid);
-
-		ntuple |= (u64)(FT_VNID_ID_VF_V(vf) |
-				FT_VNID_ID_PF_V(pf) |
-				FT_VNID_ID_VLD_V(vld)) << tp->vnic_shift;
+		struct port_info *pi = (struct port_info *)netdev_priv(dev);
+
+		ntuple |= (u64)(FT_VNID_ID_VF_V(pi->vin) |
+				FT_VNID_ID_PF_V(adap->pf) |
+				FT_VNID_ID_VLD_V(pi->vivld)) << tp->vnic_shift;
 	}
 
 	return ntuple;
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +42 -4

94 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +20 -0
index 57584ab..1d9b3e1 100644
@@ -1253,6 +1253,7 @@ enum fw_params_param_dev {
 	FW_PARAMS_PARAM_DEV_HMA_SIZE	= 0x20,
 	FW_PARAMS_PARAM_DEV_RDMA_WRITE_WITH_IMM = 0x21,
 	FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR    = 0x24,
+	FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27,
 };
 
 /*
@@ -2109,6 +2110,19 @@ struct fw_vi_cmd {
 #define FW_VI_CMD_FREE_V(x)	((x) << FW_VI_CMD_FREE_S)
 #define FW_VI_CMD_FREE_F	FW_VI_CMD_FREE_V(1U)
 
+#define FW_VI_CMD_VFVLD_S	24
+#define FW_VI_CMD_VFVLD_M	0x1
+#define FW_VI_CMD_VFVLD_V(x)	((x) << FW_VI_CMD_VFVLD_S)
+#define FW_VI_CMD_VFVLD_G(x)	\
+	(((x) >> FW_VI_CMD_VFVLD_S) & FW_VI_CMD_VFVLD_M)
+#define FW_VI_CMD_VFVLD_F	FW_VI_CMD_VFVLD_V(1U)
+
+#define FW_VI_CMD_VIN_S		16
+#define FW_VI_CMD_VIN_M		0xff
+#define FW_VI_CMD_VIN_V(x)	((x) << FW_VI_CMD_VIN_S)
+#define FW_VI_CMD_VIN_G(x)	\
+	(((x) >> FW_VI_CMD_VIN_S) & FW_VI_CMD_VIN_M)
+
 #define FW_VI_CMD_VIID_S	0
 #define FW_VI_CMD_VIID_M	0xfff
 #define FW_VI_CMD_VIID_V(x)	((x) << FW_VI_CMD_VIID_S)
@@ -2182,6 +2196,12 @@ struct fw_vi_mac_cmd {
 	} u;
 };
 
+#define FW_VI_MAC_CMD_SMTID_S		12
+#define FW_VI_MAC_CMD_SMTID_M		0xff
+#define FW_VI_MAC_CMD_SMTID_V(x)	((x) << FW_VI_MAC_CMD_SMTID_S)
+#define FW_VI_MAC_CMD_SMTID_G(x)	\
+	(((x) >> FW_VI_MAC_CMD_SMTID_S) & FW_VI_MAC_CMD_SMTID_M)
+
 #define FW_VI_MAC_CMD_VIID_S	0
 #define FW_VI_MAC_CMD_VIID_V(x)	((x) << FW_VI_MAC_CMD_VIID_S)
 
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -2
index 064ef57..907dd87 100644
@@ -1767,8 +1767,7 @@ static int init_act_open(struct cxgbi_sock *csk)
 		csk->mtu = dst_mtu(csk->dst);
 	cxgb4_best_mtu(lldi->mtus, csk->mtu, &csk->mss_idx);
 	csk->tx_chan = cxgb4_port_chan(ndev);
-	csk->smac_idx = cxgb4_tp_smt_idx(lldi->adapter_type,
-					 cxgb4_port_viid(ndev));
+	csk->smac_idx = ((struct port_info *)netdev_priv(ndev))->smt_idx;
 	step = lldi->ntxq / lldi->nchan;
 	csk->txq_idx = cxgb4_port_idx(ndev) * step;
 	step = lldi->nrxq / lldi->nchan;
drivers/target/iscsi/cxgbit/cxgbit_cm.c +4 -4
index 71888b9..0376d73 100644
@@ -932,8 +932,8 @@ cxgbit_offload_init(struct cxgbit_sock *csk, int iptype, __u8 *peer_ip,
 			goto out;
 		csk->mtu = ndev->mtu;
 		csk->tx_chan = cxgb4_port_chan(ndev);
-		csk->smac_idx = cxgb4_tp_smt_idx(cdev->lldi.adapter_type,
-						 cxgb4_port_viid(ndev));
+		csk->smac_idx =
+			       ((struct port_info *)netdev_priv(ndev))->smt_idx;
 		step = cdev->lldi.ntxq /
 			cdev->lldi.nchan;
 		csk->txq_idx = cxgb4_port_idx(ndev) * step;
@@ -968,8 +968,8 @@ cxgbit_offload_init(struct cxgbit_sock *csk, int iptype, __u8 *peer_ip,
 		port_id = cxgb4_port_idx(ndev);
 		csk->mtu = dst_mtu(dst);
 		csk->tx_chan = cxgb4_port_chan(ndev);
-		csk->smac_idx = cxgb4_tp_smt_idx(cdev->lldi.adapter_type,
-						 cxgb4_port_viid(ndev));
+		csk->smac_idx =
+			       ((struct port_info *)netdev_priv(ndev))->smt_idx;
 		step = cdev->lldi.ntxq /
 			cdev->lldi.nports;
 		csk->txq_idx = (port_id * step) +
Signature · 1 line
2.1.0
#1 lore raw
Quoted 9 lines · Ganesh Goudar

From: Santosh Rastapur <[email protected]>

If the fw supports returning VIN/VIVLD in FW_VI_CMD save it in port_info structure else retrieve these from viid and save them in port_info structure. Do the same for smt_idx from FW_VI_MAC_CMD

Quoted 10 lines
 drivers/crypto/chelsio/chtls/chtls_cm.c         |  3 +-
 drivers/infiniband/hw/cxgb4/cm.c                |  6 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 12 ++++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 58 ++++++++++++-------------
 drivers/net/ethernet/chelsio/cxgb4/l2t.c        | 13 +++---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c      | 46 ++++++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   | 20 +++++++++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c              |  3 +-
 drivers/target/iscsi/cxgbit/cxgbit_cm.c         |  8 ++--
 9 files changed, 114 insertions(+), 55 deletions(-)

Applied to for-next, but please try to write better commit messages in future, explain what benifit your change is bringing.

Jason

maintainer
#2 lore raw

From: Jason Gunthorpe <[email protected]>
Date: Wed, 21 Nov 2018 19:46:24 -0700

Quoted 21 lines · Ganesh Goudar
Quoted 9 lines

From: Santosh Rastapur <[email protected]>

If the fw supports returning VIN/VIVLD in FW_VI_CMD save it in port_info structure else retrieve these from viid and save them in port_info structure. Do the same for smt_idx from FW_VI_MAC_CMD

Quoted 10 lines
 drivers/crypto/chelsio/chtls/chtls_cm.c         |  3 +-
 drivers/infiniband/hw/cxgb4/cm.c                |  6 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 12 ++++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 58 ++++++++++++-------------
 drivers/net/ethernet/chelsio/cxgb4/l2t.c        | 13 +++---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c      | 46 ++++++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   | 20 +++++++++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c              |  3 +-
 drivers/target/iscsi/cxgbit/cxgbit_cm.c         |  8 ++--
 9 files changed, 114 insertions(+), 55 deletions(-)
Quoted 2 lines

Applied to for-next, but please try to write better commit messages in future, explain what benifit your change is bringing.

The subject line indicates this is targetting my net-next tree, therefore why did you apply it to your's?

#3 lore raw
Quoted 24 lines · David Miller

From: Jason Gunthorpe <[email protected]>
Date: Wed, 21 Nov 2018 19:46:24 -0700

Quoted 21 lines · Ganesh Goudar
Quoted 19 lines

From: Santosh Rastapur <[email protected]>

If the fw supports returning VIN/VIVLD in FW_VI_CMD save it in port_info structure else retrieve these from viid and save them in port_info structure. Do the same for smt_idx from FW_VI_MAC_CMD

 drivers/crypto/chelsio/chtls/chtls_cm.c         |  3 +-
 drivers/infiniband/hw/cxgb4/cm.c                |  6 +--
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      | 12 ++++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 58 ++++++++++++-------------
 drivers/net/ethernet/chelsio/cxgb4/l2t.c        | 13 +++---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c      | 46 ++++++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   | 20 +++++++++
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c              |  3 +-
 drivers/target/iscsi/cxgbit/cxgbit_cm.c         |  8 ++--
 9 files changed, 114 insertions(+), 55 deletions(-)
Quoted 5 lines
Quoted 2 lines

Applied to for-next, but please try to write better commit messages in future, explain what benifit your change is bringing.

The subject line indicates this is targetting my net-next tree, therefore why did you apply it to your's?

It is my mistake, it ended up in RDMA patchworks next to other RDMA chelsio patches, and contained an IB component..

It is dropped from rdma.git now.

Thanks,
Jason

maintainer Applied
#4 lore raw
In reply to Ganesh Goudar

From: Ganesh Goudar <[email protected]>
Date: Wed, 21 Nov 2018 13:40:24 +0530

Quoted 9 lines

From: Santosh Rastapur <[email protected]>

If the fw supports returning VIN/VIVLD in FW_VI_CMD save it in port_info structure else retrieve these from viid and save them in port_info structure. Do the same for smt_idx from FW_VI_MAC_CMD

Applied to net-next.