All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [net-next 06/10] fm10k: send traffic on default vid to vlan device if we have one
Date: Fri, 19 Jun 2015 21:20:13 -0700	[thread overview]
Message-ID: <5584E9FD.1000809@gmail.com> (raw)
In-Reply-To: <1434757059-3384-6-git-send-email-jacob.e.keller@intel.com>

On 06/19/2015 04:37 PM, Jacob Keller wrote:
> This patch ensures that vlan traffic on the default vid will go to the
> corresponding vlan device if it exists. To do this, mask the rx_ring vid
> if we have an active vlan on that vid.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>   drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 12 ++++++++++++
>   drivers/net/ethernet/intel/fm10k/fm10k_pci.c    |  4 ++++
>   2 files changed, 16 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> index e1ceb3a2e2cd..c173c79373fe 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
> @@ -758,6 +758,7 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
>   	struct fm10k_intfc *interface = netdev_priv(netdev);
>   	struct fm10k_hw *hw = &interface->hw;
>   	s32 err;
> +	int i;
>
>   	/* updates do not apply to VLAN 0 */
>   	if (!vid)
> @@ -775,6 +776,17 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
>   	if (!set)
>   		clear_bit(vid, interface->active_vlans);
>
> +	/* disable the default vid on ring if we have an active vlan */
> +	for (i = 0; i < interface->num_rx_queues; i++) {
> +		struct fm10k_ring *rx_ring = interface->rx_ring[i];
> +		u16 rx_vid = rx_ring->vid & (VLAN_N_VID - 1);
> +
> +		if (test_bit(rx_vid, interface->active_vlans))
> +			rx_ring->vid |= FM10K_VLAN_CLEAR;
> +		else
> +			rx_ring->vid &= ~FM10K_VLAN_CLEAR;
> +	}
> +
>   	/* Do not remove default VID related entries from VLAN and MAC tables */
>   	if (!set && vid == hw->mac.default_vid)
>   		return 0;
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> index 6d1364393a8b..989981ea3c64 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
> @@ -694,6 +694,10 @@ static void fm10k_configure_rx_ring(struct fm10k_intfc *interface,
>   	/* assign default VLAN to queue */
>   	ring->vid = hw->mac.default_vid;
>
> +	/* if we have an active VLAN, disable default vid */
> +	if (test_bit(hw->mac.default_vid, interface->active_vlans))
> +		ring->vid |= FM10K_VLAN_CLEAR;
> +
>   	/* Map interrupt */
>   	if (ring->q_vector) {
>   		rxint = ring->q_vector->v_idx + NON_Q_VECTORS(hw);
>

This doesn't quite work since the rx_ring->vid is doing a full 16b 
comparison against a value that includes the QOS value.

I just realized that is a bug in the fm10k_process_skb_fields function. 
  You probably need to update it so that code does something more like

if (rx_desc->w.vlan) {
	u16 vid = le16_to_cpu(rx_desc->w.vlan);

	if ((vid & VLAN_VID_MASK) != rx_ring->vid)
		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
	else if (vid & VLAN_PRIO_MASK)
		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
				       vid & VLAN_PRIO_MASK);
}	

  reply	other threads:[~2015-06-20  4:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 23:37 [Intel-wired-lan] [net-next 01/10] fm10k: remove is_slot_appropriate Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 02/10] fm10k: allow creation of vlan interfaces even while down Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 03/10] fm10k: don't store sw_vid at reset Jacob Keller
2015-06-20  4:03   ` Alexander Duyck
2015-06-23 18:23     ` Keller, Jacob E
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 04/10] fm10k: TRIVIAL fix up ordering of __always_unused and style Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 05/10] fm10k: add support for extra debug statistics Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 06/10] fm10k: send traffic on default vid to vlan device if we have one Jacob Keller
2015-06-20  4:20   ` Alexander Duyck [this message]
2015-06-23 16:11     ` Vick, Matthew
2015-06-23 18:24     ` Keller, Jacob E
2015-06-23 22:18     ` Keller, Jacob E
2015-06-24 22:13       ` Alexander Duyck
2015-06-24 22:38         ` Keller, Jacob E
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 07/10] fm10k: TRIVIAL fix typo in fm10k_netdev.c Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 08/10] fm10k: re-enable VF after a full reset on detection of a Malicious event Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 09/10] fm10k: Only trigger data path reset if fabric is up Jacob Keller
2015-06-19 23:37 ` [Intel-wired-lan] [net-next 10/10] fm10k: fix iov_msg_mac_vlan_pf VID checks Jacob Keller
2015-06-20  4:41   ` Alexander Duyck
2015-06-23 18:26     ` 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=5584E9FD.1000809@gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=intel-wired-lan@osuosl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.