linux/drivers/net/ethernet/netronome/nfp/nfd3/nfd3.h

/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright (C) 2015-2019 Netronome Systems, Inc. */

#ifndef _NFP_DP_NFD3_H_
#define _NFP_DP_NFD3_H_

struct sk_buff;
struct net_device;

/* TX descriptor format */

#define NFD3_DESC_TX_EOP
#define NFD3_DESC_TX_OFFSET_MASK
#define NFD3_DESC_TX_MSS_MASK

/* Flags in the host TX descriptor */
#define NFD3_DESC_TX_CSUM
#define NFD3_DESC_TX_IP4_CSUM
#define NFD3_DESC_TX_TCP_CSUM
#define NFD3_DESC_TX_UDP_CSUM
#define NFD3_DESC_TX_VLAN
#define NFD3_DESC_TX_LSO
#define NFD3_DESC_TX_ENCAP
#define NFD3_DESC_TX_O_IP4_CSUM

struct nfp_nfd3_tx_desc {};

/**
 * struct nfp_nfd3_tx_buf - software TX buffer descriptor
 * @skb:	normal ring, sk_buff associated with this buffer
 * @frag:	XDP ring, page frag associated with this buffer
 * @xdp:	XSK buffer pool handle (for AF_XDP)
 * @dma_addr:	DMA mapping address of the buffer
 * @fidx:	Fragment index (-1 for the head and [0..nr_frags-1] for frags)
 * @pkt_cnt:	Number of packets to be produced out of the skb associated
 *		with this buffer (valid only on the head's buffer).
 *		Will be 1 for all non-TSO packets.
 * @is_xsk_tx:	Flag if buffer is a RX buffer after a XDP_TX action and not a
 *		buffer from the TX queue (for AF_XDP).
 * @real_len:	Number of bytes which to be produced out of the skb (valid only
 *		on the head's buffer). Equal to skb->len for non-TSO packets.
 */
struct nfp_nfd3_tx_buf {};

void
nfp_nfd3_rx_csum(const struct nfp_net_dp *dp, struct nfp_net_r_vector *r_vec,
		 const struct nfp_net_rx_desc *rxd,
		 const struct nfp_meta_parsed *meta, struct sk_buff *skb);
bool
nfp_nfd3_parse_meta(struct net_device *netdev, struct nfp_meta_parsed *meta,
		    void *data, void *pkt, unsigned int pkt_len, int meta_len);
void nfp_nfd3_tx_complete(struct nfp_net_tx_ring *tx_ring, int budget);
int nfp_nfd3_poll(struct napi_struct *napi, int budget);
netdev_tx_t nfp_nfd3_tx(struct sk_buff *skb, struct net_device *netdev);
bool
nfp_nfd3_ctrl_tx_one(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
		     struct sk_buff *skb, bool old);
void nfp_nfd3_ctrl_poll(struct tasklet_struct *t);
void nfp_nfd3_rx_ring_fill_freelist(struct nfp_net_dp *dp,
				    struct nfp_net_rx_ring *rx_ring);
void nfp_nfd3_xsk_tx_free(struct nfp_nfd3_tx_buf *txbuf);
int nfp_nfd3_xsk_poll(struct napi_struct *napi, int budget);

#ifndef CONFIG_NFP_NET_IPSEC
static inline void nfp_nfd3_ipsec_tx(struct nfp_nfd3_tx_desc *txd, struct sk_buff *skb)
{
}
#else
void nfp_nfd3_ipsec_tx(struct nfp_nfd3_tx_desc *txd, struct sk_buff *skb);
#endif

#endif