xref: /dpdk/drivers/common/cnxk/roc_eswitch.h (revision 29a8df5cb664feb6f182c07868c49c0f5c9a4c46)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2024 Marvell.
3  */
4 
5 #ifndef __ROC_ESWITCH_H__
6 #define __ROC_ESWITCH_H__
7 
8 #define ROC_ESWITCH_VLAN_TPID 0x8100
9 #define ROC_ESWITCH_LBK_CHAN  63
10 
11 typedef enum roc_eswitch_repte_notify_msg_type {
12 	ROC_ESWITCH_REPTE_STATE = 0,
13 	ROC_ESWITCH_LINK_STATE,
14 	ROC_ESWITCH_REPTE_MTU,
15 } roc_eswitch_repte_notify_msg_type_t;
16 
17 struct roc_eswitch_repte_state {
18 	bool enable;
19 	uint16_t hw_func;
20 };
21 
22 struct roc_eswitch_link_state {
23 	bool enable;
24 	uint16_t hw_func;
25 };
26 
27 struct roc_eswitch_repte_mtu {
28 	uint16_t mtu;
29 	uint16_t rep_id;
30 	uint16_t hw_func;
31 };
32 
33 struct roc_eswitch_repte_notify_msg {
34 	roc_eswitch_repte_notify_msg_type_t type;
35 	union {
36 		struct roc_eswitch_repte_state state;
37 		struct roc_eswitch_link_state link;
38 		struct roc_eswitch_repte_mtu mtu;
39 	};
40 };
41 
42 /* Process representee notification callback */
43 typedef int (*process_repte_notify_t)(void *roc_nix,
44 				      struct roc_eswitch_repte_notify_msg *notify_msg);
45 
46 /* Generic */
47 int __roc_api roc_eswitch_is_repte_pfs_vf(uint16_t rep_pffunc, uint16_t pf_pffunc);
48 
49 /* NPC */
50 int __roc_api roc_eswitch_npc_mcam_rx_rule(struct roc_npc *roc_npc, struct roc_npc_flow *flow,
51 					   uint16_t pcifunc, uint16_t vlan_tci,
52 					   uint16_t vlan_tci_mask);
53 int __roc_api roc_eswitch_npc_mcam_tx_rule(struct roc_npc *roc_npc, struct roc_npc_flow *flow,
54 					   uint16_t pcifunc, uint32_t vlan_tci);
55 int __roc_api roc_eswitch_npc_mcam_delete_rule(struct roc_npc *roc_npc, struct roc_npc_flow *flow,
56 					       uint16_t pcifunc);
57 int __roc_api roc_eswitch_npc_rss_action_configure(struct roc_npc *roc_npc,
58 						   struct roc_npc_flow *flow, uint32_t flowkey_cfg,
59 						   uint16_t *reta_tbl);
60 
61 /* NIX */
62 int __roc_api roc_eswitch_nix_vlan_tpid_set(struct roc_nix *nix, uint32_t type, uint16_t tpid,
63 					    bool is_vf);
64 int __roc_api roc_eswitch_nix_repte_stats(struct roc_nix *roc_nix, uint16_t pf_func,
65 					  struct roc_nix_stats *stats);
66 int __roc_api roc_eswitch_nix_process_repte_notify_cb_register(struct roc_nix *roc_nix,
67 						    process_repte_notify_t proc_repte_nt);
68 void __roc_api roc_eswitch_nix_process_repte_notify_cb_unregister(struct roc_nix *roc_nix);
69 #endif /* __ROC_ESWITCH_H__ */
70