netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH iwl-next v3 08/10] ice: implement bridge port vlan
Date: Mon, 22 May 2023 13:27:37 +0200	[thread overview]
Message-ID: <ZGtRqTaWtKYbI+f1@corigine.com> (raw)
In-Reply-To: <20230522090542.45679-9-wojciech.drewek@intel.com>

+Dan Carpenter

On Mon, May 22, 2023 at 11:05:40AM +0200, Wojciech Drewek wrote:
> From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> 
> Port VLAN in this case means push and pop VLAN action on specific vid.
> There are a few limitation in hardware:
> - push and pop can't be used separately
> - if port VLAN is used there can't be any trunk VLANs, because pop
>   action is done on all traffic received by VSI in port VLAN mode
> - port VLAN mode on uplink port isn't supported
> 
> Reflect these limitations in code using dev_info to inform the user
> about unsupported configuration.
> 
> In bridge mode there is a need to configure port vlan without resetting
> VFs. To do that implement ice_port_vlan_on/off() functions. They are
> only configuring correct vlan_ops to allow setting port vlan.
> 
> We also need to clear port vlan without resetting the VF which is not
> supported right now. Change it by implementing clear_port_vlan ops.
> As previous VLAN configuration isn't always the same, store current
> config while creating port vlan and restore it in clear function.
> 
> Configuration steps:
> - configure switchdev with bridge
> - #bridge vlan add dev eth0 vid 120 pvid untagged
> - #bridge vlan add dev eth1 vid 120 pvid untagged
> - ping from VF0 to VF1
> 
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>

...

> @@ -639,14 +698,29 @@ ice_eswitch_br_vlan_create(u16 vid, u16 flags, struct ice_esw_br_port *port)
>  
>  	vlan->vid = vid;
>  	vlan->flags = flags;
> +	if ((flags & BRIDGE_VLAN_INFO_PVID) &&
> +	    (flags & BRIDGE_VLAN_INFO_UNTAGGED)) {
> +		err = ice_eswitch_br_set_pvid(port, vlan);
> +		if (err)
> +			goto err_set_pvid;
> +	} else if ((flags & BRIDGE_VLAN_INFO_PVID) ||
> +		   (flags & BRIDGE_VLAN_INFO_UNTAGGED)) {
> +		dev_info(dev, "VLAN push and pop are supported only simultaneously\n");
> +		return ERR_PTR(-EOPNOTSUPP);

Hi Wojciech,

Smatch thinks that vlan is being leaked here.
So perhaps:

		err = -EOPNOTSUPP;
		goto err_set_pvid;

.../ice_eswitch_br.c:709 ice_eswitch_br_vlan_create() warn: possible memory leak of 'vlan'


> +	}
>  
>  	err = xa_insert(&port->vlans, vlan->vid, vlan, GFP_KERNEL);
> -	if (err) {
> -		kfree(vlan);
> -		return ERR_PTR(err);
> -	}
> +	if (err)
> +		goto err_insert;
>  
>  	return vlan;
> +
> +err_insert:
> +	if (port->pvid)
> +		ice_eswitch_br_clear_pvid(port);
> +err_set_pvid:
> +	kfree(vlan);
> +	return ERR_PTR(err);
>  }
>  
>  static int

...

  reply	other threads:[~2023-05-22 11:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  9:05 [PATCH iwl-next v3 00/10] ice: switchdev bridge offload Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 01/10] ice: Minor switchdev fixes Wojciech Drewek
2023-05-22 10:05   ` [Intel-wired-lan] " Paul Menzel
2023-05-23  9:20     ` Drewek, Wojciech
2023-05-22  9:05 ` [PATCH iwl-next v3 02/10] ice: Unset src prune on uplink VSI Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 03/10] ice: Implement basic eswitch bridge setup Wojciech Drewek
2023-05-22 11:22   ` Simon Horman
2023-05-23 10:09     ` Drewek, Wojciech
2023-05-22  9:05 ` [PATCH iwl-next v3 04/10] ice: Switchdev FDB events support Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 05/10] ice: Add guard rule when creating FDB in switchdev Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 06/10] ice: Accept LAG netdevs in bridge offloads Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 07/10] ice: Add VLAN FDB support in switchdev mode Wojciech Drewek
2023-05-22  9:05 ` [PATCH iwl-next v3 08/10] ice: implement bridge port vlan Wojciech Drewek
2023-05-22 11:27   ` Simon Horman [this message]
2023-05-23 10:10     ` Drewek, Wojciech
2023-05-22  9:05 ` [PATCH iwl-next v3 09/10] ice: implement static version of ageing Wojciech Drewek
2023-05-22 10:13   ` [Intel-wired-lan] " Paul Menzel
2023-05-23 10:00     ` Drewek, Wojciech
2023-05-22  9:05 ` [PATCH iwl-next v3 10/10] ice: add tracepoints for the switchdev bridge Wojciech Drewek

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=ZGtRqTaWtKYbI+f1@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=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).