From: Marcin Szycik <[email protected]>

Use the already existing helper function to fill Ethernet header. Also
replace sizeof with a (also existing) macro to reduce the number of
variables.

Suggested-by: Martyna Szapar-Mudlaw <[email protected]>
Signed-off-by: Marcin Szycik <[email protected]>
Signed-off-by: Aleksandr Loktionov <[email protected]>
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c 
b/drivers/net/ethernet/intel/ice/ice_switch.c
index bb0f990..6496534 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -2612,7 +2612,6 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info 
*f_info,
        u16 vlan_id = ICE_MAX_VLAN_ID + 1;
        u16 vlan_tpid = ETH_P_8021Q;
        void *daddr = NULL;
-       u16 eth_hdr_sz;
        u8 *eth_hdr;
        u32 act = 0;
        __be16 *off;
@@ -2625,11 +2624,10 @@ ice_fill_sw_rule(struct ice_hw *hw, struct 
ice_fltr_info *f_info,
                return;
        }
 
-       eth_hdr_sz = sizeof(dummy_eth_header);
        eth_hdr = s_rule->hdr_data;
 
        /* initialize the ether header with a dummy header */
-       memcpy(eth_hdr, dummy_eth_header, eth_hdr_sz);
+       ice_fill_eth_hdr(eth_hdr);
        ice_fill_sw_info(hw, f_info);
 
        switch (f_info->fltr_act) {
@@ -2730,7 +2728,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info 
*f_info,
 
        /* Create the switch rule with the final dummy Ethernet header */
        if (opc != ice_aqc_opc_update_sw_rules)
-               s_rule->hdr_len = cpu_to_le16(eth_hdr_sz);
+               s_rule->hdr_len = cpu_to_le16(DUMMY_ETH_HDR_LEN);
 }
 
 /**
-- 
2.52.0

Reply via email to