net/sfc: implement simple EF10 native Tx datapath
The datapath does not support VLAN insertion, TSO and multi-segment mbufs. Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
parent
ea2ed84c2f
commit
5688520075
@ -236,7 +236,7 @@ boolean parameters value.
|
||||
more efficient than libefx-based and provides richer packet type
|
||||
classification, but lacks Rx scatter support.
|
||||
|
||||
- ``tx_datapath`` [auto|efx|ef10] (default **auto**)
|
||||
- ``tx_datapath`` [auto|efx|ef10|ef10_simple] (default **auto**)
|
||||
|
||||
Choose transmit datapath implementation.
|
||||
**auto** allows the driver itself to make a choice based on firmware
|
||||
@ -246,6 +246,9 @@ boolean parameters value.
|
||||
**ef10** chooses EF10 (SFN7xxx, SFN8xxx) native datapath which is
|
||||
more efficient than libefx-based but has no VLAN insertion and TSO
|
||||
support yet.
|
||||
**ef10_simple** chooses EF10 (SFN7xxx, SFN8xxx) native datapath which
|
||||
is even more faster then **ef10** but does not support multi-segment
|
||||
mbufs.
|
||||
|
||||
- ``perf_profile`` [auto|throughput|low-latency] (default **throughput**)
|
||||
|
||||
|
@ -162,6 +162,7 @@ sfc_dp_find_tx_by_caps(struct sfc_dp_list *head, unsigned int avail_caps)
|
||||
|
||||
extern struct sfc_dp_tx sfc_efx_tx;
|
||||
extern struct sfc_dp_tx sfc_ef10_tx;
|
||||
extern struct sfc_dp_tx sfc_ef10_simple_tx;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -313,6 +313,64 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
|
||||
return pktp - &tx_pkts[0];
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
sfc_ef10_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
|
||||
uint16_t nb_pkts)
|
||||
{
|
||||
struct sfc_ef10_txq * const txq = sfc_ef10_txq_by_dp_txq(tx_queue);
|
||||
unsigned int ptr_mask;
|
||||
unsigned int added;
|
||||
unsigned int dma_desc_space;
|
||||
bool reap_done;
|
||||
struct rte_mbuf **pktp;
|
||||
struct rte_mbuf **pktp_end;
|
||||
|
||||
if (unlikely(txq->flags &
|
||||
(SFC_EF10_TXQ_NOT_RUNNING | SFC_EF10_TXQ_EXCEPTION)))
|
||||
return 0;
|
||||
|
||||
ptr_mask = txq->ptr_mask;
|
||||
added = txq->added;
|
||||
dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
|
||||
(added - txq->completed);
|
||||
|
||||
reap_done = (dma_desc_space < RTE_MAX(txq->free_thresh, nb_pkts));
|
||||
if (reap_done) {
|
||||
sfc_ef10_tx_reap(txq);
|
||||
dma_desc_space = SFC_EF10_TXQ_LIMIT(ptr_mask + 1) -
|
||||
(added - txq->completed);
|
||||
}
|
||||
|
||||
pktp_end = &tx_pkts[MIN(nb_pkts, dma_desc_space)];
|
||||
for (pktp = &tx_pkts[0]; pktp != pktp_end; ++pktp) {
|
||||
struct rte_mbuf *pkt = *pktp;
|
||||
unsigned int id = added & ptr_mask;
|
||||
|
||||
SFC_ASSERT(rte_pktmbuf_data_len(pkt) <=
|
||||
SFC_EF10_TX_DMA_DESC_LEN_MAX);
|
||||
|
||||
sfc_ef10_tx_qdesc_dma_create(rte_mbuf_data_dma_addr(pkt),
|
||||
rte_pktmbuf_data_len(pkt),
|
||||
true, &txq->txq_hw_ring[id]);
|
||||
|
||||
txq->sw_ring[id].mbuf = pkt;
|
||||
|
||||
++added;
|
||||
}
|
||||
|
||||
if (likely(added != txq->added)) {
|
||||
sfc_ef10_tx_qpush(txq, added, txq->added);
|
||||
txq->added = added;
|
||||
}
|
||||
|
||||
#if SFC_TX_XMIT_PKTS_REAP_AT_LEAST_ONCE
|
||||
if (!reap_done)
|
||||
sfc_ef10_tx_reap(txq);
|
||||
#endif
|
||||
|
||||
return pktp - &tx_pkts[0];
|
||||
}
|
||||
|
||||
|
||||
static sfc_dp_tx_qcreate_t sfc_ef10_tx_qcreate;
|
||||
static int
|
||||
@ -449,3 +507,18 @@ struct sfc_dp_tx sfc_ef10_tx = {
|
||||
.qreap = sfc_ef10_tx_qreap,
|
||||
.pkt_burst = sfc_ef10_xmit_pkts,
|
||||
};
|
||||
|
||||
struct sfc_dp_tx sfc_ef10_simple_tx = {
|
||||
.dp = {
|
||||
.name = SFC_KVARG_DATAPATH_EF10_SIMPLE,
|
||||
.type = SFC_DP_TX,
|
||||
},
|
||||
.features = 0,
|
||||
.qcreate = sfc_ef10_tx_qcreate,
|
||||
.qdestroy = sfc_ef10_tx_qdestroy,
|
||||
.qstart = sfc_ef10_tx_qstart,
|
||||
.qtx_ev = sfc_ef10_tx_qtx_ev,
|
||||
.qstop = sfc_ef10_tx_qstop,
|
||||
.qreap = sfc_ef10_tx_qreap,
|
||||
.pkt_burst = sfc_ef10_simple_xmit_pkts,
|
||||
};
|
||||
|
@ -1470,6 +1470,7 @@ sfc_register_dp(void)
|
||||
|
||||
sfc_dp_register(&sfc_dp_head, &sfc_ef10_tx.dp);
|
||||
sfc_dp_register(&sfc_dp_head, &sfc_efx_tx.dp);
|
||||
sfc_dp_register(&sfc_dp_head, &sfc_ef10_simple_tx.dp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ extern "C" {
|
||||
|
||||
#define SFC_KVARG_DATAPATH_EFX "efx"
|
||||
#define SFC_KVARG_DATAPATH_EF10 "ef10"
|
||||
#define SFC_KVARG_DATAPATH_EF10_SIMPLE "ef10_simple"
|
||||
|
||||
#define SFC_KVARG_RX_DATAPATH "rx_datapath"
|
||||
#define SFC_KVARG_VALUES_RX_DATAPATH \
|
||||
@ -67,7 +68,8 @@ extern "C" {
|
||||
#define SFC_KVARG_TX_DATAPATH "tx_datapath"
|
||||
#define SFC_KVARG_VALUES_TX_DATAPATH \
|
||||
"[" SFC_KVARG_DATAPATH_EFX "|" \
|
||||
SFC_KVARG_DATAPATH_EF10 "]"
|
||||
SFC_KVARG_DATAPATH_EF10 "|" \
|
||||
SFC_KVARG_DATAPATH_EF10_SIMPLE "]"
|
||||
|
||||
struct sfc_adapter;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user