@@ -107,6 +107,70 @@ static inline void idpf_xdp_tx_finalize(void *_xdpq, bool sent, bool flush)
107107 libeth_xdpsq_unlock (& xdpq -> xdp_lock );
108108}
109109
110+ struct idpf_xdp_rx_desc {
111+ aligned_u64 qw0 ;
112+ #define IDPF_XDP_RX_BUFQ BIT_ULL(47)
113+ #define IDPF_XDP_RX_GEN BIT_ULL(46)
114+ #define IDPF_XDP_RX_LEN GENMASK_ULL(45, 32)
115+ #define IDPF_XDP_RX_PT GENMASK_ULL(25, 16)
116+
117+ aligned_u64 qw1 ;
118+ #define IDPF_XDP_RX_BUF GENMASK_ULL(47, 32)
119+ #define IDPF_XDP_RX_EOP BIT_ULL(1)
120+
121+ aligned_u64 qw2 ;
122+ #define IDPF_XDP_RX_HASH GENMASK_ULL(31, 0)
123+
124+ aligned_u64 qw3 ;
125+ } __aligned (4 * sizeof (u64 ));
126+ static_assert (sizeof (struct idpf_xdp_rx_desc ) ==
127+ sizeof (struct virtchnl2_rx_flex_desc_adv_nic_3 ));
128+
129+ #define idpf_xdp_rx_bufq (desc ) !!((desc)->qw0 & IDPF_XDP_RX_BUFQ)
130+ #define idpf_xdp_rx_gen (desc ) !!((desc)->qw0 & IDPF_XDP_RX_GEN)
131+ #define idpf_xdp_rx_len (desc ) FIELD_GET(IDPF_XDP_RX_LEN, (desc)->qw0)
132+ #define idpf_xdp_rx_pt (desc ) FIELD_GET(IDPF_XDP_RX_PT, (desc)->qw0)
133+ #define idpf_xdp_rx_buf (desc ) FIELD_GET(IDPF_XDP_RX_BUF, (desc)->qw1)
134+ #define idpf_xdp_rx_eop (desc ) !!((desc)->qw1 & IDPF_XDP_RX_EOP)
135+ #define idpf_xdp_rx_hash (desc ) FIELD_GET(IDPF_XDP_RX_HASH, (desc)->qw2)
136+
137+ static inline void
138+ idpf_xdp_get_qw0 (struct idpf_xdp_rx_desc * desc ,
139+ const struct virtchnl2_rx_flex_desc_adv_nic_3 * rxd )
140+ {
141+ #ifdef __LIBETH_WORD_ACCESS
142+ desc -> qw0 = ((const typeof (desc ))rxd )-> qw0 ;
143+ #else
144+ desc -> qw0 = ((u64 )le16_to_cpu (rxd -> pktlen_gen_bufq_id ) << 32 ) |
145+ ((u64 )le16_to_cpu (rxd -> ptype_err_fflags0 ) << 16 );
146+ #endif
147+ }
148+
149+ static inline void
150+ idpf_xdp_get_qw1 (struct idpf_xdp_rx_desc * desc ,
151+ const struct virtchnl2_rx_flex_desc_adv_nic_3 * rxd )
152+ {
153+ #ifdef __LIBETH_WORD_ACCESS
154+ desc -> qw1 = ((const typeof (desc ))rxd )-> qw1 ;
155+ #else
156+ desc -> qw1 = ((u64 )le16_to_cpu (rxd -> buf_id ) << 32 ) |
157+ rxd -> status_err0_qw1 ;
158+ #endif
159+ }
160+
161+ static inline void
162+ idpf_xdp_get_qw2 (struct idpf_xdp_rx_desc * desc ,
163+ const struct virtchnl2_rx_flex_desc_adv_nic_3 * rxd )
164+ {
165+ #ifdef __LIBETH_WORD_ACCESS
166+ desc -> qw2 = ((const typeof (desc ))rxd )-> qw2 ;
167+ #else
168+ desc -> qw2 = ((u64 )rxd -> hash3 << 24 ) |
169+ ((u64 )rxd -> ff2_mirrid_hash2 .hash2 << 16 ) |
170+ le16_to_cpu (rxd -> hash1 );
171+ #endif
172+ }
173+
110174void idpf_xdp_set_features (const struct idpf_vport * vport );
111175
112176int idpf_xdp (struct net_device * dev , struct netdev_bpf * xdp );
0 commit comments