.. | .. |
---|
8 | 8 | |
---|
9 | 9 | #define ICE_SW_CFG_MAX_BUF_LEN 2048 |
---|
10 | 10 | #define ICE_DFLT_VSI_INVAL 0xff |
---|
| 11 | +#define ICE_FLTR_RX BIT(0) |
---|
| 12 | +#define ICE_FLTR_TX BIT(1) |
---|
| 13 | +#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) |
---|
11 | 14 | #define ICE_VSI_INVAL_ID 0xffff |
---|
| 15 | +#define ICE_INVAL_Q_HANDLE 0xFFFF |
---|
12 | 16 | |
---|
13 | 17 | /* VSI context structure for add/get/update/free operations */ |
---|
14 | 18 | struct ice_vsi_ctx { |
---|
.. | .. |
---|
17 | 21 | u16 vsis_unallocated; |
---|
18 | 22 | u16 flags; |
---|
19 | 23 | struct ice_aqc_vsi_props info; |
---|
| 24 | + struct ice_sched_vsi_info sched; |
---|
20 | 25 | u8 alloc_from_pool; |
---|
| 26 | + u8 vf_num; |
---|
| 27 | + u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS]; |
---|
| 28 | + struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS]; |
---|
21 | 29 | }; |
---|
22 | 30 | |
---|
23 | 31 | enum ice_sw_fwd_act_type { |
---|
.. | .. |
---|
39 | 47 | ICE_SW_LKUP_DFLT = 5, |
---|
40 | 48 | ICE_SW_LKUP_ETHERTYPE_MAC = 8, |
---|
41 | 49 | ICE_SW_LKUP_PROMISC_VLAN = 9, |
---|
| 50 | + ICE_SW_LKUP_LAST |
---|
| 51 | +}; |
---|
| 52 | + |
---|
| 53 | +/* type of filter src ID */ |
---|
| 54 | +enum ice_src_id { |
---|
| 55 | + ICE_SRC_ID_UNKNOWN = 0, |
---|
| 56 | + ICE_SRC_ID_VSI, |
---|
| 57 | + ICE_SRC_ID_QUEUE, |
---|
| 58 | + ICE_SRC_ID_LPORT, |
---|
42 | 59 | }; |
---|
43 | 60 | |
---|
44 | 61 | struct ice_fltr_info { |
---|
.. | .. |
---|
49 | 66 | /* rule ID returned by firmware once filter rule is created */ |
---|
50 | 67 | u16 fltr_rule_id; |
---|
51 | 68 | u16 flag; |
---|
52 | | -#define ICE_FLTR_RX BIT(0) |
---|
53 | | -#define ICE_FLTR_TX BIT(1) |
---|
54 | | -#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) |
---|
55 | 69 | |
---|
56 | 70 | /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ |
---|
57 | 71 | u16 src; |
---|
| 72 | + enum ice_src_id src_id; |
---|
58 | 73 | |
---|
59 | 74 | union { |
---|
60 | 75 | struct { |
---|
.. | .. |
---|
76 | 91 | u16 ethertype; |
---|
77 | 92 | u8 mac_addr[ETH_ALEN]; /* optional */ |
---|
78 | 93 | } ethertype_mac; |
---|
79 | | - } l_data; |
---|
| 94 | + } l_data; /* Make sure to zero out the memory of l_data before using |
---|
| 95 | + * it or only set the data associated with lookup match |
---|
| 96 | + * rest everything should be zero |
---|
| 97 | + */ |
---|
80 | 98 | |
---|
81 | 99 | /* Depending on filter action */ |
---|
82 | 100 | union { |
---|
83 | | - /* queue id in case of ICE_FWD_TO_Q and starting |
---|
84 | | - * queue id in case of ICE_FWD_TO_QGRP. |
---|
| 101 | + /* queue ID in case of ICE_FWD_TO_Q and starting |
---|
| 102 | + * queue ID in case of ICE_FWD_TO_QGRP. |
---|
85 | 103 | */ |
---|
86 | 104 | u16 q_id:11; |
---|
87 | | - u16 vsi_id:10; |
---|
| 105 | + u16 hw_vsi_id:10; |
---|
88 | 106 | u16 vsi_list_id:10; |
---|
89 | 107 | } fwd_id; |
---|
90 | 108 | |
---|
| 109 | + /* Sw VSI handle */ |
---|
| 110 | + u16 vsi_handle; |
---|
| 111 | + |
---|
91 | 112 | /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field |
---|
92 | | - * determines the range of queues the packet needs to be forwarded to |
---|
| 113 | + * determines the range of queues the packet needs to be forwarded to. |
---|
| 114 | + * Note that qgrp_size must be set to a power of 2. |
---|
93 | 115 | */ |
---|
94 | 116 | u8 qgrp_size; |
---|
95 | 117 | |
---|
.. | .. |
---|
98 | 120 | u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ |
---|
99 | 121 | }; |
---|
100 | 122 | |
---|
101 | | -/* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list id */ |
---|
| 123 | +struct ice_sw_recipe { |
---|
| 124 | + struct list_head l_entry; |
---|
| 125 | + |
---|
| 126 | + /* To protect modification of filt_rule list |
---|
| 127 | + * defined below |
---|
| 128 | + */ |
---|
| 129 | + struct mutex filt_rule_lock; |
---|
| 130 | + |
---|
| 131 | + /* List of type ice_fltr_mgmt_list_entry */ |
---|
| 132 | + struct list_head filt_rules; |
---|
| 133 | + struct list_head filt_replay_rules; |
---|
| 134 | + |
---|
| 135 | + /* linked list of type recipe_list_entry */ |
---|
| 136 | + struct list_head rg_list; |
---|
| 137 | + /* linked list of type ice_sw_fv_list_entry*/ |
---|
| 138 | + struct list_head fv_list; |
---|
| 139 | + struct ice_aqc_recipe_data_elem *r_buf; |
---|
| 140 | + u8 recp_count; |
---|
| 141 | + u8 root_rid; |
---|
| 142 | + u8 num_profs; |
---|
| 143 | + u8 *prof_ids; |
---|
| 144 | + |
---|
| 145 | + /* recipe bitmap: what all recipes makes this recipe */ |
---|
| 146 | + DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); |
---|
| 147 | +}; |
---|
| 148 | + |
---|
| 149 | +/* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ |
---|
102 | 150 | struct ice_vsi_list_map_info { |
---|
103 | 151 | struct list_head list_entry; |
---|
104 | 152 | DECLARE_BITMAP(vsi_map, ICE_MAX_VSI); |
---|
105 | 153 | u16 vsi_list_id; |
---|
106 | | -}; |
---|
107 | | - |
---|
108 | | -enum ice_sw_fltr_status { |
---|
109 | | - ICE_FLTR_STATUS_NEW = 0, |
---|
110 | | - ICE_FLTR_STATUS_FW_SUCCESS, |
---|
111 | | - ICE_FLTR_STATUS_FW_FAIL, |
---|
| 154 | + /* counter to track how many rules are reusing this VSI list */ |
---|
| 155 | + u16 ref_cnt; |
---|
112 | 156 | }; |
---|
113 | 157 | |
---|
114 | 158 | struct ice_fltr_list_entry { |
---|
115 | 159 | struct list_head list_entry; |
---|
116 | | - enum ice_sw_fltr_status status; |
---|
| 160 | + enum ice_status status; |
---|
117 | 161 | struct ice_fltr_info fltr_info; |
---|
118 | 162 | }; |
---|
119 | 163 | |
---|
120 | 164 | /* This defines an entry in the list that maintains MAC or VLAN membership |
---|
121 | 165 | * to HW list mapping, since multiple VSIs can subscribe to the same MAC or |
---|
122 | 166 | * VLAN. As an optimization the VSI list should be created only when a |
---|
123 | | - * second VSI becomes a subscriber to the VLAN address. |
---|
| 167 | + * second VSI becomes a subscriber to the same MAC address. VSI lists are always |
---|
| 168 | + * used for VLAN membership. |
---|
124 | 169 | */ |
---|
125 | 170 | struct ice_fltr_mgmt_list_entry { |
---|
126 | | - /* back pointer to VSI list id to VSI list mapping */ |
---|
| 171 | + /* back pointer to VSI list ID to VSI list mapping */ |
---|
127 | 172 | struct ice_vsi_list_map_info *vsi_list_info; |
---|
128 | 173 | u16 vsi_count; |
---|
129 | 174 | #define ICE_INVAL_LG_ACT_INDEX 0xffff |
---|
.. | .. |
---|
136 | 181 | u8 counter_index; |
---|
137 | 182 | }; |
---|
138 | 183 | |
---|
| 184 | +enum ice_promisc_flags { |
---|
| 185 | + ICE_PROMISC_UCAST_RX = 0x1, |
---|
| 186 | + ICE_PROMISC_UCAST_TX = 0x2, |
---|
| 187 | + ICE_PROMISC_MCAST_RX = 0x4, |
---|
| 188 | + ICE_PROMISC_MCAST_TX = 0x8, |
---|
| 189 | + ICE_PROMISC_BCAST_RX = 0x10, |
---|
| 190 | + ICE_PROMISC_BCAST_TX = 0x20, |
---|
| 191 | + ICE_PROMISC_VLAN_RX = 0x40, |
---|
| 192 | + ICE_PROMISC_VLAN_TX = 0x80, |
---|
| 193 | +}; |
---|
| 194 | + |
---|
139 | 195 | /* VSI related commands */ |
---|
140 | 196 | enum ice_status |
---|
141 | | -ice_aq_add_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, |
---|
| 197 | +ice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, |
---|
| 198 | + struct ice_sq_cd *cd); |
---|
| 199 | +enum ice_status |
---|
| 200 | +ice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, |
---|
| 201 | + bool keep_vsi_alloc, struct ice_sq_cd *cd); |
---|
| 202 | +enum ice_status |
---|
| 203 | +ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, |
---|
142 | 204 | struct ice_sq_cd *cd); |
---|
143 | | -enum ice_status |
---|
144 | | -ice_aq_update_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, |
---|
145 | | - struct ice_sq_cd *cd); |
---|
146 | | -enum ice_status |
---|
147 | | -ice_aq_free_vsi(struct ice_hw *hw, struct ice_vsi_ctx *vsi_ctx, |
---|
148 | | - bool keep_vsi_alloc, struct ice_sq_cd *cd); |
---|
149 | | - |
---|
| 205 | +bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); |
---|
| 206 | +struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); |
---|
| 207 | +void ice_clear_all_vsi_ctx(struct ice_hw *hw); |
---|
| 208 | +/* Switch config */ |
---|
150 | 209 | enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); |
---|
151 | 210 | |
---|
| 211 | +enum ice_status |
---|
| 212 | +ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, |
---|
| 213 | + u16 *counter_id); |
---|
| 214 | +enum ice_status |
---|
| 215 | +ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, |
---|
| 216 | + u16 counter_id); |
---|
| 217 | + |
---|
152 | 218 | /* Switch/bridge related commands */ |
---|
| 219 | +enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw); |
---|
153 | 220 | enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); |
---|
154 | 221 | enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); |
---|
155 | | -void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_id); |
---|
156 | | -enum ice_status ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); |
---|
157 | | -enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); |
---|
158 | 222 | enum ice_status |
---|
159 | | -ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_id, bool set, u8 direction); |
---|
| 223 | +ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list); |
---|
| 224 | +enum ice_status |
---|
| 225 | +ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list); |
---|
| 226 | +void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); |
---|
| 227 | +enum ice_status |
---|
| 228 | +ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); |
---|
| 229 | +enum ice_status ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); |
---|
| 230 | + |
---|
| 231 | +/* Promisc/defport setup for VSIs */ |
---|
| 232 | +enum ice_status |
---|
| 233 | +ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction); |
---|
| 234 | +enum ice_status |
---|
| 235 | +ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, |
---|
| 236 | + u16 vid); |
---|
| 237 | +enum ice_status |
---|
| 238 | +ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, |
---|
| 239 | + u16 vid); |
---|
| 240 | +enum ice_status |
---|
| 241 | +ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, |
---|
| 242 | + bool rm_vlan_promisc); |
---|
| 243 | + |
---|
| 244 | +enum ice_status ice_init_def_sw_recp(struct ice_hw *hw); |
---|
| 245 | +u16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); |
---|
| 246 | +bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); |
---|
| 247 | + |
---|
| 248 | +enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); |
---|
| 249 | +void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); |
---|
160 | 250 | |
---|
161 | 251 | #endif /* _ICE_SWITCH_H_ */ |
---|