{ ICE_IPV4_OFOS, 14 },
{ ICE_UDP_OF, 34 },
{ ICE_VXLAN, 42 },
+ { ICE_GENEVE, 42 },
{ ICE_MAC_IL, 50 },
{ ICE_IPV4_IL, 64 },
{ ICE_TCP_IL, 84 },
{ ICE_IPV4_OFOS, 14 },
{ ICE_UDP_OF, 34 },
{ ICE_VXLAN, 42 },
+ { ICE_GENEVE, 42 },
{ ICE_MAC_IL, 50 },
{ ICE_IPV4_IL, 64 },
{ ICE_UDP_ILOS, 84 },
/* Propagate some data to the recipe database */
recps[idx].is_root = is_root;
recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
- if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN)
+ ice_zero_bitmap(recps[idx].res_idxs, ICE_MAX_FV_WORDS);
+ if (root_bufs.content.result_indx & ICE_AQ_RECIPE_RESULT_EN) {
recps[idx].chain_idx = root_bufs.content.result_indx &
~ICE_AQ_RECIPE_RESULT_EN;
- else
+ ice_set_bit(recps[idx].chain_idx, recps[idx].res_idxs);
+ } else {
recps[idx].chain_idx = ICE_INVAL_CHAIN_IND;
+ }
if (!is_root)
continue;
recps[idx].root_rid = root_bufs.content.rid &
~ICE_AQ_RECIPE_ID_IS_ROOT;
recps[idx].priority = root_bufs.content.act_ctrl_fwd_priority;
- recps[idx].big_recp = (recps[rid].n_grp_count > 1);
}
/* Complete initialization of the root recipe entry */
lkup_exts->n_val_words = fv_word_idx;
+ recps[rid].big_recp = (num_recps > 1);
recps[rid].n_grp_count = num_recps;
recps[rid].root_buf = (struct ice_aqc_recipe_data_elem *)
ice_calloc(hw, recps[rid].n_grp_count,
recp->n_ext_words = entry->r_group.n_val_pairs;
recp->chain_idx = entry->chain_idx;
recp->priority = buf[buf_idx].content.act_ctrl_fwd_priority;
+ recp->n_grp_count = rm->n_grp_count;
recp->tun_type = rm->tun_type;
recp->recp_created = true;
recp->adv_rule = 1;
LIST_FOR_EACH_ENTRY(fvit, &rm->fv_list, ice_sw_fv_list_entry,
list_entry) {
ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
+ u16 j;
status = ice_aq_get_recipe_to_profile(hw, fvit->profile_id,
(u8 *)r_bitmap, NULL);
if (status)
goto err_unroll;
+
+ /* Update profile to recipe bitmap array */
+ ice_memcpy(profile_to_recipe[fvit->profile_id], rm->r_bitmap,
+ sizeof(rm->r_bitmap), ICE_NONDMA_TO_NONDMA);
+
+ /* Update recipe to profile bitmap array */
+ for (j = 0; j < ICE_MAX_NUM_RECIPES; j++)
+ if (ice_is_bit_set(rm->r_bitmap, j))
+ ice_set_bit((u16)fvit->profile_id,
+ recipe_to_profile[j]);
}
*rid = rm->root_rid;
return ICE_SUCCESS;
}
+/**
+ * ice_fill_adv_packet_tun - fill dummy packet with udp tunnel port
+ * @hw: pointer to the hardware structure
+ * @tun_type: tunnel type
+ * @pkt: dummy packet to fill in
+ * @offsets: offset info for the dummy packet
+ */
+static enum ice_status
+ice_fill_adv_packet_tun(struct ice_hw *hw, enum ice_sw_tunnel_type tun_type,
+ u8 *pkt, const struct ice_dummy_pkt_offsets *offsets)
+{
+ u16 open_port, i;
+
+ switch (tun_type) {
+ case ICE_SW_TUN_AND_NON_TUN:
+ case ICE_SW_TUN_VXLAN_GPE:
+ case ICE_SW_TUN_VXLAN:
+ case ICE_SW_TUN_UDP:
+ if (!ice_get_open_tunnel_port(hw, TNL_VXLAN, &open_port))
+ return ICE_ERR_CFG;
+ break;
+
+ case ICE_SW_TUN_GENEVE:
+ if (!ice_get_open_tunnel_port(hw, TNL_GENEVE, &open_port))
+ return ICE_ERR_CFG;
+ break;
+
+ default:
+ /* Nothing needs to be done for this tunnel type */
+ return ICE_SUCCESS;
+ }
+
+ /* Find the outer UDP protocol header and insert the port number */
+ for (i = 0; offsets[i].type != ICE_PROTOCOL_LAST; i++) {
+ if (offsets[i].type == ICE_UDP_OF) {
+ struct ice_l4_hdr *hdr;
+ u16 offset;
+
+ offset = offsets[i].offset;
+ hdr = (struct ice_l4_hdr *)&pkt[offset];
+ hdr->dst_port = open_port << 8 | open_port >> 8;
+
+ return ICE_SUCCESS;
+ }
+ }
+
+ return ICE_ERR_CFG;
+}
+
/**
* ice_find_adv_rule_entry - Search a rule entry
* @hw: pointer to the hardware structure
ice_fill_adv_dummy_packet(lkups, lkups_cnt, s_rule, pkt, pkt_len,
pkt_offsets);
+ if (rinfo->tun_type != ICE_NON_TUN) {
+ status = ice_fill_adv_packet_tun(hw, rinfo->tun_type,
+ s_rule->pdata.lkup_tx_rx.hdr,
+ pkt_offsets);
+ if (status)
+ goto err_ice_add_adv_rule;
+ }
+
status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,
rule_buf_sz, 1, ice_aqc_opc_add_sw_rules,
NULL);
tmp_fltr.fwd_id.hw_vsi_id, status);
return status;
}
- }
- if (fm_list->vsi_count == 1) {
/* Remove the VSI list since it is no longer used */
status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type);
if (status) {
u16 lkups_cnt, struct ice_adv_rule_info *rinfo)
{
struct ice_adv_fltr_mgmt_list_entry *list_elem;
- const struct ice_dummy_pkt_offsets *offsets;
struct ice_prot_lkup_ext lkup_exts;
- u16 rule_buf_sz, pkt_len, i, rid;
struct ice_lock *rule_lock; /* Lock to protect filter rule list */
enum ice_status status = ICE_SUCCESS;
bool remove_rule = false;
- const u8 *pkt = NULL;
- u16 vsi_handle;
+ u16 i, rid, vsi_handle;
ice_memset(&lkup_exts, 0, sizeof(lkup_exts), ICE_NONDMA_MEM);
for (i = 0; i < lkups_cnt; i++) {
ice_release_lock(rule_lock);
if (remove_rule) {
struct ice_aqc_sw_rules_elem *s_rule;
+ u16 rule_buf_sz;
- ice_find_dummy_packet(lkups, lkups_cnt, rinfo->tun_type, &pkt,
- &pkt_len, &offsets);
- rule_buf_sz = ICE_SW_RULE_RX_TX_NO_HDR_SIZE + pkt_len;
+ rule_buf_sz = ICE_SW_RULE_RX_TX_NO_HDR_SIZE;
s_rule =
(struct ice_aqc_sw_rules_elem *)ice_malloc(hw,
rule_buf_sz);