Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Mar 2019 22:51:49 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r345622 - in stable/12/sys/dev/cxgbe: . common firmware tom
Message-ID:  <201903272251.x2RMpnEQ095497@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Wed Mar 27 22:51:48 2019
New Revision: 345622
URL: https://svnweb.freebsd.org/changeset/base/345622

Log:
  MFC r344654, r345334.
  
  r344654:
  cxgbe(4): Request high priority filter support explicitly, as required
  by recent firmwares.
  
  Sponsored by:	Chelsio Communications
  
  r345334:
  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.
  
  Sponsored by:	Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/adapter.h
  stable/12/sys/dev/cxgbe/common/common.h
  stable/12/sys/dev/cxgbe/common/t4_hw.c
  stable/12/sys/dev/cxgbe/firmware/t4fw_interface.h
  stable/12/sys/dev/cxgbe/t4_main.c
  stable/12/sys/dev/cxgbe/t4_sched.c
  stable/12/sys/dev/cxgbe/t4_sge.c
  stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
  stable/12/sys/dev/cxgbe/tom/t4_listen.c
  stable/12/sys/dev/cxgbe/tom/t4_tom.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/12/sys/dev/cxgbe/adapter.h	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/adapter.h	Wed Mar 27 22:51:48 2019	(r345622)
@@ -193,8 +193,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: stable/12/sys/dev/cxgbe/common/common.h
==============================================================================
--- stable/12/sys/dev/cxgbe/common/common.h	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/common/common.h	Wed Mar 27 22:51:48 2019	(r345622)
@@ -379,8 +379,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
@@ -762,10 +763,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);
@@ -776,7 +778,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: stable/12/sys/dev/cxgbe/common/t4_hw.c
==============================================================================
--- stable/12/sys/dev/cxgbe/common/t4_hw.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/common/t4_hw.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -7221,6 +7221,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;
@@ -7241,6 +7242,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));
@@ -7257,7 +7259,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;
 }
 
 /**
@@ -7277,10 +7290,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);
 }
 
 /**
@@ -7457,7 +7470,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
@@ -7472,7 +7485,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;
@@ -7481,7 +7494,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) |
@@ -7498,6 +7511,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;
 }
@@ -8758,9 +8781,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 {
@@ -8778,27 +8801,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: stable/12/sys/dev/cxgbe/firmware/t4fw_interface.h
==============================================================================
--- stable/12/sys/dev/cxgbe/firmware/t4fw_interface.h	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/firmware/t4fw_interface.h	Wed Mar 27 22:51:48 2019	(r345622)
@@ -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: stable/12/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/12/sys/dev/cxgbe/t4_main.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/t4_main.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -608,6 +608,7 @@ static int cfg_itype_and_nqueues(struct adapter *, str
 static int contact_firmware(struct adapter *);
 static int partition_resources(struct adapter *);
 static int get_params__pre_init(struct adapter *);
+static int set_params__pre_init(struct adapter *);
 static int get_params__post_init(struct adapter *);
 static int set_params__post_init(struct adapter *);
 static void t4_set_desc(struct adapter *);
@@ -2485,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) {
 		/*
@@ -3942,6 +3939,7 @@ apply_cfg_and_initialize(struct adapter *sc, char *cfg
 	}
 
 	t4_tweak_chip_settings(sc);
+	set_params__pre_init(sc);
 
 	/* get basic stuff going */
 	rc = -t4_fw_initialize(sc, sc->mbox);
@@ -4064,6 +4062,44 @@ get_params__pre_init(struct adapter *sc)
 }
 
 /*
+ * Any params that need to be set before FW_INITIALIZE.
+ */
+static int
+set_params__pre_init(struct adapter *sc)
+{
+	int rc = 0;
+	uint32_t param, val;
+
+	if (chip_id(sc) >= CHELSIO_T6) {
+		param = FW_PARAM_DEV(HPFILTER_REGION_SUPPORT);
+		val = 1;
+		rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &param, &val);
+		/* firmwares < 1.20.1.0 do not have this param. */
+		if (rc == FW_EINVAL && sc->params.fw_vers <
+		    (V_FW_HDR_FW_VER_MAJOR(1) | V_FW_HDR_FW_VER_MINOR(20) |
+		    V_FW_HDR_FW_VER_MICRO(1) | V_FW_HDR_FW_VER_BUILD(0))) {
+			rc = 0;
+		}
+		if (rc != 0) {
+			device_printf(sc->dev,
+			    "failed to enable high priority filters :%d.\n",
+			    rc);
+		}
+	}
+
+	/* 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);
+}
+
+/*
  * Retrieve various parameters that are of interest to the driver.  The device
  * has been initialized by the firmware at this point.
  */
@@ -4106,20 +4142,6 @@ get_params__post_init(struct adapter *sc)
 
 	if (chip_id(sc) >= CHELSIO_T6) {
 
-#ifdef INVARIANTS
-		if (sc->params.fw_vers >=
-		    (V_FW_HDR_FW_VER_MAJOR(1) | V_FW_HDR_FW_VER_MINOR(20) |
-		    V_FW_HDR_FW_VER_MICRO(1) | V_FW_HDR_FW_VER_BUILD(0))) {
-			/*
-			 * Note that the code to enable the region should run
-			 * before t4_fw_initialize and not here.  This is just a
-			 * reminder to add said code.
-			 */
-			device_printf(sc->dev,
-			    "hpfilter region not enabled.\n");
-		}
-#endif
-
 		sc->tids.tid_base = t4_read_reg(sc,
 		    A_LE_DB_ACTIVE_TABLE_START_INDEX);
 
@@ -4786,7 +4808,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);
@@ -5707,7 +5729,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];
 
@@ -5717,8 +5739,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);
 	}
@@ -5726,12 +5747,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);
@@ -5754,12 +5774,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)
@@ -5781,7 +5800,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);
 }
@@ -9982,7 +10001,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: stable/12/sys/dev/cxgbe/t4_sched.c
==============================================================================
--- stable/12/sys/dev/cxgbe/t4_sched.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/t4_sched.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -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: stable/12/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- stable/12/sys/dev/cxgbe/t4_sge.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/t4_sge.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -3568,9 +3568,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);
@@ -3971,10 +3970,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);
@@ -5547,7 +5544,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: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -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: stable/12/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- stable/12/sys/dev/cxgbe/tom/t4_listen.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/tom/t4_listen.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -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: stable/12/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- stable/12/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar 27 22:42:18 2019	(r345621)
+++ stable/12/sys/dev/cxgbe/tom/t4_tom.c	Wed Mar 27 22:51:48 2019	(r345622)
@@ -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?201903272251.x2RMpnEQ095497>