net/sfc: fence off 8 bits in Rx mark for tunnel offload
[dpdk.git] / drivers / net / sfc / sfc_flow_tunnel.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2021 Xilinx, Inc.
4  */
5
6 #include <stdbool.h>
7 #include <stdint.h>
8
9 #include "sfc.h"
10 #include "sfc_dp_rx.h"
11 #include "sfc_flow_tunnel.h"
12 #include "sfc_mae.h"
13
14 bool
15 sfc_flow_tunnel_is_supported(struct sfc_adapter *sa)
16 {
17         SFC_ASSERT(sfc_adapter_is_locked(sa));
18
19         return ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_MARK) != 0 &&
20                 sa->mae.status == SFC_MAE_STATUS_SUPPORTED);
21 }
22
23 bool
24 sfc_flow_tunnel_is_active(struct sfc_adapter *sa)
25 {
26         SFC_ASSERT(sfc_adapter_is_locked(sa));
27
28         return ((sa->negotiated_rx_metadata &
29                  RTE_ETH_RX_METADATA_TUNNEL_ID) != 0);
30 }