netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>, davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, guru.anbalagane@oracle.com
Subject: Re: [net-next 20/20] i40e: don't allow i40e_vsi_(add|kill)_vlan to operate when VID<1
Date: Wed, 7 Dec 2016 13:10:44 +0300	[thread overview]
Message-ID: <8f82cd1d-0118-7b37-1a05-fa7b77d4e75c@cogentembedded.com> (raw)
In-Reply-To: <20161207073354.88568-21-jeffrey.t.kirsher@intel.com>

Hello!

On 12/7/2016 10:33 AM, Jeff Kirsher wrote:

> From: Jacob Keller <jacob.e.keller@intel.com>
>
> Now that we have the separate i40e_(add|rm)_vlan_all_mac functions, we
> should not be using the i40e_vsi_kill_vlan or i40e_vsi_add_vlan
> functions when PVID is set or when VID is less than 1. This allows us to
> remove some checks in i40e_vsi_add_vlan and ensures that callers which
> need to handle VID=0 or VID=-1 don't accidentally invoke the VLAN mode
> handling used to convert filters when entering VLAN mode. We also update
> the functions to take u16 instead of s16 as well since they no longer
> expect to be called with VID=I40E_VLAN_ANY.
>
> Change-ID: Ibddf44a8bb840dde8ceef2a4fdb92fd953b05a57
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
[...]

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index da4cbe3..148a678 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -2575,12 +2575,15 @@ int i40e_add_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)
>  /**
>   * i40e_vsi_add_vlan - Add VSI membership for given VLAN
>   * @vsi: the VSI being configured
> - * @vid: VLAN id to be added (0 = untagged only , -1 = any)
> + * @vid: VLAN id to be added
>   **/
> -int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
> +int i40e_vsi_add_vlan(struct i40e_vsi *vsi, u16 vid)
>  {
>  	int err;
>
> +	if (!(vid > 0) || vsi->info.pvid)

    Why not just '!vid'?

> +		return -EINVAL;
> +
>  	/* Locked once because all functions invoked below iterates list*/
>  	spin_lock_bh(&vsi->mac_filter_hash_lock);
>  	err = i40e_add_vlan_all_mac(vsi, vid);
> @@ -2623,10 +2626,13 @@ void i40e_rm_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)
>  /**
>   * i40e_vsi_kill_vlan - Remove VSI membership for given VLAN
>   * @vsi: the VSI being configured
> - * @vid: VLAN id to be removed (0 = untagged only , -1 = any)
> + * @vid: VLAN id to be removed
>   **/
> -void i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
> +void i40e_vsi_kill_vlan(struct i40e_vsi *vsi, u16 vid)
>  {
> +	if (!(vid > 0) || vsi->info.pvid)

    Likewise.

> +		return;
> +
>  	spin_lock_bh(&vsi->mac_filter_hash_lock);
>  	i40e_rm_vlan_all_mac(vsi, vid);
>  	spin_unlock_bh(&vsi->mac_filter_hash_lock);

MBR, Sergei

  reply	other threads:[~2016-12-07 10:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07  7:33 [net-next 00/20][pull request] 40GbE Intel Wired LAN Driver Updates 2016-12-06 Jeff Kirsher
2016-12-07  7:33 ` [net-next 01/20] i40e: Driver prints log message on link speed change Jeff Kirsher
2016-12-07  7:33 ` [net-next 02/20] i40e: simplify txd use count calculation Jeff Kirsher
2016-12-07  7:33 ` [net-next 03/20] i40e: restore workaround for removing default MAC filter Jeff Kirsher
2016-12-07  7:33 ` [net-next 04/20] i40e/i40evf: napi_poll must return the work done Jeff Kirsher
2016-12-07  7:33 ` [net-next 05/20] i40e: remove code to handle dev_addr specially Jeff Kirsher
2016-12-07  7:33 ` [net-next 06/20] i40e: Blink LED on 1G BaseT boards Jeff Kirsher
2016-12-07  7:33 ` [net-next 07/20] Changed version from 1.6.21 to 1.6.25 Jeff Kirsher
2016-12-07  7:33 ` [net-next 08/20] i40e: use unsigned printf format specifier for active_filters count Jeff Kirsher
2016-12-07  7:33 ` [net-next 09/20] i40e: Add support for 25G devices Jeff Kirsher
2016-12-07  7:33 ` [net-next 10/20] i40e: Add FEC for 25g Jeff Kirsher
2016-12-07  7:33 ` [net-next 11/20] i40e: Add functions which apply correct PHY access method for read and write operation Jeff Kirsher
2016-12-07  7:33 ` [net-next 12/20] i40e: lock service task correctly Jeff Kirsher
2016-12-07  7:33 ` [net-next 13/20] i40e: defeature support for PTP L4 frame detection on XL710 Jeff Kirsher
2016-12-07  7:33 ` [net-next 14/20] i40e: recalculate vsi->active_filters from hash contents Jeff Kirsher
2016-12-07  7:33 ` [net-next 15/20] i40e: refactor i40e_update_filter_state to avoid passing aq_err Jeff Kirsher
2016-12-07  7:33 ` [net-next 16/20] i40e: delete filter after adding its replacement when converting Jeff Kirsher
2016-12-07  7:33 ` [net-next 17/20] i40e: factor out addition/deletion of VLAN per each MAC address Jeff Kirsher
2016-12-07  7:33 ` [net-next 18/20] i40e: use (add|rm)_vlan_all_mac helper functions when changing PVID Jeff Kirsher
2016-12-07  7:33 ` [net-next 19/20] i40e: move all updates for VLAN mode into i40e_sync_vsi_filters Jeff Kirsher
2016-12-07  7:33 ` [net-next 20/20] i40e: don't allow i40e_vsi_(add|kill)_vlan to operate when VID<1 Jeff Kirsher
2016-12-07 10:10   ` Sergei Shtylyov [this message]
2016-12-07 21:50     ` Keller, Jacob E
2016-12-07 21:53       ` Jeff Kirsher
2016-12-07 22:00         ` Keller, Jacob E

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=8f82cd1d-0118-7b37-1a05-fa7b77d4e75c@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=guru.anbalagane@oracle.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.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).