From: Simon Horman <simon.horman@corigine.com>
To: Wojciech Drewek <wojciech.drewek@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
alexandr.lobakin@intel.com, david.m.ertman@intel.com,
michal.swiatkowski@linux.intel.com,
marcin.szycik@linux.intel.com, pawel.chmielewski@intel.com,
sridhar.samudrala@intel.com, pmenzel@molgen.mpg.de,
dan.carpenter@linaro.org
Subject: Re: [PATCH iwl-next v4 10/13] ice: Add VLAN FDB support in switchdev mode
Date: Sun, 4 Jun 2023 18:37:28 +0200 [thread overview]
Message-ID: <ZHy9yNtc5GMr6UbR@corigine.com> (raw)
In-Reply-To: <20230524122121.15012-11-wojciech.drewek@intel.com>
On Wed, May 24, 2023 at 02:21:18PM +0200, Wojciech Drewek wrote:
> From: Marcin Szycik <marcin.szycik@intel.com>
>
> Add support for matching on VLAN tag in bridge offloads.
> Currently only trunk mode is supported.
>
> To enable VLAN filtering (existing FDB entries will be deleted):
> ip link set $BR type bridge vlan_filtering 1
>
> To add VLANs to bridge in trunk mode:
> bridge vlan add dev $PF1 vid 110-111
> bridge vlan add dev $VF1_PR vid 110-111
>
> Signed-off-by: Marcin Szycik <marcin.szycik@intel.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Hi Wojciech,
some minor feedback on this one from my side.
...
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> index 19481decffe4..820b3296da60 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
> @@ -64,13 +64,19 @@ ice_eswitch_br_netdev_to_port(struct net_device *dev)
> static void
> ice_eswitch_br_ingress_rule_setup(struct ice_adv_lkup_elem *list,
> struct ice_adv_rule_info *rule_info,
> - const unsigned char *mac,
> + const unsigned char *mac, u16 vid,
> u8 pf_id, u16 vf_vsi_idx)
> {
> list[0].type = ICE_MAC_OFOS;
> ether_addr_copy(list[0].h_u.eth_hdr.dst_addr, mac);
> eth_broadcast_addr(list[0].m_u.eth_hdr.dst_addr);
>
> + if (ice_eswitch_is_vid_valid(vid)) {
> + list[1].type = ICE_VLAN_OFOS;
> + list[1].h_u.vlan_hdr.vlan = cpu_to_be16(vid & VLAN_VID_MASK);
> + list[1].m_u.vlan_hdr.vlan = cpu_to_be16(0xFFFF);
> + }
nit: the above code seems to be (largely) duplicated in (at least)
ice_eswitch_br_egress_rule_setup(). Perhaps a helper function
would be appropriate.
> +
> rule_info->sw_act.vsi_handle = vf_vsi_idx;
> rule_info->sw_act.flag |= ICE_FLTR_RX;
> rule_info->sw_act.src = pf_id;
> @@ -80,13 +86,19 @@ ice_eswitch_br_ingress_rule_setup(struct ice_adv_lkup_elem *list,
> static void
> ice_eswitch_br_egress_rule_setup(struct ice_adv_lkup_elem *list,
> struct ice_adv_rule_info *rule_info,
> - const unsigned char *mac,
> + const unsigned char *mac, u16 vid,
> u16 pf_vsi_idx)
> {
> list[0].type = ICE_MAC_OFOS;
> ether_addr_copy(list[0].h_u.eth_hdr.dst_addr, mac);
> eth_broadcast_addr(list[0].m_u.eth_hdr.dst_addr);
>
> + if (ice_eswitch_is_vid_valid(vid)) {
> + list[1].type = ICE_VLAN_OFOS;
> + list[1].h_u.vlan_hdr.vlan = cpu_to_be16(vid & VLAN_VID_MASK);
> + list[1].m_u.vlan_hdr.vlan = cpu_to_be16(0xFFFF);
> + }
> +
> rule_info->sw_act.vsi_handle = pf_vsi_idx;
> rule_info->sw_act.flag |= ICE_FLTR_TX;
> rule_info->flags_info.act = ICE_SINGLE_ACT_LAN_ENABLE;
> @@ -110,14 +122,19 @@ ice_eswitch_br_rule_delete(struct ice_hw *hw, struct ice_rule_query_data *rule)
>
> static struct ice_rule_query_data *
> ice_eswitch_br_fwd_rule_create(struct ice_hw *hw, int vsi_idx, int port_type,
> - const unsigned char *mac)
> + const unsigned char *mac, u16 vid)
> {
> struct ice_adv_rule_info rule_info = { 0 };
> struct ice_rule_query_data *rule;
> struct ice_adv_lkup_elem *list;
> - u16 lkups_cnt = 1;
> + u16 lkups_cnt;
> int err;
>
> + if (ice_eswitch_is_vid_valid(vid))
> + lkups_cnt = 2;
> + else
> + lkups_cnt = 1;
nit: The above condition could be more succinctly expressed as
(completely untested):
lkups_cnt = ice_eswitch_is_vid_valid(vid) ? 2 : 1;
Also, the above condition appears elsewhere in this patch.
Perhaps a helper is appropriate.
> +
> rule = kzalloc(sizeof(*rule), GFP_KERNEL);
> if (!rule)
> return ERR_PTR(-ENOMEM);
> @@ -131,11 +148,11 @@ ice_eswitch_br_fwd_rule_create(struct ice_hw *hw, int vsi_idx, int port_type,
> switch (port_type) {
> case ICE_ESWITCH_BR_UPLINK_PORT:
> ice_eswitch_br_egress_rule_setup(list, &rule_info, mac,
> - vsi_idx);
> + vid, vsi_idx);
> break;
> case ICE_ESWITCH_BR_VF_REPR_PORT:
> ice_eswitch_br_ingress_rule_setup(list, &rule_info, mac,
> - hw->pf_id, vsi_idx);
> + vid, hw->pf_id, vsi_idx);
> break;
> default:
> err = -EINVAL;
> @@ -164,13 +181,18 @@ ice_eswitch_br_fwd_rule_create(struct ice_hw *hw, int vsi_idx, int port_type,
>
> static struct ice_rule_query_data *
> ice_eswitch_br_guard_rule_create(struct ice_hw *hw, u16 vsi_idx,
> - const unsigned char *mac)
> + const unsigned char *mac, u16 vid)
> {
> struct ice_adv_rule_info rule_info = { 0 };
> struct ice_rule_query_data *rule;
> struct ice_adv_lkup_elem *list;
> - const u16 lkups_cnt = 1;
> int err = -ENOMEM;
> + u16 lkups_cnt;
> +
> + if (ice_eswitch_is_vid_valid(vid))
> + lkups_cnt = 2;
> + else
> + lkups_cnt = 1;
>
> rule = kzalloc(sizeof(*rule), GFP_KERNEL);
> if (!rule)
> @@ -184,6 +206,12 @@ ice_eswitch_br_guard_rule_create(struct ice_hw *hw, u16 vsi_idx,
> ether_addr_copy(list[0].h_u.eth_hdr.src_addr, mac);
> eth_broadcast_addr(list[0].m_u.eth_hdr.src_addr);
>
> + if (ice_eswitch_is_vid_valid(vid)) {
> + list[1].type = ICE_VLAN_OFOS;
> + list[1].h_u.vlan_hdr.vlan = cpu_to_be16(vid & VLAN_VID_MASK);
> + list[1].m_u.vlan_hdr.vlan = cpu_to_be16(0xFFFF);
> + }
> +
> rule_info.allow_pass_l2 = true;
> rule_info.sw_act.vsi_handle = vsi_idx;
> rule_info.sw_act.fltr_act = ICE_NOP;
...
next prev parent reply other threads:[~2023-06-04 16:37 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 12:21 [PATCH iwl-next v4 00/13] ice: switchdev bridge offload Wojciech Drewek
2023-05-24 12:21 ` [PATCH iwl-next v4 01/13] ice: Skip adv rules removal upon switchdev release Wojciech Drewek
2023-06-04 8:17 ` Simon Horman
2023-06-05 10:27 ` Drewek, Wojciech
2023-06-07 5:49 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 02/13] ice: Prohibit rx mode change in switchdev mode Wojciech Drewek
2023-06-04 13:59 ` Simon Horman
2023-06-12 7:30 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-06-13 9:41 ` Drewek, Wojciech
2023-06-13 10:14 ` Buvaneswaran, Sujai
2023-06-13 10:14 ` Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 03/13] ice: Don't tx before switchdev is fully configured Wojciech Drewek
2023-06-04 14:00 ` Simon Horman
2023-06-07 5:57 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 04/13] ice: Disable vlan pruning for uplink VSI Wojciech Drewek
2023-06-04 14:01 ` Simon Horman
2023-06-07 6:00 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 05/13] ice: Unset src prune on " Wojciech Drewek
2023-06-04 14:02 ` Simon Horman
2023-06-07 6:02 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 06/13] ice: Implement basic eswitch bridge setup Wojciech Drewek
2023-06-04 13:59 ` Simon Horman
2023-06-05 10:47 ` Drewek, Wojciech
2023-06-05 12:02 ` Simon Horman
2023-06-07 6:03 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 07/13] ice: Switchdev FDB events support Wojciech Drewek
2023-06-04 14:17 ` Simon Horman
2023-06-05 13:53 ` Drewek, Wojciech
2023-06-07 6:06 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 08/13] ice: Add guard rule when creating FDB in switchdev Wojciech Drewek
2023-06-04 16:08 ` Simon Horman
2023-06-07 6:22 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 09/13] ice: Accept LAG netdevs in bridge offloads Wojciech Drewek
2023-06-04 16:06 ` Simon Horman
2023-06-05 17:12 ` Drewek, Wojciech
2023-06-06 9:23 ` Simon Horman
2023-06-07 6:23 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 10/13] ice: Add VLAN FDB support in switchdev mode Wojciech Drewek
2023-06-04 16:37 ` Simon Horman [this message]
2023-06-05 17:45 ` Drewek, Wojciech
2023-06-07 6:25 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 11/13] ice: implement bridge port vlan Wojciech Drewek
2023-06-04 17:30 ` Simon Horman
2023-06-07 6:34 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 12/13] ice: implement static version of ageing Wojciech Drewek
2023-06-04 17:31 ` Simon Horman
2023-06-07 6:37 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-05-24 12:21 ` [PATCH iwl-next v4 13/13] ice: add tracepoints for the switchdev bridge Wojciech Drewek
2023-06-07 6:39 ` [Intel-wired-lan] " Buvaneswaran, Sujai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZHy9yNtc5GMr6UbR@corigine.com \
--to=simon.horman@corigine.com \
--cc=alexandr.lobakin@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=david.m.ertman@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=marcin.szycik@linux.intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pawel.chmielewski@intel.com \
--cc=pmenzel@molgen.mpg.de \
--cc=sridhar.samudrala@intel.com \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).