net/ionic: miscellaneous fixes and improvements
cover net/ionic: miscellaneous fixes and improvements
This patchset provides miscellaneous fixes and improvements for the net/ionic driver used by AMD Pensando devices.
Akshay Dorwat (1):
net/ionic: fix RSS query routine
Andrew Boyer (8):
net/ionic: add stat for completion queue entries processed net/ionic: increase max supported MTU to 9750 bytes net/ionic: don't auto-enable Rx scatter-gather a second time net/ionic: replace non-standard type in structure definition net/ionic: fix device close sequence to avoid crash net/ionic: optimize device close operation net/ionic: optimize device stop operation net/ionic: optimize device start operation
Brad Larson (1):
net/ionic: add flexible firmware xstat counters
Neel Patel (2):
net/ionic: fix missing volatile type for cqe pointers net/ionic: memcpy descriptors when using Q-in-CMB
Vamsi Krishna Atluri (1):
net/ionic: report 1G and 200G link speeds when applicable
drivers/net/ionic/ionic.h | 3 + drivers/net/ionic/ionic_dev.c | 9 +- drivers/net/ionic/ionic_dev.h | 8 +- drivers/net/ionic/ionic_dev_pci.c | 2 +- drivers/net/ionic/ionic_ethdev.c | 81 ++++++-- drivers/net/ionic/ionic_if.h | 70 +++---- drivers/net/ionic/ionic_lif.c | 288 +++++++++++++++++--------- drivers/net/ionic/ionic_lif.h | 19 +- drivers/net/ionic/ionic_main.c | 17 +- drivers/net/ionic/ionic_rxtx.c | 160 ++++++++++---- drivers/net/ionic/ionic_rxtx.h | 80 ++++++- drivers/net/ionic/ionic_rxtx_sg.c | 28 +-- drivers/net/ionic/ionic_rxtx_simple.c | 28 +-- 13 files changed, 550 insertions(+), 243 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/13 net/ionic: add stat for completion queue entries processed
When completion coalescing is turned on in the FW, there will be fewer CQE than Tx packets. Expose the stat through debug logging.
--- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 3 +++ drivers/net/ionic/ionic_rxtx_sg.c | 2 ++ drivers/net/ionic/ionic_rxtx_simple.c | 2 ++ 4 files changed, 8 insertions(+)
drivers/net/ionic/ionic_lif.h +1 -0
@@ -32,6 +32,7 @@struct ionic_tx_stats {uint64_t packets;uint64_t bytes; +uint64_t comps;uint64_t drop;uint64_t stop;uint64_t no_csum;
drivers/net/ionic/ionic_rxtx.c +3 -0
@@ -117,6 +117,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) stats = &txq->stats;IONIC_PRINT (DEBUG ,"TX queue %u pkts %ju tso %ju" , txq->qcq.q.index, stats->packets, stats->tso); +IONIC_PRINT (DEBUG ,"TX queue %u comps %ju (%ju per)" , + txq->qcq.q.index, stats->comps, + stats->comps ? stats->packets / stats->comps :0 );return 0 ; }
drivers/net/ionic/ionic_rxtx_sg.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -72,6 +73,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
drivers/net/ionic/ionic_rxtx_simple.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -67,6 +68,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
Signature · 1 line
2.17.1
Re: [PATCH 01/13] net/ionic: add stat for completion queue entries processed
Quoted 4 lines · On Fri, 2 Feb 2024 11:32:26 -0800 Andrew Boyer <[email protected]> wrote:
When completion coalescing is turned on in the FW, there will be fewer CQE than Tx packets. Expose the stat through debug logging.
Signed-off-by Andrew Boyer <[email protected]>
If you care about the stat it should be in xstats.
Re: [PATCH 01/13] net/ionic: add stat for completion queue entries processed
Quoted 10 lines · Stephen Hemminger
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
On Fri, 2 Feb 2024 11:32:26 -0800
Andrew Boyer <[email protected]> wrote:
Quoted 6 lines
Quoted 4 lines
When completion coalescing is turned on in the FW, there will be fewer CQE than Tx packets. Expose the stat through debug logging.
Signed-off-by Andrew Boyer <[email protected]>If you care about the stat it should be in xstats.
Thanks for looking. Moving all of our per-queue stats to xstats is on the todo list.
-Andrew
PATCH 2/13 net/ionic: increase max supported MTU to 9750 bytes
In reply to Andrew BoyerSome configurations want to use values this high internally. Allow them to do so without modifying the code.
--- drivers/net/ionic/ionic_dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.h +1 -1
@@ -14,7 +14,7 @@#define VLAN_TAG_SIZE 4#define IONIC_MIN_MTU RTE_ETHER_MIN_MTU -#define IONIC_MAX_MTU 9378 +#define IONIC_MAX_MTU 9750#define IONIC_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)#define IONIC_MAX_RING_DESC 32768
Signature · 1 line
2.17.1
PATCH 3/13 net/ionic: don't auto-enable Rx scatter-gather a second time
In reply to Andrew BoyerThe receive side will enable scatter-gather if required based on the mbuf size. If the client already enabled it in the config, it does not need to be enabled again. This reduces log output.
--- drivers/net/ionic/ionic_lif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_lif.c +2 -1
@@ -768,7 +768,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, max_mtu =rte_le_to_cpu_32 (lif->adapter->ident.lif.eth.max_mtu);/* If mbufs are too small to hold received packets, enable SG */ -if (max_mtu > hdr_seg_size) { +if (max_mtu > hdr_seg_size && + !(lif->features &IONIC_ETH_HW_RX_SG )) {IONIC_PRINT (NOTICE ,"Enabling RX_OFFLOAD_SCATTER" ); lif->eth_dev->data->dev_conf.rxmode.offloads |=RTE_ETH_RX_OFFLOAD_SCATTER ;
Signature · 1 line
2.17.1
PATCH 4/13 net/ionic: fix missing volatile type for cqe pointers
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
This memory may be changed by the hardware, so the volatile keyword is required for correctness.
--- drivers/net/ionic/ionic_rxtx.c | 4 ++-- drivers/net/ionic/ionic_rxtx_sg.c | 8 +++++--- drivers/net/ionic/ionic_rxtx_simple.c | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_rxtx.c +2 -2
@@ -755,7 +755,7 @@ ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {struct ionic_rx_qcq *rxq = rx_queue;struct ionic_qcq *qcq = &rxq->qcq; -struct ionic_rxq_comp *cq_desc; +volatile struct ionic_rxq_comp *cq_desc;uint16_t mask, head, tail, pos;bool done_color;
@@ -794,7 +794,7 @@ ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {struct ionic_tx_qcq *txq = tx_queue;struct ionic_qcq *qcq = &txq->qcq; -struct ionic_txq_comp *cq_desc; +volatile struct ionic_txq_comp *cq_desc;uint16_t mask, head, tail, pos, cq_pos;bool done_color;
drivers/net/ionic/ionic_rxtx_sg.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info;uint32_t i;
@@ -254,7 +255,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one_sg (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -440,7 +441,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
drivers/net/ionic/ionic_rxtx_simple.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info; cq_desc = &cq_desc_base[cq->tail_idx];
@@ -227,7 +228,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -361,7 +362,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
Signature · 1 line
2.17.1
Re: [PATCH 04/13] net/ionic: fix missing volatile type for cqe pointers
Quoted 10 lines · On Fri, 2 Feb 2024 11:32:29 -0800 Andrew Boyer <[email protected]> wrote:
From: Neel Patel <[email protected]>
This memory may be changed by the hardware, so the volatile keyword is required for correctness.
Fixes e86a6fcc7cf3 ("net/ionic: add optimized non-scattered Rx/Tx")Signed-off-by Andrew Boyer <[email protected]>Signed-off-by Neel Patel <[email protected]>
In general barriers are better than volatile. Volatile is a compiler not hardware construct really.
https://www.kernel.org/doc/html/latest/process/volatile-considered-harmful.html
Re: [PATCH 04/13] net/ionic: fix missing volatile type for cqe pointers
Quoted 18 lines · Stephen Hemminger
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 8 lines · On Fri, 2 Feb 2024 11:32:29 -0800 Andrew Boyer <[email protected]> wrote:
From: Neel Patel <[email protected]>
This memory may be changed by the hardware, so the volatile keyword is required for correctness.
Fixes e86a6fcc7cf3 ("net/ionic: add optimized non-scattered Rx/Tx")
Quoted 7 lines
Quoted 2 lines
Signed-off-by Andrew Boyer <[email protected]>Signed-off-by Neel Patel <[email protected]>In general barriers are better than volatile. Volatile is a compiler not hardware construct really.
https://www.kernel.org/doc/html/latest/process/volatile-considered-harmful.html
Thanks for looking. The goal here is to prevent inappropriate compiler optimization.
From the link you posted:
Quoted 1 line
Pointers to data structures in coherent memory which might be modified by I/O devices can, sometimes, legitimately be volatile. A ring buffer used by a network adapter, where that adapter changes pointers to indicate which descriptors have been processed, is an example of this type of situation.
Doesn't that sound like what we are doing?
Thanks,
Andrew
PATCH 5/13 net/ionic: replace non-standard type in structure definition
In reply to Andrew BoyerUse uint8_t instead of u_char. This simplifies the code.
--- drivers/net/ionic/ionic_dev_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev_pci.c +1 -1
@@ -38,7 +38,7 @@ ionic_pci_setup(struct ionic_adapter *adapter)struct ionic_dev *idev = &adapter->idev;struct rte_pci_device *bus_dev = adapter->bus_dev;uint32_t sig; -u_char *bar0_base; +uint8_t *bar0_base;unsigned int i;/* BAR0: dev_cmd and interrupts */
Signature · 1 line
2.17.1
PATCH 6/13 net/ionic: memcpy descriptors when using Q-in-CMB
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
They can be batched together this way, reducing the number of PCIe transactions. This improves transmit PPS by up to 50% in some configurations.
--- drivers/net/ionic/ionic_dev.c | 9 +++-- drivers/net/ionic/ionic_dev.h | 6 ++- drivers/net/ionic/ionic_lif.c | 26 +++++++++---- drivers/net/ionic/ionic_rxtx.h | 56 +++++++++++++++++++++++++++ drivers/net/ionic/ionic_rxtx_sg.c | 18 ++++----- drivers/net/ionic/ionic_rxtx_simple.c | 18 ++++----- 6 files changed, 101 insertions(+), 32 deletions(-)
drivers/net/ionic/ionic_dev.c +6 -3
@@ -369,17 +369,19 @@ ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs) q->index = index; q->num_descs = num_descs; q->size_mask = num_descs -1 ; - q->head_idx =0 ; - q->tail_idx =0 ; +ionic_q_reset (q);return 0 ; }void -ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa) +ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa) { q->base = base; q->base_pa = base_pa; + q->cmb_base = cmb_base; + q->cmb_base_pa = cmb_base_pa; }void
@@ -393,5 +395,6 @@ void ionic_q_reset(struct ionic_queue *q) { q->head_idx =0 ; + q->cmb_head_idx =0 ; q->tail_idx =0 ; }
drivers/net/ionic/ionic_dev.h +5 -1
@@ -145,11 +145,13 @@ struct ionic_queue {uint16_t num_descs;uint16_t num_segs;uint16_t head_idx; +uint16_t cmb_head_idx;uint16_t tail_idx;uint16_t size_mask;uint8_t type;uint8_t hw_type;void *base; +void *cmb_base;void *sg_base;struct ionic_doorbell __iomem *db;void **info;
@@ -158,6 +160,7 @@ struct ionic_queue {uint32_t hw_index;rte_iova_t base_pa;rte_iova_t sg_base_pa; +rte_iova_t cmb_base_pa; };#define IONIC_INTR_NONE (-1)
@@ -244,7 +247,8 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,int ionic_q_init (struct ionic_queue *q,uint32_t index,uint16_t num_descs);void ionic_q_reset (struct ionic_queue *q); -void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); +void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa);void ionic_q_sg_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); static inline uint16_t
drivers/net/ionic/ionic_lif.c +18 -8
@@ -572,10 +572,11 @@ ionic_qcq_alloc(struct ionic_lif *lif, {struct ionic_qcq *new;uint32_t q_size, cq_size, sg_size, total_size; -void *q_base, *cq_base, *sg_base; +void *q_base, *cmb_q_base, *cq_base, *sg_base;rte_iova_t q_base_pa =0 ;rte_iova_t cq_base_pa =0 ;rte_iova_t sg_base_pa =0 ; +rte_iova_t cmb_q_base_pa =0 ;size_t page_size =rte_mem_page_size ();int err;
@@ -666,19 +667,22 @@ ionic_qcq_alloc(struct ionic_lif *lif,IONIC_PRINT (ERR ,"Cannot reserve queue from NIC mem" );return -ENOMEM ; } - q_base = (void *) + cmb_q_base = (void *) ((uintptr_t )lif->adapter->bars.bar[2 ].vaddr + (uintptr_t )lif->adapter->cmb_offset);/* CMB PA is a relative address */ - q_base_pa = lif->adapter->cmb_offset; + cmb_q_base_pa = lif->adapter->cmb_offset; lif->adapter->cmb_offset += q_size; + }else { + cmb_q_base =NULL ; + cmb_q_base_pa =0 ; }IONIC_PRINT (DEBUG ,"Q-Base-PA = %#jx CQ-Base-PA = %#jx " "SG-base-PA = %#jx" , q_base_pa, cq_base_pa, sg_base_pa); -ionic_q_map (&new->q, q_base, q_base_pa); +ionic_q_map (&new->q, q_base, q_base_pa, cmb_q_base, cmb_q_base_pa);ionic_cq_map (&new->cq, cq_base, cq_base_pa); *qcq = new;
@@ -1583,7 +1587,6 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1592,8 +1595,12 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)if (txq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (txq->flags &IONIC_QCQ_F_CMB ) +if (txq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);
@@ -1638,7 +1645,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1647,8 +1653,12 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)if (rxq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (rxq->flags &IONIC_QCQ_F_CMB ) +if (rxq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);
drivers/net/ionic/ionic_rxtx.h +56 -0
60 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx_sg.c +8 -10
@@ -166,6 +166,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -173,9 +174,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, q->head_idx));if (nb_pkts) {
@@ -196,8 +195,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, next_idx));if (nb_tx +1 < nb_pkts) {
@@ -222,7 +220,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -458,8 +456,7 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one_sg (rxq, cq_desc, rx_svc);
@@ -478,7 +475,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -542,7 +540,7 @@ ionic_rx_fill_sg(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
drivers/net/ionic/ionic_rxtx_simple.c +8 -10
@@ -139,6 +139,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -146,9 +147,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (&q->info[q->head_idx]);if (nb_pkts) {
@@ -169,8 +168,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (&q->info[next_idx]);if (nb_tx +1 < nb_pkts) {
@@ -195,7 +193,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -379,8 +377,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one (rxq, cq_desc, rx_svc);
@@ -399,7 +396,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -463,7 +461,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
Signature · 1 line
2.17.1
PATCH 7/13 net/ionic: fix RSS query routine
In reply to Andrew BoyerFrom: Akshay Dorwat <[email protected]>
The routine that copies out the RSS config can't use memcpy() because 'reta_conf->reta' is an array of uint16_t while 'lif->rss_ind_tbl' is an array of uint8_t. Instead, copy the values individually.
--- drivers/net/ionic/ionic_ethdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_ethdev.c +5 -4
@@ -561,7 +561,7 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev,struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev);struct ionic_adapter *adapter = lif->adapter;struct ionic_identity *ident = &adapter->ident; -int i, num; +int i, j, num;uint16_t tbl_sz =rte_le_to_cpu_16 (ident->lif.eth.rss_ind_tbl_sz);IONIC_PRINT_CALL ();
@@ -582,9 +582,10 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev, num = reta_size /RTE_ETH_RETA_GROUP_SIZE ;for (i =0 ; i < num; i++) { -memcpy (reta_conf->reta, - &lif->rss_ind_tbl[i *RTE_ETH_RETA_GROUP_SIZE ], -RTE_ETH_RETA_GROUP_SIZE ); +for (j =0 ; j <RTE_ETH_RETA_GROUP_SIZE ; j++) { + reta_conf->reta[j] = + lif->rss_ind_tbl[(i *RTE_ETH_RETA_GROUP_SIZE ) + j]; + } reta_conf++; }
Signature · 1 line
2.17.1
PATCH 8/13 net/ionic: report 1G and 200G link speeds when applicable
In reply to Andrew BoyerFrom: Vamsi Krishna Atluri <[email protected]>
The hardware supports these speeds, so we should report them correctly.
--- drivers/net/ionic/ionic_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ionic/ionic_ethdev.c +6 -0
@@ -285,6 +285,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, link.link_status =RTE_ETH_LINK_UP ; link.link_duplex =RTE_ETH_LINK_FULL_DUPLEX ;switch (adapter->link_speed) { +case 1000 : + link.link_speed =RTE_ETH_SPEED_NUM_1G ; +break ;case 10000 : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ;
@@ -300,6 +303,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev,case 100000 : link.link_speed =RTE_ETH_SPEED_NUM_100G ;break ; +case 200000 : + link.link_speed =RTE_ETH_SPEED_NUM_200G ; +break ;default : link.link_speed =RTE_ETH_SPEED_NUM_NONE ;break ;
Signature · 1 line
2.17.1
PATCH 9/13 net/ionic: add flexible firmware xstat counters
In reply to Andrew BoyerFrom: Brad Larson <[email protected]>
Assign 32 counters for flexible firmware events. These can be used as per-port or per-queue counters in certain firmware configurations. They are displayed as fw_flex_eventX in xstats.
--- drivers/net/ionic/ionic_ethdev.c | 33 +++++++++++++++ drivers/net/ionic/ionic_if.h | 70 ++++++++++++++++---------------- 2 files changed, 68 insertions(+), 35 deletions(-)
drivers/net/ionic/ionic_ethdev.c +33 -0
@@ -196,6 +196,39 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = { tx_desc_fetch_error)}, {"tx_desc_data_error" , offsetof(struct ionic_lif_stats , tx_desc_data_error)}, +/* Flexible firmware events */ + {"fw_flex_event1", offsetof(struct ionic_lif_stats, flex1)}, + {"fw_flex_event2", offsetof(struct ionic_lif_stats, flex2)}, + {"fw_flex_event3", offsetof(struct ionic_lif_stats, flex3)}, + {"fw_flex_event4", offsetof(struct ionic_lif_stats, flex4)}, + {"fw_flex_event5", offsetof(struct ionic_lif_stats, flex5)}, + {"fw_flex_event6", offsetof(struct ionic_lif_stats, flex6)}, + {"fw_flex_event7", offsetof(struct ionic_lif_stats, flex7)}, + {"fw_flex_event8", offsetof(struct ionic_lif_stats, flex8)}, + {"fw_flex_event9", offsetof(struct ionic_lif_stats, flex9)}, + {"fw_flex_event10", offsetof(struct ionic_lif_stats, flex10)}, + {"fw_flex_event11", offsetof(struct ionic_lif_stats, flex11)}, + {"fw_flex_event12", offsetof(struct ionic_lif_stats, flex12)}, + {"fw_flex_event13", offsetof(struct ionic_lif_stats, flex13)}, + {"fw_flex_event14", offsetof(struct ionic_lif_stats, flex14)}, + {"fw_flex_event15", offsetof(struct ionic_lif_stats, flex15)}, + {"fw_flex_event16", offsetof(struct ionic_lif_stats, flex16)}, + {"fw_flex_event17", offsetof(struct ionic_lif_stats, flex17)}, + {"fw_flex_event18", offsetof(struct ionic_lif_stats, flex18)}, + {"fw_flex_event19", offsetof(struct ionic_lif_stats, flex19)}, + {"fw_flex_event20", offsetof(struct ionic_lif_stats, flex20)}, + {"fw_flex_event21", offsetof(struct ionic_lif_stats, flex21)}, + {"fw_flex_event22", offsetof(struct ionic_lif_stats, flex22)}, + {"fw_flex_event23", offsetof(struct ionic_lif_stats, flex23)}, + {"fw_flex_event24", offsetof(struct ionic_lif_stats, flex24)}, + {"fw_flex_event25", offsetof(struct ionic_lif_stats, flex25)}, + {"fw_flex_event26", offsetof(struct ionic_lif_stats, flex26)}, + {"fw_flex_event27", offsetof(struct ionic_lif_stats, flex27)}, + {"fw_flex_event28", offsetof(struct ionic_lif_stats, flex28)}, + {"fw_flex_event29", offsetof(struct ionic_lif_stats, flex29)}, + {"fw_flex_event30", offsetof(struct ionic_lif_stats, flex30)}, + {"fw_flex_event31", offsetof(struct ionic_lif_stats, flex31)}, + {"fw_flex_event32", offsetof(struct ionic_lif_stats, flex32)}, };#define IONIC_NB_HW_STATS RTE_DIM(rte_ionic_xstats_strings)
drivers/net/ionic/ionic_if.h +35 -35
76 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 10/13 net/ionic: fix device close sequence to avoid crash
In reply to Andrew BoyerThe close routine should release all resources, but not call rte_eth_dev_destroy(). As written this code will call rte_eth_dev_release_port() twice and segfault.
Instead, move rte_eth_dev_destroy() to the remove routine. eth_ionic_dev_uninit() will call close if necessary.
--- drivers/net/ionic/ionic_ethdev.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_ethdev.c +15 -15
@@ -1009,19 +1009,21 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)ionic_lif_stop (lif); -ionic_lif_free_queues (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit); -ionic_port_reset (adapter);ionic_reset (adapter); + +ionic_lif_free_queues (lif); +ionic_lif_deinit (lif); +ionic_lif_free (lif);/* Does not free LIF object */ +if (adapter->intf->unmap_bars) (*adapter->intf->unmap_bars)(adapter); + lif->adapter =NULL ;rte_free (adapter);return 0 ;
@@ -1098,21 +1100,18 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)static int eth_ionic_dev_uninit (struct rte_eth_dev *eth_dev) { -struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev); -struct ionic_adapter *adapter = lif->adapter; -IONIC_PRINT_CALL ();if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; - adapter->lif =NULL ; - -ionic_lif_deinit (lif); -ionic_lif_free (lif); +if (eth_dev->state !=RTE_ETH_DEV_UNUSED ) +ionic_dev_close (eth_dev); -if (!(lif->state &IONIC_LIF_F_FW_RESET )) -ionic_lif_reset (lif); + eth_dev->dev_ops =NULL ; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + eth_dev->tx_pkt_prepare =NULL ;return 0 ; }
@@ -1267,17 +1266,18 @@ eth_ionic_dev_remove(struct rte_device *rte_dev) {char name[RTE_ETH_NAME_MAX_LEN ];struct rte_eth_dev *eth_dev; +int ret =0 ;/* Adapter lookup is using the eth_dev name */ snprintf (name,sizeof (name),"%s_lif" , rte_dev->name); eth_dev =rte_eth_dev_allocated (name);if (eth_dev) -ionic_dev_close (eth_dev); + ret =rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit);else IONIC_PRINT (DEBUG ,"Cannot find device %s" , rte_dev->name); -return 0 ; +return ret; }RTE_LOG_REGISTER_DEFAULT (ionic_logtype,NOTICE );
Signature · 1 line
2.17.1
PATCH 11/13 net/ionic: optimize device close operation
In reply to Andrew BoyerUse a single device reset command to speed up dev_close(). The LIF stop and port reset commands are not needed.
This reduces the outage window when restarting the process by about 2ms plus another 1ms per queue.
--- drivers/net/ionic/ionic_ethdev.c | 3 --- drivers/net/ionic/ionic_lif.c | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-)
drivers/net/ionic/ionic_ethdev.c +0 -3
@@ -1007,13 +1007,10 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; -ionic_lif_stop (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -ionic_port_reset (adapter);ionic_reset (adapter);ionic_lif_free_queues (lif);
drivers/net/ionic/ionic_lif.c +1 -7
@@ -1231,13 +1231,7 @@ ionic_lif_rss_setup(struct ionic_lif *lif)static void ionic_lif_rss_teardown (struct ionic_lif *lif) { -if (!lif->rss_ind_tbl) -return ; - -if (lif->rss_ind_tbl_z) { -/* Disable RSS on the NIC */ -ionic_lif_rss_config (lif,0x0 ,NULL ,NULL ); - +if (lif->rss_ind_tbl) { lif->rss_ind_tbl =NULL ; lif->rss_ind_tbl_pa =0 ;rte_memzone_free (lif->rss_ind_tbl_z);
Signature · 1 line
2.17.1
PATCH 12/13 net/ionic: optimize device stop operation
In reply to Andrew BoyerSplit the queue_stop operation into first-half and second-half helpers. Move the command context from the stack into each Rx/Tx queue struct. Expose some needed adminq interfaces.
This allows us to batch up the queue commands during dev_stop(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic.h | 3 ++ drivers/net/ionic/ionic_lif.c | 81 ++++++++++++++++++++++++---------- drivers/net/ionic/ionic_lif.h | 12 +++-- drivers/net/ionic/ionic_main.c | 17 ++++++- drivers/net/ionic/ionic_rxtx.c | 78 +++++++++++++++++++------------- drivers/net/ionic/ionic_rxtx.h | 14 +++++- 6 files changed, 143 insertions(+), 62 deletions(-)
drivers/net/ionic/ionic.h +3 -0
@@ -83,7 +83,10 @@ struct ionic_admin_ctx {union ionic_adminq_comp comp; }; +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx);int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +int ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +uint16_t ionic_adminq_space_avail (struct ionic_lif *lif);int ionic_dev_cmd_wait_check (struct ionic_dev *idev,unsigned long max_wait);int ionic_setup (struct ionic_adapter *adapter);
drivers/net/ionic/ionic_lif.c +57 -24
120 lines not on this page · raw message
drivers/net/ionic/ionic_lif.h +9 -3
@@ -10,7 +10,7 @@#include <rte_ethdev.h> #include <rte_ether.h> -#include "ionic_osdep.h" +#include "ionic.h" #include "ionic_dev.h" #include "ionic_rx_filter.h"
@@ -99,6 +99,8 @@ struct ionic_rx_qcq {/* cacheline4+ */ struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned; + +struct ionic_admin_ctx admin_ctx; };struct ionic_tx_qcq {
@@ -112,6 +114,8 @@ struct ionic_tx_qcq {uint16_t flags;struct ionic_tx_stats stats; + +struct ionic_admin_ctx admin_ctx; };#define IONIC_Q_TO_QCQ (_q) container_of(_q, struct ionic_qcq, q)
@@ -225,10 +229,12 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,void ionic_qcq_free (struct ionic_qcq *qcq);int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); -void ionic_lif_rxq_deinit (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq);int ionic_lif_txq_init (struct ionic_tx_qcq *txq); -void ionic_lif_txq_deinit (struct ionic_tx_qcq *txq); +void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);int ionic_lif_rss_config (struct ionic_lif *lif,const uint16_t types,const uint8_t *key,const uint32_t *indir);
drivers/net/ionic/ionic_main.c +15 -2
@@ -180,6 +180,12 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,return true; } +uint16_t +ionic_adminq_space_avail (struct ionic_lif *lif) +{ +return ionic_q_space_avail (&lif->adminqcq->qcq.q); +} +/** ionic_adminq_post - Post an admin command. * @lif: Handle to lif. * @cmd_ctx: Api admin command context.
@@ -191,7 +197,7 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,* * Return: zero or negative error status. */ -static int +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) {struct ionic_queue *q = &lif->adminqcq->qcq.q;
@@ -279,7 +285,6 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) { -bool done;int err; IONIC_PRINT(DEBUG, "Sending %s (%d) via the admin queue",
@@ -292,6 +297,14 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)return err; } +return ionic_adminq_wait (lif, ctx); +} + +int +ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) +{ +bool done; + done =ionic_adminq_wait_for_completion (lif, ctx,IONIC_DEVCMD_TIMEOUT );
drivers/net/ionic/ionic_rxtx.c +47 -31
111 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +12 -2
@@ -37,14 +37,24 @@ int ionic_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);void ionic_dev_rx_queue_release (struct rte_eth_dev *dev,uint16_t qid);int ionic_dev_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); -int ionic_dev_rx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t rx_queue_id); +int ionic_dev_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ionic_dev_tx_queue_setup (struct rte_eth_dev *dev,uint16_t tx_queue_id,uint16_t nb_desc,uint32_t socket_id,const struct rte_eth_txconf *tx_conf);void ionic_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); -int ionic_dev_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); + +/* Helpers for optimized dev_stop() */ +void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_rx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_tx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +void ionic_dev_tx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id);void ionic_rxq_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_rxq_info *qinfo);
Signature · 1 line
2.17.1
PATCH 13/13 net/ionic: optimize device start operation
In reply to Andrew BoyerSplit the queue_start operation into first-half and second-half helpers.
This allows us to batch up the queue commands during dev_start(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic_lif.c | 178 +++++++++++++++++++++------------ drivers/net/ionic/ionic_lif.h | 6 +- drivers/net/ionic/ionic_rxtx.c | 81 ++++++++++++--- drivers/net/ionic/ionic_rxtx.h | 10 ++ 4 files changed, 194 insertions(+), 81 deletions(-)
drivers/net/ionic/ionic_lif.c +113 -65
@@ -1598,52 +1598,61 @@ ionic_lif_set_features(struct ionic_lif *lif) }int -ionic_lif_txq_init (struct ionic_tx_qcq *txq) +ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq) {struct ionic_qcq *qcq = &txq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { - .pending_work = true, - .cmd.q_init = { - .opcode =IONIC_CMD_Q_INIT , - .type = q->type, - .ver = lif->qtype_info[q->type].version, - .index =rte_cpu_to_le_32 (q->index), - .flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ), - .intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ), - .ring_size =rte_log2_u32 (q->num_descs), - .cq_ring_base =rte_cpu_to_le_64 (cq->base_pa), - .sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa), - }, - }; +struct ionic_admin_ctx *ctx = &txq->admin_ctx;int err; +memset (ctx,0 ,sizeof (*ctx)); + ctx->pending_work = true; + ctx->cmd.q_init.opcode =IONIC_CMD_Q_INIT ; + ctx->cmd.q_init.type = q->type; + ctx->cmd.q_init.ver = lif->qtype_info[q->type].version; + ctx->cmd.q_init.index =rte_cpu_to_le_32 (q->index); + ctx->cmd.q_init.flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ); + ctx->cmd.q_init.intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ); + ctx->cmd.q_init.ring_size =rte_log2_u32 (q->num_descs); + ctx->cmd.q_init.cq_ring_base =rte_cpu_to_le_64 (cq->base_pa); + ctx->cmd.q_init.sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa); +if (txq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (txq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"txq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_txq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_txq_init_done (struct ionic_tx_qcq *txq) +{ +struct ionic_lif *lif = txq->qcq.lif; +struct ionic_queue *q = &txq->qcq.q; +struct ionic_admin_ctx *ctx = &txq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q);IONIC_PRINT (DEBUG ,"txq->hw_type %d" , q->hw_type);
@@ -1651,57 +1660,64 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)IONIC_PRINT (DEBUG ,"txq->db %p" , q->db); txq->flags |=IONIC_QCQ_F_INITED ; - -return 0 ; }int -ionic_lif_rxq_init (struct ionic_rx_qcq *rxq) +ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq) {struct ionic_qcq *qcq = &rxq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { - .pending_work = true, - .cmd.q_init = { - .opcode =IONIC_CMD_Q_INIT , - .type = q->type, - .ver = lif->qtype_info[q->type].version, - .index =rte_cpu_to_le_32 (q->index), - .flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ), - .intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ), - .ring_size =rte_log2_u32 (q->num_descs), - .cq_ring_base =rte_cpu_to_le_64 (cq->base_pa), - .sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa), - }, - }; +struct ionic_admin_ctx *ctx = &rxq->admin_ctx;int err; +memset (ctx,0 ,sizeof (*ctx)); + ctx->pending_work = true; + ctx->cmd.q_init.opcode =IONIC_CMD_Q_INIT ; + ctx->cmd.q_init.type = q->type; + ctx->cmd.q_init.ver = lif->qtype_info[q->type].version; + ctx->cmd.q_init.index =rte_cpu_to_le_32 (q->index); + ctx->cmd.q_init.flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ); + ctx->cmd.q_init.intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ); + ctx->cmd.q_init.ring_size =rte_log2_u32 (q->num_descs); + ctx->cmd.q_init.cq_ring_base =rte_cpu_to_le_64 (cq->base_pa); + ctx->cmd.q_init.sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa); +if (rxq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (rxq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"rxq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_rxq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq) +{ +struct ionic_lif *lif = rxq->qcq.lif; +struct ionic_queue *q = &rxq->qcq.q; +struct ionic_admin_ctx *ctx = &rxq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q); rxq->flags |=IONIC_QCQ_F_INITED ;
@@ -1709,8 +1725,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)IONIC_PRINT (DEBUG ,"rxq->hw_type %d" , q->hw_type);IONIC_PRINT (DEBUG ,"rxq->hw_index %d" , q->hw_index);IONIC_PRINT (DEBUG ,"rxq->db %p" , q->db); - -return 0 ; } static int
@@ -1959,9 +1973,11 @@ ionic_lif_configure(struct ionic_lif *lif)int ionic_lif_start (struct ionic_lif *lif) { +struct rte_eth_dev *dev = lif->eth_dev;uint32_t rx_mode; -uint32_t i; +uint32_t i, j, chunk;int err; +bool fatal = false; err =ionic_lif_rss_setup (lif);if (err)
@@ -1982,25 +1998,57 @@ ionic_lif_start(struct ionic_lif *lif)"on port %u" , lif->nrxqcqs, lif->ntxqcqs, lif->port_id); -for (i =0 ; i < lif->nrxqcqs; i++) { -struct ionic_rx_qcq *rxq = lif->rxqcqs[i]; -if (!(rxq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_rx_queue_start (lif->eth_dev, i); + chunk =ionic_adminq_space_avail (lif); + +for (i =0 ; i < lif->nrxqcqs; i += chunk) { +if (lif->rxqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Rx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { + err =ionic_dev_rx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_rx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ; -for (i =0 ; i < lif->ntxqcqs; i++) { -struct ionic_tx_qcq *txq = lif->txqcqs[i]; -if (!(txq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_tx_queue_start (lif->eth_dev, i); +for (i =0 ; i < lif->ntxqcqs; i += chunk) { +if (lif->txqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Tx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { + err =ionic_dev_tx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_tx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ;/* Carrier ON here */ lif->state |=IONIC_LIF_F_UP ;
drivers/net/ionic/ionic_lif.h +4 -2
@@ -228,11 +228,13 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, struct ionic_tx_qcq **qcq_out);void ionic_qcq_free (struct ionic_qcq *qcq); -int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); +int ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq); -int ionic_lif_txq_init (struct ionic_tx_qcq *txq); +int ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_init_done (struct ionic_tx_qcq *txq);void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq);void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);
drivers/net/ionic/ionic_rxtx.c +67 -14
126 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +10 -0
@@ -46,6 +46,16 @@ void ionic_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +/* Helpers for optimized dev_start() */ +int ionic_dev_rx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_rx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_tx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +int ionic_dev_tx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +/* Helpers for optimized dev_stop() */ void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev,uint16_t rx_queue_id);
Signature · 1 line
2.17.1
Re: [PATCH 13/13] net/ionic: optimize device start operation
drivers/net/ionic/ionic_lif.c ionic_lif_set_features(struct ionic_lif *lif) · line 1621
Quoted 12 lines · On Fri, 2 Feb 2024 11:32:38 -0800 Andrew Boyer <[email protected]> wrote:
drivers/net/ionic/ionic_lif.c +12
-0+memset (ctx,0 ,sizeof (*ctx)); + ctx->pending_work = true; + ctx->cmd.q_init.opcode =IONIC_CMD_Q_INIT ; + ctx->cmd.q_init.type = q->type; + ctx->cmd.q_init.ver = lif->qtype_info[q->type].version; + ctx->cmd.q_init.index =rte_cpu_to_le_32 (q->index); + ctx->cmd.q_init.flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ); + ctx->cmd.q_init.intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ); + ctx->cmd.q_init.ring_size =rte_log2_u32 (q->num_descs); + ctx->cmd.q_init.cq_ring_base =rte_cpu_to_le_64 (cq->base_pa); + ctx->cmd.q_init.sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa); +
memset followed by assignment is technically slower than structure initialization because it requires two writes to the data. But the optimizer may in some cases figure that out.
Re: [PATCH 13/13] net/ionic: optimize device start operation
Quoted 23 lines · Stephen Hemminger
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
drivers/net/ionic/ionic_lif.c ionic_lif_set_features(struct ionic_lif *lif) · line 1621
Quoted 12 lines · On Fri, 2 Feb 2024 11:32:38 -0800 Andrew Boyer <[email protected]> wrote:
drivers/net/ionic/ionic_lif.c +12
-0+memset (ctx,0 ,sizeof (*ctx)); + ctx->pending_work = true; + ctx->cmd.q_init.opcode =IONIC_CMD_Q_INIT ; + ctx->cmd.q_init.type = q->type; + ctx->cmd.q_init.ver = lif->qtype_info[q->type].version; + ctx->cmd.q_init.index =rte_cpu_to_le_32 (q->index); + ctx->cmd.q_init.flags =rte_cpu_to_le_16 (IONIC_QINIT_F_ENA ); + ctx->cmd.q_init.intr_index =rte_cpu_to_le_16 (IONIC_INTR_NONE ); + ctx->cmd.q_init.ring_size =rte_log2_u32 (q->num_descs); + ctx->cmd.q_init.cq_ring_base =rte_cpu_to_le_64 (cq->base_pa); + ctx->cmd.q_init.sg_ring_base =rte_cpu_to_le_64 (q->sg_base_pa); +
Quoted 3 lines
memset followed by assignment is technically slower than structure initialization because it requires two writes to the data. But the optimizer may in some cases figure that out.
Thanks for looking. Since DPDK requires C11 now, and I see other users of compound literals in lib/, I'll respin this to use that instead. (The internet says unset fields are implicitly initialized to zero, hopefully that's correct.)
It makes the diff a lot cleaner, too.
Thanks,
Andrew
Recheck-request: iol-intel-Functional
I saw this failed in CI testing for the DTS MTU_Update test but suspect it was an infra failure as it happened across 3 distinct patches in a short span of time. So, triggering a retest.
On Feb 5, 2024, at 1:44 PM, Patrick Robb <[email protected]> wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Recheck-request: iol-intel-Functional
I saw this failed in CI testing for the DTS MTU_Update test but suspect it was an infra failure as it happened across 3 distinct patches in a short span of time. So, triggering a retest.
I thought I saw another patchset hit the same failure that day.
-Andrew
v2 cover net/ionic: miscellaneous fixes and improvements
In reply to Andrew BoyerThis patchset provides miscellaneous fixes and improvements for the net/ionic driver used by AMD Pensando devices.
V2:
- Update device stop and device start patches to use compound literals as suggested by review.
Akshay Dorwat (1):
net/ionic: fix RSS query routine
Andrew Boyer (8):
net/ionic: add stat for completion queue entries processed net/ionic: increase max supported MTU to 9750 bytes net/ionic: don't auto-enable Rx scatter-gather a second time net/ionic: replace non-standard type in structure definition net/ionic: fix device close sequence to avoid crash net/ionic: optimize device close operation net/ionic: optimize device stop operation net/ionic: optimize device start operation
Brad Larson (1):
net/ionic: add flexible firmware xstat counters
Neel Patel (2):
net/ionic: fix missing volatile type for cqe pointers net/ionic: memcpy descriptors when using Q-in-CMB
Vamsi Krishna Atluri (1):
net/ionic: report 1G and 200G link speeds when applicable
drivers/net/ionic/ionic.h | 3 + drivers/net/ionic/ionic_dev.c | 9 +- drivers/net/ionic/ionic_dev.h | 8 +- drivers/net/ionic/ionic_dev_pci.c | 2 +- drivers/net/ionic/ionic_ethdev.c | 81 ++++++--- drivers/net/ionic/ionic_if.h | 70 ++++---- drivers/net/ionic/ionic_lif.c | 233 ++++++++++++++++++-------- drivers/net/ionic/ionic_lif.h | 19 ++- drivers/net/ionic/ionic_main.c | 17 +- drivers/net/ionic/ionic_rxtx.c | 160 +++++++++++++----- drivers/net/ionic/ionic_rxtx.h | 80 ++++++++- drivers/net/ionic/ionic_rxtx_sg.c | 28 ++-- drivers/net/ionic/ionic_rxtx_simple.c | 28 ++-- 13 files changed, 527 insertions(+), 211 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/13 net/ionic: add stat for completion queue entries processed
In reply to Andrew BoyerWhen completion coalescing is turned on in the FW, there will be fewer CQE than Tx packets. Expose the stat through debug logging.
--- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 3 +++ drivers/net/ionic/ionic_rxtx_sg.c | 2 ++ drivers/net/ionic/ionic_rxtx_simple.c | 2 ++ 4 files changed, 8 insertions(+)
drivers/net/ionic/ionic_lif.h +1 -0
@@ -32,6 +32,7 @@struct ionic_tx_stats {uint64_t packets;uint64_t bytes; +uint64_t comps;uint64_t drop;uint64_t stop;uint64_t no_csum;
drivers/net/ionic/ionic_rxtx.c +3 -0
@@ -117,6 +117,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) stats = &txq->stats;IONIC_PRINT (DEBUG ,"TX queue %u pkts %ju tso %ju" , txq->qcq.q.index, stats->packets, stats->tso); +IONIC_PRINT (DEBUG ,"TX queue %u comps %ju (%ju per)" , + txq->qcq.q.index, stats->comps, + stats->comps ? stats->packets / stats->comps :0 );return 0 ; }
drivers/net/ionic/ionic_rxtx_sg.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -72,6 +73,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
drivers/net/ionic/ionic_rxtx_simple.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -67,6 +68,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
Signature · 1 line
2.17.1
PATCH v2 2/13 net/ionic: increase max supported MTU to 9750 bytes
In reply to Andrew BoyerSome configurations want to use values this high internally. Allow them to do so without modifying the code.
--- drivers/net/ionic/ionic_dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.h +1 -1
@@ -14,7 +14,7 @@#define VLAN_TAG_SIZE 4#define IONIC_MIN_MTU RTE_ETHER_MIN_MTU -#define IONIC_MAX_MTU 9378 +#define IONIC_MAX_MTU 9750#define IONIC_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)#define IONIC_MAX_RING_DESC 32768
Signature · 1 line
2.17.1
PATCH v2 3/13 net/ionic: don't auto-enable Rx scatter-gather a second time
In reply to Andrew BoyerThe receive side will enable scatter-gather if required based on the mbuf size. If the client already enabled it in the config, it does not need to be enabled again. This reduces log output.
--- drivers/net/ionic/ionic_lif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_lif.c +2 -1
@@ -768,7 +768,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, max_mtu =rte_le_to_cpu_32 (lif->adapter->ident.lif.eth.max_mtu);/* If mbufs are too small to hold received packets, enable SG */ -if (max_mtu > hdr_seg_size) { +if (max_mtu > hdr_seg_size && + !(lif->features &IONIC_ETH_HW_RX_SG )) {IONIC_PRINT (NOTICE ,"Enabling RX_OFFLOAD_SCATTER" ); lif->eth_dev->data->dev_conf.rxmode.offloads |=RTE_ETH_RX_OFFLOAD_SCATTER ;
Signature · 1 line
2.17.1
PATCH v2 4/13 net/ionic: fix missing volatile type for cqe pointers
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
This memory may be changed by the hardware, so the volatile keyword is required for correctness.
--- drivers/net/ionic/ionic_rxtx.c | 4 ++-- drivers/net/ionic/ionic_rxtx_sg.c | 8 +++++--- drivers/net/ionic/ionic_rxtx_simple.c | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_rxtx.c +2 -2
@@ -755,7 +755,7 @@ ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {struct ionic_rx_qcq *rxq = rx_queue;struct ionic_qcq *qcq = &rxq->qcq; -struct ionic_rxq_comp *cq_desc; +volatile struct ionic_rxq_comp *cq_desc;uint16_t mask, head, tail, pos;bool done_color;
@@ -794,7 +794,7 @@ ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {struct ionic_tx_qcq *txq = tx_queue;struct ionic_qcq *qcq = &txq->qcq; -struct ionic_txq_comp *cq_desc; +volatile struct ionic_txq_comp *cq_desc;uint16_t mask, head, tail, pos, cq_pos;bool done_color;
drivers/net/ionic/ionic_rxtx_sg.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info;uint32_t i;
@@ -254,7 +255,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one_sg (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -440,7 +441,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
drivers/net/ionic/ionic_rxtx_simple.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info; cq_desc = &cq_desc_base[cq->tail_idx];
@@ -227,7 +228,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -361,7 +362,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
Signature · 1 line
2.17.1
PATCH v2 5/13 net/ionic: replace non-standard type in structure definition
In reply to Andrew BoyerUse uint8_t instead of u_char. This simplifies the code.
--- drivers/net/ionic/ionic_dev_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev_pci.c +1 -1
@@ -38,7 +38,7 @@ ionic_pci_setup(struct ionic_adapter *adapter)struct ionic_dev *idev = &adapter->idev;struct rte_pci_device *bus_dev = adapter->bus_dev;uint32_t sig; -u_char *bar0_base; +uint8_t *bar0_base;unsigned int i;/* BAR0: dev_cmd and interrupts */
Signature · 1 line
2.17.1
PATCH v2 6/13 net/ionic: memcpy descriptors when using Q-in-CMB
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
They can be batched together this way, reducing the number of PCIe transactions. This improves transmit PPS by up to 50% in some configurations.
--- drivers/net/ionic/ionic_dev.c | 9 +++-- drivers/net/ionic/ionic_dev.h | 6 ++- drivers/net/ionic/ionic_lif.c | 26 +++++++++---- drivers/net/ionic/ionic_rxtx.h | 56 +++++++++++++++++++++++++++ drivers/net/ionic/ionic_rxtx_sg.c | 18 ++++----- drivers/net/ionic/ionic_rxtx_simple.c | 18 ++++----- 6 files changed, 101 insertions(+), 32 deletions(-)
drivers/net/ionic/ionic_dev.c +6 -3
@@ -369,17 +369,19 @@ ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs) q->index = index; q->num_descs = num_descs; q->size_mask = num_descs -1 ; - q->head_idx =0 ; - q->tail_idx =0 ; +ionic_q_reset (q);return 0 ; }void -ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa) +ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa) { q->base = base; q->base_pa = base_pa; + q->cmb_base = cmb_base; + q->cmb_base_pa = cmb_base_pa; }void
@@ -393,5 +395,6 @@ void ionic_q_reset(struct ionic_queue *q) { q->head_idx =0 ; + q->cmb_head_idx =0 ; q->tail_idx =0 ; }
drivers/net/ionic/ionic_dev.h +5 -1
@@ -145,11 +145,13 @@ struct ionic_queue {uint16_t num_descs;uint16_t num_segs;uint16_t head_idx; +uint16_t cmb_head_idx;uint16_t tail_idx;uint16_t size_mask;uint8_t type;uint8_t hw_type;void *base; +void *cmb_base;void *sg_base;struct ionic_doorbell __iomem *db;void **info;
@@ -158,6 +160,7 @@ struct ionic_queue {uint32_t hw_index;rte_iova_t base_pa;rte_iova_t sg_base_pa; +rte_iova_t cmb_base_pa; };#define IONIC_INTR_NONE (-1)
@@ -244,7 +247,8 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,int ionic_q_init (struct ionic_queue *q,uint32_t index,uint16_t num_descs);void ionic_q_reset (struct ionic_queue *q); -void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); +void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa);void ionic_q_sg_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); static inline uint16_t
drivers/net/ionic/ionic_lif.c +18 -8
@@ -572,10 +572,11 @@ ionic_qcq_alloc(struct ionic_lif *lif, {struct ionic_qcq *new;uint32_t q_size, cq_size, sg_size, total_size; -void *q_base, *cq_base, *sg_base; +void *q_base, *cmb_q_base, *cq_base, *sg_base;rte_iova_t q_base_pa =0 ;rte_iova_t cq_base_pa =0 ;rte_iova_t sg_base_pa =0 ; +rte_iova_t cmb_q_base_pa =0 ;size_t page_size =rte_mem_page_size ();int err;
@@ -666,19 +667,22 @@ ionic_qcq_alloc(struct ionic_lif *lif,IONIC_PRINT (ERR ,"Cannot reserve queue from NIC mem" );return -ENOMEM ; } - q_base = (void *) + cmb_q_base = (void *) ((uintptr_t )lif->adapter->bars.bar[2 ].vaddr + (uintptr_t )lif->adapter->cmb_offset);/* CMB PA is a relative address */ - q_base_pa = lif->adapter->cmb_offset; + cmb_q_base_pa = lif->adapter->cmb_offset; lif->adapter->cmb_offset += q_size; + }else { + cmb_q_base =NULL ; + cmb_q_base_pa =0 ; }IONIC_PRINT (DEBUG ,"Q-Base-PA = %#jx CQ-Base-PA = %#jx " "SG-base-PA = %#jx" , q_base_pa, cq_base_pa, sg_base_pa); -ionic_q_map (&new->q, q_base, q_base_pa); +ionic_q_map (&new->q, q_base, q_base_pa, cmb_q_base, cmb_q_base_pa);ionic_cq_map (&new->cq, cq_base, cq_base_pa); *qcq = new;
@@ -1583,7 +1587,6 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1592,8 +1595,12 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)if (txq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (txq->flags &IONIC_QCQ_F_CMB ) +if (txq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);
@@ -1638,7 +1645,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1647,8 +1653,12 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)if (rxq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (rxq->flags &IONIC_QCQ_F_CMB ) +if (rxq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);
drivers/net/ionic/ionic_rxtx.h +56 -0
60 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx_sg.c +8 -10
@@ -166,6 +166,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -173,9 +174,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, q->head_idx));if (nb_pkts) {
@@ -196,8 +195,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, next_idx));if (nb_tx +1 < nb_pkts) {
@@ -222,7 +220,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -458,8 +456,7 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one_sg (rxq, cq_desc, rx_svc);
@@ -478,7 +475,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -542,7 +540,7 @@ ionic_rx_fill_sg(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
drivers/net/ionic/ionic_rxtx_simple.c +8 -10
@@ -139,6 +139,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -146,9 +147,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (&q->info[q->head_idx]);if (nb_pkts) {
@@ -169,8 +168,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (&q->info[next_idx]);if (nb_tx +1 < nb_pkts) {
@@ -195,7 +193,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -379,8 +377,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one (rxq, cq_desc, rx_svc);
@@ -399,7 +396,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -463,7 +461,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
Signature · 1 line
2.17.1
PATCH v2 7/13 net/ionic: fix RSS query routine
In reply to Andrew BoyerFrom: Akshay Dorwat <[email protected]>
The routine that copies out the RSS config can't use memcpy() because 'reta_conf->reta' is an array of uint16_t while 'lif->rss_ind_tbl' is an array of uint8_t. Instead, copy the values individually.
--- drivers/net/ionic/ionic_ethdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_ethdev.c +5 -4
@@ -561,7 +561,7 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev,struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev);struct ionic_adapter *adapter = lif->adapter;struct ionic_identity *ident = &adapter->ident; -int i, num; +int i, j, num;uint16_t tbl_sz =rte_le_to_cpu_16 (ident->lif.eth.rss_ind_tbl_sz);IONIC_PRINT_CALL ();
@@ -582,9 +582,10 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev, num = reta_size /RTE_ETH_RETA_GROUP_SIZE ;for (i =0 ; i < num; i++) { -memcpy (reta_conf->reta, - &lif->rss_ind_tbl[i *RTE_ETH_RETA_GROUP_SIZE ], -RTE_ETH_RETA_GROUP_SIZE ); +for (j =0 ; j <RTE_ETH_RETA_GROUP_SIZE ; j++) { + reta_conf->reta[j] = + lif->rss_ind_tbl[(i *RTE_ETH_RETA_GROUP_SIZE ) + j]; + } reta_conf++; }
Signature · 1 line
2.17.1
PATCH v2 8/13 net/ionic: report 1G and 200G link speeds when applicable
In reply to Andrew BoyerFrom: Vamsi Krishna Atluri <[email protected]>
The hardware supports these speeds, so we should report them correctly.
--- drivers/net/ionic/ionic_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ionic/ionic_ethdev.c +6 -0
@@ -285,6 +285,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, link.link_status =RTE_ETH_LINK_UP ; link.link_duplex =RTE_ETH_LINK_FULL_DUPLEX ;switch (adapter->link_speed) { +case 1000 : + link.link_speed =RTE_ETH_SPEED_NUM_1G ; +break ;case 10000 : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ;
@@ -300,6 +303,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev,case 100000 : link.link_speed =RTE_ETH_SPEED_NUM_100G ;break ; +case 200000 : + link.link_speed =RTE_ETH_SPEED_NUM_200G ; +break ;default : link.link_speed =RTE_ETH_SPEED_NUM_NONE ;break ;
Signature · 1 line
2.17.1
PATCH v2 9/13 net/ionic: add flexible firmware xstat counters
In reply to Andrew BoyerFrom: Brad Larson <[email protected]>
Assign 32 counters for flexible firmware events. These can be used as per-port or per-queue counters in certain firmware configurations. They are displayed as fw_flex_eventX in xstats.
--- drivers/net/ionic/ionic_ethdev.c | 33 +++++++++++++++ drivers/net/ionic/ionic_if.h | 70 ++++++++++++++++---------------- 2 files changed, 68 insertions(+), 35 deletions(-)
drivers/net/ionic/ionic_ethdev.c +33 -0
@@ -196,6 +196,39 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = { tx_desc_fetch_error)}, {"tx_desc_data_error" , offsetof(struct ionic_lif_stats , tx_desc_data_error)}, +/* Flexible firmware events */ + {"fw_flex_event1", offsetof(struct ionic_lif_stats, flex1)}, + {"fw_flex_event2", offsetof(struct ionic_lif_stats, flex2)}, + {"fw_flex_event3", offsetof(struct ionic_lif_stats, flex3)}, + {"fw_flex_event4", offsetof(struct ionic_lif_stats, flex4)}, + {"fw_flex_event5", offsetof(struct ionic_lif_stats, flex5)}, + {"fw_flex_event6", offsetof(struct ionic_lif_stats, flex6)}, + {"fw_flex_event7", offsetof(struct ionic_lif_stats, flex7)}, + {"fw_flex_event8", offsetof(struct ionic_lif_stats, flex8)}, + {"fw_flex_event9", offsetof(struct ionic_lif_stats, flex9)}, + {"fw_flex_event10", offsetof(struct ionic_lif_stats, flex10)}, + {"fw_flex_event11", offsetof(struct ionic_lif_stats, flex11)}, + {"fw_flex_event12", offsetof(struct ionic_lif_stats, flex12)}, + {"fw_flex_event13", offsetof(struct ionic_lif_stats, flex13)}, + {"fw_flex_event14", offsetof(struct ionic_lif_stats, flex14)}, + {"fw_flex_event15", offsetof(struct ionic_lif_stats, flex15)}, + {"fw_flex_event16", offsetof(struct ionic_lif_stats, flex16)}, + {"fw_flex_event17", offsetof(struct ionic_lif_stats, flex17)}, + {"fw_flex_event18", offsetof(struct ionic_lif_stats, flex18)}, + {"fw_flex_event19", offsetof(struct ionic_lif_stats, flex19)}, + {"fw_flex_event20", offsetof(struct ionic_lif_stats, flex20)}, + {"fw_flex_event21", offsetof(struct ionic_lif_stats, flex21)}, + {"fw_flex_event22", offsetof(struct ionic_lif_stats, flex22)}, + {"fw_flex_event23", offsetof(struct ionic_lif_stats, flex23)}, + {"fw_flex_event24", offsetof(struct ionic_lif_stats, flex24)}, + {"fw_flex_event25", offsetof(struct ionic_lif_stats, flex25)}, + {"fw_flex_event26", offsetof(struct ionic_lif_stats, flex26)}, + {"fw_flex_event27", offsetof(struct ionic_lif_stats, flex27)}, + {"fw_flex_event28", offsetof(struct ionic_lif_stats, flex28)}, + {"fw_flex_event29", offsetof(struct ionic_lif_stats, flex29)}, + {"fw_flex_event30", offsetof(struct ionic_lif_stats, flex30)}, + {"fw_flex_event31", offsetof(struct ionic_lif_stats, flex31)}, + {"fw_flex_event32", offsetof(struct ionic_lif_stats, flex32)}, };#define IONIC_NB_HW_STATS RTE_DIM(rte_ionic_xstats_strings)
drivers/net/ionic/ionic_if.h +35 -35
76 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 10/13 net/ionic: fix device close sequence to avoid crash
In reply to Andrew BoyerThe close routine should release all resources, but not call rte_eth_dev_destroy(). As written this code will call rte_eth_dev_release_port() twice and segfault.
Instead, move rte_eth_dev_destroy() to the remove routine. eth_ionic_dev_uninit() will call close if necessary.
--- drivers/net/ionic/ionic_ethdev.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_ethdev.c +15 -15
@@ -1009,19 +1009,21 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)ionic_lif_stop (lif); -ionic_lif_free_queues (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit); -ionic_port_reset (adapter);ionic_reset (adapter); + +ionic_lif_free_queues (lif); +ionic_lif_deinit (lif); +ionic_lif_free (lif);/* Does not free LIF object */ +if (adapter->intf->unmap_bars) (*adapter->intf->unmap_bars)(adapter); + lif->adapter =NULL ;rte_free (adapter);return 0 ;
@@ -1098,21 +1100,18 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)static int eth_ionic_dev_uninit (struct rte_eth_dev *eth_dev) { -struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev); -struct ionic_adapter *adapter = lif->adapter; -IONIC_PRINT_CALL ();if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; - adapter->lif =NULL ; - -ionic_lif_deinit (lif); -ionic_lif_free (lif); +if (eth_dev->state !=RTE_ETH_DEV_UNUSED ) +ionic_dev_close (eth_dev); -if (!(lif->state &IONIC_LIF_F_FW_RESET )) -ionic_lif_reset (lif); + eth_dev->dev_ops =NULL ; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + eth_dev->tx_pkt_prepare =NULL ;return 0 ; }
@@ -1267,17 +1266,18 @@ eth_ionic_dev_remove(struct rte_device *rte_dev) {char name[RTE_ETH_NAME_MAX_LEN ];struct rte_eth_dev *eth_dev; +int ret =0 ;/* Adapter lookup is using the eth_dev name */ snprintf (name,sizeof (name),"%s_lif" , rte_dev->name); eth_dev =rte_eth_dev_allocated (name);if (eth_dev) -ionic_dev_close (eth_dev); + ret =rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit);else IONIC_PRINT (DEBUG ,"Cannot find device %s" , rte_dev->name); -return 0 ; +return ret; }RTE_LOG_REGISTER_DEFAULT (ionic_logtype,NOTICE );
Signature · 1 line
2.17.1
PATCH v2 11/13 net/ionic: optimize device close operation
In reply to Andrew BoyerUse a single device reset command to speed up dev_close(). The LIF stop and port reset commands are not needed.
This reduces the outage window when restarting the process by about 2ms plus another 1ms per queue.
--- drivers/net/ionic/ionic_ethdev.c | 3 --- drivers/net/ionic/ionic_lif.c | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-)
drivers/net/ionic/ionic_ethdev.c +0 -3
@@ -1007,13 +1007,10 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; -ionic_lif_stop (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -ionic_port_reset (adapter);ionic_reset (adapter);ionic_lif_free_queues (lif);
drivers/net/ionic/ionic_lif.c +1 -7
@@ -1231,13 +1231,7 @@ ionic_lif_rss_setup(struct ionic_lif *lif)static void ionic_lif_rss_teardown (struct ionic_lif *lif) { -if (!lif->rss_ind_tbl) -return ; - -if (lif->rss_ind_tbl_z) { -/* Disable RSS on the NIC */ -ionic_lif_rss_config (lif,0x0 ,NULL ,NULL ); - +if (lif->rss_ind_tbl) { lif->rss_ind_tbl =NULL ; lif->rss_ind_tbl_pa =0 ;rte_memzone_free (lif->rss_ind_tbl_z);
Signature · 1 line
2.17.1
PATCH v2 12/13 net/ionic: optimize device stop operation
In reply to Andrew BoyerSplit the queue_stop operation into first-half and second-half helpers. Move the command context from the stack into each Rx/Tx queue struct. Expose some needed adminq interfaces.
This allows us to batch up the queue commands during dev_stop(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic.h | 3 ++ drivers/net/ionic/ionic_lif.c | 68 ++++++++++++++++++++++------- drivers/net/ionic/ionic_lif.h | 12 ++++-- drivers/net/ionic/ionic_main.c | 17 +++++++- drivers/net/ionic/ionic_rxtx.c | 78 ++++++++++++++++++++-------------- drivers/net/ionic/ionic_rxtx.h | 14 +++++- 6 files changed, 138 insertions(+), 54 deletions(-)
drivers/net/ionic/ionic.h +3 -0
@@ -83,7 +83,10 @@ struct ionic_admin_ctx {union ionic_adminq_comp comp; }; +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx);int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +int ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +uint16_t ionic_adminq_space_avail (struct ionic_lif *lif);int ionic_dev_cmd_wait_check (struct ionic_dev *idev,unsigned long max_wait);int ionic_setup (struct ionic_adapter *adapter);
drivers/net/ionic/ionic_lif.c +52 -16
112 lines not on this page · raw message
drivers/net/ionic/ionic_lif.h +9 -3
@@ -10,7 +10,7 @@#include <rte_ethdev.h> #include <rte_ether.h> -#include "ionic_osdep.h" +#include "ionic.h" #include "ionic_dev.h" #include "ionic_rx_filter.h"
@@ -99,6 +99,8 @@ struct ionic_rx_qcq {/* cacheline4+ */ struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned; + +struct ionic_admin_ctx admin_ctx; };struct ionic_tx_qcq {
@@ -112,6 +114,8 @@ struct ionic_tx_qcq {uint16_t flags;struct ionic_tx_stats stats; + +struct ionic_admin_ctx admin_ctx; };#define IONIC_Q_TO_QCQ (_q) container_of(_q, struct ionic_qcq, q)
@@ -225,10 +229,12 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,void ionic_qcq_free (struct ionic_qcq *qcq);int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); -void ionic_lif_rxq_deinit (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq);int ionic_lif_txq_init (struct ionic_tx_qcq *txq); -void ionic_lif_txq_deinit (struct ionic_tx_qcq *txq); +void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);int ionic_lif_rss_config (struct ionic_lif *lif,const uint16_t types,const uint8_t *key,const uint32_t *indir);
drivers/net/ionic/ionic_main.c +15 -2
@@ -180,6 +180,12 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,return true; } +uint16_t +ionic_adminq_space_avail (struct ionic_lif *lif) +{ +return ionic_q_space_avail (&lif->adminqcq->qcq.q); +} +/** ionic_adminq_post - Post an admin command. * @lif: Handle to lif. * @cmd_ctx: Api admin command context.
@@ -191,7 +197,7 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,* * Return: zero or negative error status. */ -static int +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) {struct ionic_queue *q = &lif->adminqcq->qcq.q;
@@ -279,7 +285,6 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) { -bool done;int err; IONIC_PRINT(DEBUG, "Sending %s (%d) via the admin queue",
@@ -292,6 +297,14 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)return err; } +return ionic_adminq_wait (lif, ctx); +} + +int +ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) +{ +bool done; + done =ionic_adminq_wait_for_completion (lif, ctx,IONIC_DEVCMD_TIMEOUT );
drivers/net/ionic/ionic_rxtx.c +47 -31
111 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +12 -2
@@ -37,14 +37,24 @@ int ionic_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);void ionic_dev_rx_queue_release (struct rte_eth_dev *dev,uint16_t qid);int ionic_dev_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); -int ionic_dev_rx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t rx_queue_id); +int ionic_dev_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ionic_dev_tx_queue_setup (struct rte_eth_dev *dev,uint16_t tx_queue_id,uint16_t nb_desc,uint32_t socket_id,const struct rte_eth_txconf *tx_conf);void ionic_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); -int ionic_dev_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); + +/* Helpers for optimized dev_stop() */ +void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_rx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_tx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +void ionic_dev_tx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id);void ionic_rxq_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_rxq_info *qinfo);
Signature · 1 line
2.17.1
PATCH v2 13/13 net/ionic: optimize device start operation
In reply to Andrew BoyerSplit the queue_start operation into first-half and second-half helpers.
This allows us to batch up the queue commands during dev_start(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic_lif.c | 136 +++++++++++++++++++++++---------- drivers/net/ionic/ionic_lif.h | 6 +- drivers/net/ionic/ionic_rxtx.c | 81 ++++++++++++++++---- drivers/net/ionic/ionic_rxtx.h | 10 +++ 4 files changed, 176 insertions(+), 57 deletions(-)
drivers/net/ionic/ionic_lif.c +95 -41
@@ -1601,13 +1601,16 @@ ionic_lif_set_features(struct ionic_lif *lif) }int -ionic_lif_txq_init (struct ionic_tx_qcq *txq) +ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq) {struct ionic_qcq *qcq = &txq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { +struct ionic_admin_ctx *ctx = &txq->admin_ctx; +int err; + + *ctx = (struct ionic_admin_ctx ) { .pending_work = true, .cmd.q_init = { .opcode =IONIC_CMD_Q_INIT ,
@@ -1621,32 +1624,41 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), }, }; -int err;if (txq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (txq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"txq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_txq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_txq_init_done (struct ionic_tx_qcq *txq) +{ +struct ionic_lif *lif = txq->qcq.lif; +struct ionic_queue *q = &txq->qcq.q; +struct ionic_admin_ctx *ctx = &txq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q);IONIC_PRINT (DEBUG ,"txq->hw_type %d" , q->hw_type);
@@ -1654,18 +1666,19 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)IONIC_PRINT (DEBUG ,"txq->db %p" , q->db); txq->flags |=IONIC_QCQ_F_INITED ; - -return 0 ; }int -ionic_lif_rxq_init (struct ionic_rx_qcq *rxq) +ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq) {struct ionic_qcq *qcq = &rxq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { +struct ionic_admin_ctx *ctx = &rxq->admin_ctx; +int err; + + *ctx = (struct ionic_admin_ctx ) { .pending_work = true, .cmd.q_init = { .opcode =IONIC_CMD_Q_INIT ,
@@ -1679,32 +1692,41 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), }, }; -int err;if (rxq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (rxq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"rxq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_rxq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq) +{ +struct ionic_lif *lif = rxq->qcq.lif; +struct ionic_queue *q = &rxq->qcq.q; +struct ionic_admin_ctx *ctx = &rxq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q); rxq->flags |=IONIC_QCQ_F_INITED ;
@@ -1712,8 +1734,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)IONIC_PRINT (DEBUG ,"rxq->hw_type %d" , q->hw_type);IONIC_PRINT (DEBUG ,"rxq->hw_index %d" , q->hw_index);IONIC_PRINT (DEBUG ,"rxq->db %p" , q->db); - -return 0 ; } static int
@@ -1962,9 +1982,11 @@ ionic_lif_configure(struct ionic_lif *lif)int ionic_lif_start (struct ionic_lif *lif) { +struct rte_eth_dev *dev = lif->eth_dev;uint32_t rx_mode; -uint32_t i; +uint32_t i, j, chunk;int err; +bool fatal = false; err =ionic_lif_rss_setup (lif);if (err)
@@ -1985,25 +2007,57 @@ ionic_lif_start(struct ionic_lif *lif)"on port %u" , lif->nrxqcqs, lif->ntxqcqs, lif->port_id); -for (i =0 ; i < lif->nrxqcqs; i++) { -struct ionic_rx_qcq *rxq = lif->rxqcqs[i]; -if (!(rxq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_rx_queue_start (lif->eth_dev, i); + chunk =ionic_adminq_space_avail (lif); + +for (i =0 ; i < lif->nrxqcqs; i += chunk) { +if (lif->rxqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Rx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { + err =ionic_dev_rx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_rx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ; -for (i =0 ; i < lif->ntxqcqs; i++) { -struct ionic_tx_qcq *txq = lif->txqcqs[i]; -if (!(txq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_tx_queue_start (lif->eth_dev, i); +for (i =0 ; i < lif->ntxqcqs; i += chunk) { +if (lif->txqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Tx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { + err =ionic_dev_tx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_tx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ;/* Carrier ON here */ lif->state |=IONIC_LIF_F_UP ;
drivers/net/ionic/ionic_lif.h +4 -2
@@ -228,11 +228,13 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, struct ionic_tx_qcq **qcq_out);void ionic_qcq_free (struct ionic_qcq *qcq); -int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); +int ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq); -int ionic_lif_txq_init (struct ionic_tx_qcq *txq); +int ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_init_done (struct ionic_tx_qcq *txq);void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq);void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);
drivers/net/ionic/ionic_rxtx.c +67 -14
126 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +10 -0
@@ -46,6 +46,16 @@ void ionic_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +/* Helpers for optimized dev_start() */ +int ionic_dev_rx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_rx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_tx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +int ionic_dev_tx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +/* Helpers for optimized dev_stop() */ void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev,uint16_t rx_queue_id);
Signature · 1 line
2.17.1
v3 cover net/ionic: miscellaneous fixes and improvements
In reply to Andrew BoyerThis patchset provides miscellaneous fixes and improvements for the net/ionic driver used by AMD Pensando devices.
V3:
- Resend to fix patchwork threading.
V2:
- Update device stop and device start patches to use compound literals as suggested by review.
Akshay Dorwat (1):
net/ionic: fix RSS query routine
Andrew Boyer (8):
net/ionic: add stat for completion queue entries processed net/ionic: increase max supported MTU to 9750 bytes net/ionic: don't auto-enable Rx scatter-gather a second time net/ionic: replace non-standard type in structure definition net/ionic: fix device close sequence to avoid crash net/ionic: optimize device close operation net/ionic: optimize device stop operation net/ionic: optimize device start operation
Brad Larson (1):
net/ionic: add flexible firmware xstat counters
Neel Patel (2):
net/ionic: fix missing volatile type for cqe pointers net/ionic: memcpy descriptors when using Q-in-CMB
Vamsi Krishna Atluri (1):
net/ionic: report 1G and 200G link speeds when applicable
drivers/net/ionic/ionic.h | 3 + drivers/net/ionic/ionic_dev.c | 9 +- drivers/net/ionic/ionic_dev.h | 8 +- drivers/net/ionic/ionic_dev_pci.c | 2 +- drivers/net/ionic/ionic_ethdev.c | 81 ++++++--- drivers/net/ionic/ionic_if.h | 70 ++++---- drivers/net/ionic/ionic_lif.c | 233 ++++++++++++++++++-------- drivers/net/ionic/ionic_lif.h | 19 ++- drivers/net/ionic/ionic_main.c | 17 +- drivers/net/ionic/ionic_rxtx.c | 160 +++++++++++++----- drivers/net/ionic/ionic_rxtx.h | 80 ++++++++- drivers/net/ionic/ionic_rxtx_sg.c | 28 ++-- drivers/net/ionic/ionic_rxtx_simple.c | 28 ++-- 13 files changed, 527 insertions(+), 211 deletions(-)
Signature · 1 line
2.17.1
PATCH v3 1/13 net/ionic: add stat for completion queue entries processed
When completion coalescing is turned on in the FW, there will be fewer CQE than Tx packets. Expose the stat through debug logging.
--- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 3 +++ drivers/net/ionic/ionic_rxtx_sg.c | 2 ++ drivers/net/ionic/ionic_rxtx_simple.c | 2 ++ 4 files changed, 8 insertions(+)
drivers/net/ionic/ionic_lif.h +1 -0
@@ -32,6 +32,7 @@struct ionic_tx_stats {uint64_t packets;uint64_t bytes; +uint64_t comps;uint64_t drop;uint64_t stop;uint64_t no_csum;
drivers/net/ionic/ionic_rxtx.c +3 -0
@@ -117,6 +117,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) stats = &txq->stats;IONIC_PRINT (DEBUG ,"TX queue %u pkts %ju tso %ju" , txq->qcq.q.index, stats->packets, stats->tso); +IONIC_PRINT (DEBUG ,"TX queue %u comps %ju (%ju per)" , + txq->qcq.q.index, stats->comps, + stats->comps ? stats->packets / stats->comps :0 );return 0 ; }
drivers/net/ionic/ionic_rxtx_sg.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -72,6 +73,7 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
drivers/net/ionic/ionic_rxtx_simple.c +2 -0
@@ -26,6 +26,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) {struct ionic_cq *cq = &txq->qcq.cq;struct ionic_queue *q = &txq->qcq.q; +struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm;struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base;void **info;
@@ -67,6 +68,7 @@ ionic_tx_flush(struct ionic_tx_qcq *txq) } cq_desc = &cq_desc_base[cq->tail_idx]; + stats->comps++; } }
Signature · 1 line
2.17.1
PATCH v3 2/13 net/ionic: increase max supported MTU to 9750 bytes
In reply to Andrew BoyerSome configurations want to use values this high internally. Allow them to do so without modifying the code.
--- drivers/net/ionic/ionic_dev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev.h +1 -1
@@ -14,7 +14,7 @@#define VLAN_TAG_SIZE 4#define IONIC_MIN_MTU RTE_ETHER_MIN_MTU -#define IONIC_MAX_MTU 9378 +#define IONIC_MAX_MTU 9750#define IONIC_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + VLAN_TAG_SIZE)#define IONIC_MAX_RING_DESC 32768
Signature · 1 line
2.17.1
PATCH v3 3/13 net/ionic: don't auto-enable Rx scatter-gather a second time
In reply to Andrew BoyerThe receive side will enable scatter-gather if required based on the mbuf size. If the client already enabled it in the config, it does not need to be enabled again. This reduces log output.
--- drivers/net/ionic/ionic_lif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ionic/ionic_lif.c +2 -1
@@ -768,7 +768,8 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, max_mtu =rte_le_to_cpu_32 (lif->adapter->ident.lif.eth.max_mtu);/* If mbufs are too small to hold received packets, enable SG */ -if (max_mtu > hdr_seg_size) { +if (max_mtu > hdr_seg_size && + !(lif->features &IONIC_ETH_HW_RX_SG )) {IONIC_PRINT (NOTICE ,"Enabling RX_OFFLOAD_SCATTER" ); lif->eth_dev->data->dev_conf.rxmode.offloads |=RTE_ETH_RX_OFFLOAD_SCATTER ;
Signature · 1 line
2.17.1
PATCH v3 4/13 net/ionic: fix missing volatile type for cqe pointers
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
This memory may be changed by the hardware, so the volatile keyword is required for correctness.
--- drivers/net/ionic/ionic_rxtx.c | 4 ++-- drivers/net/ionic/ionic_rxtx_sg.c | 8 +++++--- drivers/net/ionic/ionic_rxtx_simple.c | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ionic/ionic_rxtx.c +2 -2
@@ -755,7 +755,7 @@ ionic_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) {struct ionic_rx_qcq *rxq = rx_queue;struct ionic_qcq *qcq = &rxq->qcq; -struct ionic_rxq_comp *cq_desc; +volatile struct ionic_rxq_comp *cq_desc;uint16_t mask, head, tail, pos;bool done_color;
@@ -794,7 +794,7 @@ ionic_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) {struct ionic_tx_qcq *txq = tx_queue;struct ionic_qcq *qcq = &txq->qcq; -struct ionic_txq_comp *cq_desc; +volatile struct ionic_txq_comp *cq_desc;uint16_t mask, head, tail, pos, cq_pos;bool done_color;
drivers/net/ionic/ionic_rxtx_sg.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush_sg(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info;uint32_t i;
@@ -254,7 +255,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one_sg (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -440,7 +441,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
drivers/net/ionic/ionic_rxtx_simple.c +5 -3
@@ -28,7 +28,8 @@ ionic_tx_flush(struct ionic_tx_qcq *txq)struct ionic_queue *q = &txq->qcq.q;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *txm; -struct ionic_txq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_txq_comp *cq_desc_base = cq->base; +volatile struct ionic_txq_comp *cq_desc;void **info; cq_desc = &cq_desc_base[cq->tail_idx];
@@ -227,7 +228,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,*/ static __rte_always_inline voidionic_rx_clean_one (struct ionic_rx_qcq *rxq, -struct ionic_rxq_comp *cq_desc, +volatile struct ionic_rxq_comp *cq_desc,struct ionic_rx_service *rx_svc) {struct ionic_queue *q = &rxq->qcq.q;
@@ -361,7 +362,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,struct ionic_cq *cq = &rxq->qcq.cq;struct ionic_queue *q = &rxq->qcq.q;struct ionic_rxq_desc *q_desc_base = q->base; -struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; +struct ionic_rxq_comp *cq_desc_base = cq->base; +volatile struct ionic_rxq_comp *cq_desc;uint32_t work_done =0 ;uint64_t then, now, hz, delta;
Signature · 1 line
2.17.1
PATCH v3 5/13 net/ionic: replace non-standard type in structure definition
In reply to Andrew BoyerUse uint8_t instead of u_char. This simplifies the code.
--- drivers/net/ionic/ionic_dev_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ionic/ionic_dev_pci.c +1 -1
@@ -38,7 +38,7 @@ ionic_pci_setup(struct ionic_adapter *adapter)struct ionic_dev *idev = &adapter->idev;struct rte_pci_device *bus_dev = adapter->bus_dev;uint32_t sig; -u_char *bar0_base; +uint8_t *bar0_base;unsigned int i;/* BAR0: dev_cmd and interrupts */
Signature · 1 line
2.17.1
PATCH v3 6/13 net/ionic: memcpy descriptors when using Q-in-CMB
In reply to Andrew BoyerFrom: Neel Patel <[email protected]>
They can be batched together this way, reducing the number of PCIe transactions. This improves transmit PPS by up to 50% in some configurations.
--- drivers/net/ionic/ionic_dev.c | 9 +++-- drivers/net/ionic/ionic_dev.h | 6 ++- drivers/net/ionic/ionic_lif.c | 26 +++++++++---- drivers/net/ionic/ionic_rxtx.h | 56 +++++++++++++++++++++++++++ drivers/net/ionic/ionic_rxtx_sg.c | 18 ++++----- drivers/net/ionic/ionic_rxtx_simple.c | 18 ++++----- 6 files changed, 101 insertions(+), 32 deletions(-)
drivers/net/ionic/ionic_dev.c +6 -3
@@ -369,17 +369,19 @@ ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs) q->index = index; q->num_descs = num_descs; q->size_mask = num_descs -1 ; - q->head_idx =0 ; - q->tail_idx =0 ; +ionic_q_reset (q);return 0 ; }void -ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa) +ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa) { q->base = base; q->base_pa = base_pa; + q->cmb_base = cmb_base; + q->cmb_base_pa = cmb_base_pa; }void
@@ -393,5 +395,6 @@ void ionic_q_reset(struct ionic_queue *q) { q->head_idx =0 ; + q->cmb_head_idx =0 ; q->tail_idx =0 ; }
drivers/net/ionic/ionic_dev.h +5 -1
@@ -145,11 +145,13 @@ struct ionic_queue {uint16_t num_descs;uint16_t num_segs;uint16_t head_idx; +uint16_t cmb_head_idx;uint16_t tail_idx;uint16_t size_mask;uint8_t type;uint8_t hw_type;void *base; +void *cmb_base;void *sg_base;struct ionic_doorbell __iomem *db;void **info;
@@ -158,6 +160,7 @@ struct ionic_queue {uint32_t hw_index;rte_iova_t base_pa;rte_iova_t sg_base_pa; +rte_iova_t cmb_base_pa; };#define IONIC_INTR_NONE (-1)
@@ -244,7 +247,8 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do,int ionic_q_init (struct ionic_queue *q,uint32_t index,uint16_t num_descs);void ionic_q_reset (struct ionic_queue *q); -void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); +void ionic_q_map (struct ionic_queue *q,void *base,rte_iova_t base_pa, +void *cmb_base,rte_iova_t cmb_base_pa);void ionic_q_sg_map (struct ionic_queue *q,void *base,rte_iova_t base_pa); static inline uint16_t
drivers/net/ionic/ionic_lif.c +18 -8
@@ -572,10 +572,11 @@ ionic_qcq_alloc(struct ionic_lif *lif, {struct ionic_qcq *new;uint32_t q_size, cq_size, sg_size, total_size; -void *q_base, *cq_base, *sg_base; +void *q_base, *cmb_q_base, *cq_base, *sg_base;rte_iova_t q_base_pa =0 ;rte_iova_t cq_base_pa =0 ;rte_iova_t sg_base_pa =0 ; +rte_iova_t cmb_q_base_pa =0 ;size_t page_size =rte_mem_page_size ();int err;
@@ -666,19 +667,22 @@ ionic_qcq_alloc(struct ionic_lif *lif,IONIC_PRINT (ERR ,"Cannot reserve queue from NIC mem" );return -ENOMEM ; } - q_base = (void *) + cmb_q_base = (void *) ((uintptr_t )lif->adapter->bars.bar[2 ].vaddr + (uintptr_t )lif->adapter->cmb_offset);/* CMB PA is a relative address */ - q_base_pa = lif->adapter->cmb_offset; + cmb_q_base_pa = lif->adapter->cmb_offset; lif->adapter->cmb_offset += q_size; + }else { + cmb_q_base =NULL ; + cmb_q_base_pa =0 ; }IONIC_PRINT (DEBUG ,"Q-Base-PA = %#jx CQ-Base-PA = %#jx " "SG-base-PA = %#jx" , q_base_pa, cq_base_pa, sg_base_pa); -ionic_q_map (&new->q, q_base, q_base_pa); +ionic_q_map (&new->q, q_base, q_base_pa, cmb_q_base, cmb_q_base_pa);ionic_cq_map (&new->cq, cq_base, cq_base_pa); *qcq = new;
@@ -1583,7 +1587,6 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1592,8 +1595,12 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)if (txq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (txq->flags &IONIC_QCQ_F_CMB ) +if (txq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);
@@ -1638,7 +1645,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .flags = rte_cpu_to_le_16(IONIC_QINIT_F_ENA), .intr_index = rte_cpu_to_le_16(IONIC_INTR_NONE), .ring_size = rte_log2_u32(q->num_descs), - .ring_base = rte_cpu_to_le_64(q->base_pa), .cq_ring_base = rte_cpu_to_le_64(cq->base_pa), .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), },
@@ -1647,8 +1653,12 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)if (rxq->flags &IONIC_QCQ_F_SG ) ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); -if (rxq->flags &IONIC_QCQ_F_CMB ) +if (rxq->flags &IONIC_QCQ_F_CMB ) { ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + }else { + ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);
drivers/net/ionic/ionic_rxtx.h +56 -0
60 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx_sg.c +8 -10
@@ -166,6 +166,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -173,9 +174,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, q->head_idx));if (nb_pkts) {
@@ -196,8 +195,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, next_idx));if (nb_tx +1 < nb_pkts) {
@@ -222,7 +220,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -458,8 +456,7 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one_sg (rxq, cq_desc, rx_svc);
@@ -478,7 +475,8 @@ ionic_rxq_service_sg(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -542,7 +540,7 @@ ionic_rx_fill_sg(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
drivers/net/ionic/ionic_rxtx_simple.c +8 -10
@@ -139,6 +139,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, {struct ionic_tx_qcq *txq = tx_queue;struct ionic_queue *q = &txq->qcq.q; +struct ionic_txq_desc *desc_base = q->base;struct ionic_tx_stats *stats = &txq->stats;struct rte_mbuf *mbuf;uint32_t bytes_tx =0 ;
@@ -146,9 +147,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,uint64_t then, now, hz, delta;int err; -struct ionic_txq_desc *desc_base = q->base; -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[q->head_idx]); +rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (&q->info[q->head_idx]);if (nb_pkts) {
@@ -169,8 +168,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,while (nb_tx < nb_pkts) {uint16_t next_idx =Q_NEXT_TO_POST (q,1 ); -if (!(txq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&desc_base[next_idx]); +rte_prefetch0 (&desc_base[next_idx]);rte_prefetch0 (&q->info[next_idx]);if (nb_tx +1 < nb_pkts) {
@@ -195,7 +193,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (nb_tx >0 ) {rte_wmb (); -ionic_q_flush (q); +ionic_txq_flush (q); txq->last_wdog_cycles =rte_get_timer_cycles ();
@@ -379,8 +377,7 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Prefetch 4 x 16B comp */ rte_prefetch0 (&cq_desc_base[Q_NEXT_TO_SRVC (cq,4 )]);/* Prefetch 4 x 16B descriptors */ -if (!(rxq->flags &IONIC_QCQ_F_CMB )) -rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]); +rte_prefetch0 (&q_desc_base[Q_NEXT_TO_POST (q,4 )]);/* Clean one descriptor */ ionic_rx_clean_one (rxq, cq_desc, rx_svc);
@@ -399,7 +396,8 @@ ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do,/* Update the queue indices and ring the doorbell */ if (work_done) { -ionic_q_flush (q); +ionic_rxq_flush (q); + rxq->last_wdog_cycles =rte_get_timer_cycles (); rxq->wdog_ms =IONIC_Q_WDOG_MS ; }else {
@@ -463,7 +461,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq) q->head_idx =Q_NEXT_TO_POST (q,1 ); } -ionic_q_flush (q); +ionic_rxq_flush (q);return err; }
Signature · 1 line
2.17.1
PATCH v3 7/13 net/ionic: fix RSS query routine
In reply to Andrew BoyerFrom: Akshay Dorwat <[email protected]>
The routine that copies out the RSS config can't use memcpy() because 'reta_conf->reta' is an array of uint16_t while 'lif->rss_ind_tbl' is an array of uint8_t. Instead, copy the values individually.
--- drivers/net/ionic/ionic_ethdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ionic/ionic_ethdev.c +5 -4
@@ -561,7 +561,7 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev,struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev);struct ionic_adapter *adapter = lif->adapter;struct ionic_identity *ident = &adapter->ident; -int i, num; +int i, j, num;uint16_t tbl_sz =rte_le_to_cpu_16 (ident->lif.eth.rss_ind_tbl_sz);IONIC_PRINT_CALL ();
@@ -582,9 +582,10 @@ ionic_dev_rss_reta_query(struct rte_eth_dev *eth_dev, num = reta_size /RTE_ETH_RETA_GROUP_SIZE ;for (i =0 ; i < num; i++) { -memcpy (reta_conf->reta, - &lif->rss_ind_tbl[i *RTE_ETH_RETA_GROUP_SIZE ], -RTE_ETH_RETA_GROUP_SIZE ); +for (j =0 ; j <RTE_ETH_RETA_GROUP_SIZE ; j++) { + reta_conf->reta[j] = + lif->rss_ind_tbl[(i *RTE_ETH_RETA_GROUP_SIZE ) + j]; + } reta_conf++; }
Signature · 1 line
2.17.1
PATCH v3 8/13 net/ionic: report 1G and 200G link speeds when applicable
In reply to Andrew BoyerFrom: Vamsi Krishna Atluri <[email protected]>
The hardware supports these speeds, so we should report them correctly.
--- drivers/net/ionic/ionic_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ionic/ionic_ethdev.c +6 -0
@@ -285,6 +285,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev, link.link_status =RTE_ETH_LINK_UP ; link.link_duplex =RTE_ETH_LINK_FULL_DUPLEX ;switch (adapter->link_speed) { +case 1000 : + link.link_speed =RTE_ETH_SPEED_NUM_1G ; +break ;case 10000 : link.link_speed =RTE_ETH_SPEED_NUM_10G ;break ;
@@ -300,6 +303,9 @@ ionic_dev_link_update(struct rte_eth_dev *eth_dev,case 100000 : link.link_speed =RTE_ETH_SPEED_NUM_100G ;break ; +case 200000 : + link.link_speed =RTE_ETH_SPEED_NUM_200G ; +break ;default : link.link_speed =RTE_ETH_SPEED_NUM_NONE ;break ;
Signature · 1 line
2.17.1
PATCH v3 9/13 net/ionic: add flexible firmware xstat counters
In reply to Andrew BoyerFrom: Brad Larson <[email protected]>
Assign 32 counters for flexible firmware events. These can be used as per-port or per-queue counters in certain firmware configurations. They are displayed as fw_flex_eventX in xstats.
--- drivers/net/ionic/ionic_ethdev.c | 33 +++++++++++++++ drivers/net/ionic/ionic_if.h | 70 ++++++++++++++++---------------- 2 files changed, 68 insertions(+), 35 deletions(-)
drivers/net/ionic/ionic_ethdev.c +33 -0
@@ -196,6 +196,39 @@ static const struct rte_ionic_xstats_name_off rte_ionic_xstats_strings[] = { tx_desc_fetch_error)}, {"tx_desc_data_error" , offsetof(struct ionic_lif_stats , tx_desc_data_error)}, +/* Flexible firmware events */ + {"fw_flex_event1", offsetof(struct ionic_lif_stats, flex1)}, + {"fw_flex_event2", offsetof(struct ionic_lif_stats, flex2)}, + {"fw_flex_event3", offsetof(struct ionic_lif_stats, flex3)}, + {"fw_flex_event4", offsetof(struct ionic_lif_stats, flex4)}, + {"fw_flex_event5", offsetof(struct ionic_lif_stats, flex5)}, + {"fw_flex_event6", offsetof(struct ionic_lif_stats, flex6)}, + {"fw_flex_event7", offsetof(struct ionic_lif_stats, flex7)}, + {"fw_flex_event8", offsetof(struct ionic_lif_stats, flex8)}, + {"fw_flex_event9", offsetof(struct ionic_lif_stats, flex9)}, + {"fw_flex_event10", offsetof(struct ionic_lif_stats, flex10)}, + {"fw_flex_event11", offsetof(struct ionic_lif_stats, flex11)}, + {"fw_flex_event12", offsetof(struct ionic_lif_stats, flex12)}, + {"fw_flex_event13", offsetof(struct ionic_lif_stats, flex13)}, + {"fw_flex_event14", offsetof(struct ionic_lif_stats, flex14)}, + {"fw_flex_event15", offsetof(struct ionic_lif_stats, flex15)}, + {"fw_flex_event16", offsetof(struct ionic_lif_stats, flex16)}, + {"fw_flex_event17", offsetof(struct ionic_lif_stats, flex17)}, + {"fw_flex_event18", offsetof(struct ionic_lif_stats, flex18)}, + {"fw_flex_event19", offsetof(struct ionic_lif_stats, flex19)}, + {"fw_flex_event20", offsetof(struct ionic_lif_stats, flex20)}, + {"fw_flex_event21", offsetof(struct ionic_lif_stats, flex21)}, + {"fw_flex_event22", offsetof(struct ionic_lif_stats, flex22)}, + {"fw_flex_event23", offsetof(struct ionic_lif_stats, flex23)}, + {"fw_flex_event24", offsetof(struct ionic_lif_stats, flex24)}, + {"fw_flex_event25", offsetof(struct ionic_lif_stats, flex25)}, + {"fw_flex_event26", offsetof(struct ionic_lif_stats, flex26)}, + {"fw_flex_event27", offsetof(struct ionic_lif_stats, flex27)}, + {"fw_flex_event28", offsetof(struct ionic_lif_stats, flex28)}, + {"fw_flex_event29", offsetof(struct ionic_lif_stats, flex29)}, + {"fw_flex_event30", offsetof(struct ionic_lif_stats, flex30)}, + {"fw_flex_event31", offsetof(struct ionic_lif_stats, flex31)}, + {"fw_flex_event32", offsetof(struct ionic_lif_stats, flex32)}, };#define IONIC_NB_HW_STATS RTE_DIM(rte_ionic_xstats_strings)
drivers/net/ionic/ionic_if.h +35 -35
76 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 10/13 net/ionic: fix device close sequence to avoid crash
In reply to Andrew BoyerThe close routine should release all resources, but not call rte_eth_dev_destroy(). As written this code will call rte_eth_dev_release_port() twice and segfault.
Instead, move rte_eth_dev_destroy() to the remove routine. eth_ionic_dev_uninit() will call close if necessary.
--- drivers/net/ionic/ionic_ethdev.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/ionic/ionic_ethdev.c +15 -15
@@ -1009,19 +1009,21 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)ionic_lif_stop (lif); -ionic_lif_free_queues (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit); -ionic_port_reset (adapter);ionic_reset (adapter); + +ionic_lif_free_queues (lif); +ionic_lif_deinit (lif); +ionic_lif_free (lif);/* Does not free LIF object */ +if (adapter->intf->unmap_bars) (*adapter->intf->unmap_bars)(adapter); + lif->adapter =NULL ;rte_free (adapter);return 0 ;
@@ -1098,21 +1100,18 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)static int eth_ionic_dev_uninit (struct rte_eth_dev *eth_dev) { -struct ionic_lif *lif =IONIC_ETH_DEV_TO_LIF (eth_dev); -struct ionic_adapter *adapter = lif->adapter; -IONIC_PRINT_CALL ();if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; - adapter->lif =NULL ; - -ionic_lif_deinit (lif); -ionic_lif_free (lif); +if (eth_dev->state !=RTE_ETH_DEV_UNUSED ) +ionic_dev_close (eth_dev); -if (!(lif->state &IONIC_LIF_F_FW_RESET )) -ionic_lif_reset (lif); + eth_dev->dev_ops =NULL ; + eth_dev->rx_pkt_burst =NULL ; + eth_dev->tx_pkt_burst =NULL ; + eth_dev->tx_pkt_prepare =NULL ;return 0 ; }
@@ -1267,17 +1266,18 @@ eth_ionic_dev_remove(struct rte_device *rte_dev) {char name[RTE_ETH_NAME_MAX_LEN ];struct rte_eth_dev *eth_dev; +int ret =0 ;/* Adapter lookup is using the eth_dev name */ snprintf (name,sizeof (name),"%s_lif" , rte_dev->name); eth_dev =rte_eth_dev_allocated (name);if (eth_dev) -ionic_dev_close (eth_dev); + ret =rte_eth_dev_destroy (eth_dev, eth_ionic_dev_uninit);else IONIC_PRINT (DEBUG ,"Cannot find device %s" , rte_dev->name); -return 0 ; +return ret; }RTE_LOG_REGISTER_DEFAULT (ionic_logtype,NOTICE );
Signature · 1 line
2.17.1
PATCH v3 11/13 net/ionic: optimize device close operation
In reply to Andrew BoyerUse a single device reset command to speed up dev_close(). The LIF stop and port reset commands are not needed.
This reduces the outage window when restarting the process by about 2ms plus another 1ms per queue.
--- drivers/net/ionic/ionic_ethdev.c | 3 --- drivers/net/ionic/ionic_lif.c | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-)
drivers/net/ionic/ionic_ethdev.c +0 -3
@@ -1007,13 +1007,10 @@ ionic_dev_close(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; -ionic_lif_stop (lif); -IONIC_PRINT (NOTICE ,"Removing device %s" , eth_dev->device->name);if (adapter->intf->unconfigure_intr) (*adapter->intf->unconfigure_intr)(adapter); -ionic_port_reset (adapter);ionic_reset (adapter);ionic_lif_free_queues (lif);
drivers/net/ionic/ionic_lif.c +1 -7
@@ -1231,13 +1231,7 @@ ionic_lif_rss_setup(struct ionic_lif *lif)static void ionic_lif_rss_teardown (struct ionic_lif *lif) { -if (!lif->rss_ind_tbl) -return ; - -if (lif->rss_ind_tbl_z) { -/* Disable RSS on the NIC */ -ionic_lif_rss_config (lif,0x0 ,NULL ,NULL ); - +if (lif->rss_ind_tbl) { lif->rss_ind_tbl =NULL ; lif->rss_ind_tbl_pa =0 ;rte_memzone_free (lif->rss_ind_tbl_z);
Signature · 1 line
2.17.1
PATCH v3 12/13 net/ionic: optimize device stop operation
In reply to Andrew BoyerSplit the queue_stop operation into first-half and second-half helpers. Move the command context from the stack into each Rx/Tx queue struct. Expose some needed adminq interfaces.
This allows us to batch up the queue commands during dev_stop(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic.h | 3 ++ drivers/net/ionic/ionic_lif.c | 68 ++++++++++++++++++++++------- drivers/net/ionic/ionic_lif.h | 12 ++++-- drivers/net/ionic/ionic_main.c | 17 +++++++- drivers/net/ionic/ionic_rxtx.c | 78 ++++++++++++++++++++-------------- drivers/net/ionic/ionic_rxtx.h | 14 +++++- 6 files changed, 138 insertions(+), 54 deletions(-)
drivers/net/ionic/ionic.h +3 -0
@@ -83,7 +83,10 @@ struct ionic_admin_ctx {union ionic_adminq_comp comp; }; +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx);int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +int ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx); +uint16_t ionic_adminq_space_avail (struct ionic_lif *lif);int ionic_dev_cmd_wait_check (struct ionic_dev *idev,unsigned long max_wait);int ionic_setup (struct ionic_adapter *adapter);
drivers/net/ionic/ionic_lif.c +52 -16
112 lines not on this page · raw message
drivers/net/ionic/ionic_lif.h +9 -3
@@ -10,7 +10,7 @@#include <rte_ethdev.h> #include <rte_ether.h> -#include "ionic_osdep.h" +#include "ionic.h" #include "ionic_dev.h" #include "ionic_rx_filter.h"
@@ -99,6 +99,8 @@ struct ionic_rx_qcq {/* cacheline4+ */ struct rte_mbuf *mbs[IONIC_MBUF_BULK_ALLOC] __rte_cache_aligned; + +struct ionic_admin_ctx admin_ctx; };struct ionic_tx_qcq {
@@ -112,6 +114,8 @@ struct ionic_tx_qcq {uint16_t flags;struct ionic_tx_stats stats; + +struct ionic_admin_ctx admin_ctx; };#define IONIC_Q_TO_QCQ (_q) container_of(_q, struct ionic_qcq, q)
@@ -225,10 +229,12 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id,void ionic_qcq_free (struct ionic_qcq *qcq);int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); -void ionic_lif_rxq_deinit (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq);int ionic_lif_txq_init (struct ionic_tx_qcq *txq); -void ionic_lif_txq_deinit (struct ionic_tx_qcq *txq); +void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);int ionic_lif_rss_config (struct ionic_lif *lif,const uint16_t types,const uint8_t *key,const uint32_t *indir);
drivers/net/ionic/ionic_main.c +15 -2
@@ -180,6 +180,12 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,return true; } +uint16_t +ionic_adminq_space_avail (struct ionic_lif *lif) +{ +return ionic_q_space_avail (&lif->adminqcq->qcq.q); +} +/** ionic_adminq_post - Post an admin command. * @lif: Handle to lif. * @cmd_ctx: Api admin command context.
@@ -191,7 +197,7 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index,* * Return: zero or negative error status. */ -static int +int ionic_adminq_post (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) {struct ionic_queue *q = &lif->adminqcq->qcq.q;
@@ -279,7 +285,6 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif,int ionic_adminq_post_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) { -bool done;int err; IONIC_PRINT(DEBUG, "Sending %s (%d) via the admin queue",
@@ -292,6 +297,14 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx)return err; } +return ionic_adminq_wait (lif, ctx); +} + +int +ionic_adminq_wait (struct ionic_lif *lif,struct ionic_admin_ctx *ctx) +{ +bool done; + done =ionic_adminq_wait_for_completion (lif, ctx,IONIC_DEVCMD_TIMEOUT );
drivers/net/ionic/ionic_rxtx.c +47 -31
111 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +12 -2
@@ -37,14 +37,24 @@ int ionic_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp);void ionic_dev_rx_queue_release (struct rte_eth_dev *dev,uint16_t qid);int ionic_dev_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); -int ionic_dev_rx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t rx_queue_id); +int ionic_dev_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);int ionic_dev_tx_queue_setup (struct rte_eth_dev *dev,uint16_t tx_queue_id,uint16_t nb_desc,uint32_t socket_id,const struct rte_eth_txconf *tx_conf);void ionic_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); -int ionic_dev_tx_queue_stop (struct rte_eth_dev *eth_dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); + +/* Helpers for optimized dev_stop() */ +void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_rx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +void ionic_dev_tx_queue_stop_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +void ionic_dev_tx_queue_stop_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id);void ionic_rxq_info_get (struct rte_eth_dev *dev,uint16_t queue_id,struct rte_eth_rxq_info *qinfo);
Signature · 1 line
2.17.1
PATCH v3 13/13 net/ionic: optimize device start operation
In reply to Andrew BoyerSplit the queue_start operation into first-half and second-half helpers.
This allows us to batch up the queue commands during dev_start(), reducing the outage window when restarting the process by about 1ms per queue.
--- drivers/net/ionic/ionic_lif.c | 136 +++++++++++++++++++++++---------- drivers/net/ionic/ionic_lif.h | 6 +- drivers/net/ionic/ionic_rxtx.c | 81 ++++++++++++++++---- drivers/net/ionic/ionic_rxtx.h | 10 +++ 4 files changed, 176 insertions(+), 57 deletions(-)
drivers/net/ionic/ionic_lif.c +95 -41
@@ -1601,13 +1601,16 @@ ionic_lif_set_features(struct ionic_lif *lif) }int -ionic_lif_txq_init (struct ionic_tx_qcq *txq) +ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq) {struct ionic_qcq *qcq = &txq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { +struct ionic_admin_ctx *ctx = &txq->admin_ctx; +int err; + + *ctx = (struct ionic_admin_ctx ) { .pending_work = true, .cmd.q_init = { .opcode =IONIC_CMD_Q_INIT ,
@@ -1621,32 +1624,41 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq) .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), }, }; -int err;if (txq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (txq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"txq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"txq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"txq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"txq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_txq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_txq_init_done (struct ionic_tx_qcq *txq) +{ +struct ionic_lif *lif = txq->qcq.lif; +struct ionic_queue *q = &txq->qcq.q; +struct ionic_admin_ctx *ctx = &txq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q);IONIC_PRINT (DEBUG ,"txq->hw_type %d" , q->hw_type);
@@ -1654,18 +1666,19 @@ ionic_lif_txq_init(struct ionic_tx_qcq *txq)IONIC_PRINT (DEBUG ,"txq->db %p" , q->db); txq->flags |=IONIC_QCQ_F_INITED ; - -return 0 ; }int -ionic_lif_rxq_init (struct ionic_rx_qcq *rxq) +ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq) {struct ionic_qcq *qcq = &rxq->qcq;struct ionic_queue *q = &qcq->q;struct ionic_lif *lif = qcq->lif;struct ionic_cq *cq = &qcq->cq; -struct ionic_admin_ctx ctx = { +struct ionic_admin_ctx *ctx = &rxq->admin_ctx; +int err; + + *ctx = (struct ionic_admin_ctx ) { .pending_work = true, .cmd.q_init = { .opcode =IONIC_CMD_Q_INIT ,
@@ -1679,32 +1692,41 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) .sg_ring_base = rte_cpu_to_le_64(q->sg_base_pa), }, }; -int err;if (rxq->flags &IONIC_QCQ_F_SG ) - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG ); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_SG );if (rxq->flags &IONIC_QCQ_F_CMB ) { - ctx.cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); + ctx->cmd.q_init.flags |=rte_cpu_to_le_16 (IONIC_QINIT_F_CMB ); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->cmb_base_pa); }else { - ctx.cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); + ctx->cmd.q_init.ring_base =rte_cpu_to_le_64 (q->base_pa); }IONIC_PRINT (DEBUG ,"rxq_init.index %d" , q->index);IONIC_PRINT (DEBUG ,"rxq_init.ring_base 0x%" PRIx64"" , q->base_pa);IONIC_PRINT (DEBUG ,"rxq_init.ring_size %d" , - ctx.cmd.q_init.ring_size); -IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx.cmd.q_init.ver); + ctx->cmd.q_init.ring_size); +IONIC_PRINT (DEBUG ,"rxq_init.ver %u" , ctx->cmd.q_init.ver);ionic_q_reset (q);ionic_cq_reset (cq); - err =ionic_adminq_post_wait (lif, &ctx); +/* Caller responsible for calling ionic_lif_rxq_init_done() */ + err =ionic_adminq_post (lif, ctx);if (err) -return err; + ctx->pending_work = false; +return err; +} - q->hw_type = ctx.comp.q_init.hw_type; - q->hw_index =rte_le_to_cpu_32 (ctx.comp.q_init.hw_index); +void +ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq) +{ +struct ionic_lif *lif = rxq->qcq.lif; +struct ionic_queue *q = &rxq->qcq.q; +struct ionic_admin_ctx *ctx = &rxq->admin_ctx; + + q->hw_type = ctx->comp.q_init.hw_type; + q->hw_index =rte_le_to_cpu_32 (ctx->comp.q_init.hw_index); q->db =ionic_db_map (lif, q); rxq->flags |=IONIC_QCQ_F_INITED ;
@@ -1712,8 +1734,6 @@ ionic_lif_rxq_init(struct ionic_rx_qcq *rxq)IONIC_PRINT (DEBUG ,"rxq->hw_type %d" , q->hw_type);IONIC_PRINT (DEBUG ,"rxq->hw_index %d" , q->hw_index);IONIC_PRINT (DEBUG ,"rxq->db %p" , q->db); - -return 0 ; } static int
@@ -1962,9 +1982,11 @@ ionic_lif_configure(struct ionic_lif *lif)int ionic_lif_start (struct ionic_lif *lif) { +struct rte_eth_dev *dev = lif->eth_dev;uint32_t rx_mode; -uint32_t i; +uint32_t i, j, chunk;int err; +bool fatal = false; err =ionic_lif_rss_setup (lif);if (err)
@@ -1985,25 +2007,57 @@ ionic_lif_start(struct ionic_lif *lif)"on port %u" , lif->nrxqcqs, lif->ntxqcqs, lif->port_id); -for (i =0 ; i < lif->nrxqcqs; i++) { -struct ionic_rx_qcq *rxq = lif->rxqcqs[i]; -if (!(rxq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_rx_queue_start (lif->eth_dev, i); + chunk =ionic_adminq_space_avail (lif); + +for (i =0 ; i < lif->nrxqcqs; i += chunk) { +if (lif->rxqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Rx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { + err =ionic_dev_rx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->nrxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_rx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ; -for (i =0 ; i < lif->ntxqcqs; i++) { -struct ionic_tx_qcq *txq = lif->txqcqs[i]; -if (!(txq->flags &IONIC_QCQ_F_DEFERRED )) { - err =ionic_dev_tx_queue_start (lif->eth_dev, i); +for (i =0 ; i < lif->ntxqcqs; i += chunk) { +if (lif->txqcqs[0 ]->flags &IONIC_QCQ_F_DEFERRED ) { +IONIC_PRINT (DEBUG ,"Tx queue start deferred" ); +break ; + } + +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { + err =ionic_dev_tx_queue_start_firsthalf (dev, i + j); +if (err) { + fatal = true; +break ; + } + } +for (j =0 ; j < chunk && i + j < lif->ntxqcqs; j++) { +/* Commands that failed to post return immediately */ + err =ionic_dev_tx_queue_start_secondhalf (dev, i + j);if (err) -return err; +/* Don't break */ + fatal = true; } } +if (fatal) +return -EIO ;/* Carrier ON here */ lif->state |=IONIC_LIF_F_UP ;
drivers/net/ionic/ionic_lif.h +4 -2
@@ -228,11 +228,13 @@ int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, struct ionic_tx_qcq **qcq_out);void ionic_qcq_free (struct ionic_qcq *qcq); -int ionic_lif_rxq_init (struct ionic_rx_qcq *rxq); +int ionic_lif_rxq_init_nowait (struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_init_done (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_deinit_nowait (struct ionic_rx_qcq *rxq);void ionic_lif_rxq_stats (struct ionic_rx_qcq *rxq); -int ionic_lif_txq_init (struct ionic_tx_qcq *txq); +int ionic_lif_txq_init_nowait (struct ionic_tx_qcq *txq); +void ionic_lif_txq_init_done (struct ionic_tx_qcq *txq);void ionic_lif_txq_deinit_nowait (struct ionic_tx_qcq *txq);void ionic_lif_txq_stats (struct ionic_tx_qcq *txq);
drivers/net/ionic/ionic_rxtx.c +67 -14
126 lines not on this page · raw message
drivers/net/ionic/ionic_rxtx.h +10 -0
@@ -46,6 +46,16 @@ void ionic_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);int ionic_dev_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int ionic_dev_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +/* Helpers for optimized dev_start() */ +int ionic_dev_rx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_rx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t rx_queue_id); +int ionic_dev_tx_queue_start_firsthalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +int ionic_dev_tx_queue_start_secondhalf (struct rte_eth_dev *dev, +uint16_t tx_queue_id); +/* Helpers for optimized dev_stop() */ void ionic_dev_rx_queue_stop_firsthalf (struct rte_eth_dev *dev,uint16_t rx_queue_id);
Signature · 1 line
2.17.1
Quoted 26 lines · Andrew Boyer
This patchset provides miscellaneous fixes and improvements for the net/ionic driver used by AMD Pensando devices.
V3:
- Resend to fix patchwork threading.V2:
- Update device stop and device start patches to use compound literals as suggested by review.Akshay Dorwat (1):
net/ionic: fix RSS query routineAndrew Boyer (8):
net/ionic: add stat for completion queue entries processed net/ionic: increase max supported MTU to 9750 bytes net/ionic: don't auto-enable Rx scatter-gather a second time net/ionic: replace non-standard type in structure definition net/ionic: fix device close sequence to avoid crash net/ionic: optimize device close operation net/ionic: optimize device stop operation net/ionic: optimize device start operationBrad Larson (1):
net/ionic: add flexible firmware xstat counters
Quoted 7 lines
Neel Patel (2):
net/ionic: fix missing volatile type for cqe pointers net/ionic: memcpy descriptors when using Q-in-CMBVamsi Krishna Atluri (1):
net/ionic: report 1G and 200G link speeds when applicable
For series,
Quoted 31 lines · Ferruh Yigit
Quoted 30 lines · Andrew Boyer
This patchset provides miscellaneous fixes and improvements for the net/ionic driver used by AMD Pensando devices.
V3:
- Resend to fix patchwork threading.V2:
- Update device stop and device start patches to use compound literals as suggested by review.Akshay Dorwat (1):
net/ionic: fix RSS query routineAndrew Boyer (8):
net/ionic: add stat for completion queue entries processed net/ionic: increase max supported MTU to 9750 bytes net/ionic: don't auto-enable Rx scatter-gather a second time net/ionic: replace non-standard type in structure definition net/ionic: fix device close sequence to avoid crash net/ionic: optimize device close operation net/ionic: optimize device stop operation net/ionic: optimize device start operationBrad Larson (1):
net/ionic: add flexible firmware xstat countersNeel Patel (2):
net/ionic: fix missing volatile type for cqe pointers net/ionic: memcpy descriptors when using Q-in-CMB
Quoted 7 lines
Quoted 3 lines
Vamsi Krishna Atluri (1):
net/ionic: report 1G and 200G link speeds when applicableFor series,
Acked-by Ferruh Yigit <[email protected]>
Series applied to dpdk-next-net/main, thanks.