| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
* |
| 3 |
* Linux driver for VMware's vmxnet3 ethernet NIC. |
| 4 |
* Copyright (C) 2008-2023, VMware, Inc. All Rights Reserved. |
| 5 |
* Maintained by: [email protected] |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef _VMXNET3_XDP_H |
| 10 |
#define _VMXNET3_XDP_H |
| 11 |
|
| 12 |
#include <linux/filter.h> |
| 13 |
#include <linux/bpf_trace.h> |
| 14 |
#include <linux/netlink.h> |
| 15 |
|
| 16 |
#include "vmxnet3_int.h" |
| 17 |
|
| 18 |
#define VMXNET3_XDP_HEADROOM (XDP_PACKET_HEADROOM + NET_IP_ALIGN) |
| 19 |
#define VMXNET3_XDP_RX_TAILROOM SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) |
| 20 |
#define VMXNET3_XDP_RX_OFFSET VMXNET3_XDP_HEADROOM |
| 21 |
#define VMXNET3_XDP_MAX_FRSIZE (PAGE_SIZE - VMXNET3_XDP_HEADROOM - \ |
| 22 |
VMXNET3_XDP_RX_TAILROOM) |
| 23 |
#define VMXNET3_XDP_MAX_MTU (VMXNET3_XDP_MAX_FRSIZE - ETH_HLEN - \ |
| 24 |
2 * VLAN_HLEN - ETH_FCS_LEN) |
| 25 |
|
| 26 |
int vmxnet3_xdp(struct net_device *netdev, struct netdev_bpf *bpf); |
| 27 |
int vmxnet3_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, |
| 28 |
u32 flags); |
| 29 |
int vmxnet3_process_xdp(struct vmxnet3_adapter *adapter, |
| 30 |
struct vmxnet3_rx_queue *rq, |
| 31 |
struct Vmxnet3_RxCompDesc *rcd, |
| 32 |
struct vmxnet3_rx_buf_info *rbi, |
| 33 |
struct Vmxnet3_RxDesc *rxd, |
| 34 |
struct sk_buff **skb_xdp_pass); |
| 35 |
int vmxnet3_process_xdp_small(struct vmxnet3_adapter *adapter, |
| 36 |
struct vmxnet3_rx_queue *rq, |
| 37 |
void *data, int len, |
| 38 |
struct sk_buff **skb_xdp_pass); |
| 39 |
void *vmxnet3_pp_get_buff(struct page_pool *pp, dma_addr_t *dma_addr, |
| 40 |
gfp_t gfp_mask); |
| 41 |
|
| 42 |
static inline bool vmxnet3_xdp_enabled(struct vmxnet3_adapter *adapter) |
| 43 |
{ |
| 44 |
return !!rcu_access_pointer(adapter->xdp_bpf_prog); |
| 45 |
} |
| 46 |
|
| 47 |
#endif |