aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_switch.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_switch.h')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_switch.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index bb8612d8e07b..1b312e7ab2b5 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -19,6 +19,122 @@ struct ice_vsi_ctx {
19 bool alloc_from_pool; 19 bool alloc_from_pool;
20}; 20};
21 21
22enum ice_sw_fwd_act_type {
23 ICE_FWD_TO_VSI = 0,
24 ICE_FWD_TO_VSI_LIST, /* Do not use this when adding filter */
25 ICE_FWD_TO_Q,
26 ICE_FWD_TO_QGRP,
27 ICE_DROP_PACKET,
28 ICE_INVAL_ACT
29};
30
31/* Switch recipe ID enum values are specific to hardware */
32enum ice_sw_lkup_type {
33 ICE_SW_LKUP_ETHERTYPE = 0,
34 ICE_SW_LKUP_MAC = 1,
35 ICE_SW_LKUP_MAC_VLAN = 2,
36 ICE_SW_LKUP_PROMISC = 3,
37 ICE_SW_LKUP_VLAN = 4,
38 ICE_SW_LKUP_DFLT = 5,
39 ICE_SW_LKUP_ETHERTYPE_MAC = 8,
40 ICE_SW_LKUP_PROMISC_VLAN = 9,
41};
42
43struct ice_fltr_info {
44 /* Look up information: how to look up packet */
45 enum ice_sw_lkup_type lkup_type;
46 /* Forward action: filter action to do after lookup */
47 enum ice_sw_fwd_act_type fltr_act;
48 /* rule ID returned by firmware once filter rule is created */
49 u16 fltr_rule_id;
50 u16 flag;
51#define ICE_FLTR_RX BIT(0)
52#define ICE_FLTR_TX BIT(1)
53#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
54
55 /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */
56 u16 src;
57
58 union {
59 struct {
60 u8 mac_addr[ETH_ALEN];
61 } mac;
62 struct {
63 u8 mac_addr[ETH_ALEN];
64 u16 vlan_id;
65 } mac_vlan;
66 struct {
67 u16 vlan_id;
68 } vlan;
69 /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE
70 * if just using ethertype as filter. Set lkup_type as
71 * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be
72 * passed in as filter.
73 */
74 struct {
75 u16 ethertype;
76 u8 mac_addr[ETH_ALEN]; /* optional */
77 } ethertype_mac;
78 } l_data;
79
80 /* Depending on filter action */
81 union {
82 /* queue id in case of ICE_FWD_TO_Q and starting
83 * queue id in case of ICE_FWD_TO_QGRP.
84 */
85 u16 q_id:11;
86 u16 vsi_id:10;
87 u16 vsi_list_id:10;
88 } fwd_id;
89
90 /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field
91 * determines the range of queues the packet needs to be forwarded to
92 */
93 u8 qgrp_size;
94
95 /* Rule creations populate these indicators basing on the switch type */
96 bool lb_en; /* Indicate if packet can be looped back */
97 bool lan_en; /* Indicate if packet can be forwarded to the uplink */
98};
99
100/* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list id */
101struct ice_vsi_list_map_info {
102 struct list_head list_entry;
103 DECLARE_BITMAP(vsi_map, ICE_MAX_VSI);
104 u16 vsi_list_id;
105};
106
107enum ice_sw_fltr_status {
108 ICE_FLTR_STATUS_NEW = 0,
109 ICE_FLTR_STATUS_FW_SUCCESS,
110 ICE_FLTR_STATUS_FW_FAIL,
111};
112
113struct ice_fltr_list_entry {
114 struct list_head list_entry;
115 enum ice_sw_fltr_status status;
116 struct ice_fltr_info fltr_info;
117};
118
119/* This defines an entry in the list that maintains MAC or VLAN membership
120 * to HW list mapping, since multiple VSIs can subscribe to the same MAC or
121 * VLAN. As an optimization the VSI list should be created only when a
122 * second VSI becomes a subscriber to the VLAN address.
123 */
124struct ice_fltr_mgmt_list_entry {
125 /* back pointer to VSI list id to VSI list mapping */
126 struct ice_vsi_list_map_info *vsi_list_info;
127 u16 vsi_count;
128#define ICE_INVAL_LG_ACT_INDEX 0xffff
129 u16 lg_act_idx;
130#define ICE_INVAL_SW_MARKER_ID 0xffff
131 u16 sw_marker_id;
132 struct list_head list_entry;
133 struct ice_fltr_info fltr_info;
134#define ICE_INVAL_COUNTER_ID 0xff
135 u8 counter_index;
136};
137
22/* VSI related commands */ 138/* VSI related commands */
23enum ice_status 139enum ice_status
24ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, 140ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
@@ -32,4 +148,8 @@ ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx,
32 148
33enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); 149enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
34 150
151/* Switch/bridge related commands */
152enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
153enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);
154void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_id);
35#endif /* _ICE_SWITCH_H_ */ 155#endif /* _ICE_SWITCH_H_ */