Netdev List
 help / color / mirror / Atom feed
* [PATCH 2/3] atl1e: update statistics code
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
In-Reply-To: <1389370103-3009-1-git-send-email-sd@queasysnail.net>

As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets.

Minor whitespace fixes to match the style in alx.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 30 ++++++++++++++++---------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 7a73f3a..d5c2d3e 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1177,32 +1177,40 @@ static struct net_device_stats *atl1e_get_stats(struct net_device *netdev)
 	struct atl1e_hw_stats  *hw_stats = &adapter->hw_stats;
 	struct net_device_stats *net_stats = &netdev->stats;
 
-	net_stats->rx_packets = hw_stats->rx_ok;
-	net_stats->tx_packets = hw_stats->tx_ok;
 	net_stats->rx_bytes   = hw_stats->rx_byte_cnt;
 	net_stats->tx_bytes   = hw_stats->tx_byte_cnt;
 	net_stats->multicast  = hw_stats->rx_mcast;
 	net_stats->collisions = hw_stats->tx_1_col +
-				hw_stats->tx_2_col * 2 +
-				hw_stats->tx_late_col + hw_stats->tx_abort_col;
+				hw_stats->tx_2_col +
+				hw_stats->tx_late_col +
+				hw_stats->tx_abort_col;
+
+	net_stats->rx_errors  = hw_stats->rx_frag +
+				hw_stats->rx_fcs_err +
+				hw_stats->rx_len_err +
+				hw_stats->rx_sz_ov +
+				hw_stats->rx_rrd_ov +
+				hw_stats->rx_align_err +
+				hw_stats->rx_rxf_ov;
 
-	net_stats->rx_errors  = hw_stats->rx_frag + hw_stats->rx_fcs_err +
-				hw_stats->rx_len_err + hw_stats->rx_sz_ov +
-				hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
 	net_stats->rx_fifo_errors   = hw_stats->rx_rxf_ov;
 	net_stats->rx_length_errors = hw_stats->rx_len_err;
 	net_stats->rx_crc_errors    = hw_stats->rx_fcs_err;
 	net_stats->rx_frame_errors  = hw_stats->rx_align_err;
-	net_stats->rx_over_errors   = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+	net_stats->rx_dropped       = hw_stats->rx_rrd_ov;
 
-	net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
+	net_stats->tx_errors = hw_stats->tx_late_col +
+			       hw_stats->tx_abort_col +
+			       hw_stats->tx_underrun +
+			       hw_stats->tx_trunc;
 
-	net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
-			       hw_stats->tx_underrun + hw_stats->tx_trunc;
 	net_stats->tx_fifo_errors    = hw_stats->tx_underrun;
 	net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
 	net_stats->tx_window_errors  = hw_stats->tx_late_col;
 
+	net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
+	net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
+
 	return net_stats;
 }
 
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH 3/3] atl1: update statistics code
From: Sabrina Dubroca @ 2014-01-10 16:08 UTC (permalink / raw)
  To: davem; +Cc: netdev, bhutchings, jcliburn, chris.snook, Sabrina Dubroca
In-Reply-To: <1389370103-3009-1-git-send-email-sd@queasysnail.net>

As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 drivers/net/ethernet/atheros/atlx/atl1.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index 538211d..31d460a 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -1684,8 +1684,8 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
 	adapter->soft_stats.rx_bytes += smb->rx_byte_cnt;
 	adapter->soft_stats.tx_bytes += smb->tx_byte_cnt;
 	adapter->soft_stats.multicast += smb->rx_mcast;
-	adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col * 2 +
-		smb->tx_late_col + smb->tx_abort_col * adapter->hw.max_retry);
+	adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col +
+		smb->tx_late_col + smb->tx_abort_col);
 
 	/* Rx Errors */
 	adapter->soft_stats.rx_errors += (smb->rx_frag + smb->rx_fcs_err +
@@ -1718,23 +1718,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
 	adapter->soft_stats.tx_trunc += smb->tx_trunc;
 	adapter->soft_stats.tx_pause += smb->tx_pause;
 
-	netdev->stats.rx_packets = adapter->soft_stats.rx_packets;
-	netdev->stats.tx_packets = adapter->soft_stats.tx_packets;
 	netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes;
 	netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes;
 	netdev->stats.multicast = adapter->soft_stats.multicast;
 	netdev->stats.collisions = adapter->soft_stats.collisions;
 	netdev->stats.rx_errors = adapter->soft_stats.rx_errors;
-	netdev->stats.rx_over_errors =
-		adapter->soft_stats.rx_missed_errors;
 	netdev->stats.rx_length_errors =
 		adapter->soft_stats.rx_length_errors;
 	netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors;
 	netdev->stats.rx_frame_errors =
 		adapter->soft_stats.rx_frame_errors;
 	netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors;
-	netdev->stats.rx_missed_errors =
-		adapter->soft_stats.rx_missed_errors;
+	netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov;
 	netdev->stats.tx_errors = adapter->soft_stats.tx_errors;
 	netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors;
 	netdev->stats.tx_aborted_errors =
@@ -1743,6 +1738,11 @@ static void atl1_inc_smb(struct atl1_adapter *adapter)
 		adapter->soft_stats.tx_window_errors;
 	netdev->stats.tx_carrier_errors =
 		adapter->soft_stats.tx_carrier_errors;
+
+	netdev->stats.rx_packets = adapter->soft_stats.rx_packets +
+				   netdev->stats.rx_errors;
+	netdev->stats.tx_packets = adapter->soft_stats.tx_packets +
+				   netdev->stats.tx_errors;
 }
 
 static void atl1_update_mailbox(struct atl1_adapter *adapter)
-- 
1.8.5.2

^ permalink raw reply related

* Re: [PATCH v2 net-next] net: make dev_set_mtu() honor notification return code
From: Jiri Pirko @ 2014-01-10 16:21 UTC (permalink / raw)
  To: Veaceslav Falico
  Cc: netdev, David S. Miller, Eric Dumazet, Alexander Duyck,
	Nicolas Dichtel
In-Reply-To: <1389369385-17439-1-git-send-email-vfalico@redhat.com>

Fri, Jan 10, 2014 at 04:56:25PM CET, vfalico@redhat.com wrote:
>Currently, after changing the MTU for a device, dev_set_mtu() calls
>NETDEV_CHANGEMTU notification, however doesn't verify it's return code -
>which can be NOTIFY_BAD - i.e. some of the net notifier blocks refused this
>change, and continues nevertheless.
>
>To fix this, verify the return code, and if it's an error - then revert the
>MTU to the original one, notify again and pass the error code.
>
>CC: Jiri Pirko <jiri@resnulli.us>
>CC: "David S. Miller" <davem@davemloft.net>
>CC: Eric Dumazet <edumazet@google.com>
>CC: Alexander Duyck <alexander.h.duyck@intel.com>
>CC: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>Signed-off-by: Veaceslav Falico <vfalico@redhat.com>

Reviewed-by: Jiri Pirko <jiri@resnulli.us>

^ permalink raw reply

* Re: [PATCH] net: Check skb->rxhash in gro_receive
From: Tom Herbert @ 2014-01-10 16:27 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
In-Reply-To: <1389332287.31367.88.camel@edumazet-glaptop2.roam.corp.google.com>

On Thu, Jan 9, 2014 at 9:38 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2014-01-09 at 20:54 -0800, Tom Herbert wrote:
>> When initializing a gro_list for a packet, first check the rxhash of
>> the incoming skb against that of the skb's in the list. This should be
>> a very strong inidicator of whether the flow is going to be matched,
>> and potentially allows a lot of other checks to be short circuited.
>>
>
> Hmm... this idea was discussed in the past. I used it when attempting to
> use a hash table instead of a gro_list last year.
>
> Unfortunately this added lot of cycles when rxhash is not provided by
> hardware, and my tests found it was not a win.
>
> Remember : in most cases, gro_list contains one flow, so this test does
> nothing special but adds overhead.

I don't understand what your basis is that gro_list in most cases
contains one flow, but assuming that were true, maybe we should make
the it only contain one flow eliminating the complexity of multiple
flows (same_flow logic is convoluted and layers of encapsulation is
not going to simplify things).

If we are doing RPS or RFS, rxhash will be computed anyway, so the
case your optimizing is pretty narrow: no RPS, no RFS, no hardware
hash, and a single flow in gro_list. Nevertheless, if this is really
an important concern, we can make the check directly against
skb->rxhash so to be opportunistic and avoid the possibility of
computation.

>
>
>

^ permalink raw reply

* Re: ipv6: default route for link local address is not added while assigning a address
From: Nicolas Dichtel @ 2014-01-10 16:33 UTC (permalink / raw)
  To: sohny thomas; +Cc: linux-kernel, yoshfuji, davem, kumuda, netdev, David Miller
In-Reply-To: <52CFE594.8010808@gmail.com>

CC: netdev

Le 10/01/2014 13:20, sohny thomas a écrit :
> Default route for link local address is configured automatically if
> NETWORKING_IPV6=yes is in ifcfg-eth*.
> When the route table for the interface is flushed and a new address is added to
> the same device with out removing linklocal addr, default route for link local
> address has to added by default.
I would say that removing the link local route but not the link local address
is a configuration problem.
If you remove a connected route but not the associated address, you will have
the same problem.

>
> I have found the issue to be caused by this checkin
>
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net/ipv6?id=62b54dd91567686a1cb118f76a72d5f4764a86dd
>
>
> According to this change :
> He removes adding a link local route if any other address is added , applicable
> across all interfaces though there's mentioned only lo interface
> So below patch fixes for other devices

^ permalink raw reply

* Re: [PATCH net 1/2] macvlan: forbid L2 fowarding offload for macvtap
From: Vlad Yasevich @ 2014-01-10 16:40 UTC (permalink / raw)
  To: Jason Wang, Stephen Hemminger
  Cc: Michael S. Tsirkin, John Fastabend, John Fastabend, Neil Horman,
	davem, netdev, linux-kernel
In-Reply-To: <52CF9C0C.2020808@redhat.com>

On 01/10/2014 02:06 AM, Jason Wang wrote:
> On 01/10/2014 05:39 AM, Stephen Hemminger wrote:
>> On Thu, 09 Jan 2014 16:55:07 +0800
>> Jason Wang <jasowang@redhat.com> wrote:
>>
>>> What if use do want a qdisc and want to change the its queue length for
>>> tun/macvlan? And the the name tx_queue_length is misleading. For tun it
>>> may make sense since it was used in transmission path. For macvtap it
>>> was not. So maybe what we need is just a new ioctl for both tun/macvtap
>>> and a new feature flag. If user create the device with new feature flag,
>>> the socket receive queue length could be changed by ioctl instead of
>>> dev->tx_queue_length. If not, the old behaviour could be kept.
>> The overloading of tx_queue_len in macvtap was the original design mistake.
>> Can't this just be undone and expose rx_queue_len as sysfs attribute?
> 
> That works. But we current allow user to change the socket sndbuf
> through TUNSNDBUF. Maybe we need a similar one for receive.
> 

That would make sense.  Since the user interacts with tun fd almost as a
socket and there is actually a socket hiding in the kernel, it almost
begs for actual SO_SNDBUF/SO_RCVBUF support :)

-vlad

^ permalink raw reply

* Re: [PATCH] net: Check skb->rxhash in gro_receive
From: Tom Herbert @ 2014-01-10 16:47 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Linux Netdev List
In-Reply-To: <1389332635.31367.91.camel@edumazet-glaptop2.roam.corp.google.com>

On Thu, Jan 9, 2014 at 9:43 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2014-01-09 at 21:38 -0800, Eric Dumazet wrote:
>
>> Hmm... this idea was discussed in the past. I used it when attempting to
>> use a hash table instead of a gro_list last year.
>>
>> Unfortunately this added lot of cycles when rxhash is not provided by
>> hardware, and my tests found it was not a win.
>>
>> Remember : in most cases, gro_list contains one flow, so this test does
>> nothing special but adds overhead.
>
> Additional point : For napi_gro_frag() users, skb->head do not contains
> headers, so flow dissector enters slow path to fetch the headers from
> the fragment, one by one.
>
skb_get_hash is only called for the new skb, we compare against
skb->rxhash for packets on the gro_list. Also, I still intend to
change skb_get_hash to not repeatedly compute the hash when there's no
L4 hash to be found.

>
>

^ permalink raw reply

* Re: [net-next 14/16] i40e: enable PTP
From: Keller, Jacob E @ 2014-01-10 16:48 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Kirsher, Jeffrey T, davem@davemloft.net, netdev@vger.kernel.org,
	gospo@redhat.com, sassmann@redhat.com, Richard Cochran,
	Brandeburg, Jesse
In-Reply-To: <1389369305.2025.64.camel@bwh-desktop.uk.level5networks.com>

On Fri, 2014-01-10 at 15:55 +0000, Ben Hutchings wrote:
> On Fri, 2014-01-10 at 00:58 -0800, Jeff Kirsher wrote:
> > From: Jacob Keller <jacob.e.keller@intel.com>
> > 
> > New feature: Enable PTP support in the i40e driver.
> > 
> > Change-ID: I6a8e799f582705191f9583afb1b9231a8db96cc8
> > Cc: Richard Cochran <richardcochran@gmail.com>
> > Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> > Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> > Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > ---
> >  drivers/net/ethernet/intel/i40e/Makefile       |   2 +
> >  drivers/net/ethernet/intel/i40e/i40e.h         |  24 +
> >  drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  33 +-
> >  drivers/net/ethernet/intel/i40e/i40e_main.c    |  45 +-
> >  drivers/net/ethernet/intel/i40e/i40e_ptp.c     | 640 +++++++++++++++++++++++++
> >  drivers/net/ethernet/intel/i40e/i40e_txrx.c    |  53 ++
> >  drivers/net/ethernet/intel/i40e/i40e_txrx.h    |   3 +
> >  7 files changed, 798 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/net/ethernet/intel/i40e/i40e_ptp.c
> 
> This is missing a Kconfig update to select PTP_1588_CLOCK.
> 
> [...]
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > @@ -1698,6 +1698,25 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu)
> >  }
> >  
> >  /**
> > + * i40e_ioctl - Access the hwtstamp interface
> > + * @netdev: network interface device structure
> > + * @ifr: interface request data
> > + * @cmd: ioctl command
> > + **/
> > +int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
> > +{
> > +	struct i40e_netdev_priv *np = netdev_priv(netdev);
> > +	struct i40e_pf *pf = np->vsi->back;
> > +
> > +	switch (cmd) {
> > +	case SIOCSHWTSTAMP:
> > +		return i40e_ptp_hwtstamp_ioctl(pf, ifr, cmd);
> > +	default:
> > +		return -EOPNOTSUPP;
> > +	}
> > +}
> 
> Please implement SIOCGHWTSTAMP as well.

Yep. I still need to implement this for other Intel drivers as well.

> 
> [...]
> > --- /dev/null
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
> [...]
> > +void i40e_ptp_init(struct i40e_pf *pf)
> > +{
> > +	struct i40e_hw *hw = &pf->hw;
> > +	struct net_device *netdev = pf->vsi[pf->lan_vsi]->netdev;
> > +
> > +	snprintf(pf->ptp_caps.name, 16, "%pm", netdev->dev_addr);
> [...]
> 
> Use sizeof(), not a magic number.  Also the clock name should perhaps be
> the driver name, not the MAC address.

Some other drivers probably need to be updated to not use magic number
as well..

> 
> Is the clock shared between multiple PFs or are there independent clocks
> for each PF?

Each PF gets its own register set, and while the clock is physically
driven by the same source, there is no mechanism to ensure registers are
in sync, so effectively each PF has its own independent clock. (ie:
can't support boundary clock properly)

Thanks,
Jake

> 
> Ben.
> 



^ permalink raw reply

* Re: [PATCH net-next] qlcnic: Convert vmalloc/memset to kcalloc
From: Jitendra Kalsaria @ 2014-01-10 16:58 UTC (permalink / raw)
  To: Joe Perches; +Cc: Dept-Eng Linux Driver, netdev, linux-kernel
In-Reply-To: <1389249745.24222.20.camel@joe-AO722>



On 1/8/14 10:42 PM, "Joe Perches" <joe@perches.com> wrote:

>vmalloc is a limited resource.  Don't use it unnecessarily.
>
>It seems this allocation should work with kcalloc.
>
>Remove unnecessary memset(,0,) of buf as it's completely
>overwritten as the previously only unset field in
>struct qlcnic_pci_func_cfg is now set to 0.
>
>Use kfree instead of vfree.
>Use ETH_ALEN instead of 6.
>
>Signed-off-by: Joe Perches <joe@perches.com>
>---
> drivers/net/ethernet/qlogic/qlcnic/qlcnic.h       |  2 +-
> drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 16 ++++++----------
> 2 files changed, 7 insertions(+), 11 deletions(-)

Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

>
>diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
>b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
>index 35d4876..8d7aa4c 100644
>--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
>+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
>@@ -1267,7 +1267,7 @@ struct qlcnic_pci_func_cfg {
> 	u16	port_num;
> 	u8	pci_func;
> 	u8	func_state;
>-	u8	def_mac_addr[6];
>+	u8	def_mac_addr[ETH_ALEN];
> };
> 
> struct qlcnic_npar_func_cfg {
>diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
>b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
>index b529667..c9b704d 100644
>--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
>+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
>@@ -6,7 +6,6 @@
>  */
> 
> #include <linux/slab.h>
>-#include <linux/vmalloc.h>
> #include <linux/interrupt.h>
> 
> #include "qlcnic.h"
>@@ -927,38 +926,35 @@ static ssize_t qlcnic_sysfs_read_pci_config(struct
>file *file,
> 	u32 pci_func_count = qlcnic_get_pci_func_count(adapter);
> 	struct qlcnic_pci_func_cfg *pci_cfg;
> 	struct qlcnic_pci_info *pci_info;
>-	size_t pci_info_sz, pci_cfg_sz;
>+	size_t pci_cfg_sz;
> 	int i, ret;
> 
> 	pci_cfg_sz = pci_func_count * sizeof(*pci_cfg);
> 	if (size != pci_cfg_sz)
> 		return QL_STATUS_INVALID_PARAM;
> 
>-	pci_info_sz = pci_func_count * sizeof(*pci_info);
>-	pci_info = vmalloc(pci_info_sz);
>+	pci_info = kcalloc(pci_func_count, sizeof(*pci_info), GFP_KERNEL);
> 	if (!pci_info)
> 		return -ENOMEM;
> 
>-	memset(pci_info, 0, pci_info_sz);
>-	memset(buf, 0, pci_cfg_sz);
>-	pci_cfg = (struct qlcnic_pci_func_cfg *)buf;
>-
> 	ret = qlcnic_get_pci_info(adapter, pci_info);
> 	if (ret) {
>-		vfree(pci_info);
>+		kfree(pci_info);
> 		return ret;
> 	}
> 
>+	pci_cfg = (struct qlcnic_pci_func_cfg *)buf;
> 	for (i = 0; i < pci_func_count; i++) {
> 		pci_cfg[i].pci_func = pci_info[i].id;
> 		pci_cfg[i].func_type = pci_info[i].type;
>+		pci_cfg[i].func_state = 0;
> 		pci_cfg[i].port_num = pci_info[i].default_port;
> 		pci_cfg[i].min_bw = pci_info[i].tx_min_bw;
> 		pci_cfg[i].max_bw = pci_info[i].tx_max_bw;
> 		memcpy(&pci_cfg[i].def_mac_addr, &pci_info[i].mac, ETH_ALEN);
> 	}
> 
>-	vfree(pci_info);
>+	kfree(pci_info);
> 	return size;
> }

Thanks,
Jiten

^ permalink raw reply

* Re: ipv6: default route for link local address is not added while assigning a address
From: Hannes Frederic Sowa @ 2014-01-10 17:16 UTC (permalink / raw)
  To: Nicolas Dichtel
  Cc: sohny thomas, linux-kernel, yoshfuji, davem, kumuda, netdev
In-Reply-To: <52D020C4.30105@6wind.com>

On Fri, Jan 10, 2014 at 05:33:08PM +0100, Nicolas Dichtel wrote:
> CC: netdev
> 
> Le 10/01/2014 13:20, sohny thomas a écrit :
> >Default route for link local address is configured automatically if
> >NETWORKING_IPV6=yes is in ifcfg-eth*.
> >When the route table for the interface is flushed and a new address is 
> >added to
> >the same device with out removing linklocal addr, default route for link 
> >local
> >address has to added by default.
> I would say that removing the link local route but not the link local 
> address
> is a configuration problem.
> If you remove a connected route but not the associated address, you will 
> have
> the same problem.

We have some user accessible routes that are essential for IPv6 stack
to work at all. So I don't know if I can agree with that.

Maybe flush is a bit too aggressive?

^ permalink raw reply

* [PATCH net-next 0/8] qlcnic driver updates
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh

From: Shahed Shaikh <shahed.shaikh@qlogic.com>

Hi David,

This series includes following changes:
o SRIOV and VLAN filtering related enhancements which includes
   - Do MAC learning for PF
   - Restrict VF from configuring any VLAN mode
   - Enable flooding on PF
   - Turn on promiscuous mode for PF

o Bug fix in qlcnic_sriov_cleanup() introduced by commit
  154d0c81("qlcnic: VLAN enhancement for 84XX adapters")

o Beaconing support for 83xx and 84xx series adapters

o Allow 82xx adapter to perform IPv6 LRO even if destination IP address is not
  programmed.


Please apply this series to net-next.

Thanks,
Shahed

Himanshu Madhani (1):
  qlcnic: Enable beaconing for 83xx/84xx Series adapter.

Manish Chopra (1):
  qlcnic: Fix SR-IOV cleanup code path

Shahed Shaikh (2):
  qlcnic: Enable IPv6 LRO even if IP address is not programmed
  qlcnic: Update version to 5.3.54

Sucheta Chakraborty (4):
  qlcnic: Restrict VF from configuring any VLAN mode.
  qlcnic: Enable VF flood bit on PF.
  qlcnic: Turn on promiscous mode for SRIOV PF.
  qlcnic: Do MAC learning for SRIOV PF.

 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        | 15 +++-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c    | 35 +++++++++-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h    |  3 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  |  1 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c  |  8 ++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c     | 38 +++++++---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h     |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     | 80 ++++++++++++++--------
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |  1 +
 .../ethernet/qlogic/qlcnic/qlcnic_sriov_common.c   |  4 +-
 .../net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c   | 42 +++++++++++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c  | 17 ++---
 12 files changed, 183 insertions(+), 62 deletions(-)

-- 
1.8.3.1

^ permalink raw reply

* [PATCH net-next 1/8] qlcnic: Restrict VF from configuring any VLAN mode.
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Sucheta Chakraborty
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o Adapter should allow vlan traffic only for vlans configured on a VF.
  On configuring any vlan mode from VF, adapter will allow any vlan
  traffic to pass for that VF. Do not allow VF to configure this mode.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
index d14d9a1..c588286 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
@@ -9,9 +9,12 @@
 #include "qlcnic.h"
 #include <linux/types.h>
 
-#define QLCNIC_SRIOV_VF_MAX_MAC 8
+#define QLCNIC_SRIOV_VF_MAX_MAC 7
 #define QLC_VF_MIN_TX_RATE	100
 #define QLC_VF_MAX_TX_RATE	9999
+#define QLC_MAC_OPCODE_MASK	0x7
+#define QLC_MAC_STAR_ADD	6
+#define QLC_MAC_STAR_DEL	7
 
 static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8);
 
@@ -1173,6 +1176,13 @@ static int qlcnic_sriov_validate_cfg_macvlan(struct qlcnic_adapter *adapter,
 	struct qlcnic_vport *vp = vf->vp;
 	u8 op, new_op;
 
+	if (((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_ADD) ||
+	    ((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_DEL)) {
+		netdev_err(adapter->netdev, "MAC + any VLAN filter not allowed from VF %d\n",
+			   vf->pci_func);
+		return -EINVAL;
+	}
+
 	if (!(cmd->req.arg[1] & BIT_8))
 		return -EINVAL;
 
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 2/8] qlcnic: Enable VF flood bit on PF.
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Sucheta Chakraborty
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o On enabling VF flood bit, PF driver will  be able to receive traffic
  from all its VFs.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
---
 .../net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c   | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
index c588286..09acf15 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
@@ -15,6 +15,8 @@
 #define QLC_MAC_OPCODE_MASK	0x7
 #define QLC_MAC_STAR_ADD	6
 #define QLC_MAC_STAR_DEL	7
+#define QLC_VF_FLOOD_BIT	BIT_16
+#define QLC_FLOOD_MODE		0x5
 
 static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8);
 
@@ -347,6 +349,28 @@ static int qlcnic_sriov_pf_cfg_vlan_filtering(struct qlcnic_adapter *adapter,
 	return err;
 }
 
+/* On configuring VF flood bit, PFD will receive traffic from all VFs */
+static int qlcnic_sriov_pf_cfg_flood(struct qlcnic_adapter *adapter)
+{
+	struct qlcnic_cmd_args cmd;
+	int err;
+
+	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO);
+	if (err)
+		return err;
+
+	cmd.req.arg[1] = QLC_FLOOD_MODE | QLC_VF_FLOOD_BIT;
+
+	err = qlcnic_issue_cmd(adapter, &cmd);
+	if (err)
+		dev_err(&adapter->pdev->dev,
+			"Failed to configure VF Flood bit on PF, err=%d\n",
+			err);
+
+	qlcnic_free_mbx_args(&cmd);
+	return err;
+}
+
 static int qlcnic_sriov_pf_cfg_eswitch(struct qlcnic_adapter *adapter,
 				       u8 func, u8 enable)
 {
@@ -474,6 +498,12 @@ static int qlcnic_sriov_pf_init(struct qlcnic_adapter *adapter)
 	if (err)
 		return err;
 
+	if (qlcnic_84xx_check(adapter)) {
+		err = qlcnic_sriov_pf_cfg_flood(adapter);
+		if (err)
+			goto disable_vlan_filtering;
+	}
+
 	err = qlcnic_sriov_pf_cfg_eswitch(adapter, func, 1);
 	if (err)
 		goto disable_vlan_filtering;
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 3/8] qlcnic: Turn on promiscous mode for SRIOV PF.
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Sucheta Chakraborty
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o By default, SRIOV PF will have promiscous mode on.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 03eb2ad..ca22160 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1618,6 +1618,10 @@ int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
 
 	cmd->type = QLC_83XX_MBX_CMD_NO_WAIT;
 	qlcnic_83xx_set_interface_id_promisc(adapter, &temp);
+
+	if (qlcnic_84xx_check(adapter) && qlcnic_sriov_pf_check(adapter))
+		mode = VPORT_MISS_MODE_ACCEPT_ALL;
+
 	cmd->req.arg[1] = mode | temp;
 	err = qlcnic_issue_cmd(adapter, cmd);
 	if (!err)
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 4/8] qlcnic: Do MAC learning for SRIOV PF.
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Sucheta Chakraborty
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o MAC learning will be done for SRIOV PF to help program VLAN filters
  onto adapter. This will help VNIC traffic to flow through without
  flooding traffic.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        |  1 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c    |  2 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  |  1 +
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c  |  8 ++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c     |  3 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     | 80 ++++++++++++++--------
 6 files changed, 64 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 35d4876..76740c2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1079,6 +1079,7 @@ struct qlcnic_adapter {
 	u64 dev_rst_time;
 	bool drv_mac_learn;
 	bool fdb_mac_learn;
+	u8 rx_mac_learn;
 	unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)];
 	u8 flash_mfg_id;
 	struct qlcnic_npar_info *npars;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index ca22160..03f70e8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1591,7 +1591,9 @@ static void qlcnic_83xx_set_interface_id_promisc(struct qlcnic_adapter *adapter,
 						 u32 *interface_id)
 {
 	if (qlcnic_sriov_pf_check(adapter)) {
+		qlcnic_alloc_lb_filters_mem(adapter);
 		qlcnic_pf_set_interface_id_promisc(adapter, interface_id);
+		adapter->rx_mac_learn = 1;
 	} else {
 		if (!qlcnic_sriov_vf_check(adapter))
 			*interface_id = adapter->recv_ctx->context_id << 16;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index 22ae884..abe3924 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -2214,6 +2214,7 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
 	struct qlcnic_hardware_context *ahw = adapter->ahw;
 	int err = 0;
 
+	adapter->rx_mac_learn = 0;
 	ahw->msix_supported = !!qlcnic_use_msi_x;
 
 	qlcnic_83xx_init_rings(adapter);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
index 474320a..23c4fd1 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
@@ -224,10 +224,14 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *adapter)
 		return -EIO;
 	}
 
-	if (ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY)
+	if (ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY) {
 		adapter->flags |= QLCNIC_ESWITCH_ENABLED;
-	else
+		if (adapter->drv_mac_learn)
+			adapter->rx_mac_learn = 1;
+	} else {
 		adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
+		adapter->rx_mac_learn = 0;
+	}
 
 	ahw->idc.vnic_state = QLCNIC_DEV_NPAR_NON_OPER;
 	ahw->idc.vnic_wait_limit = QLCNIC_DEV_NPAR_OPER_TIMEO;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index a9a149b..18cc365 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -546,8 +546,11 @@ void __qlcnic_set_multi(struct net_device *netdev, u16 vlan)
 	    !adapter->fdb_mac_learn) {
 		qlcnic_alloc_lb_filters_mem(adapter);
 		adapter->drv_mac_learn = 1;
+		if (adapter->flags & QLCNIC_ESWITCH_ENABLED)
+			adapter->rx_mac_learn = 1;
 	} else {
 		adapter->drv_mac_learn = 0;
+		adapter->rx_mac_learn = 0;
 	}
 
 	qlcnic_nic_set_promisc(adapter, mode);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6373f60..cbe4a30 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -156,9 +156,9 @@ static inline void qlcnic_83xx_disable_tx_intr(struct qlcnic_adapter *adapter,
 	writel(1, tx_ring->crb_intr_mask);
 }
 
-static inline u8 qlcnic_mac_hash(u64 mac)
+static inline u8 qlcnic_mac_hash(u64 mac, u16 vlan)
 {
-	return (u8)((mac & 0xff) ^ ((mac >> 40) & 0xff));
+	return (u8)((mac & 0xff) ^ ((mac >> 40) & 0xff) ^ (vlan & 0xff));
 }
 
 static inline u32 qlcnic_get_ref_handle(struct qlcnic_adapter *adapter,
@@ -221,8 +221,11 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
 	u8 hindex, op;
 	int ret;
 
+	if (!qlcnic_sriov_pf_check(adapter) || (vlan_id == 0xffff))
+		vlan_id = 0;
+
 	memcpy(&src_addr, phdr->h_source, ETH_ALEN);
-	hindex = qlcnic_mac_hash(src_addr) &
+	hindex = qlcnic_mac_hash(src_addr, vlan_id) &
 		 (adapter->fhash.fbucket_size - 1);
 
 	if (loopback_pkt) {
@@ -322,27 +325,43 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
 			       struct cmd_desc_type0 *first_desc,
 			       struct sk_buff *skb)
 {
+	struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data);
+	struct ethhdr *phdr = (struct ethhdr *)(skb->data);
+	struct net_device *netdev = adapter->netdev;
+	u16 protocol = ntohs(skb->protocol);
 	struct qlcnic_filter *fil, *tmp_fil;
-	struct hlist_node *n;
 	struct hlist_head *head;
-	struct net_device *netdev = adapter->netdev;
-	struct ethhdr *phdr = (struct ethhdr *)(skb->data);
+	struct hlist_node *n;
 	u64 src_addr = 0;
 	u16 vlan_id = 0;
-	u8 hindex;
+	u8 hindex, hval;
 
-	if (ether_addr_equal(phdr->h_source, adapter->mac_addr))
-		return;
+	if (!qlcnic_sriov_pf_check(adapter)) {
+		if (ether_addr_equal(phdr->h_source, adapter->mac_addr))
+			return;
+	} else {
+		if (protocol == ETH_P_8021Q) {
+			vh = (struct vlan_ethhdr *)skb->data;
+			vlan_id = ntohs(vh->h_vlan_TCI);
+		} else if (vlan_tx_tag_present(skb)) {
+			vlan_id = vlan_tx_tag_get(skb);
+		}
+
+		if (ether_addr_equal(phdr->h_source, adapter->mac_addr) &&
+		    !vlan_id)
+			return;
+	}
 
 	if (adapter->fhash.fnum >= adapter->fhash.fmax) {
 		adapter->stats.mac_filter_limit_overrun++;
-		netdev_info(netdev, "Can not add more than %d mac addresses\n",
-			    adapter->fhash.fmax);
+		netdev_info(netdev, "Can not add more than %d mac-vlan filters, configured %d\n",
+			    adapter->fhash.fmax, adapter->fhash.fnum);
 		return;
 	}
 
 	memcpy(&src_addr, phdr->h_source, ETH_ALEN);
-	hindex = qlcnic_mac_hash(src_addr) & (adapter->fhash.fbucket_size - 1);
+	hval = qlcnic_mac_hash(src_addr, vlan_id);
+	hindex = hval & (adapter->fhash.fbucket_size - 1);
 	head = &(adapter->fhash.fhead[hindex]);
 
 	hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
@@ -1599,7 +1618,8 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
 	struct sk_buff *skb;
 	struct qlcnic_host_rds_ring *rds_ring;
 	int index, length, cksum, is_lb_pkt;
-	u16 vid = 0xffff, t_vid;
+	u16 vid = 0xffff;
+	int err;
 
 	if (unlikely(ring >= adapter->max_rds_rings))
 		return NULL;
@@ -1617,19 +1637,19 @@ qlcnic_83xx_process_rcv(struct qlcnic_adapter *adapter,
 	if (!skb)
 		return buffer;
 
-	if (adapter->drv_mac_learn &&
-	    (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
-		t_vid = 0;
-		is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 0);
-		qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
-	}
-
 	if (length > rds_ring->skb_size)
 		skb_put(skb, rds_ring->skb_size);
 	else
 		skb_put(skb, length);
 
-	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
+	err = qlcnic_check_rx_tagging(adapter, skb, &vid);
+
+	if (adapter->rx_mac_learn) {
+		is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 0);
+		qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, vid);
+	}
+
+	if (unlikely(err)) {
 		adapter->stats.rxdropped++;
 		dev_kfree_skb(skb);
 		return buffer;
@@ -1664,7 +1684,8 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
 	int l2_hdr_offset, l4_hdr_offset;
 	int index, is_lb_pkt;
 	u16 lro_length, length, data_offset, gso_size;
-	u16 vid = 0xffff, t_vid;
+	u16 vid = 0xffff;
+	int err;
 
 	if (unlikely(ring > adapter->max_rds_rings))
 		return NULL;
@@ -1686,12 +1707,6 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
 	if (!skb)
 		return buffer;
 
-	if (adapter->drv_mac_learn &&
-	    (adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
-		t_vid = 0;
-		is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 1);
-		qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, t_vid);
-	}
 	if (qlcnic_83xx_is_tstamp(sts_data[1]))
 		data_offset = l4_hdr_offset + QLCNIC_TCP_TS_HDR_SIZE;
 	else
@@ -1700,7 +1715,14 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
 	skb_put(skb, lro_length + data_offset);
 	skb_pull(skb, l2_hdr_offset);
 
-	if (unlikely(qlcnic_check_rx_tagging(adapter, skb, &vid))) {
+	err = qlcnic_check_rx_tagging(adapter, skb, &vid);
+
+	if (adapter->rx_mac_learn) {
+		is_lb_pkt = qlcnic_83xx_is_lb_pkt(sts_data[1], 1);
+		qlcnic_add_lb_filter(adapter, skb, is_lb_pkt, vid);
+	}
+
+	if (unlikely(err)) {
 		adapter->stats.rxdropped++;
 		dev_kfree_skb(skb);
 		return buffer;
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 5/8] qlcnic: Enable beaconing for 83xx/84xx Series adapter.
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Himanshu Madhani
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Himanshu Madhani <himanshu.madhani@qlogic.com>

o Refactored code to handle beaconing test for all adapters.
o Use GET_LED_CONFIG mailbox command for 83xx/84xx series adapter
  to detect current beaconing state of the adapter.

Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        | 10 ++++++-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c    | 29 ++++++++++++++++++-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h    |  3 ++
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c     | 33 ++++++++++++++++------
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h     |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |  1 +
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c  | 17 +++--------
 7 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 76740c2..94bbf48 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -970,6 +970,9 @@ struct qlcnic_ipaddr {
 #define QLCNIC_BEACON_EANBLE		0xC
 #define QLCNIC_BEACON_DISABLE		0xD
 
+#define QLCNIC_BEACON_ON		2
+#define QLCNIC_BEACON_OFF		0
+
 #define QLCNIC_MSIX_TBL_SPACE		8192
 #define QLCNIC_PCI_REG_MSIX_TBL 	0x44
 #define QLCNIC_MSIX_TBL_PGSIZE		4096
@@ -1641,7 +1644,6 @@ int qlcnic_set_default_offload_settings(struct qlcnic_adapter *);
 int qlcnic_reset_npar_config(struct qlcnic_adapter *);
 int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *);
 void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int, u16);
-int qlcnic_get_beacon_state(struct qlcnic_adapter *, u8 *);
 int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
 int qlcnic_read_mac_addr(struct qlcnic_adapter *);
 int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);
@@ -1768,6 +1770,7 @@ struct qlcnic_hardware_ops {
 					       pci_channel_state_t);
 	pci_ers_result_t (*io_slot_reset) (struct pci_dev *);
 	void (*io_resume) (struct pci_dev *);
+	void (*get_beacon_state)(struct qlcnic_adapter *);
 };
 
 extern struct qlcnic_nic_template qlcnic_vf_ops;
@@ -1994,6 +1997,11 @@ static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter)
 		adapter->ahw->hw_ops->set_mac_filter_count(adapter);
 }
 
+static inline void qlcnic_get_beacon_state(struct qlcnic_adapter *adapter)
+{
+	adapter->ahw->hw_ops->get_beacon_state(adapter);
+}
+
 static inline void qlcnic_read_phys_port_id(struct qlcnic_adapter *adapter)
 {
 	if (adapter->ahw->hw_ops->read_phys_port_id)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 03f70e8..a684d28 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -181,7 +181,7 @@ static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops = {
 	.io_error_detected		= qlcnic_83xx_io_error_detected,
 	.io_slot_reset			= qlcnic_83xx_io_slot_reset,
 	.io_resume			= qlcnic_83xx_io_resume,
-
+	.get_beacon_state		= qlcnic_83xx_get_beacon_state,
 };
 
 static struct qlcnic_nic_template qlcnic_83xx_ops = {
@@ -1388,6 +1388,33 @@ out:
 	netif_device_attach(netdev);
 }
 
+void qlcnic_83xx_get_beacon_state(struct qlcnic_adapter *adapter)
+{
+	struct qlcnic_hardware_context *ahw = adapter->ahw;
+	struct qlcnic_cmd_args cmd;
+	u8 beacon_state;
+	int err = 0;
+
+	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LED_CONFIG);
+	if (!err) {
+		err = qlcnic_issue_cmd(adapter, &cmd);
+		if (!err) {
+			beacon_state = cmd.rsp.arg[4];
+			if (beacon_state == QLCNIC_BEACON_DISABLE)
+				ahw->beacon_state = QLC_83XX_BEACON_OFF;
+			else if (beacon_state == QLC_83XX_ENABLE_BEACON)
+				ahw->beacon_state = QLC_83XX_BEACON_ON;
+		}
+	} else {
+		netdev_err(adapter->netdev, "Get beacon state failed, err=%d\n",
+			   err);
+	}
+
+	qlcnic_free_mbx_args(&cmd);
+
+	return;
+}
+
 int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
 			   u32 beacon)
 {
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
index 34d2911..4643b15 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -381,6 +381,8 @@ enum qlcnic_83xx_states {
 
 /* LED configuration settings */
 #define QLC_83XX_ENABLE_BEACON		0xe
+#define QLC_83XX_BEACON_ON		1
+#define QLC_83XX_BEACON_OFF		0
 #define QLC_83XX_LED_RATE		0xff
 #define QLC_83XX_LED_ACT		(1 << 10)
 #define QLC_83XX_LED_MOD		(0 << 13)
@@ -559,6 +561,7 @@ void qlcnic_83xx_napi_del(struct qlcnic_adapter *);
 void qlcnic_83xx_napi_enable(struct qlcnic_adapter *);
 void qlcnic_83xx_napi_disable(struct qlcnic_adapter *);
 int qlcnic_83xx_config_led(struct qlcnic_adapter *, u32, u32);
+void qlcnic_83xx_get_beacon_state(struct qlcnic_adapter *);
 void qlcnic_ind_wr(struct qlcnic_adapter *, u32, u32);
 int qlcnic_ind_rd(struct qlcnic_adapter *, u32);
 int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 18cc365..e96b76d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -1533,19 +1533,34 @@ int qlcnic_82xx_config_led(struct qlcnic_adapter *adapter, u32 state, u32 rate)
 	return rv;
 }
 
-int qlcnic_get_beacon_state(struct qlcnic_adapter *adapter, u8 *h_state)
+void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *adapter)
 {
+	struct qlcnic_hardware_context *ahw = adapter->ahw;
 	struct qlcnic_cmd_args cmd;
-	int err;
+	u8 beacon_state;
+	int err = 0;
 
-	err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_GET_LED_STATUS);
-	if (!err) {
-		err = qlcnic_issue_cmd(adapter, &cmd);
-		if (!err)
-			*h_state = cmd.rsp.arg[1];
+	if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) {
+		err = qlcnic_alloc_mbx_args(&cmd, adapter,
+					    QLCNIC_CMD_GET_LED_STATUS);
+		if (!err) {
+			err = qlcnic_issue_cmd(adapter, &cmd);
+			if (err) {
+				netdev_err(adapter->netdev,
+					   "Failed to get current beacon state, err=%d\n",
+					   err);
+			} else {
+				beacon_state = cmd.rsp.arg[1];
+				if (beacon_state == QLCNIC_BEACON_DISABLE)
+					ahw->beacon_state = QLCNIC_BEACON_OFF;
+				else if (beacon_state == QLCNIC_BEACON_EANBLE)
+					ahw->beacon_state = QLCNIC_BEACON_ON;
+			}
+		}
+		qlcnic_free_mbx_args(&cmd);
 	}
-	qlcnic_free_mbx_args(&cmd);
-	return err;
+
+	return;
 }
 
 void qlcnic_82xx_get_func_no(struct qlcnic_adapter *adapter)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
index 13303e7..0e739ae 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
@@ -169,6 +169,7 @@ int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int);
 int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32);
 int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter,
 			 struct net_device *netdev);
+void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *);
 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
 			       u64 *uaddr, u16 vlan_id);
 void qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *adapter);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index eeec83a..a57dfe4 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -546,6 +546,7 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = {
 	.io_error_detected		= qlcnic_82xx_io_error_detected,
 	.io_slot_reset			= qlcnic_82xx_io_slot_reset,
 	.io_resume			= qlcnic_82xx_io_resume,
+	.get_beacon_state		= qlcnic_82xx_get_beacon_state,
 };
 
 static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index b529667..83a5d11 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -127,6 +127,8 @@ static int qlcnic_83xx_store_beacon(struct qlcnic_adapter *adapter,
 	if (kstrtoul(buf, 2, &h_beacon))
 		return -EINVAL;
 
+	qlcnic_get_beacon_state(adapter);
+
 	if (ahw->beacon_state == h_beacon)
 		return len;
 
@@ -158,7 +160,7 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter,
 	struct qlcnic_hardware_context *ahw = adapter->ahw;
 	int err, drv_sds_rings = adapter->drv_sds_rings;
 	u16 beacon;
-	u8 h_beacon_state, b_state, b_rate;
+	u8 b_state, b_rate;
 
 	if (len != sizeof(u16))
 		return QL_STATUS_INVALID_PARAM;
@@ -168,18 +170,7 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter,
 	if (err)
 		return err;
 
-	if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) {
-		err = qlcnic_get_beacon_state(adapter, &h_beacon_state);
-		if (err) {
-			netdev_err(adapter->netdev,
-				   "Failed to get current beacon state\n");
-		} else {
-			if (h_beacon_state == QLCNIC_BEACON_DISABLE)
-				ahw->beacon_state = 0;
-			else if (h_beacon_state == QLCNIC_BEACON_EANBLE)
-				ahw->beacon_state = 2;
-		}
-	}
+	qlcnic_get_beacon_state(adapter);
 
 	if (ahw->beacon_state == b_state)
 		return len;
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 6/8] qlcnic: Fix SR-IOV cleanup code path
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Manish Chopra
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Manish Chopra <manish.chopra@qlogic.com>

o Add __QLCNIC_SRIOV_ENABLE bit check before doing SRIOV cleanup

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index bf8fca7..f998fdc 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -277,9 +277,7 @@ static void qlcnic_sriov_vf_cleanup(struct qlcnic_adapter *adapter)
 
 void qlcnic_sriov_cleanup(struct qlcnic_adapter *adapter)
 {
-	struct qlcnic_sriov *sriov = adapter->ahw->sriov;
-
-	if (!sriov)
+	if (!test_bit(__QLCNIC_SRIOV_ENABLE, &adapter->state))
 		return;
 
 	qlcnic_sriov_free_vlans(adapter);
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 7/8] qlcnic: Enable IPv6 LRO even if IP address is not programmed
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Shahed Shaikh <shahed.shaikh@qlogic.com>

o Enabling BIT_9 while configuring hardware LRO allows adapter to
  perform LRO even if destination IP address is not programmed in adapter.

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index e96b76d..6ca5e57 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -782,8 +782,8 @@ void qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *adapter)
 			"Could not send interrupt coalescing parameters\n");
 }
 
-#define QLCNIC_ENABLE_IPV4_LRO		1
-#define QLCNIC_ENABLE_IPV6_LRO		2
+#define QLCNIC_ENABLE_IPV4_LRO		BIT_0
+#define QLCNIC_ENABLE_IPV6_LRO		(BIT_1 | BIT_9)
 
 int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int enable)
 {
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH net-next 8/8] qlcnic: Update version to 5.3.54
From: Shahed Shaikh @ 2014-01-10 16:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept_NX_Linux_NIC_Driver, Shahed Shaikh
In-Reply-To: <1389372539-13753-1-git-send-email-shahed.shaikh@qlogic.com>

From: Shahed Shaikh <shahed.shaikh@qlogic.com>

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 94bbf48..61c70ba 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -38,8 +38,8 @@
 
 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 3
-#define _QLCNIC_LINUX_SUBVERSION 53
-#define QLCNIC_LINUX_VERSIONID  "5.3.53"
+#define _QLCNIC_LINUX_SUBVERSION 54
+#define QLCNIC_LINUX_VERSIONID  "5.3.54"
 #define QLCNIC_DRV_IDC_VER  0x01
 #define QLCNIC_DRIVER_VERSION  ((_QLCNIC_LINUX_MAJOR << 16) |\
 		 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
-- 
1.8.3.1

^ permalink raw reply related

* RE: [net-next 05/15] i40e: add a comment on barrier and fix panic on reset
From: Williams, Mitch A @ 2014-01-10 17:34 UTC (permalink / raw)
  To: Scott Feldman, Kirsher, Jeffrey T
  Cc: David Miller, Rose, Gregory V, Netdev, gospo@redhat.com,
	sassmann@redhat.com, Brandeburg, Jesse
In-Reply-To: <5B8599B2-AE3C-4E03-8EDF-8F35894E9CC3@cumulusnetworks.com>



> -----Original Message-----
> From: Scott Feldman [mailto:sfeldma@cumulusnetworks.com]
> Sent: Thursday, January 09, 2014 2:17 PM
> To: Kirsher, Jeffrey T
> Cc: David Miller; Rose, Gregory V; Netdev; gospo@redhat.com;
> sassmann@redhat.com; Williams, Mitch A; Brandeburg, Jesse
> Subject: Re: [net-next 05/15] i40e: add a comment on barrier and fix panic
> on reset
> 
> 
> On Jan 9, 2014, at 4:52 AM, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> wrote:
> 
> > From: Greg Rose <gregory.v.rose@intel.com>
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > index ea76134..5cdc67c 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > @@ -422,7 +422,7 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
> > 	memset(&vsi->net_stats_offsets, 0, sizeof(vsi->net_stats_offsets));
> > 	memset(&vsi->eth_stats, 0, sizeof(vsi->eth_stats));
> > 	memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets));
> > -	if (vsi->rx_rings)
> > +	if (vsi->rx_rings && vsi->rx_rings[0]) {
> 
> Any reason why just [0] is checked for !NULL here...
> 
> > 		for (i = 0; i < vsi->num_queue_pairs; i++) {
> > 			memset(&vsi->rx_rings[i]->stats, 0 ,
> > 			       sizeof(vsi->rx_rings[i]->stats));
> > @@ -433,6 +433,7 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
> > 			memset(&vsi->tx_rings[i]->tx_stats, 0,
> > 			       sizeof(vsi->tx_rings[i]->tx_stats));
> > 		}
> > +	}
> > 	vsi->stat_offsets_loaded = false;
> > }
> >
> > @@ -2101,8 +2105,11 @@ static void i40e_vsi_free_rx_resources(struct
> i40e_vsi *vsi)
> > {
> > 	int i;
> >
> > +	if (!vsi->rx_rings)
> > +		return;
> > +
> > 	for (i = 0; i < vsi->num_queue_pairs; i++)
> > -		if (vsi->rx_rings[i]->desc)
> > +		if (vsi->rx_rings[i] && vsi->rx_rings[i]->desc)
> 
> but here every [i] is checked for !NULL here?
> 
> > 			i40e_free_rx_resources(vsi->rx_rings[i]);
> > }
> >
> 
> If [0] check is sufficient to know if array members are allocated, maybe an
> wrapper func would help document intent:
> 
> static bool i40e_vsi_rings_allocated(struct i40e_ring *ring)
> {
> 	return (ring && ring[0]);
> }
> 
> -scott
The assumption in vsi_reset_stats() is that the device is up and running normally, in which case all of the rings will be allocated, so we only need to check the first one.

OTOH, in free_rx_resources can be called in case of an allocation failure, in which case you could conceivably have some rings allocated and some not.

-Mitch

^ permalink raw reply

* Re: [PATCH net V3 2/2] net: core: explicitly select a txq before doing l2 forwarding
From: John Fastabend @ 2014-01-10 17:37 UTC (permalink / raw)
  To: Jason Wang; +Cc: davem, netdev, linux-kernel, mst, Neil Horman, e1000-devel
In-Reply-To: <1389341906-2367-2-git-send-email-jasowang@redhat.com>

On 1/10/2014 12:18 AM, Jason Wang wrote:
> Currently, the tx queue were selected implicitly in ndo_dfwd_start_xmit(). The
> will cause several issues:
>
> - NETIF_F_LLTX were removed for macvlan, so txq lock were done for macvlan
>    instead of lower device which misses the necessary txq synchronization for
>    lower device such as txq stopping or frozen required by dev watchdog or
>    control path.
> - dev_hard_start_xmit() was called with NULL txq which bypasses the net device
>    watchdog.
> - dev_hard_start_xmit() does not check txq everywhere which will lead a crash
>    when tso is disabled for lower device.
>
> Fix this by explicitly introducing a new param for .ndo_select_queue() for just
> selecting queues in the case of l2 forwarding offload. netdev_pick_tx() was also
> extended to accept this parameter and dev_queue_xmit_accel() was used to do l2
> forwarding transmission.
>
> With this fixes, NETIF_F_LLTX could be preserved for macvlan and there's no need
> to check txq against NULL in dev_hard_start_xmit(). Also there's no need to keep
> a dedicated ndo_dfwd_start_xmit() and we can just reuse the code of
> dev_queue_xmit() to do the transmission.
>
> In the future, it was also required for macvtap l2 forwarding support since it
> provides a necessary synchronization method.
>
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: e1000-devel@lists.sourceforge.net
> Signed-off-by: Jason Wang <jasowang@redhat.com>
>
> ---
> Changes from V2:
> - Reuse dev_queue_xmit() instead of re-inventing dfwd_direct_xmit()
> - remove the unnecessary braces
> Changes from V1:
> - Adding a new parameter to ndo_select_queue instead of a new method to select
>    queue for l2 forwarding.
> - Remove the unnecessary ndo_dfwd_start_xmit() since txq was selected
>    explicitly.
> - Keep NETIF_F_LLTX when netdev feature is changed.
> - Shape the commit log
> ---

Looks good to me thanks, I tested my macvlan use cases and everything
works as expected.

Acked-by: John Fastabend <john.r.fastabend@intel.com>

^ permalink raw reply

* Re: [PATCH net V3 1/2] macvlan: forbid L2 fowarding offload for macvtap
From: John Fastabend @ 2014-01-10 17:39 UTC (permalink / raw)
  To: Jason Wang; +Cc: davem, netdev, linux-kernel, mst, Neil Horman
In-Reply-To: <1389341906-2367-1-git-send-email-jasowang@redhat.com>

On 1/10/2014 12:18 AM, Jason Wang wrote:
> L2 fowarding offload will bypass the rx handler of real device. This will make
> the packet could not be forwarded to macvtap device. Another problem is the
> dev_hard_start_xmit() called for macvtap does not have any synchronization.
>
> Fix this by forbidding L2 forwarding for macvtap.
>
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---

Same thing here tested my l2 forwarding offload use cases
and they still work. Thanks! For net-next we can look at
getting macvtap to work correctly.

Acked-by: John Fastabend <john.r.fastabend@intel.com.com>

^ permalink raw reply

* Re: [PATCH] net: Check skb->rxhash in gro_receive
From: Eric Dumazet @ 2014-01-10 17:45 UTC (permalink / raw)
  To: Tom Herbert; +Cc: David Miller, Linux Netdev List
In-Reply-To: <CA+mtBx_c=we-13b0Vyrim0=kArhx0OYY1P99HwUeuR2w87hRFw@mail.gmail.com>

On Fri, 2014-01-10 at 08:27 -0800, Tom Herbert wrote:
> On Thu, Jan 9, 2014 at 9:38 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > On Thu, 2014-01-09 at 20:54 -0800, Tom Herbert wrote:
> >> When initializing a gro_list for a packet, first check the rxhash of
> >> the incoming skb against that of the skb's in the list. This should be
> >> a very strong inidicator of whether the flow is going to be matched,
> >> and potentially allows a lot of other checks to be short circuited.
> >>
> >
> > Hmm... this idea was discussed in the past. I used it when attempting to
> > use a hash table instead of a gro_list last year.
> >
> > Unfortunately this added lot of cycles when rxhash is not provided by
> > hardware, and my tests found it was not a win.
> >
> > Remember : in most cases, gro_list contains one flow, so this test does
> > nothing special but adds overhead.
> 
> I don't understand what your basis is that gro_list in most cases
> contains one flow, but assuming that were true, maybe we should make
> the it only contain one flow eliminating the complexity of multiple
> flows (same_flow logic is convoluted and layers of encapsulation is
> not going to simplify things).
> 

The complexity of GRO is the aggregation itself. You wont avoid it.

> If we are doing RPS or RFS, rxhash will be computed anyway, so the
> case your optimizing is pretty narrow: no RPS, no RFS, no hardware
> hash, and a single flow in gro_list. Nevertheless, if this is really
> an important concern, we can make the check directly against
> skb->rxhash so to be opportunistic and avoid the possibility of
> computation.


We'll compute rxhash once per GRO packet, containing up to 40 MSS
packets.

Thats a big difference.

If your patch was doing this, I would have no complain.

(No new conditional branch, and skb->rxhash, if provided by the NIC,
can give a hint.)

diff --git a/net/core/dev.c b/net/core/dev.c
index ce01847793c0..c9f7a26d7ce7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3798,7 +3798,8 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
        for (p = napi->gro_list; p; p = p->next) {
                unsigned long diffs;
 
-               diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
+               diffs = p->rxhash ^ skb->rxhash;
+               diffs |= (unsigned long)p->dev ^ (unsigned long)skb->dev;
                diffs |= p->vlan_tci ^ skb->vlan_tci;
                if (maclen == ETH_HLEN)
                        diffs |= compare_ether_header(skb_mac_header(p),

^ permalink raw reply related

* Re: [net-next 00/16][pull request] Intel Wired LAN Driver Updates
From: David Miller @ 2014-01-10 17:48 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
In-Reply-To: <1389344336-1558-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 10 Jan 2014 00:58:40 -0800

> This series contains updates to i40e only.

Please address the feedback given and resubmit, thank you.

^ permalink raw reply

* Re: [PATCH] netdevice.7: document SIOCGIFCONF case ifc_req==NULL
From: Michael Kerrisk (man-pages) @ 2014-01-10 17:52 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20140109233018.886FA140064-MSQiN3VOO+MkAF8ESQKhnNBPR1lH4CV8@public.gmane.org>

On 01/10/2014 12:30 PM, Tilman Schmidt wrote:
> Add the missing description of the possibility to call SIOCGIFCONF
> with ifc_req==NULL to determine the needed buffer size, as described
> in http://lkml.indiana.edu/hypermail/linux/kernel/0110.1/0506.html
> and verified against source files net/core/dev_ioctl.c and
> net/ipv4/devinet.c in the current kernel git tree.
> This functionality has been present since the beginning of the 2.6
> series. It's about time it gets documented.
> While I'm at it, also generally clarify the section on SIOCGIFCONF.
> 
> Patch prepared against man-pages version 3.55.
> 
> Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>

Hello Tilman,

Thanks for the patch. I'm trying to verify this from the code, but 
am having some trouble finding the relevant pieces. Could you point
me more specifically at the points in the kernel source where this
case is handled?

Thanks,

Michael



> ---
>  man7/netdevice.7 |   83 +++++++++++++++++++++++++++++++++++++------------------
>  1 file changed, 57 insertions(+), 26 deletions(-)
> 
> --- a/man7/netdevice.7	2013-12-12 08:42:55.000000000 +0100
> +++ b/man7/netdevice.7	2014-01-09 23:43:23.000000000 +0100
> @@ -15,7 +15,7 @@
>  .\" Modified, 2011-11-02, <bidulock-B8ReZeU34LJAfugRpC6u6w@public.gmane.org>, added many basic
>  .\"  but missing ioctls, such as SIOCGIFADDR.
>  .\"
> -.TH NETDEVICE  7 2012-04-26 "Linux" "Linux Programmer's Manual"
> +.TH NETDEVICE  7 2014-01-09 "Linux" "Linux Programmer's Manual"
>  .SH NAME
>  netdevice \- low-level access to Linux network devices
>  .SH SYNOPSIS
> @@ -29,7 +29,7 @@
>  Linux supports some standard ioctls to configure network devices.
>  They can be used on any socket's file descriptor regardless of the
>  family or type.
> -They pass an
> +Most of them pass an
>  .I ifreq
>  structure:
>  
> @@ -53,14 +53,6 @@
>          char           *ifr_data;
>      };
>  };
> -
> -struct ifconf {
> -    int                 ifc_len; /* size of buffer */
> -    union {
> -        char           *ifc_buf; /* buffer address */
> -        struct ifreq   *ifc_req; /* array of structures */
> -    };
> -};
>  .fi
>  .in
>  
> @@ -265,30 +257,69 @@
>  means only addresses of the
>  .B AF_INET
>  (IPv4) family for compatibility.
> -The user passes a
> +Unlike the others, this ioctl passes an
>  .I ifconf
> -structure as argument to the ioctl.
> -It contains a pointer to an array of
> -.I ifreq
> -structures in
> +structure:
> +
> +.in +4n
> +.nf
> +struct ifconf {
> +    int                 ifc_len; /* size of buffer */
> +    union {
> +        char           *ifc_buf; /* buffer address */
> +        struct ifreq   *ifc_req; /* array of structures */
> +    };
> +};
> +.fi
> +.in
> +
> +If
>  .I ifc_req
> -and its length in bytes in
> +is NULL,
> +.B SIOCGIFCONF
> +returns the necessary buffer size in bytes
> +for receiving all available addresses in
>  .IR ifc_len .
> -The kernel fills the ifreqs with all current L3 interface addresses that
> -are running:
> +Otherwise
> +.I ifc_req
> +contains a pointer to an array of
> +.I ifreq
> +structures to be filled with all currently active L3 interface addresses.
> +.I ifc_len
> +contains the size of the array in bytes.
> +Within each
> +.I ifreq
> +structure,
>  .I ifr_name
> -contains the interface name (eth0:1 etc.),
> +will receive the interface name, and
>  .I ifr_addr
>  the address.
> -The kernel returns with the actual length in
> +The actual number of bytes transferred is returned in
>  .IR ifc_len .
> -If
> +
> +If the size specified by
> +.I ifc_len
> +is insufficient to store all the addresses,
> +the kernel will skip the exceeding ones and return success.
> +There is no reliable way of detecting this condition once it has occurred.
> +It is therefore recommended to either determine the necessary buffer size
> +beforehand by calling
> +.B SIOCGIFCONF
> +with
> +.I ifc_req
> +set to NULL, or to retry the call with a bigger buffer whenever
>  .I ifc_len
> -is equal to the original length the buffer probably has overflowed
> -and you should retry with a bigger buffer to get all addresses.
> -When no error occurs the ioctl returns 0;
> -otherwise \-1.
> -Overflow is not an error.
> +upon return differs by less than sizeof(struct
> +.IR ifreq )
> +from its original value.
> +
> +If an error occurs accessing the
> +.I ifconf
> +or
> +.I ifreq
> +structures,
> +.B EFAULT
> +will be returned.
>  .\" Slaving isn't supported in 2.2
>  .\" .
>  .\" .TP
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox