FILE
tun.c
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/tun.c
1// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB 2// Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 4#include "act.h" 5#include "en/tc_tun_encap.h" 6#include "en/tc_priv.h" 7 8static bool 9tc_act_can_offload_tun_encap(struct mlx5e_tc_act_parse_state *parse_state, 10 const struct flow_action_entry *act, 11 int act_index, 12 struct mlx5_flow_attr *attr) 13{ 14 if (!act->tunnel) { 15 NL_SET_ERR_MSG_MOD(parse_state->extack, 16 "Zero tunnel attributes is not supported"); 17 return false; 18 } 19 20 return true; 21} 22 23static int 24tc_act_parse_tun_encap(struct mlx5e_tc_act_parse_state *parse_state, 25 const struct flow_action_entry *act, 26 struct mlx5e_priv *priv, 27 struct mlx5_flow_attr *attr) 28{ 29 parse_state->tun_info = act->tunnel; 30 parse_state->encap = true; 31 32 return 0; 33} 34 35static int 36tc_act_parse_tun_decap(struct mlx5e_tc_act_parse_state *parse_state, 37 const struct flow_action_entry *act, 38 struct mlx5e_priv *priv, 39 struct mlx5_flow_attr *attr) 40{ 41 parse_state->decap = true; 42 43 return 0; 44} 45 46struct mlx5e_tc_act mlx5e_tc_act_tun_encap = { 47 .can_offload = tc_act_can_offload_tun_encap, 48 .parse_action = tc_act_parse_tun_encap, 49}; 50 51struct mlx5e_tc_act mlx5e_tc_act_tun_decap = { 52 .parse_action = tc_act_parse_tun_decap, 53};
~/
Read-only file preview.