Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2022 Corigine, Inc. 3 : : * All rights reserved. 4 : : */ 5 : : 6 : : #ifndef __NFP_FLOWER_H__ 7 : : #define __NFP_FLOWER_H__ 8 : : 9 : : #include "../nfp_net_common.h" 10 : : 11 : : /* Extra features bitmap. */ 12 : : #define NFP_FL_FEATS_GENEVE RTE_BIT64(0) 13 : : #define NFP_FL_NBI_MTU_SETTING RTE_BIT64(1) 14 : : #define NFP_FL_FEATS_GENEVE_OPT RTE_BIT64(2) 15 : : #define NFP_FL_FEATS_VLAN_PCP RTE_BIT64(3) 16 : : #define NFP_FL_FEATS_VF_RLIM RTE_BIT64(4) 17 : : #define NFP_FL_FEATS_FLOW_MOD RTE_BIT64(5) 18 : : #define NFP_FL_FEATS_PRE_TUN_RULES RTE_BIT64(6) 19 : : #define NFP_FL_FEATS_IPV6_TUN RTE_BIT64(7) 20 : : #define NFP_FL_FEATS_VLAN_QINQ RTE_BIT64(8) 21 : : #define NFP_FL_FEATS_QOS_PPS RTE_BIT64(9) 22 : : #define NFP_FL_FEATS_QOS_METER RTE_BIT64(10) 23 : : #define NFP_FL_FEATS_DECAP_V2 RTE_BIT64(11) 24 : : #define NFP_FL_FEATS_HOST_ACK RTE_BIT64(31) 25 : : 26 : : /* 27 : : * Flower fallback and ctrl path always adds and removes 28 : : * 8 bytes of prepended data. Tx descriptors must point 29 : : * to the correct packet data offset after metadata has 30 : : * been added 31 : : */ 32 : : #define FLOWER_PKT_DATA_OFFSET (NFP_NET_META_HEADER_SIZE + NFP_NET_META_FIELD_SIZE) 33 : : 34 : : #define MAX_FLOWER_VFS 64 35 : : 36 : : /* Forward declaration */ 37 : : struct nfp_app_fw_flower; 38 : : struct nfp_flower_representor; 39 : : 40 : : /* The function pointers for different NFD version */ 41 : : struct nfp_flower_nfd_func { 42 : : /** Function used to add metadata into pkt. */ 43 : : uint32_t (*pkt_add_metadata_t)(struct rte_mbuf *mbuf, 44 : : uint32_t port_id); 45 : : /** Function used to xmit pkt through ctrl vnic. */ 46 : : uint16_t (*ctrl_vnic_xmit_t)(struct nfp_app_fw_flower *app_fw_flower, 47 : : struct rte_mbuf *mbuf); 48 : : /** Function used to xmit pkts through PF. */ 49 : : uint16_t (*pf_xmit_t)(void *tx_queue, struct rte_mbuf **tx_pkts, 50 : : uint16_t nb_pkts); 51 : : }; 52 : : 53 : : /* The flower application's private structure */ 54 : : struct nfp_app_fw_flower { 55 : : /** Switch domain for this app */ 56 : : uint16_t switch_domain_id; 57 : : 58 : : /** Number of VF representors */ 59 : : uint8_t num_vf_reprs; 60 : : 61 : : /** Number of phyport representors */ 62 : : uint8_t num_phyport_reprs; 63 : : 64 : : /** Pointer to the PF vNIC */ 65 : : struct nfp_net_hw *pf_hw; 66 : : 67 : : /** Pointer to a mempool for the Ctrl vNIC */ 68 : : struct rte_mempool *ctrl_pktmbuf_pool; 69 : : 70 : : /** Pointer to the ctrl vNIC */ 71 : : struct nfp_net_hw *ctrl_hw; 72 : : 73 : : /** Ctrl vNIC Rx counter */ 74 : : uint64_t ctrl_vnic_rx_count; 75 : : 76 : : /** Ctrl vNIC Tx counter */ 77 : : uint64_t ctrl_vnic_tx_count; 78 : : 79 : : /** Array of phyport representors */ 80 : : struct nfp_flower_representor *phy_reprs[NFP_MAX_PHYPORTS]; 81 : : 82 : : /** Array of VF representors */ 83 : : struct nfp_flower_representor *vf_reprs[MAX_FLOWER_VFS]; 84 : : 85 : : /** PF representor */ 86 : : struct nfp_flower_representor *pf_repr; 87 : : 88 : : /** Service id of Ctrl vNIC service */ 89 : : uint32_t ctrl_vnic_id; 90 : : 91 : : /** Flower extra features */ 92 : : uint64_t ext_features; 93 : : 94 : : struct nfp_flow_priv *flow_priv; 95 : : struct nfp_mtr_priv *mtr_priv; 96 : : 97 : : /** Function pointers for different NFD version */ 98 : : struct nfp_flower_nfd_func nfd_func; 99 : : }; 100 : : 101 : : static inline bool 102 : : nfp_flower_support_decap_v2(const struct nfp_app_fw_flower *app_fw_flower) 103 : : { 104 [ # # # # : 0 : return app_fw_flower->ext_features & NFP_FL_FEATS_DECAP_V2; # # # # # # # # ] 105 : : } 106 : : 107 : : int nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev, 108 : : const struct nfp_dev_info *dev_info); 109 : : void nfp_uninit_app_fw_flower(struct nfp_pf_dev *pf_dev); 110 : : int nfp_secondary_init_app_fw_flower(struct nfp_pf_dev *pf_dev); 111 : : bool nfp_flower_pf_dispatch_pkts(struct nfp_net_hw *hw, 112 : : struct rte_mbuf *mbuf, 113 : : uint32_t port_id); 114 : : uint16_t nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 115 : : uint16_t nb_pkts); 116 : : int nfp_flower_pf_start(struct rte_eth_dev *dev); 117 : : uint32_t nfp_flower_pkt_add_metadata(struct nfp_app_fw_flower *app_fw_flower, 118 : : struct rte_mbuf *mbuf, uint32_t port_id); 119 : : 120 : : #endif /* __NFP_FLOWER_H__ */