svn commit: r355580 - head/sys/dev/cxgbe
Navdeep Parhar
np at FreeBSD.org
Tue Dec 10 08:16:20 UTC 2019
Author: np
Date: Tue Dec 10 08:16:19 2019
New Revision: 355580
URL: https://svnweb.freebsd.org/changeset/base/355580
Log:
cxgbe(4): Use TX_PKTS2 work requests in netmap Tx if it's available.
TX_PKTS2 is more efficient within the firmware and this improves netmap
Tx by a few Mpps in some common scenarios.
MFC after: 1 week
Sponsored by: Chelsio Communications
Modified:
head/sys/dev/cxgbe/adapter.h
head/sys/dev/cxgbe/t4_netmap.c
head/sys/dev/cxgbe/t4_sge.c
Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h Tue Dec 10 07:45:10 2019 (r355579)
+++ head/sys/dev/cxgbe/adapter.h Tue Dec 10 08:16:19 2019 (r355580)
@@ -743,6 +743,7 @@ struct sge_nm_txq {
u_int udb_qid;
u_int cntxt_id;
__be32 cpl_ctrl0; /* for convenience */
+ __be32 op_pkd; /* ditto */
u_int nid; /* netmap ring # for this queue */
/* infrequently used items after this */
Modified: head/sys/dev/cxgbe/t4_netmap.c
==============================================================================
--- head/sys/dev/cxgbe/t4_netmap.c Tue Dec 10 07:45:10 2019 (r355579)
+++ head/sys/dev/cxgbe/t4_netmap.c Tue Dec 10 08:16:19 2019 (r355580)
@@ -573,7 +573,10 @@ ndesc_to_npkt(const int n)
}
#define MAX_NPKT_IN_TYPE1_WR (ndesc_to_npkt(SGE_MAX_WR_NDESC))
-/* Space (in descriptors) needed for a type1 WR that carries n packets */
+/*
+ * Space (in descriptors) needed for a type1 WR (TX_PKTS or TX_PKTS2) that
+ * carries n packets
+ */
static inline int
npkt_to_ndesc(const int n)
{
@@ -583,7 +586,10 @@ npkt_to_ndesc(const int n)
return ((n + 2) / 2);
}
-/* Space (in 16B units) needed for a type1 WR that carries n packets */
+/*
+ * Space (in 16B units) needed for a type1 WR (TX_PKTS or TX_PKTS2) that
+ * carries n packets
+ */
static inline int
npkt_to_len16(const int n)
{
@@ -670,7 +676,7 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_
len = 0;
wr = (void *)&nm_txq->desc[nm_txq->pidx];
- wr->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR));
+ wr->op_pkd = nm_txq->op_pkd;
wr->equiq_to_len16 = htobe32(V_FW_WR_LEN16(npkt_to_len16(n)));
wr->npkt = n;
wr->r3 = 0;
@@ -778,7 +784,8 @@ reclaim_nm_tx_desc(struct sge_nm_txq *nm_txq)
while (nm_txq->cidx != hw_cidx) {
wr = (void *)&nm_txq->desc[nm_txq->cidx];
- MPASS(wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)));
+ MPASS(wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)) ||
+ wr->op_pkd == htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)));
MPASS(wr->type == 1);
MPASS(wr->npkt > 0 && wr->npkt <= MAX_NPKT_IN_TYPE1_WR);
Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Tue Dec 10 07:45:10 2019 (r355579)
+++ head/sys/dev/cxgbe/t4_sge.c Tue Dec 10 08:16:19 2019 (r355580)
@@ -3754,6 +3754,10 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm
nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) |
V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) |
V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld));
+ if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0))
+ nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR));
+ else
+ nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR));
nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID;
snprintf(name, sizeof(name), "%d", idx);
More information about the svn-src-head
mailing list