drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.h
Extension
.h
Size
3404 bytes
Lines
122
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mlx5e_accel_tx_psp_state {
	u32 tailen;
	u32 keyid;
	__be32 spi;
	u8 inner_ipproto;
	u8 ver;
};

#ifdef CONFIG_MLX5_EN_PSP
static inline bool mlx5e_psp_is_offload_state(struct mlx5e_accel_tx_psp_state *psp_state)
{
	return (psp_state->tailen != 0);
}

static inline bool mlx5e_psp_is_offload(struct sk_buff *skb, struct net_device *netdev)
{
	bool ret;

	rcu_read_lock();
	ret = !!psp_skb_get_assoc_rcu(skb);
	rcu_read_unlock();
	return ret;
}

bool mlx5e_psp_handle_tx_skb(struct net_device *netdev,
			     struct sk_buff *skb,
			     struct mlx5e_accel_tx_psp_state *psp_st);

void mlx5e_psp_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb,
			     struct mlx5e_accel_tx_psp_state *psp_st,
			     struct mlx5_wqe_eth_seg *eseg);

void mlx5e_psp_handle_tx_wqe(struct mlx5e_tx_wqe *wqe,
			     struct mlx5e_accel_tx_psp_state *psp_st,
			     struct mlx5_wqe_inline_seg *inlseg);

static inline bool mlx5e_psp_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
						   struct mlx5e_accel_tx_psp_state *psp_st,
						   struct mlx5_wqe_eth_seg *eseg)
{
	u8 inner_ipproto;

	if (!mlx5e_psp_is_offload_state(psp_st))
		return false;

	inner_ipproto = psp_st->inner_ipproto;
	eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
	if (inner_ipproto) {
		eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM;
		if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP)
			eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM;
		if (likely(skb->ip_summed == CHECKSUM_PARTIAL))
			sq->stats->csum_partial_inner++;
	} else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
		eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM;
		sq->stats->csum_partial_inner++;
	}

	return true;
}

static inline unsigned int mlx5e_psp_tx_ids_len(struct mlx5e_accel_tx_psp_state *psp_st)
{
	return psp_st->tailen;
}

static inline bool mlx5e_psp_is_rx_flow(struct mlx5_cqe64 *cqe)
{
	return MLX5_PSP_METADATA_MARKER(be32_to_cpu(cqe->ft_metadata));
}

bool mlx5e_psp_offload_handle_rx_skb(struct net_device *netdev, struct sk_buff *skb,
				     struct mlx5_cqe64 *cqe);
#else
static inline bool mlx5e_psp_is_offload_state(struct mlx5e_accel_tx_psp_state *psp_state)
{
	return false;
}

static inline bool mlx5e_psp_is_offload(struct sk_buff *skb, struct net_device *netdev)
{
	return false;
}

static inline bool mlx5e_psp_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
						   struct mlx5e_accel_tx_psp_state *psp_st,
						   struct mlx5_wqe_eth_seg *eseg)
{
	return false;
}

Annotation

Implementation Notes