Skip to contentSkip to conversation

net/cxgbe: feature updates and bug fixes

PATCH In review Rahul Lakkireddy 2 participants 7 messages Jun 29, 2018 – Jul 4, 2018 Network drivers

lore
Share & tools
lore
#4 lore raw

PATCH 4/5 net/cxgbe: fix Rx channel map and queue type

In reply to Rahul Lakkireddy

Set the Rx channel map and ingress queue type properly to allow firmware to manage the internal mapping correctly.

Fixes 6c2809628cd5 ("net/cxgbe: improve latency for slow traffic")
---
 drivers/net/cxgbe/base/t4fw_interface.h |  8 ++++++++
 drivers/net/cxgbe/cxgbe_compat.h        |  9 ---------
 drivers/net/cxgbe/sge.c                 | 10 +++++++---
 3 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/cxgbe/base/t4fw_interface.h +8 -0
index 9dc6d8123..5ddde6b59 100644
@@ -794,6 +794,11 @@ enum fw_iq_type {
 	FW_IQ_TYPE_FL_INT_CAP,
 };
 
+enum fw_iq_iqtype {
+	FW_IQ_IQTYPE_NIC = 1,
+	FW_IQ_IQTYPE_OFLD,
+};
+
 struct fw_iq_cmd {
 	__be32 op_to_vfn;
 	__be32 alloc_to_len16;
@@ -927,6 +932,9 @@ struct fw_iq_cmd {
 	(((x) >> S_FW_IQ_CMD_IQFLINTCONGEN) & M_FW_IQ_CMD_IQFLINTCONGEN)
 #define F_FW_IQ_CMD_IQFLINTCONGEN	V_FW_IQ_CMD_IQFLINTCONGEN(1U)
 
+#define S_FW_IQ_CMD_IQTYPE	24
+#define V_FW_IQ_CMD_IQTYPE(x)	((x) << S_FW_IQ_CMD_IQTYPE)
+
 #define S_FW_IQ_CMD_FL0CNGCHMAP		20
 #define M_FW_IQ_CMD_FL0CNGCHMAP		0xf
 #define V_FW_IQ_CMD_FL0CNGCHMAP(x)	((x) << S_FW_IQ_CMD_FL0CNGCHMAP)
drivers/net/cxgbe/cxgbe_compat.h +0 -9
index 779bcf165..d33452861 100644
@@ -198,15 +198,6 @@ static inline int cxgbe_fls(int x)
 	return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
 }
 
-/**
- * cxgbe_ffs - find first bit set
- * @x: the word to search
- */
-static inline int cxgbe_ffs(int x)
-{
-	return x ? __builtin_ffs(x) : 0;
-}
-
 static inline unsigned long ilog2(unsigned long n)
 {
 	unsigned int e = 0;
drivers/net/cxgbe/sge.c +7 -3
index 357b4856d..4ea40d191 100644
@@ -1889,12 +1889,16 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
 			    F_FW_CMD_WRITE | F_FW_CMD_EXEC);
 
 	if (is_pf4(adap)) {
-		pciechan = cong > 0 ? cxgbe_ffs(cong) - 1 : pi->tx_chan;
+		pciechan = pi->tx_chan;
 		c.op_to_vfn |= htonl(V_FW_IQ_CMD_PFN(adap->pf) |
 				     V_FW_IQ_CMD_VFN(0));
 		if (cong >= 0)
-			c.iqns_to_fl0congen = htonl(F_FW_IQ_CMD_IQFLINTCONGEN |
-						    F_FW_IQ_CMD_IQRO);
+			c.iqns_to_fl0congen =
+				htonl(F_FW_IQ_CMD_IQFLINTCONGEN |
+				      V_FW_IQ_CMD_IQTYPE(cong ?
+							 FW_IQ_IQTYPE_NIC :
+							 FW_IQ_IQTYPE_OFLD) |
+				      F_FW_IQ_CMD_IQRO);
 	} else {
 		pciechan = pi->port_id;
 	}
Signature · 1 line
2.14.1
#5 lore raw

PATCH 5/5 net/cxgbevf: add missing Tx byte counters

In reply to Rahul Lakkireddy
Fixes a0a344a8f728 ("net/cxgbe: add VF port statistics")
---
 drivers/net/cxgbe/base/t4_regs.h   | 3 +++
 drivers/net/cxgbe/base/t4vf_hw.c   | 6 ++++++
 drivers/net/cxgbe/cxgbevf_ethdev.c | 1 +
 3 files changed, 10 insertions(+)
drivers/net/cxgbe/base/t4_regs.h +3 -0
index fd8f9cf27..0c3a76860 100644
@@ -799,8 +799,11 @@
 #define A_MPS_STAT_RX_BG_3_LB_TRUNC_FRAME_L 0x96b8
 #define A_MPS_STAT_RX_BG_3_LB_TRUNC_FRAME_H 0x96bc
 
+#define A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L 0x80
 #define A_MPS_VF_STAT_TX_VF_BCAST_FRAMES_L 0x88
+#define A_MPS_VF_STAT_TX_VF_MCAST_BYTES_L 0x90
 #define A_MPS_VF_STAT_TX_VF_MCAST_FRAMES_L 0x98
+#define A_MPS_VF_STAT_TX_VF_UCAST_BYTES_L 0xa0
 #define A_MPS_VF_STAT_TX_VF_UCAST_FRAMES_L 0xa8
 #define A_MPS_VF_STAT_TX_VF_DROP_FRAMES_L 0xb0
 #define A_MPS_VF_STAT_RX_VF_BCAST_FRAMES_L 0xd0
drivers/net/cxgbe/base/t4vf_hw.c +6 -0
index 9fd0b8791..d96456bbe 100644
@@ -683,6 +683,9 @@ static int t4vf_get_port_stats_fw(struct adapter *adapter, int pidx,
 	/*
 	 * Translate firmware statistics into host native statistics.
 	 */
+	p->tx_octets = be64_to_cpu(fwstats.tx_bcast_bytes) +
+		       be64_to_cpu(fwstats.tx_mcast_bytes) +
+		       be64_to_cpu(fwstats.tx_ucast_bytes);
 	p->tx_bcast_frames = be64_to_cpu(fwstats.tx_bcast_frames);
 	p->tx_mcast_frames = be64_to_cpu(fwstats.tx_mcast_frames);
 	p->tx_ucast_frames = be64_to_cpu(fwstats.tx_ucast_frames);
@@ -722,6 +725,9 @@ void t4vf_get_port_stats(struct adapter *adapter, int pidx,
 #define GET_STAT(name) \
 	t4_read_reg64(adapter, \
 			T4VF_MPS_BASE_ADDR + A_MPS_VF_STAT_##name##_L)
+	p->tx_octets = GET_STAT(TX_VF_BCAST_BYTES) +
+		       GET_STAT(TX_VF_MCAST_BYTES) +
+		       GET_STAT(TX_VF_UCAST_BYTES);
 	p->tx_bcast_frames = GET_STAT(TX_VF_BCAST_FRAMES);
 	p->tx_mcast_frames = GET_STAT(TX_VF_MCAST_FRAMES);
 	p->tx_ucast_frames = GET_STAT(TX_VF_UCAST_FRAMES);
drivers/net/cxgbe/cxgbevf_ethdev.c +1 -0
index b4770e0c5..3b32ca9d4 100644
@@ -50,6 +50,7 @@ static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev,
 	/* TX Stats */
 	eth_stats->opackets = ps.tx_bcast_frames + ps.tx_mcast_frames +
 			      ps.tx_ucast_frames;
+	eth_stats->obytes = ps.tx_octets;
 	eth_stats->oerrors  = ps.tx_drop;
 
 	for (i = 0; i < pi->n_rx_qsets; i++) {
Signature · 1 line
2.14.1
#0 lore raw

cover net/cxgbe: feature updates and bug fixes

Patch 1 adds link up and down operations for PF and VF.

Patch 2 enables 2-tuple based RSS hash on IPv4 fragment packets and IPv6 packets with extension headers.

Patch 3 queries firmware for max queues that can be allocated.

Patch 4 fixes Rx channel map and ingress queue type needed for firmware to manage internal mapping correctly.

Patch 5 fixes forgotten Tx byte counters for VF.

Thanks,
Rahul

Rahul Lakkireddy (5):
net/cxgbe: add link up and down ops net/cxgbe: enable more RSS hash functions net/cxgbe: query firmware for max queues available net/cxgbe: fix Rx channel map and queue type net/cxgbevf: add missing Tx byte counters

 drivers/net/cxgbe/base/common.h         |  10 ++++
 drivers/net/cxgbe/base/t4_hw.c          |  40 +++++++++++++
 drivers/net/cxgbe/base/t4_regs.h        |   3 +
 drivers/net/cxgbe/base/t4fw_interface.h |  14 +++++
 drivers/net/cxgbe/base/t4vf_hw.c        |   6 ++
 drivers/net/cxgbe/cxgbe.h               |  21 +++++--
 drivers/net/cxgbe/cxgbe_compat.h        |   9 ---
 drivers/net/cxgbe/cxgbe_ethdev.c        |  80 ++++++++++++++++++++++---
 drivers/net/cxgbe/cxgbe_main.c          | 100 +++++++++++++++++++++++++-------
 drivers/net/cxgbe/cxgbe_pfvf.h          |   2 +
 drivers/net/cxgbe/cxgbevf_ethdev.c      |   3 +
 drivers/net/cxgbe/cxgbevf_main.c        |  20 +------
 drivers/net/cxgbe/sge.c                 |  10 +++-
 13 files changed, 256 insertions(+), 62 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/5 net/cxgbe: add link up and down ops

Add ops to set link up and down for both PF and VF. If wait_to_complete is set, poll for link update for up to 10 seconds max.

Original work by Surendra Mobiya <[email protected]>

---
 drivers/net/cxgbe/cxgbe.h          |  5 +++
 drivers/net/cxgbe/cxgbe_ethdev.c   | 72 ++++++++++++++++++++++++++++++++++++--
 drivers/net/cxgbe/cxgbe_main.c     | 36 +++++++++++++------
 drivers/net/cxgbe/cxgbe_pfvf.h     |  2 ++
 drivers/net/cxgbe/cxgbevf_ethdev.c |  2 ++
 5 files changed, 103 insertions(+), 14 deletions(-)
drivers/net/cxgbe/cxgbe.h +5 -0
index 27d6e2b84..96a6a4084 100644
@@ -18,6 +18,10 @@
 #define CXGBE_MIN_RX_BUFSIZE ETHER_MIN_MTU /* min buf size */
 #define CXGBE_MAX_RX_PKTLEN (9000 + ETHER_HDR_LEN + ETHER_CRC_LEN) /* max pkt */
 
+/* Max poll time is 100 * 100msec = 10 sec */
+#define CXGBE_LINK_STATUS_POLL_MS 100 /* 100ms */
+#define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
+
 #define CXGBE_DEFAULT_RSS_KEY_LEN     40 /* 320-bits */
 #define CXGBE_RSS_HF_ALL (ETH_RSS_IPV4 | ETH_RSS_IPV6 | \
 			  ETH_RSS_NONFRAG_IPV4_TCP | \
@@ -32,6 +36,7 @@ bool force_linkup(struct adapter *adap);
 int cxgbe_probe(struct adapter *adapter);
 int cxgbevf_probe(struct adapter *adapter);
 void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps);
+int cxgbe_set_link_status(struct port_info *pi, bool status);
 int cxgbe_up(struct adapter *adap);
 int cxgbe_down(struct port_info *pi);
 void cxgbe_close(struct adapter *adapter);
drivers/net/cxgbe/cxgbe_ethdev.c +69 -3

96 lines not on this page · raw message

drivers/net/cxgbe/cxgbe_main.c +25 -11
index 21ad380ae..edbb4df28 100644
@@ -1434,6 +1434,30 @@ void cxgbe_get_speed_caps(struct port_info *pi, u32 *speed_caps)
 		*speed_caps |= ETH_LINK_SPEED_FIXED;
 }
 
+/**
+ * cxgbe_set_link_status - Set device link up or down.
+ * @pi: Underlying port's info
+ * @status: 0 - down, 1 - up
+ *
+ * Set the device link up or down.
+ */
+int cxgbe_set_link_status(struct port_info *pi, bool status)
+{
+	struct adapter *adapter = pi->adapter;
+	int err = 0;
+
+	err = t4_enable_vi(adapter, adapter->mbox, pi->viid, status, status);
+	if (err) {
+		dev_err(adapter, "%s: disable_vi failed: %d\n", __func__, err);
+		return err;
+	}
+
+	if (!status)
+		t4_reset_link_config(adapter, pi->pidx);
+
+	return 0;
+}
+
 /**
  * cxgb_up - enable the adapter
  * @adap: adapter being enabled
@@ -1459,17 +1483,7 @@ int cxgbe_up(struct adapter *adap)
  */
 int cxgbe_down(struct port_info *pi)
 {
-	struct adapter *adapter = pi->adapter;
-	int err = 0;
-
-	err = t4_enable_vi(adapter, adapter->mbox, pi->viid, false, false);
-	if (err) {
-		dev_err(adapter, "%s: disable_vi failed: %d\n", __func__, err);
-		return err;
-	}
-
-	t4_reset_link_config(adapter, pi->pidx);
-	return 0;
+	return cxgbe_set_link_status(pi, false);
 }
 
 /*
drivers/net/cxgbe/cxgbe_pfvf.h +2 -0
index 2bba97423..8d0a105aa 100644
@@ -35,6 +35,8 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
 int cxgbe_dev_start(struct rte_eth_dev *eth_dev);
 int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
 			  int wait_to_complete);
+int cxgbe_dev_set_link_up(struct rte_eth_dev *dev);
+int cxgbe_dev_set_link_down(struct rte_eth_dev *dev);
 uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts);
 uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/cxgbe/cxgbevf_ethdev.c +2 -0
index a942ba6b6..b4770e0c5 100644
@@ -85,6 +85,8 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
 	.dev_infos_get          = cxgbe_dev_info_get,
 	.dev_supported_ptypes_get = cxgbe_dev_supported_ptypes_get,
 	.link_update            = cxgbe_dev_link_update,
+	.dev_set_link_up        = cxgbe_dev_set_link_up,
+	.dev_set_link_down      = cxgbe_dev_set_link_down,
 	.mtu_set                = cxgbe_dev_mtu_set,
 	.tx_queue_setup         = cxgbe_dev_tx_queue_setup,
 	.tx_queue_start         = cxgbe_dev_tx_queue_start,
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/5 net/cxgbe: enable more RSS hash functions

In reply to Rahul Lakkireddy

Enable RSS on IPv4 fragmented packets and IPv6 packets with extension headers based on 2-tuple hash.

---
 drivers/net/cxgbe/cxgbe.h        | 15 ++++++++++-----
 drivers/net/cxgbe/cxgbe_ethdev.c |  8 ++++----
 drivers/net/cxgbe/cxgbe_main.c   | 14 ++++++++------
 3 files changed, 22 insertions(+), 15 deletions(-)
drivers/net/cxgbe/cxgbe.h +10 -5
index 96a6a4084..70f974f5a 100644
@@ -23,11 +23,16 @@
 #define CXGBE_LINK_STATUS_POLL_CNT 100 /* Max number of times to poll */
 
 #define CXGBE_DEFAULT_RSS_KEY_LEN     40 /* 320-bits */
-#define CXGBE_RSS_HF_ALL (ETH_RSS_IPV4 | ETH_RSS_IPV6 | \
-			  ETH_RSS_NONFRAG_IPV4_TCP | \
-			  ETH_RSS_NONFRAG_IPV4_UDP | \
-			  ETH_RSS_NONFRAG_IPV6_TCP | \
-			  ETH_RSS_NONFRAG_IPV6_UDP)
+#define CXGBE_RSS_HF_IPV4_MASK (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | \
+				ETH_RSS_NONFRAG_IPV4_OTHER)
+#define CXGBE_RSS_HF_IPV6_MASK (ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | \
+				ETH_RSS_NONFRAG_IPV6_OTHER | \
+				ETH_RSS_IPV6_EX)
+#define CXGBE_RSS_HF_TCP_IPV6_MASK (ETH_RSS_NONFRAG_IPV6_TCP | \
+				    ETH_RSS_IPV6_TCP_EX)
+#define CXGBE_RSS_HF_UDP_IPV6_MASK (ETH_RSS_NONFRAG_IPV6_UDP | \
+				    ETH_RSS_IPV6_UDP_EX)
+#define CXGBE_RSS_HF_ALL (ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP)
 
 #define CXGBE_DEVARG_KEEP_OVLAN "keep_ovlan"
 #define CXGBE_DEVARG_FORCE_LINK_UP "force_link_up"
drivers/net/cxgbe/cxgbe_ethdev.c +4 -4
index eb07a1f89..41674041e 100644
@@ -863,13 +863,13 @@ static int cxgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 		return err;
 
 	if (flags & F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN) {
-		rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
+		rss_hf |= CXGBE_RSS_HF_TCP_IPV6_MASK;
 		if (flags & F_FW_RSS_VI_CONFIG_CMD_UDPEN)
-			rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
+			rss_hf |= CXGBE_RSS_HF_UDP_IPV6_MASK;
 	}
 
 	if (flags & F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN)
-		rss_hf |= ETH_RSS_IPV6;
+		rss_hf |= CXGBE_RSS_HF_IPV6_MASK;
 
 	if (flags & F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN) {
 		rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
@@ -878,7 +878,7 @@ static int cxgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 	}
 
 	if (flags & F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN)
-		rss_hf |= ETH_RSS_IPV4;
+		rss_hf |= CXGBE_RSS_HF_IPV4_MASK;
 
 	rss_conf->rss_hf = rss_hf;
 
drivers/net/cxgbe/cxgbe_main.c +8 -6
index edbb4df28..1d77d4621 100644
@@ -1203,7 +1203,7 @@ int cxgbe_write_rss_conf(const struct port_info *pi, uint64_t rss_hf)
 	if (rss_hf & ~CXGBE_RSS_HF_ALL)
 		return -EINVAL;
 
-	if (rss_hf & ETH_RSS_IPV4)
+	if (rss_hf & CXGBE_RSS_HF_IPV4_MASK)
 		flags |= F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN;
 
 	if (rss_hf & ETH_RSS_NONFRAG_IPV4_TCP)
@@ -1213,14 +1213,16 @@ int cxgbe_write_rss_conf(const struct port_info *pi, uint64_t rss_hf)
 		flags |= F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN |
 			 F_FW_RSS_VI_CONFIG_CMD_UDPEN;
 
-	if (rss_hf & ETH_RSS_IPV6)
+	if (rss_hf & CXGBE_RSS_HF_IPV6_MASK)
 		flags |= F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN;
 
-	if (rss_hf & ETH_RSS_NONFRAG_IPV6_TCP)
-		flags |= F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN;
+	if (rss_hf & CXGBE_RSS_HF_TCP_IPV6_MASK)
+		flags |= F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN |
+			 F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN;
 
-	if (rss_hf & ETH_RSS_NONFRAG_IPV6_UDP)
-		flags |= F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN |
+	if (rss_hf & CXGBE_RSS_HF_UDP_IPV6_MASK)
+		flags |= F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN |
+			 F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN |
 			 F_FW_RSS_VI_CONFIG_CMD_UDPEN;
 
 	rxq = &adapter->sge.ethrxq[pi->first_qset];
Signature · 1 line
2.14.1
#3 lore raw

PATCH 3/5 net/cxgbe: query firmware for max queues available

In reply to Rahul Lakkireddy

Query firmware for max Tx and Rx queues that can be allocated. Move the code to determine max queues to common place for both PF and VF.

---
 drivers/net/cxgbe/base/common.h         | 10 +++++++
 drivers/net/cxgbe/base/t4_hw.c          | 40 ++++++++++++++++++++++++++
 drivers/net/cxgbe/base/t4fw_interface.h |  6 ++++
 drivers/net/cxgbe/cxgbe.h               |  1 +
 drivers/net/cxgbe/cxgbe_main.c          | 50 +++++++++++++++++++++++++++++++--
 drivers/net/cxgbe/cxgbevf_main.c        | 20 ++-----------
 6 files changed, 106 insertions(+), 21 deletions(-)
drivers/net/cxgbe/base/common.h +10 -0
index e524f7931..9c4a33771 100644
@@ -207,6 +207,14 @@ struct rss_params {
 	} u;
 };
 
+/*
+ * Maximum resources provisioned for a PCI PF.
+ */
+struct pf_resources {
+	unsigned int neq;      /* N egress Qs */
+	unsigned int niqflint; /* N ingress Qs/w free list(s) & intr */
+};
+
 /*
  * Maximum resources provisioned for a PCI VF.
  */
@@ -230,6 +238,7 @@ struct adapter_params {
 	struct pci_params pci;
 	struct devlog_params devlog;
 	struct rss_params rss;
+	struct pf_resources pfres;
 	struct vf_resources vfres;
 	enum pcie_memwin drv_memwin;
 
@@ -456,6 +465,7 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
 		       unsigned int nregs, unsigned int start_idx);
 
 int t4_get_vpd_params(struct adapter *adapter, struct vpd_params *p);
+int t4_get_pfres(struct adapter *adapter);
 int t4_read_flash(struct adapter *adapter, unsigned int addr,
 		  unsigned int nwords, u32 *data, int byte_oriented);
 int t4_flash_cfg_addr(struct adapter *adapter);
drivers/net/cxgbe/base/t4_hw.c +40 -0
index 66d080476..698781509 100644
@@ -2480,6 +2480,46 @@ int t4_get_core_clock(struct adapter *adapter, struct vpd_params *p)
 	return 0;
 }
 
+/**
+ * t4_get_pfres - retrieve VF resource limits
+ * @adapter: the adapter
+ *
+ * Retrieves configured resource limits and capabilities for a physical
+ * function.  The results are stored in @adapter->pfres.
+ */
+int t4_get_pfres(struct adapter *adapter)
+{
+	struct pf_resources *pfres = &adapter->params.pfres;
+	struct fw_pfvf_cmd cmd, rpl;
+	u32 word;
+	int v;
+
+	/*
+	 * Execute PFVF Read command to get VF resource limits; bail out early
+	 * with error on command failure.
+	 */
+	memset(&cmd, 0, sizeof(cmd));
+	cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_PFVF_CMD) |
+				    F_FW_CMD_REQUEST |
+				    F_FW_CMD_READ |
+				    V_FW_PFVF_CMD_PFN(adapter->pf) |
+				    V_FW_PFVF_CMD_VFN(0));
+	cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
+	v = t4_wr_mbox(adapter, adapter->mbox, &cmd, sizeof(cmd), &rpl);
+	if (v != FW_SUCCESS)
+		return v;
+
+	/*
+	 * Extract PF resource limits and return success.
+	 */
+	word = be32_to_cpu(rpl.niqflint_niq);
+	pfres->niqflint = G_FW_PFVF_CMD_NIQFLINT(word);
+
+	word = be32_to_cpu(rpl.type_to_neq);
+	pfres->neq = G_FW_PFVF_CMD_NEQ(word);
+	return 0;
+}
+
 /* serial flash and firmware constants and flash config file constants */
 enum {
 	SF_ATTEMPTS = 10,             /* max retries for SF operations */
drivers/net/cxgbe/base/t4fw_interface.h +6 -0
index 842aa1263..9dc6d8123 100644
@@ -729,6 +729,12 @@ struct fw_pfvf_cmd {
 	__be32 r4;
 };
 
+#define S_FW_PFVF_CMD_PFN		8
+#define V_FW_PFVF_CMD_PFN(x)		((x) << S_FW_PFVF_CMD_PFN)
+
+#define S_FW_PFVF_CMD_VFN		0
+#define V_FW_PFVF_CMD_VFN(x)		((x) << S_FW_PFVF_CMD_VFN)
+
 #define S_FW_PFVF_CMD_NIQFLINT          20
 #define M_FW_PFVF_CMD_NIQFLINT          0xfff
 #define G_FW_PFVF_CMD_NIQFLINT(x)       \
drivers/net/cxgbe/cxgbe.h +1 -0
index 70f974f5a..5e6f5c98d 100644
@@ -63,5 +63,6 @@ void cxgbe_enable_rx_queues(struct port_info *pi);
 void print_port_info(struct adapter *adap);
 void print_adapter_info(struct adapter *adap);
 int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key);
+void configure_max_ethqsets(struct adapter *adapter);
 
 #endif /* _CXGBE_H_ */
drivers/net/cxgbe/cxgbe_main.c +47 -3

80 lines not on this page · raw message

drivers/net/cxgbe/cxgbevf_main.c +2 -18
index 5b3fb5399..4214d0312 100644
@@ -20,7 +20,7 @@
 static void size_nports_qsets(struct adapter *adapter)
 {
 	struct vf_resources *vfres = &adapter->params.vfres;
-	unsigned int ethqsets, pmask_nports;
+	unsigned int pmask_nports;
 
 	/*
 	 * The number of "ports" which we support is equal to the number of
@@ -49,23 +49,7 @@ static void size_nports_qsets(struct adapter *adapter)
 		adapter->params.nports = pmask_nports;
 	}
 
-	/*
-	 * We need to reserve an Ingress Queue for the Asynchronous Firmware
-	 * Event Queue.
-	 *
-	 * For each Queue Set, we'll need the ability to allocate two Egress
-	 * Contexts -- one for the Ingress Queue Free List and one for the TX
-	 * Ethernet Queue.
-	 */
-	ethqsets = vfres->niqflint - 1;
-	if (vfres->nethctrl != ethqsets)
-		ethqsets = min(vfres->nethctrl, ethqsets);
-	if (vfres->neq < ethqsets * 2)
-		ethqsets = vfres->neq / 2;
-	if (ethqsets > MAX_ETH_QSETS)
-		ethqsets = MAX_ETH_QSETS;
-	adapter->sge.max_ethqsets = ethqsets;
-
+	configure_max_ethqsets(adapter);
 	if (adapter->sge.max_ethqsets < adapter->params.nports) {
 		dev_warn(adapter->pdev_dev, "only using %d of %d available"
 			 " virtual interfaces (too few Queue Sets)\n",
Signature · 1 line
2.14.1
#6 lore raw
In reply to Rahul Lakkireddy
Quoted 15 lines · Rahul Lakkireddy

Patch 1 adds link up and down operations for PF and VF.

Patch 2 enables 2-tuple based RSS hash on IPv4 fragment packets and IPv6 packets with extension headers.

Patch 3 queries firmware for max queues that can be allocated.

Patch 4 fixes Rx channel map and ingress queue type needed for firmware to manage internal mapping correctly.

Patch 5 fixes forgotten Tx byte counters for VF.

Thanks,
Rahul

Quoted 6 lines

Rahul Lakkireddy (5):
net/cxgbe: add link up and down ops net/cxgbe: enable more RSS hash functions net/cxgbe: query firmware for max queues available net/cxgbe: fix Rx channel map and queue type net/cxgbevf: add missing Tx byte counters

Series applied to dpdk-next-net/master, thanks.