Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

XDP i40e driver testing #16

Open
williamtu opened this issue Feb 5, 2017 · 0 comments
Open

XDP i40e driver testing #16

williamtu opened this issue Feb 5, 2017 · 0 comments

Comments

@williamtu
Copy link
Contributor

williamtu commented Feb 5, 2017

I observed 2 issues.

  1. no xdp adjust head support
/**
 * i40e_xdp_setup - Add/remove an XDP program to a VSI
 * @vsi: the VSI to add the program
 * @prog: the XDP program
 **/
int i40e_xdp_setup(struct i40e_vsi *vsi, 
                          struct bpf_prog *prog)
{
        struct i40e_pf *pf = vsi->back;
        struct net_device *netdev = vsi->netdev;
        int i, frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
        bool need_reset;
        struct bpf_prog *old_prog;

        if (prog && prog->xdp_adjust_head)
                return -EOPNOTSUPP;
  1. When dropping packets from XDP, it still counts as rx_receive++, not rx_dropped++
    return XDP_DROP
static bool i40e_run_xdp(struct i40e_ring *rx_ring,
                         struct i40e_rx_buffer *rx_buffer,
                         union i40e_rx_desc *rx_desc,
                         unsigned int size,
                         struct bpf_prog *xdp_prog)
{
...
        case XDP_DROP:
do_drop:
                if (likely(i40e_page_is_reusable(rx_buffer->page))) {
                        i40e_reuse_rx_page(rx_ring, rx_buffer);
                        rx_ring->rx_stats.page_reuse_count++;
                        break;
                }
                dma_unmap_page(rx_ring->dev, rx_buffer->dma, PAGE_SIZE,
                               DMA_FROM_DEVICE);
                __free_pages(rx_buffer->page, 0);
                break;
        default:
                bpf_warn_invalid_xdp_action(xdp_action);
                goto do_drop;
        }

        /* clear contents of buffer_info */
        rx_buffer->page = NULL;
        return true; /* Swallowed by XDP */

return true will add packets stats to txdp_consumed_bytes

static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
{
...
                skb = i40e_fetch_rx_buffer(rx_ring, rx_desc, skb,
                                           &xdp_consumed_bytes);
                if (xdp_consumed_bytes) {
                        cleaned_count++;

                        i40e_update_rx_next_to_clean(rx_ring);

                        total_rx_bytes += xdp_consumed_bytes;
                        total_rx_packets++;

@williamtu williamtu changed the title XDP i40e XDP i40e driver testing Feb 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant