History

ice: fix access-beyond-end in the switch code

Global `-Warray-bounds` enablement revealed some problems, one of which is the way we define and use AQC rules messages. In fact, they have a shared header, followed by the actual message, which can be of one of several different formats. So it is straightforward enough to define that header as a separate struct and then embed it into message structures as needed, but currently all the formats reside in one union coupled with the header. Then, the code allocates only the memory needed for a particular message format, leaving the union potentially incomplete. There are no actual reads or writes beyond the end of an allocated chunk, but at the same time, the whole implementation is fragile and backed by an equilibrium rather than strong type and memory checks. Define the structures the other way around: one for the common header and the rest for the actual formats with the header embedded. There are no places where several union members would be used at the same time anyway. This allows to use proper struct_size() and let the compiler know what is going to be done. Finally, unsilence `-Warray-bounds` back for ice_switch.c. Other little things worth mentioning: * &ice_sw_rule_vsi_list_query is not used anywhere, remove it. It's weird anyway to talk to hardware with purely kernel types (bitmaps); * expand the ICE_SW_RULE_*_SIZE() macros to pass a structure variable name to struct_size() to let it do strict typechecking; * rename ice_sw_rule_lkup_rx_tx::hdr to ::hdr_data to keep ::hdr for the header structure to have the same name for it constistenly everywhere; * drop the duplicate of %ICE_SW_RULE_RX_TX_NO_HDR_SIZE residing in ice_switch.h.

Alexander Lobakin committed 4 years ago

Commit 6e1ff611 parent c6fbbf14 files · +115 −139Browse files

Unified · Split

4 files
  1. drivers/net/ethernet/intel/ice/Makefile +0 −5
  2. drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +26 −32
  3. drivers/net/ethernet/intel/ice/ice_switch.c +89 −99
  4. drivers/net/ethernet/intel/ice/ice_switch.h +0 −3
drivers/net/ethernet/intel/ice/Makefile+0−5
@@ -47,8 +47,3 @@ ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o · 46 unmodified lines
47ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o47ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
48ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o48ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
49ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o49ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o
50
51# FIXME: temporarily silence -Warray-bounds on non W=1+ builds
52ifndef KBUILD_EXTRA_WARN
53CFLAGS_ice_switch.o += -Wno-array-bounds
54endif
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h+26−32
@@ -601,12 +601,30 @@ struct ice_aqc_sw_rules { · 600 unmodified lines
601 __le32 addr_low;601 __le32 addr_low;
602};602};
603 603
604/* Add switch rule response:
605 * Content of return buffer is same as the input buffer. The status field and
606 * LUT index are updated as part of the response
607 */
608struct ice_aqc_sw_rules_elem_hdr {
609 __le16 type; /* Switch rule type, one of T_... */
610#define ICE_AQC_SW_RULES_T_LKUP_RX 0x0
611#define ICE_AQC_SW_RULES_T_LKUP_TX 0x1
612#define ICE_AQC_SW_RULES_T_LG_ACT 0x2
613#define ICE_AQC_SW_RULES_T_VSI_LIST_SET 0x3
614#define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR 0x4
615#define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET 0x5
616#define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR 0x6
617 __le16 status;
618} __packed __aligned(sizeof(__le16));
619
604/* Add/Update/Get/Remove lookup Rx/Tx command/response entry620/* Add/Update/Get/Remove lookup Rx/Tx command/response entry
605 * This structures describes the lookup rules and associated actions. "index"621 * This structures describes the lookup rules and associated actions. "index"
606 * is returned as part of a response to a successful Add command, and can be622 * is returned as part of a response to a successful Add command, and can be
607 * used to identify the rule for Update/Get/Remove commands.623 * used to identify the rule for Update/Get/Remove commands.
608 */624 */
609struct ice_sw_rule_lkup_rx_tx {625struct ice_sw_rule_lkup_rx_tx {
626 struct ice_aqc_sw_rules_elem_hdr hdr;
627
610 __le16 recipe_id;628 __le16 recipe_id;
611#define ICE_SW_RECIPE_LOGICAL_PORT_FWD 10629#define ICE_SW_RECIPE_LOGICAL_PORT_FWD 10
612 /* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */630 /* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */
@@ -683,14 +701,16 @@ struct ice_sw_rule_lkup_rx_tx { · 70 unmodified lines
683 * lookup-type701 * lookup-type
684 */702 */
685 __le16 hdr_len;703 __le16 hdr_len;
686 u8 hdr[];704 u8 hdr_data[];
687};705} __packed __aligned(sizeof(__le16));
688 706
689/* Add/Update/Remove large action command/response entry707/* Add/Update/Remove large action command/response entry
690 * "index" is returned as part of a response to a successful Add command, and708 * "index" is returned as part of a response to a successful Add command, and
691 * can be used to identify the action for Update/Get/Remove commands.709 * can be used to identify the action for Update/Get/Remove commands.
692 */710 */
693struct ice_sw_rule_lg_act {711struct ice_sw_rule_lg_act {
712 struct ice_aqc_sw_rules_elem_hdr hdr;
713
694 __le16 index; /* Index in large action table */714 __le16 index; /* Index in large action table */
695 __le16 size;715 __le16 size;
696 /* Max number of large actions */716 /* Max number of large actions */
@@ -744,45 +764,19 @@ struct ice_sw_rule_lg_act { · 47 unmodified lines
744#define ICE_LG_ACT_STAT_COUNT_S 3764#define ICE_LG_ACT_STAT_COUNT_S 3
745#define ICE_LG_ACT_STAT_COUNT_M (0x7F << ICE_LG_ACT_STAT_COUNT_S)765#define ICE_LG_ACT_STAT_COUNT_M (0x7F << ICE_LG_ACT_STAT_COUNT_S)
746 __le32 act[]; /* array of size for actions */766 __le32 act[]; /* array of size for actions */
747};767} __packed __aligned(sizeof(__le16));
748 768
749/* Add/Update/Remove VSI list command/response entry769/* Add/Update/Remove VSI list command/response entry
750 * "index" is returned as part of a response to a successful Add command, and770 * "index" is returned as part of a response to a successful Add command, and
751 * can be used to identify the VSI list for Update/Get/Remove commands.771 * can be used to identify the VSI list for Update/Get/Remove commands.
752 */772 */
753struct ice_sw_rule_vsi_list {773struct ice_sw_rule_vsi_list {
774 struct ice_aqc_sw_rules_elem_hdr hdr;
775
754 __le16 index; /* Index of VSI/Prune list */776 __le16 index; /* Index of VSI/Prune list */
755 __le16 number_vsi;777 __le16 number_vsi;
756 __le16 vsi[]; /* Array of number_vsi VSI numbers */778 __le16 vsi[]; /* Array of number_vsi VSI numbers */
757};779} __packed __aligned(sizeof(__le16));
758
759/* Query VSI list command/response entry */
760struct ice_sw_rule_vsi_list_query {
761 __le16 index;
762 DECLARE_BITMAP(vsi_list, ICE_MAX_VSI);
763} __packed;
764
765/* Add switch rule response:
766 * Content of return buffer is same as the input buffer. The status field and
767 * LUT index are updated as part of the response
768 */
769struct ice_aqc_sw_rules_elem {
770 __le16 type; /* Switch rule type, one of T_... */
771#define ICE_AQC_SW_RULES_T_LKUP_RX 0x0
772#define ICE_AQC_SW_RULES_T_LKUP_TX 0x1
773#define ICE_AQC_SW_RULES_T_LG_ACT 0x2
774#define ICE_AQC_SW_RULES_T_VSI_LIST_SET 0x3
775#define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR 0x4
776#define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET 0x5
777#define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR 0x6
778 __le16 status;
779 union {
780 struct ice_sw_rule_lkup_rx_tx lkup_tx_rx;
781 struct ice_sw_rule_lg_act lg_act;
782 struct ice_sw_rule_vsi_list vsi_list;
783 struct ice_sw_rule_vsi_list_query vsi_list_query;
784 } __packed pdata;
785};
786 780
787/* Query PFC Mode (direct 0x0302)781/* Query PFC Mode (direct 0x0302)
788 * Set PFC Mode (direct 0x0303)782 * Set PFC Mode (direct 0x0303)
drivers/net/ethernet/intel/ice/ice_switch.c+89−99
@@ -1282,18 +1282,13 @@ static const struct ice_dummy_pkt_profile ice_dummy_pkt_profiles[] = { · 1281 unmodified lines
1282 ICE_PKT_PROFILE(tcp, 0),1282 ICE_PKT_PROFILE(tcp, 0),
1283};1283};
1284 1284
1285#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \1285#define ICE_SW_RULE_RX_TX_HDR_SIZE(s, l) struct_size((s), hdr_data, (l))
1286 (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \1286#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s) \
1287 (DUMMY_ETH_HDR_LEN * \1287 ICE_SW_RULE_RX_TX_HDR_SIZE((s), DUMMY_ETH_HDR_LEN)
1288 sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0])))1288#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s) \
1289#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \1289 ICE_SW_RULE_RX_TX_HDR_SIZE((s), 0)
1290 (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))1290#define ICE_SW_RULE_LG_ACT_SIZE(s, n) struct_size((s), act, (n))
1291#define ICE_SW_RULE_LG_ACT_SIZE(n) \1291#define ICE_SW_RULE_VSI_LIST_SIZE(s, n) struct_size((s), vsi, (n))
1292 (offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \
1293 ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0])))
1294#define ICE_SW_RULE_VSI_LIST_SIZE(n) \
1295 (offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \
1296 ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0])))
1297 1292
1298/* this is a recipe to profile association bitmap */1293/* this is a recipe to profile association bitmap */
1299static DECLARE_BITMAP(recipe_to_profile[ICE_MAX_NUM_RECIPES],1294static DECLARE_BITMAP(recipe_to_profile[ICE_MAX_NUM_RECIPES],
@@ -2376,7 +2371,8 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi) · 1076 unmodified lines
2376 */2371 */
2377static void2372static void
2378ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,2373ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
2379 struct ice_aqc_sw_rules_elem *s_rule, enum ice_adminq_opc opc)2374 struct ice_sw_rule_lkup_rx_tx *s_rule,
2375 enum ice_adminq_opc opc)
2380{2376{
2381 u16 vlan_id = ICE_MAX_VLAN_ID + 1;2377 u16 vlan_id = ICE_MAX_VLAN_ID + 1;
2382 u16 vlan_tpid = ETH_P_8021Q;2378 u16 vlan_tpid = ETH_P_8021Q;
@@ -2388,15 +2384,14 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, · 5 unmodified lines
2388 u8 q_rgn;2384 u8 q_rgn;
2389 2385
2390 if (opc == ice_aqc_opc_remove_sw_rules) {2386 if (opc == ice_aqc_opc_remove_sw_rules) {
2391 s_rule->pdata.lkup_tx_rx.act = 0;2387 s_rule->act = 0;
2392 s_rule->pdata.lkup_tx_rx.index =2388 s_rule->index = cpu_to_le16(f_info->fltr_rule_id);
2393 cpu_to_le16(f_info->fltr_rule_id);2389 s_rule->hdr_len = 0;
2394 s_rule->pdata.lkup_tx_rx.hdr_len = 0;
2395 return;2390 return;
2396 }2391 }
2397 2392
2398 eth_hdr_sz = sizeof(dummy_eth_header);2393 eth_hdr_sz = sizeof(dummy_eth_header);
2399 eth_hdr = s_rule->pdata.lkup_tx_rx.hdr;2394 eth_hdr = s_rule->hdr_data;
2400 2395
2401 /* initialize the ether header with a dummy header */2396 /* initialize the ether header with a dummy header */
2402 memcpy(eth_hdr, dummy_eth_header, eth_hdr_sz);2397 memcpy(eth_hdr, dummy_eth_header, eth_hdr_sz);
@@ -2481,14 +2476,14 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, · 78 unmodified lines
2481 break;2476 break;
2482 }2477 }
2483 2478
2484 s_rule->type = (f_info->flag & ICE_FLTR_RX) ?2479 s_rule->hdr.type = (f_info->flag & ICE_FLTR_RX) ?
2485 cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_RX) :2480 cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_RX) :
2486 cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_TX);2481 cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_TX);
2487 2482
2488 /* Recipe set depending on lookup type */2483 /* Recipe set depending on lookup type */
2489 s_rule->pdata.lkup_tx_rx.recipe_id = cpu_to_le16(f_info->lkup_type);2484 s_rule->recipe_id = cpu_to_le16(f_info->lkup_type);
2490 s_rule->pdata.lkup_tx_rx.src = cpu_to_le16(f_info->src);2485 s_rule->src = cpu_to_le16(f_info->src);
2491 s_rule->pdata.lkup_tx_rx.act = cpu_to_le32(act);2486 s_rule->act = cpu_to_le32(act);
2492 2487
2493 if (daddr)2488 if (daddr)
2494 ether_addr_copy(eth_hdr + ICE_ETH_DA_OFFSET, daddr);2489 ether_addr_copy(eth_hdr + ICE_ETH_DA_OFFSET, daddr);
@@ -2502,7 +2497,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, · 7 unmodified lines
2502 2497
2503 /* Create the switch rule with the final dummy Ethernet header */2498 /* Create the switch rule with the final dummy Ethernet header */
2504 if (opc != ice_aqc_opc_update_sw_rules)2499 if (opc != ice_aqc_opc_update_sw_rules)
2505 s_rule->pdata.lkup_tx_rx.hdr_len = cpu_to_le16(eth_hdr_sz);2500 s_rule->hdr_len = cpu_to_le16(eth_hdr_sz);
2506}2501}
2507 2502
2508/**2503/**
@@ -2519,7 +2514,8 @@ static int · 10 unmodified lines
2519ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent,2514ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent,
2520 u16 sw_marker, u16 l_id)2515 u16 sw_marker, u16 l_id)
2521{2516{
2522 struct ice_aqc_sw_rules_elem *lg_act, *rx_tx;2517 struct ice_sw_rule_lkup_rx_tx *rx_tx;
2518 struct ice_sw_rule_lg_act *lg_act;
2523 /* For software marker we need 3 large actions2519 /* For software marker we need 3 large actions
2524 * 1. FWD action: FWD TO VSI or VSI LIST2520 * 1. FWD action: FWD TO VSI or VSI LIST
2525 * 2. GENERIC VALUE action to hold the profile ID2521 * 2. GENERIC VALUE action to hold the profile ID
@@ -2540,18 +2536,18 @@ ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent, · 14 unmodified lines
2540 * 1. Large Action2536 * 1. Large Action
2541 * 2. Look up Tx Rx2537 * 2. Look up Tx Rx
2542 */2538 */
2543 lg_act_size = (u16)ICE_SW_RULE_LG_ACT_SIZE(num_lg_acts);2539 lg_act_size = (u16)ICE_SW_RULE_LG_ACT_SIZE(lg_act, num_lg_acts);
2544 rules_size = lg_act_size + ICE_SW_RULE_RX_TX_ETH_HDR_SIZE;2540 rules_size = lg_act_size + ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(rx_tx);
2545 lg_act = devm_kzalloc(ice_hw_to_dev(hw), rules_size, GFP_KERNEL);2541 lg_act = devm_kzalloc(ice_hw_to_dev(hw), rules_size, GFP_KERNEL);
2546 if (!lg_act)2542 if (!lg_act)
2547 return -ENOMEM;2543 return -ENOMEM;
2548 2544
2549 rx_tx = (struct ice_aqc_sw_rules_elem *)((u8 *)lg_act + lg_act_size);2545 rx_tx = (typeof(rx_tx))((u8 *)lg_act + lg_act_size);
2550 2546
2551 /* Fill in the first switch rule i.e. large action */2547 /* Fill in the first switch rule i.e. large action */
2552 lg_act->type = cpu_to_le16(ICE_AQC_SW_RULES_T_LG_ACT);2548 lg_act->hdr.type = cpu_to_le16(ICE_AQC_SW_RULES_T_LG_ACT);
2553 lg_act->pdata.lg_act.index = cpu_to_le16(l_id);2549 lg_act->index = cpu_to_le16(l_id);
2554 lg_act->pdata.lg_act.size = cpu_to_le16(num_lg_acts);2550 lg_act->size = cpu_to_le16(num_lg_acts);
2555 2551
2556 /* First action VSI forwarding or VSI list forwarding depending on how2552 /* First action VSI forwarding or VSI list forwarding depending on how
2557 * many VSIs2553 * many VSIs
@@ -2563,13 +2559,13 @@ ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent, · 5 unmodified lines
2563 act |= (id << ICE_LG_ACT_VSI_LIST_ID_S) & ICE_LG_ACT_VSI_LIST_ID_M;2559 act |= (id << ICE_LG_ACT_VSI_LIST_ID_S) & ICE_LG_ACT_VSI_LIST_ID_M;
2564 if (m_ent->vsi_count > 1)2560 if (m_ent->vsi_count > 1)
2565 act |= ICE_LG_ACT_VSI_LIST;2561 act |= ICE_LG_ACT_VSI_LIST;
2566 lg_act->pdata.lg_act.act[0] = cpu_to_le32(act);2562 lg_act->act[0] = cpu_to_le32(act);
2567 2563
2568 /* Second action descriptor type */2564 /* Second action descriptor type */
2569 act = ICE_LG_ACT_GENERIC;2565 act = ICE_LG_ACT_GENERIC;
2570 2566
2571 act |= (1 << ICE_LG_ACT_GENERIC_VALUE_S) & ICE_LG_ACT_GENERIC_VALUE_M;2567 act |= (1 << ICE_LG_ACT_GENERIC_VALUE_S) & ICE_LG_ACT_GENERIC_VALUE_M;
2572 lg_act->pdata.lg_act.act[1] = cpu_to_le32(act);2568 lg_act->act[1] = cpu_to_le32(act);
2573 2569
2574 act = (ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX <<2570 act = (ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX <<
2575 ICE_LG_ACT_GENERIC_OFFSET_S) & ICE_LG_ACT_GENERIC_OFFSET_M;2571 ICE_LG_ACT_GENERIC_OFFSET_S) & ICE_LG_ACT_GENERIC_OFFSET_M;
@@ -2579,24 +2575,22 @@ ice_add_marker_act(struct ice_hw *hw, struct ice_fltr_mgmt_list_entry *m_ent, · 3 unmodified lines
2579 act |= (sw_marker << ICE_LG_ACT_GENERIC_VALUE_S) &2575 act |= (sw_marker << ICE_LG_ACT_GENERIC_VALUE_S) &
2580 ICE_LG_ACT_GENERIC_VALUE_M;2576 ICE_LG_ACT_GENERIC_VALUE_M;
2581 2577
2582 lg_act->pdata.lg_act.act[2] = cpu_to_le32(act);2578 lg_act->act[2] = cpu_to_le32(act);
2583 2579
2584 /* call the fill switch rule to fill the lookup Tx Rx structure */2580 /* call the fill switch rule to fill the lookup Tx Rx structure */
2585 ice_fill_sw_rule(hw, &m_ent->fltr_info, rx_tx,2581 ice_fill_sw_rule(hw, &m_ent->fltr_info, rx_tx,
2586 ice_aqc_opc_update_sw_rules);2582 ice_aqc_opc_update_sw_rules);
2587 2583
2588 /* Update the action to point to the large action ID */2584 /* Update the action to point to the large action ID */
2589 rx_tx->pdata.lkup_tx_rx.act =2585 rx_tx->act = cpu_to_le32(ICE_SINGLE_ACT_PTR |
2590 cpu_to_le32(ICE_SINGLE_ACT_PTR |2586 ((l_id << ICE_SINGLE_ACT_PTR_VAL_S) &
2591 ((l_id << ICE_SINGLE_ACT_PTR_VAL_S) &2587 ICE_SINGLE_ACT_PTR_VAL_M));
2592 ICE_SINGLE_ACT_PTR_VAL_M));
2593 2588
2594 /* Use the filter rule ID of the previously created rule with single2589 /* Use the filter rule ID of the previously created rule with single
2595 * act. Once the update happens, hardware will treat this as large2590 * act. Once the update happens, hardware will treat this as large
2596 * action2591 * action
2597 */2592 */
2598 rx_tx->pdata.lkup_tx_rx.index =2593 rx_tx->index = cpu_to_le16(m_ent->fltr_info.fltr_rule_id);
2599 cpu_to_le16(m_ent->fltr_info.fltr_rule_id);
2600 2594
2601 status = ice_aq_sw_rules(hw, lg_act, rules_size, 2,2595 status = ice_aq_sw_rules(hw, lg_act, rules_size, 2,
2602 ice_aqc_opc_update_sw_rules, NULL);2596 ice_aqc_opc_update_sw_rules, NULL);
@@ -2658,7 +2652,7 @@ ice_update_vsi_list_rule(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, · 55 unmodified lines
2658 u16 vsi_list_id, bool remove, enum ice_adminq_opc opc,2652 u16 vsi_list_id, bool remove, enum ice_adminq_opc opc,
2659 enum ice_sw_lkup_type lkup_type)2653 enum ice_sw_lkup_type lkup_type)
2660{2654{
2661 struct ice_aqc_sw_rules_elem *s_rule;2655 struct ice_sw_rule_vsi_list *s_rule;
2662 u16 s_rule_size;2656 u16 s_rule_size;
2663 u16 rule_type;2657 u16 rule_type;
2664 int status;2658 int status;
@@ -2681,7 +2675,7 @@ ice_update_vsi_list_rule(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, · 16 unmodified lines
2681 else2675 else
2682 return -EINVAL;2676 return -EINVAL;
2683 2677
2684 s_rule_size = (u16)ICE_SW_RULE_VSI_LIST_SIZE(num_vsi);2678 s_rule_size = (u16)ICE_SW_RULE_VSI_LIST_SIZE(s_rule, num_vsi);
2685 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);2679 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);
2686 if (!s_rule)2680 if (!s_rule)
2687 return -ENOMEM;2681 return -ENOMEM;
@@ -2691,13 +2685,13 @@ ice_update_vsi_list_rule(struct ice_hw *hw, u16 *vsi_handle_arr, u16 num_vsi, · 3 unmodified lines
2691 goto exit;2685 goto exit;
2692 }2686 }
2693 /* AQ call requires hw_vsi_id(s) */2687 /* AQ call requires hw_vsi_id(s) */
2694 s_rule->pdata.vsi_list.vsi[i] =2688 s_rule->vsi[i] =
2695 cpu_to_le16(ice_get_hw_vsi_num(hw, vsi_handle_arr[i]));2689 cpu_to_le16(ice_get_hw_vsi_num(hw, vsi_handle_arr[i]));
2696 }2690 }
2697 2691
2698 s_rule->type = cpu_to_le16(rule_type);2692 s_rule->hdr.type = cpu_to_le16(rule_type);
2699 s_rule->pdata.vsi_list.number_vsi = cpu_to_le16(num_vsi);2693 s_rule->number_vsi = cpu_to_le16(num_vsi);
2700 s_rule->pdata.vsi_list.index = cpu_to_le16(vsi_list_id);2694 s_rule->index = cpu_to_le16(vsi_list_id);
2701 2695
2702 status = ice_aq_sw_rules(hw, s_rule, s_rule_size, 1, opc, NULL);2696 status = ice_aq_sw_rules(hw, s_rule, s_rule_size, 1, opc, NULL);
2703 2697
@@ -2745,13 +2739,14 @@ ice_create_pkt_fwd_rule(struct ice_hw *hw, · 41 unmodified lines
2745 struct ice_fltr_list_entry *f_entry)2739 struct ice_fltr_list_entry *f_entry)
2746{2740{
2747 struct ice_fltr_mgmt_list_entry *fm_entry;2741 struct ice_fltr_mgmt_list_entry *fm_entry;
2748 struct ice_aqc_sw_rules_elem *s_rule;2742 struct ice_sw_rule_lkup_rx_tx *s_rule;
2749 enum ice_sw_lkup_type l_type;2743 enum ice_sw_lkup_type l_type;
2750 struct ice_sw_recipe *recp;2744 struct ice_sw_recipe *recp;
2751 int status;2745 int status;
2752 2746
2753 s_rule = devm_kzalloc(ice_hw_to_dev(hw),2747 s_rule = devm_kzalloc(ice_hw_to_dev(hw),
2754 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE, GFP_KERNEL);2748 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule),
2749 GFP_KERNEL);
2755 if (!s_rule)2750 if (!s_rule)
2756 return -ENOMEM;2751 return -ENOMEM;
2757 fm_entry = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*fm_entry),2752 fm_entry = devm_kzalloc(ice_hw_to_dev(hw), sizeof(*fm_entry),
@@ -2772,17 +2767,16 @@ ice_create_pkt_fwd_rule(struct ice_hw *hw, · 14 unmodified lines
2772 ice_fill_sw_rule(hw, &fm_entry->fltr_info, s_rule,2767 ice_fill_sw_rule(hw, &fm_entry->fltr_info, s_rule,
2773 ice_aqc_opc_add_sw_rules);2768 ice_aqc_opc_add_sw_rules);
2774 2769
2775 status = ice_aq_sw_rules(hw, s_rule, ICE_SW_RULE_RX_TX_ETH_HDR_SIZE, 1,2770 status = ice_aq_sw_rules(hw, s_rule,
2771 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule), 1,
2776 ice_aqc_opc_add_sw_rules, NULL);2772 ice_aqc_opc_add_sw_rules, NULL);
2777 if (status) {2773 if (status) {
2778 devm_kfree(ice_hw_to_dev(hw), fm_entry);2774 devm_kfree(ice_hw_to_dev(hw), fm_entry);
2779 goto ice_create_pkt_fwd_rule_exit;2775 goto ice_create_pkt_fwd_rule_exit;
2780 }2776 }
2781 2777
2782 f_entry->fltr_info.fltr_rule_id =2778 f_entry->fltr_info.fltr_rule_id = le16_to_cpu(s_rule->index);
2783 le16_to_cpu(s_rule->pdata.lkup_tx_rx.index);2779 fm_entry->fltr_info.fltr_rule_id = le16_to_cpu(s_rule->index);
2784 fm_entry->fltr_info.fltr_rule_id =
2785 le16_to_cpu(s_rule->pdata.lkup_tx_rx.index);
2786 2780
2787 /* The book keeping entries will get removed when base driver2781 /* The book keeping entries will get removed when base driver
2788 * calls remove filter AQ command2782 * calls remove filter AQ command
@@ -2807,20 +2801,22 @@ ice_create_pkt_fwd_rule_exit: · 18 unmodified lines
2807static int2801static int
2808ice_update_pkt_fwd_rule(struct ice_hw *hw, struct ice_fltr_info *f_info)2802ice_update_pkt_fwd_rule(struct ice_hw *hw, struct ice_fltr_info *f_info)
2809{2803{
2810 struct ice_aqc_sw_rules_elem *s_rule;2804 struct ice_sw_rule_lkup_rx_tx *s_rule;
2811 int status;2805 int status;
2812 2806
2813 s_rule = devm_kzalloc(ice_hw_to_dev(hw),2807 s_rule = devm_kzalloc(ice_hw_to_dev(hw),
2814 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE, GFP_KERNEL);2808 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule),
2809 GFP_KERNEL);
2815 if (!s_rule)2810 if (!s_rule)
2816 return -ENOMEM;2811 return -ENOMEM;
2817 2812
2818 ice_fill_sw_rule(hw, f_info, s_rule, ice_aqc_opc_update_sw_rules);2813 ice_fill_sw_rule(hw, f_info, s_rule, ice_aqc_opc_update_sw_rules);
2819 2814
2820 s_rule->pdata.lkup_tx_rx.index = cpu_to_le16(f_info->fltr_rule_id);2815 s_rule->index = cpu_to_le16(f_info->fltr_rule_id);
2821 2816
2822 /* Update switch rule with new rule set to forward VSI list */2817 /* Update switch rule with new rule set to forward VSI list */
2823 status = ice_aq_sw_rules(hw, s_rule, ICE_SW_RULE_RX_TX_ETH_HDR_SIZE, 1,2818 status = ice_aq_sw_rules(hw, s_rule,
2819 ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule), 1,
2824 ice_aqc_opc_update_sw_rules, NULL);2820 ice_aqc_opc_update_sw_rules, NULL);
2825 2821
2826 devm_kfree(ice_hw_to_dev(hw), s_rule);2822 devm_kfree(ice_hw_to_dev(hw), s_rule);
@@ -3104,17 +3100,17 @@ static int · 277 unmodified lines
3104ice_remove_vsi_list_rule(struct ice_hw *hw, u16 vsi_list_id,3100ice_remove_vsi_list_rule(struct ice_hw *hw, u16 vsi_list_id,
3105 enum ice_sw_lkup_type lkup_type)3101 enum ice_sw_lkup_type lkup_type)
3106{3102{
3107 struct ice_aqc_sw_rules_elem *s_rule;3103 struct ice_sw_rule_vsi_list *s_rule;
3108 u16 s_rule_size;3104 u16 s_rule_size;
3109 int status;3105 int status;
3110 3106
3111 s_rule_size = (u16)ICE_SW_RULE_VSI_LIST_SIZE(0);3107 s_rule_size = (u16)ICE_SW_RULE_VSI_LIST_SIZE(s_rule, 0);
3112 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);3108 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);
3113 if (!s_rule)3109 if (!s_rule)
3114 return -ENOMEM;3110 return -ENOMEM;
3115 3111
3116 s_rule->type = cpu_to_le16(ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR);3112 s_rule->hdr.type = cpu_to_le16(ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR);
3117 s_rule->pdata.vsi_list.index = cpu_to_le16(vsi_list_id);3113 s_rule->index = cpu_to_le16(vsi_list_id);
3118 3114
3119 /* Free the vsi_list resource that we allocated. It is assumed that the3115 /* Free the vsi_list resource that we allocated. It is assumed that the
3120 * list is empty at this point.3116 * list is empty at this point.
@@ -3274,10 +3270,10 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id, · 153 unmodified lines
3274 3270
3275 if (remove_rule) {3271 if (remove_rule) {
3276 /* Remove the lookup rule */3272 /* Remove the lookup rule */
3277 struct ice_aqc_sw_rules_elem *s_rule;3273 struct ice_sw_rule_lkup_rx_tx *s_rule;
3278 3274
3279 s_rule = devm_kzalloc(ice_hw_to_dev(hw),3275 s_rule = devm_kzalloc(ice_hw_to_dev(hw),
3280 ICE_SW_RULE_RX_TX_NO_HDR_SIZE,3276 ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s_rule),
3281 GFP_KERNEL);3277 GFP_KERNEL);
3282 if (!s_rule) {3278 if (!s_rule) {
3283 status = -ENOMEM;3279 status = -ENOMEM;
@@ -3288,8 +3284,8 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id, · 4 unmodified lines
3288 ice_aqc_opc_remove_sw_rules);3284 ice_aqc_opc_remove_sw_rules);
3289 3285
3290 status = ice_aq_sw_rules(hw, s_rule,3286 status = ice_aq_sw_rules(hw, s_rule,
3291 ICE_SW_RULE_RX_TX_NO_HDR_SIZE, 1,3287 ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s_rule),
3292 ice_aqc_opc_remove_sw_rules, NULL);3288 1, ice_aqc_opc_remove_sw_rules, NULL);
3293 3289
3294 /* Remove a book keeping from the list */3290 /* Remove a book keeping from the list */
3295 devm_kfree(ice_hw_to_dev(hw), s_rule);3291 devm_kfree(ice_hw_to_dev(hw), s_rule);
@@ -3437,7 +3433,7 @@ bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle) · 141 unmodified lines
3437 */3433 */
3438int ice_add_mac(struct ice_hw *hw, struct list_head *m_list)3434int ice_add_mac(struct ice_hw *hw, struct list_head *m_list)
3439{3435{
3440 struct ice_aqc_sw_rules_elem *s_rule, *r_iter;3436 struct ice_sw_rule_lkup_rx_tx *s_rule, *r_iter;
3441 struct ice_fltr_list_entry *m_list_itr;3437 struct ice_fltr_list_entry *m_list_itr;
3442 struct list_head *rule_head;3438 struct list_head *rule_head;
3443 u16 total_elem_left, s_rule_size;3439 u16 total_elem_left, s_rule_size;
@@ -3501,7 +3497,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 57 unmodified lines
3501 rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;3497 rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;
3502 3498
3503 /* Allocate switch rule buffer for the bulk update for unicast */3499 /* Allocate switch rule buffer for the bulk update for unicast */
3504 s_rule_size = ICE_SW_RULE_RX_TX_ETH_HDR_SIZE;3500 s_rule_size = ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule);
3505 s_rule = devm_kcalloc(ice_hw_to_dev(hw), num_unicast, s_rule_size,3501 s_rule = devm_kcalloc(ice_hw_to_dev(hw), num_unicast, s_rule_size,
3506 GFP_KERNEL);3502 GFP_KERNEL);
3507 if (!s_rule) {3503 if (!s_rule) {
@@ -3517,8 +3513,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 9 unmodified lines
3517 if (is_unicast_ether_addr(mac_addr)) {3513 if (is_unicast_ether_addr(mac_addr)) {
3518 ice_fill_sw_rule(hw, &m_list_itr->fltr_info, r_iter,3514 ice_fill_sw_rule(hw, &m_list_itr->fltr_info, r_iter,
3519 ice_aqc_opc_add_sw_rules);3515 ice_aqc_opc_add_sw_rules);
3520 r_iter = (struct ice_aqc_sw_rules_elem *)3516 r_iter = (typeof(s_rule))((u8 *)r_iter + s_rule_size);
3521 ((u8 *)r_iter + s_rule_size);
3522 }3517 }
3523 }3518 }
3524 3519
@@ -3527,7 +3522,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 2 unmodified lines
3527 /* Call AQ switch rule in AQ_MAX chunk */3522 /* Call AQ switch rule in AQ_MAX chunk */
3528 for (total_elem_left = num_unicast; total_elem_left > 0;3523 for (total_elem_left = num_unicast; total_elem_left > 0;
3529 total_elem_left -= elem_sent) {3524 total_elem_left -= elem_sent) {
3530 struct ice_aqc_sw_rules_elem *entry = r_iter;3525 struct ice_sw_rule_lkup_rx_tx *entry = r_iter;
3531 3526
3532 elem_sent = min_t(u8, total_elem_left,3527 elem_sent = min_t(u8, total_elem_left,
3533 (ICE_AQ_MAX_BUF_LEN / s_rule_size));3528 (ICE_AQ_MAX_BUF_LEN / s_rule_size));
@@ -3536,7 +3531,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 2 unmodified lines
3536 NULL);3531 NULL);
3537 if (status)3532 if (status)
3538 goto ice_add_mac_exit;3533 goto ice_add_mac_exit;
3539 r_iter = (struct ice_aqc_sw_rules_elem *)3534 r_iter = (typeof(s_rule))
3540 ((u8 *)r_iter + (elem_sent * s_rule_size));3535 ((u8 *)r_iter + (elem_sent * s_rule_size));
3541 }3536 }
3542 3537
@@ -3548,8 +3543,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 5 unmodified lines
3548 struct ice_fltr_mgmt_list_entry *fm_entry;3543 struct ice_fltr_mgmt_list_entry *fm_entry;
3549 3544
3550 if (is_unicast_ether_addr(mac_addr)) {3545 if (is_unicast_ether_addr(mac_addr)) {
3551 f_info->fltr_rule_id =3546 f_info->fltr_rule_id = le16_to_cpu(r_iter->index);
3552 le16_to_cpu(r_iter->pdata.lkup_tx_rx.index);
3553 f_info->fltr_act = ICE_FWD_TO_VSI;3547 f_info->fltr_act = ICE_FWD_TO_VSI;
3554 /* Create an entry to track this MAC address */3548 /* Create an entry to track this MAC address */
3555 fm_entry = devm_kzalloc(ice_hw_to_dev(hw),3549 fm_entry = devm_kzalloc(ice_hw_to_dev(hw),
@@ -3565,8 +3559,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · 9 unmodified lines
3565 */3559 */
3566 3560
3567 list_add(&fm_entry->list_entry, rule_head);3561 list_add(&fm_entry->list_entry, rule_head);
3568 r_iter = (struct ice_aqc_sw_rules_elem *)3562 r_iter = (typeof(s_rule))((u8 *)r_iter + s_rule_size);
3569 ((u8 *)r_iter + s_rule_size);
3570 }3563 }
3571 }3564 }
3572 3565
@@ -3865,7 +3858,7 @@ ice_rem_adv_rule_info(struct ice_hw *hw, struct list_head *rule_head) · 292 unmodified lines
3865 */3858 */
3866int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction)3859int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction)
3867{3860{
3868 struct ice_aqc_sw_rules_elem *s_rule;3861 struct ice_sw_rule_lkup_rx_tx *s_rule;
3869 struct ice_fltr_info f_info;3862 struct ice_fltr_info f_info;
3870 enum ice_adminq_opc opcode;3863 enum ice_adminq_opc opcode;
3871 u16 s_rule_size;3864 u16 s_rule_size;
@@ -3876,8 +3869,8 @@ int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction) · 4 unmodified lines
3876 return -EINVAL;3869 return -EINVAL;
3877 hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);3870 hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
3878 3871
3879 s_rule_size = set ? ICE_SW_RULE_RX_TX_ETH_HDR_SIZE :3872 s_rule_size = set ? ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s_rule) :
3880 ICE_SW_RULE_RX_TX_NO_HDR_SIZE;3873 ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s_rule);
3881 3874
3882 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);3875 s_rule = devm_kzalloc(ice_hw_to_dev(hw), s_rule_size, GFP_KERNEL);
3883 if (!s_rule)3876 if (!s_rule)
@@ -3915,7 +3908,7 @@ int ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction) · 31 unmodified lines
3915 if (status || !(f_info.flag & ICE_FLTR_TX_RX))3908 if (status || !(f_info.flag & ICE_FLTR_TX_RX))
3916 goto out;3909 goto out;
3917 if (set) {3910 if (set) {
3918 u16 index = le16_to_cpu(s_rule->pdata.lkup_tx_rx.index);3911 u16 index = le16_to_cpu(s_rule->index);
3919 3912
3920 if (f_info.flag & ICE_FLTR_TX) {3913 if (f_info.flag & ICE_FLTR_TX) {
3921 hw->port_info->dflt_tx_vsi_num = hw_vsi_id;3914 hw->port_info->dflt_tx_vsi_num = hw_vsi_id;
@@ -5641,7 +5634,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, · 1719 unmodified lines
5641 */5634 */
5642static int5635static int
5643ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,5636ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
5644 struct ice_aqc_sw_rules_elem *s_rule,5637 struct ice_sw_rule_lkup_rx_tx *s_rule,
5645 const struct ice_dummy_pkt_profile *profile)5638 const struct ice_dummy_pkt_profile *profile)
5646{5639{
5647 u8 *pkt;5640 u8 *pkt;
@@ -5650,7 +5643,7 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, · 2 unmodified lines
5650 /* Start with a packet with a pre-defined/dummy content. Then, fill5643 /* Start with a packet with a pre-defined/dummy content. Then, fill
5651 * in the header values to be looked up or matched.5644 * in the header values to be looked up or matched.
5652 */5645 */
5653 pkt = s_rule->pdata.lkup_tx_rx.hdr;5646 pkt = s_rule->hdr_data;
5654 5647
5655 memcpy(pkt, profile->pkt, profile->pkt_len);5648 memcpy(pkt, profile->pkt, profile->pkt_len);
5656 5649
@@ -5740,7 +5733,7 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, · 83 unmodified lines
5740 }5733 }
5741 }5734 }
5742 5735
5743 s_rule->pdata.lkup_tx_rx.hdr_len = cpu_to_le16(profile->pkt_len);5736 s_rule->hdr_len = cpu_to_le16(profile->pkt_len);
5744 5737
5745 return 0;5738 return 0;
5746}5739}
@@ -5963,7 +5956,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 216 unmodified lines
5963 struct ice_rule_query_data *added_entry)5956 struct ice_rule_query_data *added_entry)
5964{5957{
5965 struct ice_adv_fltr_mgmt_list_entry *m_entry, *adv_fltr = NULL;5958 struct ice_adv_fltr_mgmt_list_entry *m_entry, *adv_fltr = NULL;
5966 struct ice_aqc_sw_rules_elem *s_rule = NULL;5959 struct ice_sw_rule_lkup_rx_tx *s_rule = NULL;
5967 const struct ice_dummy_pkt_profile *profile;5960 const struct ice_dummy_pkt_profile *profile;
5968 u16 rid = 0, i, rule_buf_sz, vsi_handle;5961 u16 rid = 0, i, rule_buf_sz, vsi_handle;
5969 struct list_head *rule_head;5962 struct list_head *rule_head;
@@ -6040,7 +6033,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 70 unmodified lines
6040 }6033 }
6041 return status;6034 return status;
6042 }6035 }
6043 rule_buf_sz = ICE_SW_RULE_RX_TX_NO_HDR_SIZE + profile->pkt_len;6036 rule_buf_sz = ICE_SW_RULE_RX_TX_HDR_SIZE(s_rule, profile->pkt_len);
6044 s_rule = kzalloc(rule_buf_sz, GFP_KERNEL);6037 s_rule = kzalloc(rule_buf_sz, GFP_KERNEL);
6045 if (!s_rule)6038 if (!s_rule)
6046 return -ENOMEM;6039 return -ENOMEM;
@@ -6089,16 +6082,15 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 42 unmodified lines
6089 * by caller)6082 * by caller)
6090 */6083 */
6091 if (rinfo->rx) {6084 if (rinfo->rx) {
6092 s_rule->type = cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_RX);6085 s_rule->hdr.type = cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_RX);
6093 s_rule->pdata.lkup_tx_rx.src =6086 s_rule->src = cpu_to_le16(hw->port_info->lport);
6094 cpu_to_le16(hw->port_info->lport);
6095 } else {6087 } else {
6096 s_rule->type = cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_TX);6088 s_rule->hdr.type = cpu_to_le16(ICE_AQC_SW_RULES_T_LKUP_TX);
6097 s_rule->pdata.lkup_tx_rx.src = cpu_to_le16(rinfo->sw_act.src);6089 s_rule->src = cpu_to_le16(rinfo->sw_act.src);
6098 }6090 }
6099 6091
6100 s_rule->pdata.lkup_tx_rx.recipe_id = cpu_to_le16(rid);6092 s_rule->recipe_id = cpu_to_le16(rid);
6101 s_rule->pdata.lkup_tx_rx.act = cpu_to_le32(act);6093 s_rule->act = cpu_to_le32(act);
6102 6094
6103 status = ice_fill_adv_dummy_packet(lkups, lkups_cnt, s_rule, profile);6095 status = ice_fill_adv_dummy_packet(lkups, lkups_cnt, s_rule, profile);
6104 if (status)6096 if (status)
@@ -6107,7 +6099,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 2 unmodified lines
6107 if (rinfo->tun_type != ICE_NON_TUN &&6099 if (rinfo->tun_type != ICE_NON_TUN &&
6108 rinfo->tun_type != ICE_SW_TUN_AND_NON_TUN) {6100 rinfo->tun_type != ICE_SW_TUN_AND_NON_TUN) {
6109 status = ice_fill_adv_packet_tun(hw, rinfo->tun_type,6101 status = ice_fill_adv_packet_tun(hw, rinfo->tun_type,
6110 s_rule->pdata.lkup_tx_rx.hdr,6102 s_rule->hdr_data,
6111 profile->offsets);6103 profile->offsets);
6112 if (status)6104 if (status)
6113 goto err_ice_add_adv_rule;6105 goto err_ice_add_adv_rule;
@@ -6135,8 +6127,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 21 unmodified lines
6135 6127
6136 adv_fltr->lkups_cnt = lkups_cnt;6128 adv_fltr->lkups_cnt = lkups_cnt;
6137 adv_fltr->rule_info = *rinfo;6129 adv_fltr->rule_info = *rinfo;
6138 adv_fltr->rule_info.fltr_rule_id =6130 adv_fltr->rule_info.fltr_rule_id = le16_to_cpu(s_rule->index);
6139 le16_to_cpu(s_rule->pdata.lkup_tx_rx.index);
6140 sw = hw->switch_info;6131 sw = hw->switch_info;
6141 sw->recp_list[rid].adv_rule = true;6132 sw->recp_list[rid].adv_rule = true;
6142 rule_head = &sw->recp_list[rid].filt_rules;6133 rule_head = &sw->recp_list[rid].filt_rules;
@@ -6384,17 +6375,16 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 241 unmodified lines
6384 }6375 }
6385 mutex_unlock(rule_lock);6376 mutex_unlock(rule_lock);
6386 if (remove_rule) {6377 if (remove_rule) {
6387 struct ice_aqc_sw_rules_elem *s_rule;6378 struct ice_sw_rule_lkup_rx_tx *s_rule;
6388 u16 rule_buf_sz;6379 u16 rule_buf_sz;
6389 6380
6390 rule_buf_sz = ICE_SW_RULE_RX_TX_NO_HDR_SIZE;6381 rule_buf_sz = ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s_rule);
6391 s_rule = kzalloc(rule_buf_sz, GFP_KERNEL);6382 s_rule = kzalloc(rule_buf_sz, GFP_KERNEL);
6392 if (!s_rule)6383 if (!s_rule)
6393 return -ENOMEM;6384 return -ENOMEM;
6394 s_rule->pdata.lkup_tx_rx.act = 0;6385 s_rule->act = 0;
6395 s_rule->pdata.lkup_tx_rx.index =6386 s_rule->index = cpu_to_le16(list_elem->rule_info.fltr_rule_id);
6396 cpu_to_le16(list_elem->rule_info.fltr_rule_id);6387 s_rule->hdr_len = 0;
6397 s_rule->pdata.lkup_tx_rx.hdr_len = 0;
6398 status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,6388 status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,
6399 rule_buf_sz, 1,6389 rule_buf_sz, 1,
6400 ice_aqc_opc_remove_sw_rules, NULL);6390 ice_aqc_opc_remove_sw_rules, NULL);
drivers/net/ethernet/intel/ice/ice_switch.h+0−3
@@ -23,9 +23,6 @@ · 22 unmodified lines
23#define ICE_PROFID_IPV6_GTPU_TEID 4623#define ICE_PROFID_IPV6_GTPU_TEID 46
24#define ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER 7024#define ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER 70
25 25
26#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \
27 (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))
28
29/* VSI context structure for add/get/update/free operations */26/* VSI context structure for add/get/update/free operations */
30struct ice_vsi_ctx {27struct ice_vsi_ctx {
31 u16 vsi_num;28 u16 vsi_num;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t