0001
0002
0003
0004 #ifndef _ICE_TXRX_LIB_H_
0005 #define _ICE_TXRX_LIB_H_
0006 #include "ice.h"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 static inline bool
0019 ice_test_staterr(__le16 status_err_n, const u16 stat_err_bits)
0020 {
0021 return !!(status_err_n & cpu_to_le16(stat_err_bits));
0022 }
0023
0024 static inline __le64
0025 ice_build_ctob(u64 td_cmd, u64 td_offset, unsigned int size, u64 td_tag)
0026 {
0027 return cpu_to_le64(ICE_TX_DESC_DTYPE_DATA |
0028 (td_cmd << ICE_TXD_QW1_CMD_S) |
0029 (td_offset << ICE_TXD_QW1_OFFSET_S) |
0030 ((u64)size << ICE_TXD_QW1_TX_BUF_SZ_S) |
0031 (td_tag << ICE_TXD_QW1_L2TAG1_S));
0032 }
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 static inline u16
0043 ice_get_vlan_tag_from_rx_desc(union ice_32b_rx_flex_desc *rx_desc)
0044 {
0045 u16 stat_err_bits;
0046
0047 stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_L2TAG1P_S);
0048 if (ice_test_staterr(rx_desc->wb.status_error0, stat_err_bits))
0049 return le16_to_cpu(rx_desc->wb.l2tag1);
0050
0051 stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS1_L2TAG2P_S);
0052 if (ice_test_staterr(rx_desc->wb.status_error1, stat_err_bits))
0053 return le16_to_cpu(rx_desc->wb.l2tag2_2nd);
0054
0055 return 0;
0056 }
0057
0058
0059
0060
0061
0062
0063
0064 static inline void ice_xdp_ring_update_tail(struct ice_tx_ring *xdp_ring)
0065 {
0066
0067
0068
0069 wmb();
0070 writel_relaxed(xdp_ring->next_to_use, xdp_ring->tail);
0071 }
0072
0073 void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res);
0074 int ice_xmit_xdp_buff(struct xdp_buff *xdp, struct ice_tx_ring *xdp_ring);
0075 int ice_xmit_xdp_ring(void *data, u16 size, struct ice_tx_ring *xdp_ring);
0076 void ice_release_rx_desc(struct ice_rx_ring *rx_ring, u16 val);
0077 void
0078 ice_process_skb_fields(struct ice_rx_ring *rx_ring,
0079 union ice_32b_rx_flex_desc *rx_desc,
0080 struct sk_buff *skb, u16 ptype);
0081 void
0082 ice_receive_skb(struct ice_rx_ring *rx_ring, struct sk_buff *skb, u16 vlan_tag);
0083 #endif