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
This commit is contained in:
Navdeep Parhar 2019-12-10 08:16:19 +00:00
parent 6f012c14bc
commit aa7bdbc00c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355580
3 changed files with 16 additions and 4 deletions

View File

@ -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 */

View File

@ -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_txq,
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);

View File

@ -3754,6 +3754,10 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx,
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);