1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2018 Intel Corporation. */
3 
4 #ifndef _IXGBE_TXRX_COMMON_H_
5 #define _IXGBE_TXRX_COMMON_H_
6 
7 #define IXGBE_XDP_PASS		0
8 #define IXGBE_XDP_CONSUMED	BIT(0)
9 #define IXGBE_XDP_TX		BIT(1)
10 #define IXGBE_XDP_REDIR		BIT(2)
11 #define IXGBE_XDP_EXIT		BIT(3)
12 
13 #define IXGBE_TXD_CMD (IXGBE_TXD_CMD_EOP | \
14 		       IXGBE_TXD_CMD_RS)
15 
16 int ixgbe_xmit_xdp_ring(struct ixgbe_ring *ring,
17 			struct xdp_frame *xdpf);
18 bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring,
19 			   union ixgbe_adv_rx_desc *rx_desc,
20 			   struct sk_buff *skb);
21 void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
22 			      union ixgbe_adv_rx_desc *rx_desc,
23 			      struct sk_buff *skb);
24 void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
25 		  struct sk_buff *skb);
26 void ixgbe_xdp_ring_update_tail(struct ixgbe_ring *ring);
27 void ixgbe_xdp_ring_update_tail_locked(struct ixgbe_ring *ring);
28 void ixgbe_irq_rearm_queues(struct ixgbe_adapter *adapter, u64 qmask);
29 
30 void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring);
31 void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring);
32 
33 struct xsk_buff_pool *ixgbe_xsk_pool(struct ixgbe_adapter *adapter,
34 				     struct ixgbe_ring *ring);
35 int ixgbe_xsk_pool_setup(struct ixgbe_adapter *adapter,
36 			 struct xsk_buff_pool *pool,
37 			 u16 qid);
38 
39 bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 cleaned_count);
40 int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector,
41 			  struct ixgbe_ring *rx_ring,
42 			  const int budget);
43 void ixgbe_xsk_clean_rx_ring(struct ixgbe_ring *rx_ring);
44 bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
45 			    struct ixgbe_ring *tx_ring, int napi_budget);
46 int ixgbe_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags);
47 void ixgbe_xsk_clean_tx_ring(struct ixgbe_ring *tx_ring);
48 
49 void ixgbe_update_tx_ring_stats(struct ixgbe_ring *tx_ring,
50 				struct ixgbe_q_vector *q_vector, u64 pkts,
51 				u64 bytes);
52 void ixgbe_update_rx_ring_stats(struct ixgbe_ring *rx_ring,
53 				struct ixgbe_q_vector *q_vector, u64 pkts,
54 				u64 bytes);
55 
56 #endif /* #define _IXGBE_TXRX_COMMON_H_ */
57