Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wb on itr newest fixes #6

Draft
wants to merge 4 commits into
base: idpf-top
Choose a base branch
from
Draft

Commits on Mar 6, 2024

  1. idpf-linux: refactor idpf_tx_buf structure

    This patch does main 3 thngs: it 1) adds a mechanism to guard against
    stashing partial packets into the hash table, 2) uses a type field to
    more efficiently identify the information contained in any given tx_buf
    struct and what to do with it, 3) removes the 8 byte next_to_watch
    pointer in favor of a much smaller index field. This all makes the
    driver more robust, leads to more efficient decision making when
    cleaning, and makes the idpf_tx_buf struct more cache friendly.
    
    Part 1: don't stash partial packets. This can happen when an RE
    completion is received in flow scheduling mode, or when an out of order
    RS 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.
    
    Add a field 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.
    
    Part 2: add a type field. Part of shrinking the tx_buf struct size
    required reverting the completion tag to a u16 instead of an int. The
    int was necessary so we could use -1 to indicate that a completion tag
    was invalid, and thus any tx_buf with an invalid completion tag was
    effectively empty / should be ignored.
    
    Instead, now use an explcit EMPTY type to indicate that a tx_buf is
    empty/should be ignored. This has the added benefit of eliminating the
    need to clear the tx_bufs of any stale data. The type can simply be set
    to EMPTY and the cleaning routines can simply move on.
    
    The invalid completion tag was also used to indicate that a tx_buf was
    empty because its corresponding index on the descriptor ring was used
    for a context descriptor. Now use an explicit RESERVED type to signal to
    the cleaning routines to skip that descriptor/tx_buf.
    
    Part 3: use a smaller end of packet field. To further reduce the size of
    the tx_buf struct, the 8 byte next_to_watch pointer is replaced with a 2
    byte index. next_to_watch was used a pointer to the last descriptor of
    the packet. Instead, just use that descriptor's index as this can be
    represented with a much smaller type. Plus, now all of the cleaning
    routines use the same mechanism to loop through the rest of the packet.
    
    This does require a switch from the s16 next_to_clean overflow
    descriptor
    ring wrap calculation to u16 and the normal ring size check.
    
    Signed-off-by: Joshua Hay <[email protected]>
    Signed-off-by: Michal Kubiak <[email protected]>
    jahay1 authored and michalQb committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5c00f15 View commit details
    Browse the repository at this point in the history
  2. idpf: enable WB_ON_ITR

    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.
    
    The patch is necessary to start work on the AF_XDP implementation for
    the idpf driver, because there may be a case where a regular LAN Tx
    queue and an XDP queue share the same NAPI.
    
    Fixes: c2d548c ("idpf: add TX splitq napi poll support")
    Fixes: a5ab9ee ("idpf: add singleq start_xmit and napi poll")
    Reviewed-by: Przemek Kitszel <[email protected]>
    Reviewed-by: Alexander Lobakin <[email protected]>
    Signed-off-by: Joshua Hay <[email protected]>
    Co-developed-by: Michal Kubiak <[email protected]>
    Signed-off-by: Michal Kubiak <[email protected]>
    jahay1 authored and michalQb committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    dde052f View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Fix tx_stop/start

    michalQb committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    eb4bf16 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. Configuration menu
    Copy the full SHA
    2163fda View commit details
    Browse the repository at this point in the history