Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2019 17:27:11 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345334 - in head/sys/dev/cxgbe: . common firmware tom
Message-ID:  <201903201727.x2KHRBNi017458@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Wed Mar 20 17:27:11 2019
New Revision: 345334
URL: https://svnweb.freebsd.org/changeset/base/345334

Log:
  cxgbe(4): Treat the viid as an opaque identifier.
  
  Recent firmwares prefer to use a different format for viid internally
  and this change allows them to do so.
  
  MFC after:	1 week
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/firmware/t4fw_interface.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sched.c
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tom.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/adapter.h	Wed Mar 20 17:27:11 2019	(r345334)
@@ -194,8 +194,10 @@ struct vi_info {
 	int if_flags;
 
 	uint16_t *rss, *nm_rss;
-	int smt_idx;		/* for convenience */
-	uint16_t viid;
+	uint16_t viid;		/* opaque VI identifier */
+	uint16_t smt_idx;
+	uint16_t vin;
+	uint8_t vfvld;
 	int16_t  xact_addr_filt;/* index of exact MAC address filter */
 	uint16_t rss_size;	/* size of VI's RSS table slice */
 	uint16_t rss_base;	/* start of VI's RSS table slice */

Modified: head/sys/dev/cxgbe/common/common.h
==============================================================================
--- head/sys/dev/cxgbe/common/common.h	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/common/common.h	Wed Mar 20 17:27:11 2019	(r345334)
@@ -375,8 +375,9 @@ struct adapter_params {
 
 	uint32_t mps_bg_map;	/* rx buffer group map for all ports (upto 4) */
 
-	bool ulptx_memwrite_dsgl;        /* use of T5 DSGL allowed */
-	bool fr_nsmr_tpte_wr_support;    /* FW support for FR_NSMR_TPTE_WR */
+	bool ulptx_memwrite_dsgl;	/* use of T5 DSGL allowed */
+	bool fr_nsmr_tpte_wr_support;	/* FW support for FR_NSMR_TPTE_WR */
+	bool viid_smt_extn_support;	/* FW returns vin, vfvld & smt index? */
 };
 
 #define CHELSIO_T4		0x4
@@ -756,10 +757,11 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbo
 int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox,
 		     unsigned int port, unsigned int pf, unsigned int vf,
 		     unsigned int nmac, u8 *mac, u16 *rss_size,
+		     uint8_t *vfvld, uint16_t *vin,
 		     unsigned int portfunc, unsigned int idstype);
 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
 		unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
-		u16 *rss_size);
+		u16 *rss_size, uint8_t *vfvld, uint16_t *vin);
 int t4_free_vi(struct adapter *adap, unsigned int mbox,
 	       unsigned int pf, unsigned int vf,
 	       unsigned int viid);
@@ -770,7 +772,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i
 		      bool free, unsigned int naddr, const u8 **addr, u16 *idx,
 		      u64 *hash, 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, uint16_t *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,

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- head/sys/dev/cxgbe/common/t4_hw.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/common/t4_hw.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -7794,6 +7794,7 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbo
 int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox,
 		     unsigned int port, unsigned int pf, unsigned int vf,
 		     unsigned int nmac, u8 *mac, u16 *rss_size,
+		     uint8_t *vfvld, uint16_t *vin,
 		     unsigned int portfunc, unsigned int idstype)
 {
 	int ret;
@@ -7814,6 +7815,7 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in
 	ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c);
 	if (ret)
 		return ret;
+	ret = G_FW_VI_CMD_VIID(be16_to_cpu(c.type_to_viid));
 
 	if (mac) {
 		memcpy(mac, c.mac, sizeof(c.mac));
@@ -7830,7 +7832,18 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in
 	}
 	if (rss_size)
 		*rss_size = G_FW_VI_CMD_RSSSIZE(be16_to_cpu(c.norss_rsssize));
-	return G_FW_VI_CMD_VIID(be16_to_cpu(c.type_to_viid));
+	if (vfvld) {
+		*vfvld = adap->params.viid_smt_extn_support ?
+		    G_FW_VI_CMD_VFVLD(be32_to_cpu(c.alloc_to_len16)) :
+		    G_FW_VIID_VIVLD(ret);
+	}
+	if (vin) {
+		*vin = adap->params.viid_smt_extn_support ?
+		    G_FW_VI_CMD_VIN(be32_to_cpu(c.alloc_to_len16)) :
+		    G_FW_VIID_VIN(ret);
+	}
+
+	return ret;
 }
 
 /**
@@ -7850,10 +7863,10 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in
  */
 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
 		unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac,
-		u16 *rss_size)
+		u16 *rss_size, uint8_t *vfvld, uint16_t *vin)
 {
 	return t4_alloc_vi_func(adap, mbox, port, pf, vf, nmac, mac, rss_size,
-				FW_VI_FUNC_ETH, 0);
+				vfvld, vin, FW_VI_FUNC_ETH, 0);
 }
 
 /**
@@ -8030,7 +8043,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i
  *	@idx: index of existing filter for old value of MAC address, or -1
  *	@addr: the new MAC address value
  *	@persist: whether a new MAC allocation should be persistent
- *	@add_smt: if true also add the address to the HW SMT
+ *	@smt_idx: add MAC to SMT and return its index, or NULL
  *
  *	Modifies an exact-match filter and sets it to the new MAC address if
  *	@idx >= 0, or adds the MAC address to a new filter if @idx < 0.  In the
@@ -8045,7 +8058,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i
  *	MAC value.  Note that this index may differ from @idx.
  */
 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, uint16_t *smt_idx)
 {
 	int ret, mode;
 	struct fw_vi_mac_cmd c;
@@ -8054,7 +8067,7 @@ int t4_change_mac(struct adapter *adap, unsigned int m
 
 	if (idx < 0)		/* new allocation */
 		idx = persist ? FW_VI_MAC_ADD_PERSIST_MAC : FW_VI_MAC_ADD_MAC;
-	mode = add_smt ? FW_VI_MAC_SMT_AND_MPSTCAM : FW_VI_MAC_MPS_TCAM_ENTRY;
+	mode = smt_idx ? FW_VI_MAC_SMT_AND_MPSTCAM : FW_VI_MAC_MPS_TCAM_ENTRY;
 
 	memset(&c, 0, sizeof(c));
 	c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) |
@@ -8071,6 +8084,16 @@ int t4_change_mac(struct adapter *adap, unsigned int m
 		ret = G_FW_VI_MAC_CMD_IDX(be16_to_cpu(p->valid_to_idx));
 		if (ret >= max_mac_addr)
 			ret = -ENOMEM;
+		if (smt_idx) {
+			if (adap->params.viid_smt_extn_support)
+				*smt_idx = G_FW_VI_MAC_CMD_SMTID(be32_to_cpu(c.op_to_viid));
+			else {
+				if (chip_id(adap) <= CHELSIO_T5)
+					*smt_idx = (viid & M_FW_VIID_VIN) << 1;
+				else
+					*smt_idx = viid & M_FW_VIID_VIN;
+			}
+		}
 	}
 	return ret;
 }
@@ -9331,9 +9354,9 @@ int t4_port_init(struct adapter *adap, int mbox, int p
 {
 	u8 addr[6];
 	int ret, i, j;
-	u16 rss_size;
 	struct port_info *p = adap2pinfo(adap, port_id);
 	u32 param, val;
+	struct vi_info *vi = &p->vi[0];
 
 	for (i = 0, j = -1; i <= p->port_id; i++) {
 		do {
@@ -9351,27 +9374,23 @@ int t4_port_init(struct adapter *adap, int mbox, int p
  		t4_update_port_info(p);
 	}
 
-	ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &rss_size);
+	ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &vi->rss_size,
+	    &vi->vfvld, &vi->vin);
 	if (ret < 0)
 		return ret;
 
-	p->vi[0].viid = ret;
-	if (chip_id(adap) <= CHELSIO_T5)
-		p->vi[0].smt_idx = (ret & 0x7f) << 1;
-	else
-		p->vi[0].smt_idx = (ret & 0x7f);
-	p->vi[0].rss_size = rss_size;
+	vi->viid = ret;
 	t4_os_set_hw_addr(p, addr);
 
 	param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
 	    V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) |
-	    V_FW_PARAMS_PARAM_YZ(p->vi[0].viid);
+	    V_FW_PARAMS_PARAM_YZ(vi->viid);
 	ret = t4_query_params(adap, mbox, pf, vf, 1, &param, &val);
 	if (ret)
-		p->vi[0].rss_base = 0xffff;
+		vi->rss_base = 0xffff;
 	else {
 		/* MPASS((val >> 16) == rss_size); */
-		p->vi[0].rss_base = val & 0xffff;
+		vi->rss_base = val & 0xffff;
 	}
 
 	return 0;

Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h
==============================================================================
--- head/sys/dev/cxgbe/firmware/t4fw_interface.h	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/firmware/t4fw_interface.h	Wed Mar 20 17:27:11 2019	(r345334)
@@ -4798,6 +4798,7 @@ enum fw_params_param_dev {
 	FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR	= 0x24,
 	FW_PARAMS_PARAM_DEV_ADD_SMAC = 0x25,
 	FW_PARAMS_PARAM_DEV_HPFILTER_REGION_SUPPORT = 0x26,
+	FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27,
 };
 
 /*
@@ -6502,6 +6503,19 @@ struct fw_vi_cmd {
     (((x) >> S_FW_VI_CMD_FREE) & M_FW_VI_CMD_FREE)
 #define F_FW_VI_CMD_FREE		V_FW_VI_CMD_FREE(1U)
 
+#define S_FW_VI_CMD_VFVLD		24
+#define M_FW_VI_CMD_VFVLD		0x1
+#define V_FW_VI_CMD_VFVLD(x)		((x) << S_FW_VI_CMD_VFVLD)
+#define G_FW_VI_CMD_VFVLD(x)		\
+    (((x) >> S_FW_VI_CMD_VFVLD) & M_FW_VI_CMD_VFVLD)
+#define F_FW_VI_CMD_VFVLD		V_FW_VI_CMD_VFVLD(1U)
+
+#define S_FW_VI_CMD_VIN			16
+#define M_FW_VI_CMD_VIN			0xff
+#define V_FW_VI_CMD_VIN(x)		((x) << S_FW_VI_CMD_VIN)
+#define G_FW_VI_CMD_VIN(x)		\
+    (((x) >> S_FW_VI_CMD_VIN) & M_FW_VI_CMD_VIN)
+
 #define S_FW_VI_CMD_TYPE		15
 #define M_FW_VI_CMD_TYPE		0x1
 #define V_FW_VI_CMD_TYPE(x)		((x) << S_FW_VI_CMD_TYPE)
@@ -6607,6 +6621,12 @@ struct fw_vi_mac_cmd {
 		} exact_vni[2];
 	} u;
 };
+
+#define S_FW_VI_MAC_CMD_SMTID		12
+#define M_FW_VI_MAC_CMD_SMTID		0xff
+#define V_FW_VI_MAC_CMD_SMTID(x)	((x) << S_FW_VI_MAC_CMD_SMTID)
+#define G_FW_VI_MAC_CMD_SMTID(x)	\
+    (((x) >> S_FW_VI_MAC_CMD_SMTID) & M_FW_VI_MAC_CMD_SMTID)
 
 #define S_FW_VI_MAC_CMD_VIID		0
 #define M_FW_VI_MAC_CMD_VIID		0xfff

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/t4_main.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -2486,17 +2486,13 @@ alloc_extra_vi(struct adapter *sc, struct port_info *p
 	    device_get_nameunit(vi->dev)));
 	func = vi_mac_funcs[index];
 	rc = t4_alloc_vi_func(sc, sc->mbox, pi->tx_chan, sc->pf, 0, 1,
-	    vi->hw_addr, &vi->rss_size, func, 0);
+	    vi->hw_addr, &vi->rss_size, &vi->vfvld, &vi->vin, func, 0);
 	if (rc < 0) {
 		device_printf(vi->dev, "failed to allocate virtual interface %d"
 		    "for port %d: %d\n", index, pi->port_id, -rc);
 		return (-rc);
 	}
 	vi->viid = rc;
-	if (chip_id(sc) <= CHELSIO_T5)
-		vi->smt_idx = (rc & 0x7f) << 1;
-	else
-		vi->smt_idx = (rc & 0x7f);
 
 	if (vi->rss_size == 1) {
 		/*
@@ -4113,6 +4109,15 @@ set_params__pre_init(struct adapter *sc)
 		}
 	}
 
+	/* Enable opaque VIIDs with firmwares that support it. */
+	param = FW_PARAM_DEV(OPAQUE_VIID_SMT_EXTN);
+	val = 1;
+	rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &param, &val);
+	if (rc == 0 && val == 1)
+		sc->params.viid_smt_extn_support = true;
+	else
+		sc->params.viid_smt_extn_support = false;
+
 	return (rc);
 }
 
@@ -4825,7 +4830,7 @@ update_mac_settings(struct ifnet *ifp, int flags)
 
 		bcopy(IF_LLADDR(ifp), ucaddr, sizeof(ucaddr));
 		rc = t4_change_mac(sc, sc->mbox, vi->viid, vi->xact_addr_filt,
-		    ucaddr, true, true);
+		    ucaddr, true, &vi->smt_idx);
 		if (rc < 0) {
 			rc = -rc;
 			if_printf(ifp, "change_mac failed: %d\n", rc);
@@ -5746,7 +5751,7 @@ get_regs(struct adapter *sc, struct t4_regdump *regs, 
 #define	A_PL_INDIR_DATA	0x1fc
 
 static uint64_t
-read_vf_stat(struct adapter *sc, unsigned int viid, int reg)
+read_vf_stat(struct adapter *sc, u_int vin, int reg)
 {
 	u32 stats[2];
 
@@ -5756,8 +5761,7 @@ read_vf_stat(struct adapter *sc, unsigned int viid, in
 		stats[1] = t4_read_reg(sc, VF_MPS_REG(reg + 4));
 	} else {
 		t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) |
-		    V_PL_VFID(G_FW_VIID_VIN(viid)) |
-		    V_PL_ADDR(VF_MPS_REG(reg)));
+		    V_PL_VFID(vin) | V_PL_ADDR(VF_MPS_REG(reg)));
 		stats[0] = t4_read_reg(sc, A_PL_INDIR_DATA);
 		stats[1] = t4_read_reg(sc, A_PL_INDIR_DATA);
 	}
@@ -5765,12 +5769,11 @@ read_vf_stat(struct adapter *sc, unsigned int viid, in
 }
 
 static void
-t4_get_vi_stats(struct adapter *sc, unsigned int viid,
-    struct fw_vi_stats_vf *stats)
+t4_get_vi_stats(struct adapter *sc, u_int vin, struct fw_vi_stats_vf *stats)
 {
 
 #define GET_STAT(name) \
-	read_vf_stat(sc, viid, A_MPS_VF_STAT_##name##_L)
+	read_vf_stat(sc, vin, A_MPS_VF_STAT_##name##_L)
 
 	stats->tx_bcast_bytes    = GET_STAT(TX_VF_BCAST_BYTES);
 	stats->tx_bcast_frames   = GET_STAT(TX_VF_BCAST_FRAMES);
@@ -5793,12 +5796,11 @@ t4_get_vi_stats(struct adapter *sc, unsigned int viid,
 }
 
 static void
-t4_clr_vi_stats(struct adapter *sc, unsigned int viid)
+t4_clr_vi_stats(struct adapter *sc, u_int vin)
 {
 	int reg;
 
-	t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) |
-	    V_PL_VFID(G_FW_VIID_VIN(viid)) |
+	t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | V_PL_VFID(vin) |
 	    V_PL_ADDR(VF_MPS_REG(A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L)));
 	for (reg = A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L;
 	     reg <= A_MPS_VF_STAT_RX_VF_ERR_FRAMES_H; reg += 4)
@@ -5820,7 +5822,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *v
 		return;
 
 	mtx_lock(&sc->reg_lock);
-	t4_get_vi_stats(sc, vi->viid, &vi->stats);
+	t4_get_vi_stats(sc, vi->vin, &vi->stats);
 	getmicrotime(&vi->last_refreshed);
 	mtx_unlock(&sc->reg_lock);
 }
@@ -10055,7 +10057,7 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t 
 		mtx_lock(&sc->reg_lock);
 		for_each_vi(pi, v, vi) {
 			if (vi->flags & VI_INIT_DONE)
-				t4_clr_vi_stats(sc, vi->viid);
+				t4_clr_vi_stats(sc, vi->vin);
 		}
 		bg_map = pi->mps_bg_map;
 		v = 0;	/* reuse */

Modified: head/sys/dev/cxgbe/t4_sched.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sched.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/t4_sched.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -799,9 +799,8 @@ failed:
 	cst->tx_total = cst->tx_credits;
 	cst->plen = 0;
 	cst->ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) |
-	    V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) |
-	    V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) |
-	    V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid)));
+	    V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) |
+	    V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld));
 
 	/*
 	 * Queues will be selected later when the connection flowid is available.

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/t4_sge.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -3640,9 +3640,8 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm
 	nm_txq->nid = idx;
 	nm_txq->iqidx = iqidx;
 	nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) |
-	    V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) |
-	    V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) |
-	    V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid)));
+	    V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) |
+	    V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld));
 	nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID;
 
 	snprintf(name, sizeof(name), "%d", idx);
@@ -4043,10 +4042,8 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int
 		    V_TXPKT_INTF(pi->tx_chan));
 	else
 		txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) |
-		    V_TXPKT_INTF(pi->tx_chan) |
-		    V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) |
-		    V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) |
-		    V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid)));
+		    V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) |
+		    V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld));
 	txq->tc_idx = -1;
 	txq->sdesc = malloc(eq->sidx * sizeof(struct tx_sdesc), M_CXGBE,
 	    M_ZERO | M_WAITOK);
@@ -5657,7 +5654,7 @@ send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct p
     struct vi_info *vi)
 {
 	struct wrq_cookie cookie;
-	u_int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN;
+	u_int pfvf = pi->adapter->pf << S_FW_VIID_PFN;
 	struct fw_flowc_wr *flowc;
 
 	mtx_assert(&cst->lock, MA_OWNED);

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -107,7 +107,7 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par
 	struct vi_info *vi = toep->vi;
 	struct port_info *pi = vi->pi;
 	struct adapter *sc = pi->adapter;
-	unsigned int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN;
+	unsigned int pfvf = sc->pf << S_FW_VIID_PFN;
 	struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
 
 	KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT),

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_listen.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/tom/t4_listen.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -356,7 +356,7 @@ send_reset_synqe(struct toedev *tod, struct synq_entry
 	struct sge_wrq *ofld_txq;
 	struct sge_ofld_rxq *ofld_rxq;
 	const int nparams = 6;
-	unsigned int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN;
+	const u_int pfvf = sc->pf << S_FW_VIID_PFN;
 
 	INP_WLOCK_ASSERT(synqe->lctx->inp);
 

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar 20 17:27:00 2019	(r345333)
+++ head/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar 20 17:27:11 2019	(r345334)
@@ -633,7 +633,6 @@ select_ntuple(struct vi_info *vi, struct l2t_entry *e)
 {
 	struct adapter *sc = vi->pi->adapter;
 	struct tp_params *tp = &sc->params.tp;
-	uint16_t viid = vi->viid;
 	uint64_t ntuple = 0;
 
 	/*
@@ -650,12 +649,9 @@ select_ntuple(struct vi_info *vi, struct l2t_entry *e)
 		ntuple |= (uint64_t)IPPROTO_TCP << tp->protocol_shift;
 
 	if (tp->vnic_shift >= 0 && tp->ingress_config & F_VNIC) {
-		uint32_t vf = G_FW_VIID_VIN(viid);
-		uint32_t pf = G_FW_VIID_PFN(viid);
-		uint32_t vld = G_FW_VIID_VIVLD(viid);
-
-		ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vf) | V_FT_VNID_ID_PF(pf) |
-		    V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift;
+		ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vi->vin) |
+		    V_FT_VNID_ID_PF(sc->pf) | V_FT_VNID_ID_VLD(vi->vfvld)) <<
+		    tp->vnic_shift;
 	}
 
 	if (is_t4(sc))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903201727.x2KHRBNi017458>