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_FLOW_PARTIAL RTE_BIT64(13) 25 : : #define NFP_FL_FEATS_HOST_ACK RTE_BIT64(31) 26 : : 27 : : /* 28 : : * Flower fallback and ctrl path always adds and removes 29 : : * 8 bytes of prepended data. Tx descriptors must point 30 : : * to the correct packet data offset after metadata has 31 : : * been added 32 : : */ 33 : : #define FLOWER_PKT_DATA_OFFSET (NFP_NET_META_HEADER_SIZE + NFP_NET_META_FIELD_SIZE) 34 : : 35 : : #define MAX_FLOWER_VFS 64 36 : : 37 : : /* Forward declaration */ 38 : : struct nfp_app_fw_flower; 39 : : struct nfp_flower_representor; 40 : : 41 : : /* The function pointers for different NFD version */ 42 : : struct nfp_flower_nfd_func { 43 : : /** Function used to add metadata into pkt. */ 44 : : uint32_t (*pkt_add_metadata_t)(struct rte_mbuf *mbuf, 45 : : uint32_t port_id); 46 : : /** Function used to xmit pkt through ctrl vnic. */ 47 : : uint16_t (*ctrl_vnic_xmit_t)(struct nfp_app_fw_flower *app_fw_flower, 48 : : struct rte_mbuf *mbuf); 49 : : /** Function used to xmit pkts through PF. */ 50 : : uint16_t (*pf_xmit_t)(void *tx_queue, struct rte_mbuf **tx_pkts, 51 : : uint16_t nb_pkts); 52 : : }; 53 : : 54 : : /* The flower application's private structure */ 55 : : struct nfp_app_fw_flower { 56 : : /** Switch domain for this app */ 57 : : uint16_t switch_domain_id; 58 : : 59 : : /** Number of VF representors */ 60 : : uint8_t num_vf_reprs; 61 : : 62 : : /** Number of phyport representors */ 63 : : uint8_t num_phyport_reprs; 64 : : 65 : : /** Pointer to the PF vNIC */ 66 : : struct nfp_net_hw *pf_hw; 67 : : struct rte_eth_dev *pf_ethdev; 68 : : 69 : : /** Pointer to a mempool for the Ctrl vNIC */ 70 : : struct rte_mempool *ctrl_pktmbuf_pool; 71 : : 72 : : /** Pointer to the ctrl vNIC */ 73 : : struct nfp_net_hw *ctrl_hw; 74 : : struct rte_eth_dev *ctrl_ethdev; 75 : : 76 : : /** Ctrl vNIC Rx counter */ 77 : : uint64_t ctrl_vnic_rx_count; 78 : : 79 : : /** Ctrl vNIC Tx counter */ 80 : : uint64_t ctrl_vnic_tx_count; 81 : : 82 : : /** Array of phyport representors */ 83 : : struct nfp_flower_representor *phy_reprs[NFP_MAX_PHYPORTS]; 84 : : 85 : : /** Array of VF representors */ 86 : : struct nfp_flower_representor *vf_reprs[MAX_FLOWER_VFS]; 87 : : 88 : : /** PF representor */ 89 : : struct nfp_flower_representor *pf_repr; 90 : : 91 : : /** Service id of Ctrl vNIC service */ 92 : : uint32_t ctrl_vnic_id; 93 : : 94 : : /** Flower extra features */ 95 : : uint64_t ext_features; 96 : : 97 : : struct nfp_flow_priv *flow_priv; 98 : : struct nfp_mtr_priv *mtr_priv; 99 : : 100 : : /** Function pointers for different NFD version */ 101 : : struct nfp_flower_nfd_func nfd_func; 102 : : }; 103 : : 104 : : static inline bool 105 : : nfp_flower_support_decap_v2(const struct nfp_app_fw_flower *app_fw_flower) 106 : : { 107 [ # # # # : 0 : return app_fw_flower->ext_features & NFP_FL_FEATS_DECAP_V2; # # # # # # # # ] 108 : : } 109 : : 110 : : int nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv); 111 : : void nfp_uninit_app_fw_flower(struct nfp_net_hw_priv *hw_priv); 112 : : int nfp_secondary_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv); 113 : : bool nfp_flower_pf_dispatch_pkts(struct nfp_net_rxq *rxq, 114 : : struct rte_mbuf *mbuf, 115 : : uint32_t port_id); 116 : : uint16_t nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 117 : : uint16_t nb_pkts); 118 : : uint16_t nfp_flower_multiple_pf_xmit_pkts(void *tx_queue, 119 : : struct rte_mbuf **tx_pkts, 120 : : uint16_t nb_pkts); 121 : : uint16_t nfp_flower_multiple_pf_recv_pkts(void *rx_queue, 122 : : struct rte_mbuf **tx_pkts, 123 : : uint16_t nb_pkts); 124 : : int nfp_flower_pf_start(struct rte_eth_dev *dev); 125 : : int nfp_flower_pf_stop(struct rte_eth_dev *dev); 126 : : uint32_t nfp_flower_pkt_add_metadata(struct nfp_app_fw_flower *app_fw_flower, 127 : : struct rte_mbuf *mbuf, uint32_t port_id); 128 : : 129 : : #endif /* __NFP_FLOWER_H__ */