idpf: XDP chapter II: convert Tx completion to libeth
Subsystems (5)
Alexander Lobakin
maintainerv2 cover idpf: XDP chapter II: convert Tx completion to libeth
XDP for idpf is currently 5 chapters:
* convert Rx to libeth;
* convert Tx completion to libeth (this);
* generic XDP and XSk code changes;
* actual XDP for idpf via libeth_xdp;
* XSk for idpf (^).
Part II does the following:
* adds generic libeth Tx completion routines;
* converts idpf to use generic libeth Tx comp routines;
* fixes Tx queue timeouts and robustifies Tx completion in general;
* fixes Tx event/descriptor flushes (writebacks).
Most idpf patches again remove more lines than adds. Generic Tx completion helpers and structs are needed as libeth_xdp (Ch. III) makes use of them. WB_ON_ITR is needed since XDPSQs don't want to work without it at all. Tx queue timeouts fixes are needed since without them, it's way easier to catch a Tx timeout event when WB_ON_ITR is enabled.
Alexander Lobakin (3):
libeth: add Tx buffer completion helpers
idpf: convert to libeth Tx buffer completion
netdevice: add netdev_tx_reset_subqueue() shorthand
Joshua Hay (2):
idpf: refactor Tx completion routines
idpf: enable WB_ON_ITR
Michal Kubiak (1):
idpf: fix netdev Tx queue stop/wake
include/net/libeth/types.h | 25 ++ drivers/net/ethernet/intel/idpf/idpf_txrx.h | 92 ++-- include/linux/netdevice.h | 13 +- include/net/libeth/tx.h | 129 ++++++ drivers/net/ethernet/intel/idpf/idpf_dev.c | 2 + .../ethernet/intel/idpf/idpf_singleq_txrx.c | 110 +++-- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 394 ++++++++---------- drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 2 + 8 files changed, 441 insertions(+), 326 deletions(-) create mode 100644 include/net/libeth/types.h create mode 100644 include/net/libeth/tx.h
---
From v1[0]:
* drop the stats implementation. It's not generic, uses old Ethtool interfaces and is written using macro templates which made it barely readable (Kuba).
I'll be rewriting it separately.
* replace /* <multi-line comment> with /*\n * <multi-line comment> since the special rule for netdev was removed.
[0] https://lore.kernel.org/netdev/[email protected]
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 1/6 libeth: add Tx buffer completion helpers
Software-side Tx buffers for storing DMA, frame size, skb pointers etc. are pretty much generic and every driver defines them the same way. The same can be said for software Tx completions -- same napi_consume_skb()s and all that...
Add a couple simple wrappers for doing that to stop repeating the old tale at least within the Intel code. Drivers are free to use 'priv' member at the end of the structure.
--- include/net/libeth/types.h | 25 +++++++ include/net/libeth/tx.h | 129 +++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 include/net/libeth/types.h create mode 100644 include/net/libeth/tx.h
include/net/libeth/types.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2024 Intel Corporation */ + +#ifndef __LIBETH_TYPES_H +#define __LIBETH_TYPES_H + +#include <linux/types.h> + +/** +* struct libeth_sq_napi_stats - "hot" counters to update in Tx completion loop +* @packets: completed frames counter +* @bytes: sum of bytes of completed frames above +* @raw: alias to access all the fields as an array +*/ +struct libeth_sq_napi_stats { +union { +struct { +u32 packets; +u32 bytes; + }; + DECLARE_FLEX_ARRAY(u32, raw); + }; +}; + +#endif /* __LIBETH_TYPES_H */
include/net/libeth/tx.h new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 2/6 idpf: convert to libeth Tx buffer completion
In reply to Alexander Lobakin&idpf_tx_buffer is almost identical to the previous generations, as well as the way it's handled. Moreover, relying on dma_unmap_addr() and !!buf->skb instead of explicit defining of buffer's type was never good. Use the newly added libeth helpers to do it properly and reduce the copy-paste around the Tx code.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 50 +---- .../ethernet/intel/idpf/idpf_singleq_txrx.c | 82 +++---- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 205 +++++++----------- 3 files changed, 105 insertions(+), 232 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -48
@@ -131,7 +131,6 @@ do { \ (txq)->num_completions_pending - (txq)->complq->num_completions)#define IDPF_TX_SPLITQ_COMPL_TAG_WIDTH 16 -#define IDPF_SPLITQ_TX_INVAL_COMPL_TAG -1/* Adjust the generation for the completion tag and wrap if necessary */ #define IDPF_TX_ADJ_COMPL_TAG_GEN (txq) \ ((++(txq)->compl_tag_cur_gen) >= (txq)->compl_tag_gen_max ? \
@@ -149,47 +148,7 @@ union idpf_tx_flex_desc {struct idpf_flex_tx_sched_desc flow;/* flow based scheduling */ }; -/** -* struct idpf_tx_buf -* @next_to_watch: Next descriptor to clean -* @skb: Pointer to the skb -* @dma: DMA address -* @len: DMA length -* @bytecount: Number of bytes -* @gso_segs: Number of GSO segments -* @compl_tag: Splitq only, unique identifier for a buffer. Used to compare -* with completion tag returned in buffer completion event. -* Because the completion tag is expected to be the same in all -* data descriptors for a given packet, and a single packet can -* span multiple buffers, we need this field to track all -* buffers associated with this completion tag independently of -* the buf_id. The tag consists of a N bit buf_id and M upper -* order "generation bits". See compl_tag_bufid_m and -* compl_tag_gen_s in struct idpf_queue. We'll use a value of -1 -* to indicate the tag is not valid. -* @ctx_entry: Singleq only. Used to indicate the corresponding entry -* in the descriptor ring was used for a context descriptor and -* this buffer entry should be skipped. -*/ -struct idpf_tx_buf { -void *next_to_watch; -struct sk_buff *skb; -DEFINE_DMA_UNMAP_ADDR (dma); -DEFINE_DMA_UNMAP_LEN (len); -unsigned int bytecount; -unsigned short gso_segs; - -union { -int compl_tag; - -bool ctx_entry; - }; -}; - -struct idpf_tx_stash { -struct hlist_node hlist; -struct idpf_tx_buf buf; -}; +#define idpf_tx_buf libeth_sqe/** * struct idpf_buf_lifo - LIFO for managing OOO completions
@@ -496,11 +455,6 @@ struct idpf_tx_queue_stats {u64_stats_t dma_map_errs; }; -struct idpf_cleaned_stats { -u32 packets; -u32 bytes; -}; -#define IDPF_ITR_DYNAMIC 1#define IDPF_ITR_MAX 0x1FE0#define IDPF_ITR_20K 0x0032
@@ -688,7 +642,7 @@ struct idpf_tx_queue {void *desc_ring; }; -struct idpf_tx_buf *tx_buf; +struct libeth_sqe *tx_buf;struct idpf_txq_group *txq_grp;struct device *dev;void __iomem *tail;
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +30 -52
168 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_txrx.c +73 -132
391 lines not on this page · raw message
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 3/6 netdevice: add netdev_tx_reset_subqueue() shorthand
In reply to Alexander LobakinAdd a shorthand similar to other net*_subqueue() helpers for resetting the queue by its index w/o obtaining &netdev_tx_queue beforehand manually.
--- include/linux/netdevice.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
include/linux/netdevice.h +12 -1
@@ -3599,6 +3599,17 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)#endif } +/** +* netdev_tx_reset_subqueue - reset the BQL stats and state of a netdev queue +* @dev: network device +* @qid: stack index of the queue to reset +*/ +static inline void netdev_tx_reset_subqueue (const struct net_device *dev, +u32 qid) +{ +netdev_tx_reset_queue (netdev_get_tx_queue (dev, qid)); +} +/** * netdev_reset_queue - reset the packets and bytes count of a network device * @dev_queue: network device
@@ -3608,7 +3619,7 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)*/ static inline void netdev_reset_queue (struct net_device *dev_queue) { -netdev_tx_reset_queue (netdev_get_tx_queue (dev_queue,0 )); +netdev_tx_reset_subqueue (dev_queue,0 ); }/**
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 4/6 idpf: refactor Tx completion routines
In reply to Alexander LobakinFrom: Joshua Hay <[email protected]>
Add a mechanism to guard against stashing partial packets into the hash table to make the driver more robust, with more efficient decision making when cleaning.
Don't stash partial packets. This can happen when an RE (Report Event) completion is received in flow scheduling mode, or when an out of order RS (Report Status) completion is received. The first buffer with the skb is stashed, but some or all of its frags are not because the stack is out of reserve buffers. This leaves the ring in a weird state since the frags are still on the ring.
Use the field libeth_sqe::nr_frags to track the number of fragments/tx_bufs representing the packet. The clean routines check to make sure there are enough reserve buffers on the stack before stashing any part of the packet. If there are not, next_to_clean is left pointing to the first buffer of the packet that failed to be stashed. This leaves the whole packet on the ring, and the next time around, cleaning will start from this packet.
An RS completion is still expected for this packet in either case. So instead of being cleaned from the hash table, it will be cleaned from the ring directly. This should all still be fine since the DESC_UNUSED and BUFS_UNUSED will reflect the state of the ring. If we ever fall below the thresholds, the TxQ will still be stopped, giving the completion queue time to catch up. This may lead to stopping the queue more frequently, but it guarantees the Tx ring will always be in a good state.
Also, always use the idpf_tx_splitq_clean function to clean descriptors, i.e. use it from clean_buf_ring as well. This way we avoid duplicating the logic and make sure we're using the same reserve buffers guard rail.
This does require a switch from the s16 next_to_clean overflow descriptor ring wrap calculation to u16 and the normal ring size check.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 6 +- .../ethernet/intel/idpf/idpf_singleq_txrx.c | 24 +-- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 167 +++++++++++------- 3 files changed, 121 insertions(+), 76 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +3 -3
@@ -127,7 +127,7 @@ do { \*/ #define IDPF_TX_COMPLQ_PENDING (txq) \ (((txq)->num_completions_pending >= (txq)->complq->num_completions ? \ - 0 : U64_MAX) + \ + 0 : U32_MAX) + \ (txq)->num_completions_pending - (txq)->complq->num_completions)#define IDPF_TX_SPLITQ_COMPL_TAG_WIDTH 16
@@ -785,7 +785,7 @@ struct idpf_compl_queue {u32 next_to_use;u32 next_to_clean; -u32 num_completions; +aligned_u64 num_completions;__cacheline_group_end_aligned (read_write);__cacheline_group_begin_aligned (cold);
@@ -917,7 +917,7 @@ struct idpf_txq_group {struct idpf_compl_queue *complq; -u32 num_completions_pending; +aligned_u64 num_completions_pending; };static inline int idpf_q_vector_to_mem (const struct idpf_q_vector *q_vector)
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +14 -10
@@ -239,15 +239,16 @@ static void idpf_tx_singleq_map(struct idpf_tx_queue *tx_q, offsets, max_data, td_tag); - tx_desc++; - i++; - -if (i == tx_q->desc_count) { +if (unlikely (++i == tx_q->desc_count)) { + tx_buf = &tx_q->tx_buf[0 ]; tx_desc = &tx_q->base_tx[0 ]; i =0 ; + }else { + tx_buf++; + tx_desc++; } - tx_q->tx_buf[i].type =LIBETH_SQE_EMPTY ; + tx_buf->type =LIBETH_SQE_EMPTY ; dma += max_data; size -= max_data;
@@ -261,12 +262,14 @@ static void idpf_tx_singleq_map(struct idpf_tx_queue *tx_q, tx_desc->qw1 =idpf_tx_singleq_build_ctob (td_cmd, offsets, size, td_tag); - tx_desc++; - i++; -if (i == tx_q->desc_count) { +if (unlikely (++i == tx_q->desc_count)) { + tx_buf = &tx_q->tx_buf[0 ]; tx_desc = &tx_q->base_tx[0 ]; i =0 ; + }else { + tx_buf++; + tx_desc++; } size =skb_frag_size (frag);
@@ -274,8 +277,6 @@ static void idpf_tx_singleq_map(struct idpf_tx_queue *tx_q, dma =skb_frag_dma_map (tx_q->dev, frag,0 , size,DMA_TO_DEVICE ); - - tx_buf = &tx_q->tx_buf[i]; }skb_tx_timestamp (first->skb);
@@ -454,6 +455,9 @@ static bool idpf_tx_singleq_clean(struct idpf_tx_queue *tx_q, int napi_budget, goto fetch_next_txq_desc; } +if (unlikely (tx_buf->type !=LIBETH_SQE_SKB )) +break ; +/* prevent any other reads prior to type */ smp_rmb ();
drivers/net/ethernet/intel/idpf/idpf_txrx.c +104 -63
342 lines not on this page · raw message
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 5/6 idpf: fix netdev Tx queue stop/wake
In reply to Alexander LobakinFrom: Michal Kubiak <[email protected]>
netif_txq_maybe_stop() returns -1, 0, or 1, while idpf_tx_maybe_stop_common() says it returns 0 or -EBUSY. As a result, there sometimes are Tx queue timeout warnings despite that the queue is empty or there is at least enough space to restart it. Make idpf_tx_maybe_stop_common() inline and returning true or false, handling the return of netif_txq_maybe_stop() properly. Use a correct goto in idpf_tx_maybe_stop_splitq() to avoid stopping the queue or incrementing the stops counter twice.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 9 ++++- .../ethernet/intel/idpf/idpf_singleq_txrx.c | 4 +++ drivers/net/ethernet/intel/idpf/idpf_txrx.c | 35 +++++-------------- 3 files changed, 21 insertions(+), 27 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +8 -1
@@ -1018,7 +1018,6 @@ void idpf_tx_dma_map_error(struct idpf_tx_queue *txq, struct sk_buff *skb, struct idpf_tx_buf *first, u16 ring_idx);unsigned int idpf_tx_desc_count_required (struct idpf_tx_queue *txq,struct sk_buff *skb); -int idpf_tx_maybe_stop_common (struct idpf_tx_queue *tx_q,unsigned int size);void idpf_tx_timeout (struct net_device *netdev,unsigned int txqueue);netdev_tx_t idpf_tx_singleq_frame (struct sk_buff *skb,struct idpf_tx_queue *tx_q);
@@ -1027,4 +1026,12 @@ bool idpf_rx_singleq_buf_hw_alloc_all(struct idpf_rx_queue *rxq, u16 cleaned_count);int idpf_tso (struct sk_buff *skb,struct idpf_tx_offload_params *off); +static inline bool idpf_tx_maybe_stop_common (struct idpf_tx_queue *tx_q, +u32 needed) +{ +return !netif_subqueue_maybe_stop (tx_q->netdev, tx_q->idx, +IDPF_DESC_UNUSED (tx_q), + needed, needed); +} +#endif /* !_IDPF_TXRX_H_ */
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +4 -0
@@ -375,6 +375,10 @@ netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb, IDPF_TX_DESCS_FOR_CTX)) {idpf_tx_buf_hw_update (tx_q, tx_q->next_to_use, false); +u64_stats_update_begin (&tx_q->stats_sync); +u64_stats_inc (&tx_q->q_stats.q_busy); +u64_stats_update_end (&tx_q->stats_sync); +return NETDEV_TX_BUSY ; }
drivers/net/ethernet/intel/idpf/idpf_txrx.c +9 -26
@@ -2131,29 +2131,6 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, desc->flow.qw1.compl_tag =cpu_to_le16 (params->compl_tag); } -/** -* idpf_tx_maybe_stop_common - 1st level check for common Tx stop conditions -* @tx_q: the queue to be checked -* @size: number of descriptors we want to assure is available -* -* Returns 0 if stop is not needed -*/ -int idpf_tx_maybe_stop_common (struct idpf_tx_queue *tx_q,unsigned int size) -{ -struct netdev_queue *nq; - -if (likely (IDPF_DESC_UNUSED (tx_q) >= size)) -return 0 ; - -u64_stats_update_begin (&tx_q->stats_sync); -u64_stats_inc (&tx_q->q_stats.q_busy); -u64_stats_update_end (&tx_q->stats_sync); - - nq =netdev_get_tx_queue (tx_q->netdev, tx_q->idx); - -return netif_txq_maybe_stop (nq,IDPF_DESC_UNUSED (tx_q), size, size); -} -/** * idpf_tx_maybe_stop_splitq - 1st level check for Tx splitq stop conditions * @tx_q: the queue to be checked
@@ -2165,7 +2142,7 @@ static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q, unsigned int descs_needed) {if (idpf_tx_maybe_stop_common (tx_q, descs_needed)) - goto splitq_stop; + goto out;/* If there are too many outstanding completions expected on the * completion queue, stop the TX queue to give the device some time to
@@ -2184,10 +2161,12 @@ static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q,return 0 ; splitq_stop: +netif_stop_subqueue (tx_q->netdev, tx_q->idx); + +out:u64_stats_update_begin (&tx_q->stats_sync);u64_stats_inc (&tx_q->q_stats.q_busy);u64_stats_update_end (&tx_q->stats_sync); -netif_stop_subqueue (tx_q->netdev, tx_q->idx);return -EBUSY ; }
@@ -2210,7 +2189,11 @@ void idpf_tx_buf_hw_update(struct idpf_tx_queue *tx_q, u32 val, nq =netdev_get_tx_queue (tx_q->netdev, tx_q->idx); tx_q->next_to_use = val; -idpf_tx_maybe_stop_common (tx_q,IDPF_TX_DESC_NEEDED ); +if (idpf_tx_maybe_stop_common (tx_q,IDPF_TX_DESC_NEEDED )) { +u64_stats_update_begin (&tx_q->stats_sync); +u64_stats_inc (&tx_q->q_stats.q_busy); +u64_stats_update_end (&tx_q->stats_sync); + }/* Force memory writes to complete before letting h/w * know there are new descriptors to fetch. (Only
Signature · 1 line
2.46.0
Alexander Lobakin
maintainerPATCH v2 6/6 idpf: enable WB_ON_ITR
In reply to Alexander LobakinFrom: Joshua Hay <[email protected]>
Tell hardware to write back completed descriptors even when interrupts are disabled. Otherwise, descriptors might not be written back until the hardware can flush a full cacheline of descriptors. This can cause unnecessary delays when traffic is light (or even trigger Tx queue timeout).
The example scenario to reproduce the Tx timeout if the fix is not applied:
- configure at least 2 Tx queues to be assigned to the same q_vector,
- generate a huge Tx traffic on the first Tx queue
- try to send a few packets using the second Tx queue.
In such a case Tx timeout will appear on the second Tx queue because no completion descriptors are written back for that queue while interrupts are disabled due to NAPI polling.
--- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 27 ++++++++++++++++++- drivers/net/ethernet/intel/idpf/idpf_dev.c | 2 ++ .../ethernet/intel/idpf/idpf_singleq_txrx.c | 6 ++++- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 7 ++++- drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 2 ++ 5 files changed, 41 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_txrx.h +26 -1
@@ -349,9 +349,11 @@ struct idpf_vec_regs {* struct idpf_intr_reg * @dyn_ctl: Dynamic control interrupt register * @dyn_ctl_intena_m: Mask for dyn_ctl interrupt enable +* @dyn_ctl_intena_msk_m: Mask for dyn_ctl interrupt enable mask * @dyn_ctl_itridx_s: Register bit offset for ITR index * @dyn_ctl_itridx_m: Mask for ITR index * @dyn_ctl_intrvl_s: Register bit offset for ITR interval +* @dyn_ctl_wb_on_itr_m: Mask for WB on ITR feature * @rx_itr: RX ITR register * @tx_itr: TX ITR register * @icr_ena: Interrupt cause register offset
@@ -360,9 +362,11 @@ struct idpf_vec_regs {struct idpf_intr_reg {void __iomem *dyn_ctl;u32 dyn_ctl_intena_m; +u32 dyn_ctl_intena_msk_m;u32 dyn_ctl_itridx_s;u32 dyn_ctl_itridx_m;u32 dyn_ctl_intrvl_s; +u32 dyn_ctl_wb_on_itr_m;void __iomem *rx_itr;void __iomem *tx_itr;void __iomem *icr_ena;
@@ -383,6 +387,7 @@ struct idpf_intr_reg {* @intr_reg: See struct idpf_intr_reg * @napi: napi handler * @total_events: Number of interrupts processed +* @wb_on_itr: whether WB on ITR is enabled * @tx_dim: Data for TX net_dim algorithm * @tx_itr_value: TX interrupt throttling rate * @tx_intr_mode: Dynamic ITR or not
@@ -413,6 +418,7 @@ struct idpf_q_vector {__cacheline_group_begin_aligned (read_write);struct napi_struct napi;u16 total_events; +bool wb_on_itr;struct dim tx_dim;u16 tx_itr_value;
@@ -431,7 +437,7 @@ struct idpf_q_vector {cpumask_var_t affinity_mask;__cacheline_group_end_aligned (cold); }; -libeth_cacheline_set_assert(struct idpf_q_vector, 104, +libeth_cacheline_set_assert(struct idpf_q_vector, 112,424 +2 *sizeof (struct dim ), 8 + sizeof(cpumask_var_t));
@@ -987,6 +993,25 @@ static inline void idpf_tx_splitq_build_desc(union idpf_tx_flex_desc *desc,idpf_tx_splitq_build_flow_desc (desc, params, td_cmd, size); } +/** +* idpf_vport_intr_set_wb_on_itr - enable descriptor writeback on disabled interrupts +* @q_vector: pointer to queue vector struct +*/ +static inline void idpf_vport_intr_set_wb_on_itr (struct idpf_q_vector *q_vector) +{ +struct idpf_intr_reg *reg; + +if (q_vector->wb_on_itr) +return ; + + q_vector->wb_on_itr = true; + reg = &q_vector->intr_reg; + +writel (reg->dyn_ctl_wb_on_itr_m | reg->dyn_ctl_intena_msk_m | + (IDPF_NO_ITR_UPDATE_IDX << reg->dyn_ctl_itridx_s), + reg->dyn_ctl); +} +int idpf_vport_singleq_napi_poll (struct napi_struct *napi,int budget);void idpf_vport_init_num_qs (struct idpf_vport *vport,struct virtchnl2_create_vport *vport_msg);
drivers/net/ethernet/intel/idpf/idpf_dev.c +2 -0
@@ -97,8 +97,10 @@ static int idpf_intr_reg_init(struct idpf_vport *vport) intr->dyn_ctl =idpf_get_reg_addr (adapter, reg_vals[vec_id].dyn_ctl_reg); intr->dyn_ctl_intena_m =PF_GLINT_DYN_CTL_INTENA_M ; + intr->dyn_ctl_intena_msk_m =PF_GLINT_DYN_CTL_INTENA_MSK_M ; intr->dyn_ctl_itridx_s =PF_GLINT_DYN_CTL_ITR_INDX_S ; intr->dyn_ctl_intrvl_s =PF_GLINT_DYN_CTL_INTERVAL_S ; + intr->dyn_ctl_wb_on_itr_m =PF_GLINT_DYN_CTL_WB_ON_ITR_M ; spacing =IDPF_ITR_IDX_SPACING (reg_vals[vec_id].itrn_index_spacing,IDPF_PF_ITR_IDX_SPACING );
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +5 -1
@@ -1120,8 +1120,10 @@ int idpf_vport_singleq_napi_poll(struct napi_struct *napi, int budget) &work_done);/* If work not completed, return budget and polling will return */ -if (!clean_complete) +if (!clean_complete) { +idpf_vport_intr_set_wb_on_itr (q_vector);return budget; + } work_done =min_t (int, work_done, budget -1 );
@@ -1130,6 +1132,8 @@ int idpf_vport_singleq_napi_poll(struct napi_struct *napi, int budget)*/ if (likely (napi_complete_done (napi, work_done)))idpf_vport_intr_update_itr_ena_irq (q_vector); +else +idpf_vport_intr_set_wb_on_itr (q_vector);return work_done; }
drivers/net/ethernet/intel/idpf/idpf_txrx.c +6 -1
@@ -3714,6 +3714,7 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector)/* net_dim() updates ITR out-of-band using a work item */ idpf_net_dim (q_vector); + q_vector->wb_on_itr = false; intval =idpf_vport_intr_buildreg_itr (q_vector,IDPF_NO_ITR_UPDATE_IDX ,0 );
@@ -4016,8 +4017,10 @@ static int idpf_vport_splitq_napi_poll(struct napi_struct *napi, int budget) clean_complete &=idpf_tx_splitq_clean_all (q_vector, budget, &work_done);/* If work not completed, return budget and polling will return */ -if (!clean_complete) +if (!clean_complete) { +idpf_vport_intr_set_wb_on_itr (q_vector);return budget; + } work_done =min_t (int, work_done, budget -1 );
@@ -4026,6 +4029,8 @@ static int idpf_vport_splitq_napi_poll(struct napi_struct *napi, int budget)*/ if (likely (napi_complete_done (napi, work_done)))idpf_vport_intr_update_itr_ena_irq (q_vector); +else +idpf_vport_intr_set_wb_on_itr (q_vector);/* Switch to poll mode in the tear-down path after sending disable * queues virtchnl message, as the interrupts will be disabled after
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c +2 -0
@@ -97,7 +97,9 @@ static int idpf_vf_intr_reg_init(struct idpf_vport *vport) intr->dyn_ctl =idpf_get_reg_addr (adapter, reg_vals[vec_id].dyn_ctl_reg); intr->dyn_ctl_intena_m =VF_INT_DYN_CTLN_INTENA_M ; + intr->dyn_ctl_intena_msk_m =VF_INT_DYN_CTLN_INTENA_MSK_M ; intr->dyn_ctl_itridx_s =VF_INT_DYN_CTLN_ITR_INDX_S ; + intr->dyn_ctl_wb_on_itr_m =VF_INT_DYN_CTLN_WB_ON_ITR_M ; spacing =IDPF_ITR_IDX_SPACING (reg_vals[vec_id].itrn_index_spacing,IDPF_VF_ITR_IDX_SPACING );
Signature · 1 line
2.46.0