Commit c7aec596 authored by Tony Nguyen's avatar Tony Nguyen Committed by Jeff Kirsher

ixgbevf: Add XDP support for pass and drop actions

Implement XDP_PASS and XDP_DROP based on the ixgbe implementation.

Based largely on commit 92470808 ("ixgbe: add XDP support for pass and
drop actions").
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 70da6824
/******************************************************************************* /*******************************************************************************
Intel 82599 Virtual Function driver Intel 82599 Virtual Function driver
Copyright(c) 1999 - 2015 Intel Corporation. Copyright(c) 1999 - 2018 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -336,8 +336,13 @@ static int ixgbevf_set_ringparam(struct net_device *netdev, ...@@ -336,8 +336,13 @@ static int ixgbevf_set_ringparam(struct net_device *netdev,
for (i = 0; i < adapter->num_rx_queues; i++) { for (i = 0; i < adapter->num_rx_queues; i++) {
/* clone ring and setup updated count */ /* clone ring and setup updated count */
rx_ring[i] = *adapter->rx_ring[i]; rx_ring[i] = *adapter->rx_ring[i];
/* Clear copied XDP RX-queue info */
memset(&rx_ring[i].xdp_rxq, 0,
sizeof(rx_ring[i].xdp_rxq));
rx_ring[i].count = new_rx_count; rx_ring[i].count = new_rx_count;
err = ixgbevf_setup_rx_resources(&rx_ring[i]); err = ixgbevf_setup_rx_resources(adapter, &rx_ring[i]);
if (err) { if (err) {
while (i) { while (i) {
i--; i--;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/******************************************************************************* /*******************************************************************************
Intel 82599 Virtual Function driver Intel 82599 Virtual Function driver
Copyright(c) 1999 - 2015 Intel Corporation. Copyright(c) 1999 - 2018 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/u64_stats_sync.h> #include <linux/u64_stats_sync.h>
#include <net/xdp.h>
#include "vf.h" #include "vf.h"
...@@ -100,6 +101,7 @@ struct ixgbevf_ring { ...@@ -100,6 +101,7 @@ struct ixgbevf_ring {
struct ixgbevf_ring *next; struct ixgbevf_ring *next;
struct ixgbevf_q_vector *q_vector; /* backpointer to q_vector */ struct ixgbevf_q_vector *q_vector; /* backpointer to q_vector */
struct net_device *netdev; struct net_device *netdev;
struct bpf_prog *xdp_prog;
struct device *dev; struct device *dev;
void *desc; /* descriptor ring memory */ void *desc; /* descriptor ring memory */
dma_addr_t dma; /* phys. address of descriptor ring */ dma_addr_t dma; /* phys. address of descriptor ring */
...@@ -120,7 +122,7 @@ struct ixgbevf_ring { ...@@ -120,7 +122,7 @@ struct ixgbevf_ring {
struct ixgbevf_tx_queue_stats tx_stats; struct ixgbevf_tx_queue_stats tx_stats;
struct ixgbevf_rx_queue_stats rx_stats; struct ixgbevf_rx_queue_stats rx_stats;
}; };
struct xdp_rxq_info xdp_rxq;
u64 hw_csum_rx_error; u64 hw_csum_rx_error;
u8 __iomem *tail; u8 __iomem *tail;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -357,6 +359,7 @@ struct ixgbevf_adapter { ...@@ -357,6 +359,7 @@ struct ixgbevf_adapter {
/* OS defined structs */ /* OS defined structs */
struct net_device *netdev; struct net_device *netdev;
struct bpf_prog *xdp_prog;
struct pci_dev *pdev; struct pci_dev *pdev;
/* structs defined in ixgbe_vf.h */ /* structs defined in ixgbe_vf.h */
...@@ -443,7 +446,8 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter); ...@@ -443,7 +446,8 @@ void ixgbevf_down(struct ixgbevf_adapter *adapter);
void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter); void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter);
void ixgbevf_reset(struct ixgbevf_adapter *adapter); void ixgbevf_reset(struct ixgbevf_adapter *adapter);
void ixgbevf_set_ethtool_ops(struct net_device *netdev); void ixgbevf_set_ethtool_ops(struct net_device *netdev);
int ixgbevf_setup_rx_resources(struct ixgbevf_ring *); int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter,
struct ixgbevf_ring *rx_ring);
int ixgbevf_setup_tx_resources(struct ixgbevf_ring *); int ixgbevf_setup_tx_resources(struct ixgbevf_ring *);
void ixgbevf_free_rx_resources(struct ixgbevf_ring *); void ixgbevf_free_rx_resources(struct ixgbevf_ring *);
void ixgbevf_free_tx_resources(struct ixgbevf_ring *); void ixgbevf_free_tx_resources(struct ixgbevf_ring *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment