Skip to content

Commit d49b9b0

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== ice: allow matching on meta data Michal Swiatkowski says: This patchset is intended to improve the usability of the switchdev slow path. Without matching on a meta data values slow path works based on VF's MAC addresses. It causes a problem when the VF wants to use more than one MAC address (e.g. when it is in trusted mode). Parse all meta data in the same place where protocol type fields are parsed. Add description for the currently implemented meta data. It is important to note that depending on DDP not all described meta data can be available. Using not available meta data leads to error returned by function which is looking for correct words in profiles read from DDP. There is also one small improvement, remove of rx field in rule info structure (patch 2). It is redundant. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents efc3001 + 0ef4479 commit d49b9b0

File tree

12 files changed

+351
-259
lines changed

12 files changed

+351
-259
lines changed

drivers/net/ethernet/intel/ice/ice_eswitch.c

Lines changed: 27 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
#include "ice_tc_lib.h"
1111

1212
/**
13-
* ice_eswitch_add_vf_mac_rule - add adv rule with VF's MAC
13+
* ice_eswitch_add_vf_sp_rule - add adv rule with VF's VSI index
1414
* @pf: pointer to PF struct
1515
* @vf: pointer to VF struct
16-
* @mac: VF's MAC address
1716
*
1817
* This function adds advanced rule that forwards packets with
19-
* VF's MAC address (src MAC) to the corresponding switchdev ctrl VSI queue.
18+
* VF's VSI index to the corresponding switchdev ctrl VSI queue.
2019
*/
21-
int
22-
ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac)
20+
static int
21+
ice_eswitch_add_vf_sp_rule(struct ice_pf *pf, struct ice_vf *vf)
2322
{
2423
struct ice_vsi *ctrl_vsi = pf->switchdev.control_vsi;
2524
struct ice_adv_rule_info rule_info = { 0 };
@@ -32,76 +31,41 @@ ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac)
3231
if (!list)
3332
return -ENOMEM;
3433

35-
list[0].type = ICE_MAC_OFOS;
36-
ether_addr_copy(list[0].h_u.eth_hdr.src_addr, mac);
37-
eth_broadcast_addr(list[0].m_u.eth_hdr.src_addr);
34+
ice_rule_add_src_vsi_metadata(list);
3835

39-
rule_info.sw_act.flag |= ICE_FLTR_TX;
36+
rule_info.sw_act.flag = ICE_FLTR_TX;
4037
rule_info.sw_act.vsi_handle = ctrl_vsi->idx;
4138
rule_info.sw_act.fltr_act = ICE_FWD_TO_Q;
42-
rule_info.rx = false;
4339
rule_info.sw_act.fwd_id.q_id = hw->func_caps.common_cap.rxq_first_id +
4440
ctrl_vsi->rxq_map[vf->vf_id];
4541
rule_info.flags_info.act |= ICE_SINGLE_ACT_LB_ENABLE;
4642
rule_info.flags_info.act_valid = true;
4743
rule_info.tun_type = ICE_SW_TUN_AND_NON_TUN;
44+
rule_info.src_vsi = vf->lan_vsi_idx;
4845

4946
err = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info,
50-
vf->repr->mac_rule);
47+
&vf->repr->sp_rule);
5148
if (err)
52-
dev_err(ice_pf_to_dev(pf), "Unable to add VF mac rule in switchdev mode for VF %d",
49+
dev_err(ice_pf_to_dev(pf), "Unable to add VF slow-path rule in switchdev mode for VF %d",
5350
vf->vf_id);
54-
else
55-
vf->repr->rule_added = true;
5651

5752
kfree(list);
5853
return err;
5954
}
6055

6156
/**
62-
* ice_eswitch_replay_vf_mac_rule - replay adv rule with VF's MAC
63-
* @vf: pointer to vF struct
64-
*
65-
* This function replays VF's MAC rule after reset.
66-
*/
67-
void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf)
68-
{
69-
int err;
70-
71-
if (!ice_is_switchdev_running(vf->pf))
72-
return;
73-
74-
if (is_valid_ether_addr(vf->hw_lan_addr)) {
75-
err = ice_eswitch_add_vf_mac_rule(vf->pf, vf,
76-
vf->hw_lan_addr);
77-
if (err) {
78-
dev_err(ice_pf_to_dev(vf->pf), "Failed to add MAC %pM for VF %d\n, error %d\n",
79-
vf->hw_lan_addr, vf->vf_id, err);
80-
return;
81-
}
82-
vf->num_mac++;
83-
84-
ether_addr_copy(vf->dev_lan_addr, vf->hw_lan_addr);
85-
}
86-
}
87-
88-
/**
89-
* ice_eswitch_del_vf_mac_rule - delete adv rule with VF's MAC
57+
* ice_eswitch_del_vf_sp_rule - delete adv rule with VF's VSI index
9058
* @vf: pointer to the VF struct
9159
*
92-
* Delete the advanced rule that was used to forward packets with the VF's MAC
93-
* address (src MAC) to the corresponding switchdev ctrl VSI queue.
60+
* Delete the advanced rule that was used to forward packets with the VF's VSI
61+
* index to the corresponding switchdev ctrl VSI queue.
9462
*/
95-
void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf)
63+
static void ice_eswitch_del_vf_sp_rule(struct ice_vf *vf)
9664
{
97-
if (!ice_is_switchdev_running(vf->pf))
98-
return;
99-
100-
if (!vf->repr->rule_added)
65+
if (!vf->repr)
10166
return;
10267

103-
ice_rem_adv_rule_by_id(&vf->pf->hw, vf->repr->mac_rule);
104-
vf->repr->rule_added = false;
68+
ice_rem_adv_rule_by_id(&vf->pf->hw, &vf->repr->sp_rule);
10569
}
10670

10771
/**
@@ -237,6 +201,7 @@ ice_eswitch_release_reprs(struct ice_pf *pf, struct ice_vsi *ctrl_vsi)
237201
ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);
238202
metadata_dst_free(vf->repr->dst);
239203
vf->repr->dst = NULL;
204+
ice_eswitch_del_vf_sp_rule(vf);
240205
ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
241206
ICE_FWD_TO_VSI);
242207

@@ -264,25 +229,30 @@ static int ice_eswitch_setup_reprs(struct ice_pf *pf)
264229
vf->repr->dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX,
265230
GFP_KERNEL);
266231
if (!vf->repr->dst) {
267-
ice_fltr_add_mac_and_broadcast(vsi,
268-
vf->hw_lan_addr,
232+
ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
233+
ICE_FWD_TO_VSI);
234+
goto err;
235+
}
236+
237+
if (ice_eswitch_add_vf_sp_rule(pf, vf)) {
238+
ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
269239
ICE_FWD_TO_VSI);
270240
goto err;
271241
}
272242

273243
if (ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof)) {
274-
ice_fltr_add_mac_and_broadcast(vsi,
275-
vf->hw_lan_addr,
244+
ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
276245
ICE_FWD_TO_VSI);
246+
ice_eswitch_del_vf_sp_rule(vf);
277247
metadata_dst_free(vf->repr->dst);
278248
vf->repr->dst = NULL;
279249
goto err;
280250
}
281251

282252
if (ice_vsi_add_vlan_zero(vsi)) {
283-
ice_fltr_add_mac_and_broadcast(vsi,
284-
vf->hw_lan_addr,
253+
ice_fltr_add_mac_and_broadcast(vsi, vf->hw_lan_addr,
285254
ICE_FWD_TO_VSI);
255+
ice_eswitch_del_vf_sp_rule(vf);
286256
metadata_dst_free(vf->repr->dst);
287257
vf->repr->dst = NULL;
288258
ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof);

drivers/net/ethernet/intel/ice/ice_eswitch.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
2020
void ice_eswitch_update_repr(struct ice_vsi *vsi);
2121

2222
void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
23-
int
24-
ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
25-
const u8 *mac);
26-
void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf);
27-
void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf);
2823

2924
void ice_eswitch_set_target_vsi(struct sk_buff *skb,
3025
struct ice_tx_offload_params *off);
@@ -34,15 +29,6 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev);
3429
static inline void ice_eswitch_release(struct ice_pf *pf) { }
3530

3631
static inline void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf) { }
37-
static inline void ice_eswitch_replay_vf_mac_rule(struct ice_vf *vf) { }
38-
static inline void ice_eswitch_del_vf_mac_rule(struct ice_vf *vf) { }
39-
40-
static inline int
41-
ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf,
42-
const u8 *mac)
43-
{
44-
return -EOPNOTSUPP;
45-
}
4632

4733
static inline void
4834
ice_eswitch_set_target_vsi(struct sk_buff *skb,

0 commit comments

Comments
 (0)