diff options
author | Sunil Goutham <sgoutham@cavium.com> | 2017-05-02 16:06:54 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-02 22:41:21 +0300 |
commit | 05c773f52b96ef3fbc7d9bfa21caadc6247ef7a8 (patch) | |
tree | 9d20a83f0b3f08bd3fcd3d0c00920abaa19dfb8c /drivers/net/ethernet/cavium/thunder/nicvf_queues.h | |
parent | 927987f39f116db477fcd74ced2a2aea940e585c (diff) | |
download | linux-05c773f52b96ef3fbc7d9bfa21caadc6247ef7a8.tar.xz |
net: thunderx: Add basic XDP support
Adds basic XDP support i.e attaching a BPF program to an
interface. Also takes care of allocating separate Tx queues
for XDP path and for network stack packet transmission.
This patch doesn't support handling of any of the XDP actions,
all are treated as XDP_PASS i.e packets will be handed over to
the network stack.
Changes also involve allocating one receive buffer per page in XDP
mode and multiple in normal mode i.e when no BPF program is attached.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cavium/thunder/nicvf_queues.h')
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_queues.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h index da4836601d8c..07136a2819ff 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.h +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.h @@ -10,6 +10,7 @@ #define NICVF_QUEUES_H #include <linux/netdevice.h> +#include <linux/iommu.h> #include "q_struct.h" #define MAX_QUEUE_SET 128 @@ -312,6 +313,14 @@ struct queue_set { #define CQ_ERR_MASK (CQ_WR_FULL | CQ_WR_DISABLE | CQ_WR_FAULT) +static inline u64 nicvf_iova_to_phys(struct nicvf *nic, dma_addr_t dma_addr) +{ + /* Translation is installed only when IOMMU is present */ + if (nic->iommu_domain) + return iommu_iova_to_phys(nic->iommu_domain, dma_addr); + return dma_addr; +} + void nicvf_unmap_sndq_buffers(struct nicvf *nic, struct snd_queue *sq, int hdr_sqe, u8 subdesc_cnt); void nicvf_config_vlan_stripping(struct nicvf *nic, |