* Re: [PATCH net] ip: zero sockaddr returned on error queue
From: Eric Dumazet @ 2015-01-15 19:06 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: netdev, davem
In-Reply-To: <1421345920-13994-1-git-send-email-willemb@google.com>
On Thu, 2015-01-15 at 13:18 -0500, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
>
> The sockaddr is returned in IP(V6)_RECVERR as part of errhdr. That
> structure is defined and allocated on the stack as
>
> struct {
> struct sock_extended_err ee;
> struct sockaddr_in(6) offender;
> } errhdr;
>
> The second part is only initialized for certain SO_EE_ORIGIN values.
> Always initialize it completely.
>
> An MTU exceeded error on a SOCK_RAW/IPPROTO_RAW is one example that
> would return uninitialized bytes.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
>
> ----
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: [PATCH_V5] dm9000: Add regulator and reset support to dm9000
From: David Miller @ 2015-01-15 19:08 UTC (permalink / raw)
To: Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8
In-Reply-To: <1421316746-38128-1-git-send-email-Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
From: Zubair Lutfullah Kakakhel <Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Date: Thu, 15 Jan 2015 10:12:26 +0000
> In boards, the dm9000 chip's power and reset can be controlled by gpio.
>
> It makes sense to add them to the dm9000 driver and let dt be used to
> enable power and reset the phy.
>
> Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Paul Burton <paul.burton-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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
* Re: [PATCH] sh_eth: Fix addition of .trscer_err_mask to wrong SoC data
From: David Miller @ 2015-01-15 19:09 UTC (permalink / raw)
To: geert+renesas
Cc: nobuhiro.iwamatsu.yj, yoshihiro.shimoda.uh, netdev, linux-sh
In-Reply-To: <1421319139-22655-1-git-send-email-geert+renesas@glider.be>
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Thu, 15 Jan 2015 11:52:19 +0100
> commit b284fbe3b3ef9cf8 ("sh_eth: Fix access to TRSCER register") wanted
> to add a .trscer_err_mask value to the R-Car Gen2 family-specific data
> structure (r8a779x_data), but it was accidentally added to the
> SH7724-specific data structure (sh7724_data).
>
> Presumably this happened due to a patch conflict with commit
> d407bc0203539031 ("sh-eth: Set fdr_value of R-Car SoCs"), which added
> another field at the same position.
>
> Move the field setting to fix this.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Fixes: b284fbe3b3ef9cf8 ("sh_eth: Fix access to TRSCER register")
Oops, applied, thanks Geert.
^ permalink raw reply
* Re: [PATCH] rtlwifi: rtl8192ee: New firmware from Realtek
From: Kyle McMartin @ 2015-01-15 19:21 UTC (permalink / raw)
To: Larry Finger; +Cc: linux-firmware, linux-wireless, Troy Tan, netdev
In-Reply-To: <1421270679-3029-1-git-send-email-Larry.Finger@lwfinger.net>
On Wed, Jan 14, 2015 at 03:24:39PM -0600, Larry Finger wrote:
> From: Troy Tan <troy_tan@realsil.com.cn>
>
> Recent testing by Realtek found bugs in both the driver and firmware for
> the RTL8192EE chips.
>
> Signed-off-by: Troy Tan <troy_tan@realsil.com.cn>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> WHENCE | 5 ++++-
> rtlwifi/rtl8192eefw.bin | Bin 32754 -> 31818 bytes
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/WHENCE b/WHENCE
> index df2dffa..c6f650e 100644
> --- a/WHENCE
> +++ b/WHENCE
> @@ -2115,7 +2115,10 @@ Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
>
> Driver: rtl8192ee - Realtek 802.11n WLAN driver for RTL8192EE
>
> -Info: Taken from Realtek version rtl_92ce_92se_92de_8723ae_88ee_8723be_92ee_linux_mac80211_0017.1224.2013
> +Info: Initial version taken from Realtek version
> + rtl_92ce_92se_92de_8723ae_88ee_8723be_92ee_linux_mac80211_0017.1224.2013
> + Updated Jan. 14, 2015 with file added by Realtek to
> + http://github.com/lwfinger/rtlwifi_new.git.
> File: rtlwifi/rtl8192eefw.bin
>
Looks good, applied. Thanks Larry.
regards, Kyle
^ permalink raw reply
* Re: [PATCH RFC v2 net-next 2/2] ip_tunnel: Remove struct gro_cells
From: Eric Dumazet @ 2015-01-15 19:24 UTC (permalink / raw)
To: Martin Lau; +Cc: netdev, kernel-team
In-Reply-To: <20150115181932.GA3899482@devbig242.prn2.facebook.com>
On Thu, 2015-01-15 at 10:39 -0800, Martin Lau wrote:
> >
> > -static inline void gro_cells_destroy(struct gro_cells *gcells)
> > +static inline void gro_cell_free_percpu(struct gro_cell __percpu *gcells)
> > {
> > int i;
> >
> > - if (!gcells->cells)
> > + if (IS_ERR_OR_NULL(gcells))
> > return;
> >
> > For example, I have no idea why this part is needed.
> For this change:
> - err = gro_cells_init(&tunnel->gro_cells, dev);
> - if (err) {
> + tunnel->gro_cells = gro_cell_alloc_percpu(dev);
> + if (IS_ERR(tunnel->gro_cells)) {
That is bad. See David Miller recent mail about this kind of construct.
Current code is better : Do not store an error code in structure, but
rather use a local variable.
Thanks
^ permalink raw reply
* Re: [PATCH] net: core: Fix race by protecting process_queues at CPU hotplug
From: Eric Dumazet @ 2015-01-15 19:28 UTC (permalink / raw)
To: subashab; +Cc: netdev
In-Reply-To: <4504851fe2f44615e67cde94286a2fdd.squirrel@www.codeaurora.org>
On Thu, 2015-01-15 at 19:03 +0000, subashab@codeaurora.org wrote:
> When a CPU is hotplugged while processing incoming packets,
> dev_cpu_callback() will copy the poll list from the offline
> CPU and raise the softIRQ. In the same context, it will also
> process process_queue of the offline CPU by de-queueing and
> calling netif_rx. Due to this there is a potential for race
> condition between process_backlog() and dev_cpu_callback()
> accessing the same process_queue resource. This patch
> protects this concurrent access by locking.
>
> Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
> ---
> net/core/dev.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index df0b522..aa8f503 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3640,6 +3640,7 @@ static void flush_backlog(void *arg)
> struct net_device *dev = arg;
> struct softnet_data *sd = &__get_cpu_var(softnet_data);
> struct sk_buff *skb, *tmp;
> + unsigned long flags;
>
> rps_lock(sd);
> skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) {
> @@ -3651,6 +3652,7 @@ static void flush_backlog(void *arg)
> }
> rps_unlock(sd);
>
> + spin_lock_irqsave(&sd->process_queue.lock, flags);
> skb_queue_walk_safe(&sd->process_queue, skb, tmp) {
> if (skb->dev == dev) {
> __skb_unlink(skb, &sd->process_queue);
> @@ -3658,6 +3660,7 @@ static void flush_backlog(void *arg)
> input_queue_head_incr(sd);
> }
> }
> + spin_unlock_irqrestore(&sd->process_queue.lock, flags);
> }
>
> static int napi_gro_complete(struct sk_buff *skb)
> @@ -4021,7 +4024,7 @@ static int process_backlog(struct napi_struct *napi,
> int quota)
> {
> int work = 0;
> struct softnet_data *sd = container_of(napi, struct softnet_data, backlog);
> -
> + unsigned long flags;
> #ifdef CONFIG_RPS
> /* Check if we have pending ipi, its better to send them now,
> * not waiting net_rx_action() end.
> @@ -4032,18 +4035,19 @@ static int process_backlog(struct napi_struct
> *napi, int quota)
> }
> #endif
> napi->weight = weight_p;
> - local_irq_disable();
> + spin_lock_irqsave(&sd->process_queue.lock, flags);
> while (work < quota) {
> struct sk_buff *skb;
> unsigned int qlen;
>
> while ((skb = __skb_dequeue(&sd->process_queue))) {
> - local_irq_enable();
> + spin_unlock_irqrestore(&sd->process_queue.lock, flags);
> __netif_receive_skb(skb);
> - local_irq_disable();
> + spin_lock_irqsave(&sd->process_queue.lock, flags);
> input_queue_head_incr(sd);
> if (++work >= quota) {
> - local_irq_enable();
> + spin_unlock_irqrestore(&sd->process_queue.lock,
> + flags);
> return work;
> }
This would be a terrible change in term of performance.
There is something wrong here : process_queue is local to the cpu.
A cpu does not have to use a spin lock to protect this queue.
Can you reproduce the bug on x86 ?
^ permalink raw reply
* Re: [PATCH] net: sh_eth: Use u32 for 32-bit register data
From: David Miller @ 2015-01-15 19:46 UTC (permalink / raw)
To: geert+renesas
Cc: nobuhiro.iwamatsu.yj, yoshihiro.shimoda.uh, netdev, linux-sh
In-Reply-To: <1421319268-22831-1-git-send-email-geert+renesas@glider.be>
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Thu, 15 Jan 2015 11:54:28 +0100
> Replace "unsigned long" by "u32" when handling 32-bit register data.
>
> A.o., this saves 11 * 36 bytes in the static sh_eth_cpu_data structures
> when compiling for 64-bit.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH 3/3] genetlink: synchronize socket closing and family removal
From: David Miller @ 2015-01-15 19:50 UTC (permalink / raw)
To: johannes; +Cc: netdev, jeff.layton, sedat.dilek, johannes.berg
In-Reply-To: <1421319885-31779-3-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes@sipsolutions.net>
Date: Thu, 15 Jan 2015 12:04:45 +0100
> + atomic_dec(&genl_sk_destructing_cnt);
> + printk(KERN_DEBUG "dec destructing\n");
> + wake_up(&genl_sk_destructing_waitq);
Hmmm, maybe only wakeup if "!atomic_dec_and_test()"?
^ permalink raw reply
* [PATCH net-next] Driver: Vmxnet3: Fix ethtool -S to return correct rx queue stats
From: Shrikrishna Khare @ 2015-01-15 19:54 UTC (permalink / raw)
To: sbhatewara, pv-drivers, netdev, linux-kernel
Cc: Shrikrishna Khare, Gao Zhenyu
Signed-off-by: Gao Zhenyu <gzhenyu@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Reviewed-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
---
drivers/net/vmxnet3/vmxnet3_ethtool.c | 2 +-
drivers/net/vmxnet3/vmxnet3_int.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 8a5a90e..4c8a944 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -323,7 +323,7 @@ vmxnet3_get_ethtool_stats(struct net_device *netdev,
vmxnet3_tq_driver_stats[i].offset);
}
- for (j = 0; j < adapter->num_tx_queues; j++) {
+ for (j = 0; j < adapter->num_rx_queues; j++) {
base = (u8 *)&adapter->rqd_start[j].stats;
*buf++ = (u64) j;
for (i = 1; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 6297d9f..406144b 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -69,10 +69,10 @@
/*
* Version numbers
*/
-#define VMXNET3_DRIVER_VERSION_STRING "1.3.2.0-k"
+#define VMXNET3_DRIVER_VERSION_STRING "1.3.3.0-k"
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
-#define VMXNET3_DRIVER_VERSION_NUM 0x01030200
+#define VMXNET3_DRIVER_VERSION_NUM 0x01030300
#if defined(CONFIG_PCI_MSI)
/* RSS only makes sense if MSI-X is supported. */
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH for 3.19 2/3] rtlwifi: Fix handling of new style descriptors
From: Larry Finger @ 2015-01-15 20:10 UTC (permalink / raw)
To: Kalle Valo, 谭杭波
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <87y4p4w8wb.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>
On 01/15/2015 06:00 AM, Kalle Valo wrote:
> Hi Troy,
>
> please avoid top-posting.
>
> 谭杭波 <troy_tan-kXabqFNEczNtrwSWzY7KCg@public.gmane.org> writes:
>
>> You can find get_available_desc here:
>>
>> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/
>> pci.c
>> index e25faac..a62170e 100644
>> --- a/drivers/net/wireless/rtlwifi/pci.c
>> +++ b/drivers/net/wireless/rtlwifi/pci.c
>> @@ -578,6 +578,13 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int
>> prio)
>> else
>> entry = (u8 *)(&ring->desc[ring->idx]);
>>
>> + if (rtlpriv->cfg->ops->get_available_desc &&
>> + rtlpriv->cfg->ops->get_available_desc(hw, prio) <= 1) {
>> + RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_DMESG,
>> + "no available desc!\n");
>> + return;
>> + }
>
> I don't see rtlpriv->cfg->ops->get_available_desc set here, only being
> called?
Kalle,
Troy and I will try to prepare a patch that only fixes the bugs, and we will
submit the cleanup for -next.
Sorry for the noise,
Larry
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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
* Re: [PATCH] e100: Don't enable WoL by default on Toshiba devices
From: Ondrej Zary @ 2015-01-15 20:15 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: David Miller, e1000-devel, netdev, linux-kernel
In-Reply-To: <1421335864.2632.29.camel@jtkirshe-mobl>
On Thursday 15 January 2015 16:31:04 Jeff Kirsher wrote:
> On Thu, 2015-01-15 at 16:18 +0100, Ondrej Zary wrote:
> > On Thursday 15 January 2015, Jeff Kirsher wrote:
> > > On Thu, 2015-01-15 at 14:40 +0100, Ondrej Zary wrote:
> > > > On Thursday 13 November 2014, Jeff Kirsher wrote:
> > > > > On Wed, 2014-11-12 at 18:18 -0500, David Miller wrote:
> > > > > > From: Ondrej Zary <linux@rainbow-software.org>
> > > > > > Date: Wed, 12 Nov 2014 23:47:25 +0100
> > > > > >
> > > > > > > Enabling WoL on some Toshiba laptops (such as Portege R100)
> > > >
> > > > causes
> > > >
> > > > > > > battery drain after shutdown (WoL is active even on battery).
> > > >
> > > > These
> > > >
> > > > > > > laptops have the WoL bit set in EEPROM ID, causing e100 driver
> > > >
> > > > to
> > > >
> > > > > > > enable WoL by default.
> > > > > > >
> > > > > > > Check subsystem vendor ID and if it's Toshiba, don't enable WoL
> > > >
> > > > by
> > > >
> > > > > > > default from EEPROM settings.
> > > > > > >
> > > > > > > Fixes
> > > >
> > > > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/110784
> > > >
> > > > > > > Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
> > > > > >
> > > > > > Jeff, are you gonna pick this up?
> > > > >
> > > > > Yes, sorry I did not catch it earlier.
> > > >
> > > > What happened to this patch? I don't see it in net.git or
> > > > net-next.git
> > > > (checked both davem's and jkirsher's)
> > >
> > > Sorry, I thought I had replied with a NAK on this patch after further
> > > review of the changes.
> > >
> > > We don't fix BIOS issues in the driver especially regarding feature
> > > enablement like WoL. We would end up with dozens of these kinds of
> > > fixes if we to allow this.
> > >
> > > You should go back to the OEM and ask for a BIOS update to resolve this
> > > or configure udev so that ethtool disables WoL.
> >
> > This is not a BIOS bug. When the machine is powered off in BIOS (or
> > GRUB), everything is OK.
> >
> > The bug is that e100 driver enables WoL based on some bit in EEPROM that
> > happens to be set on at least some Toshiba laptops and user has no way to
> > change it.
>
> Yes, the EEPROM can be modified/updated through the BIOS update I
> suggested earlier. So again, a BIOS issue.
The machine has already the latest BIOS and it's unlikely that Toshiba will
release a new version for old laptops.
> OR you can configure udev so that ethtool disables WoL if you do not
> want to pursue a EEPROM update through a BIOS update.
I can configure udev but what about other people that install Linux and expect
it to work (not drain battery after shutdown)? Without needing to know what
udev, ethtool or WoL is.
> > Windows driver does not do this. Other Linux ethernet drivers
> > don't do this. When user wants WoL, (s)he enables it in BIOS and OS.
> > Maybe this (mis)feature should be removed from the driver.
--
Ondrej Zary
^ permalink raw reply
* Re: [net-next 10/17] i40e: clean up PTP log messages
From: David Miller @ 2015-01-15 20:38 UTC (permalink / raw)
To: shannon.nelson
Cc: David.Laight, jeffrey.t.kirsher, netdev, nhorman, sassmann,
jogreene, jacob.e.keller
In-Reply-To: <FC41C24E35F18A40888AACA1A36F3E418ADD011A@fmsmsx115.amr.corp.intel.com>
From: "Nelson, Shannon" <shannon.nelson@intel.com>
Date: Thu, 15 Jan 2015 15:01:42 +0000
> The dev_info() messages have the PCI device and function number in the string, so it's really not too hard to track down the resulting netdev port:
> Jan 13 15:46:55 snelson3-cup kernel: [621235.401627] i40e 0000:84:00.1: PHC enabled
>
> Later messages use netdev_info() and have both the device number and the netdev name:
> Jan 13 15:46:56 snelson3-cup kernel: [621236.508868] i40e 0000:04:00.1 p261p2: NIC Link is Up 10 Gbps Full Duplex, Flow Control: None
>
> Note that the driver name appears in both as well.
I think we should consistently provide the netdev name as soon as
register_netdevice() returns.
It is unwise for every driver to have their own private policy on
this.
Please change this back.
^ permalink raw reply
* Re: [PATCH 3/3] genetlink: synchronize socket closing and family removal
From: Johannes Berg @ 2015-01-15 20:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev, jeff.layton, sedat.dilek
In-Reply-To: <20150115.145007.184934220260873768.davem@davemloft.net>
On Thu, 2015-01-15 at 14:50 -0500, David Miller wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> Date: Thu, 15 Jan 2015 12:04:45 +0100
>
> > + atomic_dec(&genl_sk_destructing_cnt);
> > + printk(KERN_DEBUG "dec destructing\n");
> > + wake_up(&genl_sk_destructing_waitq);
>
> Hmmm, maybe only wakeup if "!atomic_dec_and_test()"?
Yes, good point.
And, umm, how the hell did I manage to leave the printk() in there?
johannes
^ permalink raw reply
* [PATCH v2] genetlink: synchronize socket closing and family removal
From: Johannes Berg @ 2015-01-15 20:57 UTC (permalink / raw)
To: netdev; +Cc: Jeff Layton, Sedat Dilek, Johannes Berg
In-Reply-To: <1421319885-31779-3-git-send-email-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
In addition to the problem Jeff Layton reported, I looked at the code
and reproduced the same warning by subscribing and removing the genl
family with a socket still open. This is a fairly tricky race which
originates in the fact that generic netlink allows the family to go
away while sockets are still open - unlike regular netlink which has
a module refcount for every open socket so in general this cannot be
triggered.
Trying to resolve this issue by the obvious locking isn't possible as
it will result in deadlocks between unregistration and group unbind
notification (which incidentally lockdep doesn't find due to the home
grown locking in the netlink table.)
To really resolve this, introduce a "closing socket" reference counter
(for generic netlink only, as it's the only affected family) in the
core netlink code and use that in generic netlink to wait for all the
sockets that are being closed at the same time as a generic netlink
family is removed.
This fixes the race that when a socket is closed, it will should call
the unbind, but if the family is removed at the same time the unbind
will not find it, leading to the warning. The real problem though is
that in this case the unbind could actually find a new family that is
registered to have a multicast group with the same ID, and call its
mcast_unbind() leading to confusing.
Also remove the warning since it would still trigger, but is now no
longer a problem.
This also moves the code in af_netlink.c to before unreferencing the
module to avoid having the same problem in the normal non-genl case.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/linux/genetlink.h | 4 ++++
include/net/genetlink.h | 5 ++++-
net/netlink/af_netlink.c | 24 +++++++++++++++++-------
net/netlink/af_netlink.h | 1 +
net/netlink/genetlink.c | 16 +++++++++-------
5 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 55b685719d52..09460d6d6682 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -11,6 +11,10 @@ extern void genl_unlock(void);
extern int lockdep_genl_is_held(void);
#endif
+/* for synchronisation between af_netlink and genetlink */
+extern atomic_t genl_sk_destructing_cnt;
+extern wait_queue_head_t genl_sk_destructing_waitq;
+
/**
* rcu_dereference_genl - rcu_dereference with debug checking
* @p: The pointer to read, prior to dereferencing
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 2ea2c55bdc87..6c92415311ca 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -35,7 +35,10 @@ struct genl_info;
* undo operations done by pre_doit, for example release locks
* @mcast_bind: a socket bound to the given multicast group (which
* is given as the offset into the groups array)
- * @mcast_unbind: a socket was unbound from the given multicast group
+ * @mcast_unbind: a socket was unbound from the given multicast group.
+ * Note that unbind() will not be called symmetrically if the
+ * generic netlink family is removed while there are still open
+ * sockets.
* @attrbuf: buffer to store parsed attributes
* @family_list: family list
* @mcgrps: multicast groups used by this family (private)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 01b702d63457..0a91ea36ac55 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -61,6 +61,7 @@
#include <linux/rhashtable.h>
#include <asm/cacheflush.h>
#include <linux/hash.h>
+#include <linux/genetlink.h>
#include <net/net_namespace.h>
#include <net/sock.h>
@@ -1089,6 +1090,8 @@ static void netlink_remove(struct sock *sk)
__sk_del_bind_node(sk);
netlink_update_listeners(sk);
}
+ if (sk->sk_protocol == NETLINK_GENERIC)
+ atomic_inc(&genl_sk_destructing_cnt);
netlink_table_ungrab();
}
@@ -1212,6 +1215,20 @@ static int netlink_release(struct socket *sock)
* will be purged.
*/
+ /* must not acquire netlink_table_lock in any way again before unbind
+ * and notifying genetlink is done as otherwise it might deadlock
+ */
+ if (nlk->netlink_unbind) {
+ int i;
+
+ for (i = 0; i < nlk->ngroups; i++)
+ if (test_bit(i, nlk->groups))
+ nlk->netlink_unbind(sock_net(sk), i + 1);
+ }
+ if (sk->sk_protocol == NETLINK_GENERIC &&
+ atomic_dec_return(&genl_sk_destructing_cnt) == 0)
+ wake_up(&genl_sk_destructing_waitq);
+
sock->sk = NULL;
wake_up_interruptible_all(&nlk->wait);
@@ -1247,13 +1264,6 @@ static int netlink_release(struct socket *sock)
netlink_table_ungrab();
}
- if (nlk->netlink_unbind) {
- int i;
-
- for (i = 0; i < nlk->ngroups; i++)
- if (test_bit(i, nlk->groups))
- nlk->netlink_unbind(sock_net(sk), i + 1);
- }
kfree(nlk->groups);
nlk->groups = NULL;
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index 7518375782f5..89008405d6b4 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -2,6 +2,7 @@
#define _AF_NETLINK_H
#include <linux/rhashtable.h>
+#include <linux/atomic.h>
#include <net/sock.h>
#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index c18d3f5624b2..ee57459fc258 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -23,6 +23,9 @@
static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */
static DECLARE_RWSEM(cb_lock);
+atomic_t genl_sk_destructing_cnt = ATOMIC_INIT(0);
+DECLARE_WAIT_QUEUE_HEAD(genl_sk_destructing_waitq);
+
void genl_lock(void)
{
mutex_lock(&genl_mutex);
@@ -435,15 +438,18 @@ int genl_unregister_family(struct genl_family *family)
genl_lock_all();
- genl_unregister_mc_groups(family);
-
list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
if (family->id != rc->id || strcmp(rc->name, family->name))
continue;
+ genl_unregister_mc_groups(family);
+
list_del(&rc->family_list);
family->n_ops = 0;
- genl_unlock_all();
+ up_write(&cb_lock);
+ wait_event(genl_sk_destructing_waitq,
+ atomic_read(&genl_sk_destructing_cnt) == 0);
+ genl_unlock();
kfree(family->attrbuf);
genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0);
@@ -1014,7 +1020,6 @@ static int genl_bind(struct net *net, int group)
static void genl_unbind(struct net *net, int group)
{
int i;
- bool found = false;
down_read(&cb_lock);
for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
@@ -1027,14 +1032,11 @@ static void genl_unbind(struct net *net, int group)
if (f->mcast_unbind)
f->mcast_unbind(net, fam_grp);
- found = true;
break;
}
}
}
up_read(&cb_lock);
-
- WARN_ON(!found);
}
static int __net_init genl_pernet_init(struct net *net)
--
2.1.4
^ permalink raw reply related
* Re: net_test_tools: add ipv6 support for kbench_mod
From: Shaohua Li @ 2015-01-15 21:17 UTC (permalink / raw)
To: David Miller; +Cc: netdev, kafai
In-Reply-To: <20150114.013540.1963709251689177055.davem@davemloft.net>
On Wed, Jan 14, 2015 at 01:35:40AM -0500, David Miller wrote:
> From: Shaohua Li <shli@fb.com>
> Date: Tue, 13 Jan 2015 21:45:48 -0800
>
> > This patch adds ipv6 support for kbench_mod test module
>
> This doesn't even link because ip6_route_input is not an
> exported symbol.
>
> So you either didn't test this, or it depends upon custom
> kernel changes which you didn't mention.
>
> Either way I can't apply this, sorry
Yes, we need export the sysmbol for the test. Can we export the symbol?
or I can delete the route input test, which one do you prefer?
Thanks,
Shaohua
^ permalink raw reply
* Greetings
From: David Edward Cleasby @ 2015-01-15 21:09 UTC (permalink / raw)
To: netdev
Hello,
I am David Edward Cleasby, Group financial director of Bidvest Bank. I will like to discuss an Inheritance deal with you, which will be of help to both of us, if interested kindly reply to: david.ecleashy@outlook.com for more details.
^ permalink raw reply
* [PATCH net] ipv6: stop sending PTB packets for MTU < 1280
From: Hagen Paul Pfeifer @ 2015-01-15 21:34 UTC (permalink / raw)
To: netdev; +Cc: Hannes Frederic Sowa, Hagen Paul Pfeifer, stable, Fernando Gont
Reduce the attack vector and stop generating IPv6 Fragment Header for
paths with an MTU smaller than the minimum required IPv6 MTU
size (1280 byte) - called atomic fragments.
See IETF I-D "Deprecating the Generation of IPv6 Atomic Fragments" [1]
for more information and how this "feature" can be misused.
[1] https://tools.ietf.org/html/draft-ietf-6man-deprecate-atomfrag-generation-00
Cc: stable@vger.kernel.org
Signed-off-by: Fernando Gont <fgont@si6networks.com>
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
net/ipv6/route.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 34dcbb5..d4603fb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1160,12 +1160,9 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
struct net *net = dev_net(dst->dev);
rt6->rt6i_flags |= RTF_MODIFIED;
- if (mtu < IPV6_MIN_MTU) {
- u32 features = dst_metric(dst, RTAX_FEATURES);
+ if (mtu < IPV6_MIN_MTU)
mtu = IPV6_MIN_MTU;
- features |= RTAX_FEATURE_ALLFRAG;
- dst_metric_set(dst, RTAX_FEATURES, features);
- }
+
dst_metric_set(dst, RTAX_MTU, mtu);
rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires);
}
--
2.1.4
^ permalink raw reply related
* [PATCH v3 1/3] net/macb: Fix comments to meet style guidelines
From: Xander Huff @ 2015-01-15 21:45 UTC (permalink / raw)
To: davem, nicolas.ferre, david.light
Cc: netdev, jaeden.amero, rich.tollerton, brad.mouring, linux-kernel,
cyrille.pitchen, Xander Huff
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAC999F@AcuExch.aculab.com>
Change comments to not exceed 80 characters per line.
Update block comments in macb.h to start on the line after /*.
Signed-off-by: Xander Huff <xander.huff@ni.com>
---
drivers/net/ethernet/cadence/macb.h | 734 ++++++++++++++----------------------
1 file changed, 284 insertions(+), 450 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 378b218..31dc080 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -15,471 +15,309 @@
#define MACB_MAX_QUEUES 8
/* MACB register offsets */
-#define MACB_NCR 0x0000 /* Network Control */
-#define MACB_NCFGR 0x0004 /* Network Config */
-#define MACB_NSR 0x0008 /* Network Status */
-#define MACB_TAR 0x000c /* AT91RM9200 only */
-#define MACB_TCR 0x0010 /* AT91RM9200 only */
-#define MACB_TSR 0x0014 /* Transmit Status */
-#define MACB_RBQP 0x0018 /* RX Q Base Address */
-#define MACB_TBQP 0x001c /* TX Q Base Address */
-#define MACB_RSR 0x0020 /* Receive Status */
-#define MACB_ISR 0x0024 /* Interrupt Status */
-#define MACB_IER 0x0028 /* Interrupt Enable */
-#define MACB_IDR 0x002c /* Interrupt Disable */
-#define MACB_IMR 0x0030 /* Interrupt Mask */
-#define MACB_MAN 0x0034 /* PHY Maintenance */
-#define MACB_PTR 0x0038
-#define MACB_PFR 0x003c
-#define MACB_FTO 0x0040
-#define MACB_SCF 0x0044
-#define MACB_MCF 0x0048
-#define MACB_FRO 0x004c
-#define MACB_FCSE 0x0050
-#define MACB_ALE 0x0054
-#define MACB_DTF 0x0058
-#define MACB_LCOL 0x005c
-#define MACB_EXCOL 0x0060
-#define MACB_TUND 0x0064
-#define MACB_CSE 0x0068
-#define MACB_RRE 0x006c
-#define MACB_ROVR 0x0070
-#define MACB_RSE 0x0074
-#define MACB_ELE 0x0078
-#define MACB_RJA 0x007c
-#define MACB_USF 0x0080
-#define MACB_STE 0x0084
-#define MACB_RLE 0x0088
-#define MACB_TPF 0x008c
-#define MACB_HRB 0x0090
-#define MACB_HRT 0x0094
-#define MACB_SA1B 0x0098
-#define MACB_SA1T 0x009c
-#define MACB_SA2B 0x00a0
-#define MACB_SA2T 0x00a4
-#define MACB_SA3B 0x00a8
-#define MACB_SA3T 0x00ac
-#define MACB_SA4B 0x00b0
-#define MACB_SA4T 0x00b4
-#define MACB_TID 0x00b8
-#define MACB_TPQ 0x00bc
-#define MACB_USRIO 0x00c0
-#define MACB_WOL 0x00c4
-#define MACB_MID 0x00fc
+#define MACB_NCR 0x0000 /* Network Control */
+#define MACB_NCFGR 0x0004 /* Network Config */
+#define MACB_NSR 0x0008 /* Network Status */
+#define MACB_TAR 0x000c /* AT91RM9200 only */
+#define MACB_TCR 0x0010 /* AT91RM9200 only */
+#define MACB_TSR 0x0014 /* Transmit Status */
+#define MACB_RBQP 0x0018 /* RX Q Base Address */
+#define MACB_TBQP 0x001c /* TX Q Base Address */
+#define MACB_RSR 0x0020 /* Receive Status */
+#define MACB_ISR 0x0024 /* Interrupt Status */
+#define MACB_IER 0x0028 /* Interrupt Enable */
+#define MACB_IDR 0x002c /* Interrupt Disable */
+#define MACB_IMR 0x0030 /* Interrupt Mask */
+#define MACB_MAN 0x0034 /* PHY Maintenance */
+#define MACB_PTR 0x0038
+#define MACB_PFR 0x003c
+#define MACB_FTO 0x0040
+#define MACB_SCF 0x0044
+#define MACB_MCF 0x0048
+#define MACB_FRO 0x004c
+#define MACB_FCSE 0x0050
+#define MACB_ALE 0x0054
+#define MACB_DTF 0x0058
+#define MACB_LCOL 0x005c
+#define MACB_EXCOL 0x0060
+#define MACB_TUND 0x0064
+#define MACB_CSE 0x0068
+#define MACB_RRE 0x006c
+#define MACB_ROVR 0x0070
+#define MACB_RSE 0x0074
+#define MACB_ELE 0x0078
+#define MACB_RJA 0x007c
+#define MACB_USF 0x0080
+#define MACB_STE 0x0084
+#define MACB_RLE 0x0088
+#define MACB_TPF 0x008c
+#define MACB_HRB 0x0090
+#define MACB_HRT 0x0094
+#define MACB_SA1B 0x0098
+#define MACB_SA1T 0x009c
+#define MACB_SA2B 0x00a0
+#define MACB_SA2T 0x00a4
+#define MACB_SA3B 0x00a8
+#define MACB_SA3T 0x00ac
+#define MACB_SA4B 0x00b0
+#define MACB_SA4T 0x00b4
+#define MACB_TID 0x00b8
+#define MACB_TPQ 0x00bc
+#define MACB_USRIO 0x00c0
+#define MACB_WOL 0x00c4
+#define MACB_MID 0x00fc
/* GEM register offsets. */
-#define GEM_NCFGR 0x0004 /* Network Config */
-#define GEM_USRIO 0x000c /* User IO */
-#define GEM_DMACFG 0x0010 /* DMA Configuration */
-#define GEM_HRB 0x0080 /* Hash Bottom */
-#define GEM_HRT 0x0084 /* Hash Top */
-#define GEM_SA1B 0x0088 /* Specific1 Bottom */
-#define GEM_SA1T 0x008C /* Specific1 Top */
-#define GEM_SA2B 0x0090 /* Specific2 Bottom */
-#define GEM_SA2T 0x0094 /* Specific2 Top */
-#define GEM_SA3B 0x0098 /* Specific3 Bottom */
-#define GEM_SA3T 0x009C /* Specific3 Top */
-#define GEM_SA4B 0x00A0 /* Specific4 Bottom */
-#define GEM_SA4T 0x00A4 /* Specific4 Top */
-#define GEM_OTX 0x0100 /* Octets transmitted */
-#define GEM_OCTTXL 0x0100 /* Octets transmitted
- * [31:0]
- */
-#define GEM_OCTTXH 0x0104 /* Octets transmitted
- * [47:32]
- */
-#define GEM_TXCNT 0x0108 /* Error-free Frames
- * Transmitted counter
- */
-#define GEM_TXBCCNT 0x010c /* Error-free Broadcast
- * Frames counter
- */
-#define GEM_TXMCCNT 0x0110 /* Error-free Multicast
- * Frames counter
- */
-#define GEM_TXPAUSECNT 0x0114 /* Pause Frames
- * Transmitted Counter
- */
-#define GEM_TX64CNT 0x0118 /* Error-free 64 byte
- * Frames Transmitted
- * counter
- */
-#define GEM_TX65CNT 0x011c /* Error-free 65-127 byte
- * Frames Transmitted
- * counter
- */
-#define GEM_TX128CNT 0x0120 /* Error-free 128-255
- * byte Frames
- * Transmitted counter
- */
-#define GEM_TX256CNT 0x0124 /* Error-free 256-511
- * byte Frames
- * transmitted counter
- */
-#define GEM_TX512CNT 0x0128 /* Error-free 512-1023
- * byte Frames
- * transmitted counter
- */
-#define GEM_TX1024CNT 0x012c /* Error-free 1024-1518
- * byte Frames
- * transmitted counter
- */
-#define GEM_TX1519CNT 0x0130 /* Error-free larger than
- * 1519 byte Frames
- * tranmitted counter
- */
-#define GEM_TXURUNCNT 0x0134 /* TX under run error
- * counter
- */
-#define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame
- * Counter
- */
-#define GEM_MULTICOLLCNT 0x013c /* Multiple Collision
- * Frame Counter
- */
-#define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision
- * Frame Counter
- */
-#define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame
- * Counter
- */
-#define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission
- * Frame Counter
- */
-#define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error
- * Counter
- */
-#define GEM_ORX 0x0150 /* Octets received */
-#define GEM_OCTRXL 0x0150 /* Octets received
- * [31:0]
- */
-#define GEM_OCTRXH 0x0154 /* Octets received
- * [47:32]
- */
-#define GEM_RXCNT 0x0158 /* Error-free Frames
- * Received Counter
- */
-#define GEM_RXBROADCNT 0x015c /* Error-free Broadcast
- * Frames Received
- * Counter
- */
-#define GEM_RXMULTICNT 0x0160 /* Error-free Multicast
- * Frames Received
- * Counter
- */
-#define GEM_RXPAUSECNT 0x0164 /* Error-free Pause
- * Frames Received
- * Counter
- */
-#define GEM_RX64CNT 0x0168 /* Error-free 64 byte
- * Frames Received
- * Counter
- */
-#define GEM_RX65CNT 0x016c /* Error-free 65-127 byte
- * Frames Received
- * Counter
- */
-#define GEM_RX128CNT 0x0170 /* Error-free 128-255
- * byte Frames Received
- * Counter
- */
-#define GEM_RX256CNT 0x0174 /* Error-free 256-511
- * byte Frames Received
- * Counter
- */
-#define GEM_RX512CNT 0x0178 /* Error-free 512-1023
- * byte Frames Received
- * Counter
- */
-#define GEM_RX1024CNT 0x017c /* Error-free 1024-1518
- * byte Frames Received
- * Counter
- */
-#define GEM_RX1519CNT 0x0180 /* Error-free larger than
- * 1519 Frames Received
- * Counter
- */
-#define GEM_RXUNDRCNT 0x0184 /* Undersize Frames
- * Received Counter
- */
-#define GEM_RXOVRCNT 0x0188 /* Oversize Frames
- * Received Counter
- */
-#define GEM_RXJABCNT 0x018c /* Jabbers Received
- * Counter
- */
-#define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence
- * Error Counter
- */
-#define GEM_RXLENGTHCNT 0x0194 /* Length Field Error
- * Counter
- */
-#define GEM_RXSYMBCNT 0x0198 /* Symbol Error
- * Counter
- */
-#define GEM_RXALIGNCNT 0x019c /* Alignment Error
- * Counter
- */
-#define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error
- * Counter
- */
-#define GEM_RXORCNT 0x01a4 /* Receive Overrun
- * Counter
- */
-#define GEM_RXIPCCNT 0x01a8 /* IP header Checksum
- * Error Counter
- */
-#define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error
- * Counter
- */
-#define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error
- * Counter
- */
-#define GEM_DCFG1 0x0280 /* Design Config 1 */
-#define GEM_DCFG2 0x0284 /* Design Config 2 */
-#define GEM_DCFG3 0x0288 /* Design Config 3 */
-#define GEM_DCFG4 0x028c /* Design Config 4 */
-#define GEM_DCFG5 0x0290 /* Design Config 5 */
-#define GEM_DCFG6 0x0294 /* Design Config 6 */
-#define GEM_DCFG7 0x0298 /* Design Config 7 */
-
-#define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
-#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
-#define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2))
-#define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2))
-#define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2))
-#define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2))
+#define GEM_NCFGR 0x0004 /* Network Config */
+#define GEM_USRIO 0x000c /* User IO */
+#define GEM_DMACFG 0x0010 /* DMA Configuration */
+#define GEM_HRB 0x0080 /* Hash Bottom */
+#define GEM_HRT 0x0084 /* Hash Top */
+#define GEM_SA1B 0x0088 /* Specific1 Bottom */
+#define GEM_SA1T 0x008C /* Specific1 Top */
+#define GEM_SA2B 0x0090 /* Specific2 Bottom */
+#define GEM_SA2T 0x0094 /* Specific2 Top */
+#define GEM_SA3B 0x0098 /* Specific3 Bottom */
+#define GEM_SA3T 0x009C /* Specific3 Top */
+#define GEM_SA4B 0x00A0 /* Specific4 Bottom */
+#define GEM_SA4T 0x00A4 /* Specific4 Top */
+#define GEM_OTX 0x0100 /* Octets transmitted */
+#define GEM_OCTTXL 0x0100 /* Octets transmitted [31:0] */
+#define GEM_OCTTXH 0x0104 /* Octets transmitted [47:32] */
+#define GEM_TXCNT 0x0108 /* Frames Transmitted counter */
+#define GEM_TXBCCNT 0x010c /* Broadcast Frames counter */
+#define GEM_TXMCCNT 0x0110 /* Multicast Frames counter */
+#define GEM_TXPAUSECNT 0x0114 /* Pause Frames Transmitted Counter */
+#define GEM_TX64CNT 0x0118 /* 64 byte Frames TX counter */
+#define GEM_TX65CNT 0x011c /* 65-127 byte Frames TX counter */
+#define GEM_TX128CNT 0x0120 /* 128-255 byte Frames TX counter */
+#define GEM_TX256CNT 0x0124 /* 256-511 byte Frames TX counter */
+#define GEM_TX512CNT 0x0128 /* 512-1023 byte Frames TX counter */
+#define GEM_TX1024CNT 0x012c /* 1024-1518 byte Frames TX counter */
+#define GEM_TX1519CNT 0x0130 /* 1519+ byte Frames TX counter */
+#define GEM_TXURUNCNT 0x0134 /* TX under run error counter */
+#define GEM_SNGLCOLLCNT 0x0138 /* Single Collision Frame Counter */
+#define GEM_MULTICOLLCNT 0x013c /* Multiple Collision Frame Counter */
+#define GEM_EXCESSCOLLCNT 0x0140 /* Excessive Collision Frame Counter */
+#define GEM_LATECOLLCNT 0x0144 /* Late Collision Frame Counter */
+#define GEM_TXDEFERCNT 0x0148 /* Deferred Transmission Frame Counter */
+#define GEM_TXCSENSECNT 0x014c /* Carrier Sense Error Counter */
+#define GEM_ORX 0x0150 /* Octets received */
+#define GEM_OCTRXL 0x0150 /* Octets received [31:0] */
+#define GEM_OCTRXH 0x0154 /* Octets received [47:32] */
+#define GEM_RXCNT 0x0158 /* Frames Received Counter */
+#define GEM_RXBROADCNT 0x015c /* Broadcast Frames Received Counter */
+#define GEM_RXMULTICNT 0x0160 /* Multicast Frames Received Counter */
+#define GEM_RXPAUSECNT 0x0164 /* Pause Frames Received Counter */
+#define GEM_RX64CNT 0x0168 /* 64 byte Frames RX Counter */
+#define GEM_RX65CNT 0x016c /* 65-127 byte Frames RX Counter */
+#define GEM_RX128CNT 0x0170 /* 128-255 byte Frames RX Counter */
+#define GEM_RX256CNT 0x0174 /* 256-511 byte Frames RX Counter */
+#define GEM_RX512CNT 0x0178 /* 512-1023 byte Frames RX Counter */
+#define GEM_RX1024CNT 0x017c /* 1024-1518 byte Frames RX Counter */
+#define GEM_RX1519CNT 0x0180 /* 1519+ byte Frames RX Counter */
+#define GEM_RXUNDRCNT 0x0184 /* Undersize Frames Received Counter */
+#define GEM_RXOVRCNT 0x0188 /* Oversize Frames Received Counter */
+#define GEM_RXJABCNT 0x018c /* Jabbers Received Counter */
+#define GEM_RXFCSCNT 0x0190 /* Frame Check Sequence Error Counter */
+#define GEM_RXLENGTHCNT 0x0194 /* Length Field Error Counter */
+#define GEM_RXSYMBCNT 0x0198 /* Symbol Error Counter */
+#define GEM_RXALIGNCNT 0x019c /* Alignment Error Counter */
+#define GEM_RXRESERRCNT 0x01a0 /* Receive Resource Error Counter */
+#define GEM_RXORCNT 0x01a4 /* Receive Overrun Counter */
+#define GEM_RXIPCCNT 0x01a8 /* IP header Checksum Error Counter */
+#define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error Counter */
+#define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error Counter */
+#define GEM_DCFG1 0x0280 /* Design Config 1 */
+#define GEM_DCFG2 0x0284 /* Design Config 2 */
+#define GEM_DCFG3 0x0288 /* Design Config 3 */
+#define GEM_DCFG4 0x028c /* Design Config 4 */
+#define GEM_DCFG5 0x0290 /* Design Config 5 */
+#define GEM_DCFG6 0x0294 /* Design Config 6 */
+#define GEM_DCFG7 0x0298 /* Design Config 7 */
+
+#define GEM_ISR(hw_q) (0x0400 + ((hw_q) << 2))
+#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2))
+#define GEM_RBQP(hw_q) (0x0480 + ((hw_q) << 2))
+#define GEM_IER(hw_q) (0x0600 + ((hw_q) << 2))
+#define GEM_IDR(hw_q) (0x0620 + ((hw_q) << 2))
+#define GEM_IMR(hw_q) (0x0640 + ((hw_q) << 2))
/* Bitfields in NCR */
-#define MACB_LB_OFFSET 0 /* reserved */
-#define MACB_LB_SIZE 1
-#define MACB_LLB_OFFSET 1 /* Loop back local */
-#define MACB_LLB_SIZE 1
-#define MACB_RE_OFFSET 2 /* Receive enable */
-#define MACB_RE_SIZE 1
-#define MACB_TE_OFFSET 3 /* Transmit enable */
-#define MACB_TE_SIZE 1
-#define MACB_MPE_OFFSET 4 /* Management port enable */
-#define MACB_MPE_SIZE 1
-#define MACB_CLRSTAT_OFFSET 5 /* Clear stats regs */
-#define MACB_CLRSTAT_SIZE 1
-#define MACB_INCSTAT_OFFSET 6 /* Incremental stats regs */
-#define MACB_INCSTAT_SIZE 1
-#define MACB_WESTAT_OFFSET 7 /* Write enable stats regs */
-#define MACB_WESTAT_SIZE 1
-#define MACB_BP_OFFSET 8 /* Back pressure */
-#define MACB_BP_SIZE 1
-#define MACB_TSTART_OFFSET 9 /* Start transmission */
-#define MACB_TSTART_SIZE 1
-#define MACB_THALT_OFFSET 10 /* Transmit halt */
-#define MACB_THALT_SIZE 1
-#define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */
-#define MACB_NCR_TPF_SIZE 1
-#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum
- * pause frame
- */
-#define MACB_TZQ_SIZE 1
+#define MACB_LB_OFFSET 0 /* reserved */
+#define MACB_LB_SIZE 1
+#define MACB_LLB_OFFSET 1 /* Loop back local */
+#define MACB_LLB_SIZE 1
+#define MACB_RE_OFFSET 2 /* Receive enable */
+#define MACB_RE_SIZE 1
+#define MACB_TE_OFFSET 3 /* Transmit enable */
+#define MACB_TE_SIZE 1
+#define MACB_MPE_OFFSET 4 /* Management port enable */
+#define MACB_MPE_SIZE 1
+#define MACB_CLRSTAT_OFFSET 5 /* Clear stats regs */
+#define MACB_CLRSTAT_SIZE 1
+#define MACB_INCSTAT_OFFSET 6 /* Incremental stats regs */
+#define MACB_INCSTAT_SIZE 1
+#define MACB_WESTAT_OFFSET 7 /* Write enable stats regs */
+#define MACB_WESTAT_SIZE 1
+#define MACB_BP_OFFSET 8 /* Back pressure */
+#define MACB_BP_SIZE 1
+#define MACB_TSTART_OFFSET 9 /* Start transmission */
+#define MACB_TSTART_SIZE 1
+#define MACB_THALT_OFFSET 10 /* Transmit halt */
+#define MACB_THALT_SIZE 1
+#define MACB_NCR_TPF_OFFSET 11 /* Transmit pause frame */
+#define MACB_NCR_TPF_SIZE 1
+#define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */
+#define MACB_TZQ_SIZE 1
/* Bitfields in NCFGR */
-#define MACB_SPD_OFFSET 0 /* Speed */
-#define MACB_SPD_SIZE 1
-#define MACB_FD_OFFSET 1 /* Full duplex */
-#define MACB_FD_SIZE 1
-#define MACB_BIT_RATE_OFFSET 2 /* Discard non-VLAN frames */
-#define MACB_BIT_RATE_SIZE 1
-#define MACB_JFRAME_OFFSET 3 /* reserved */
-#define MACB_JFRAME_SIZE 1
-#define MACB_CAF_OFFSET 4 /* Copy all frames */
-#define MACB_CAF_SIZE 1
-#define MACB_NBC_OFFSET 5 /* No broadcast */
-#define MACB_NBC_SIZE 1
-#define MACB_NCFGR_MTI_OFFSET 6 /* Multicast hash enable */
-#define MACB_NCFGR_MTI_SIZE 1
-#define MACB_UNI_OFFSET 7 /* Unicast hash enable */
-#define MACB_UNI_SIZE 1
-#define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */
-#define MACB_BIG_SIZE 1
-#define MACB_EAE_OFFSET 9 /* External address match
- * enable
- */
-#define MACB_EAE_SIZE 1
-#define MACB_CLK_OFFSET 10
-#define MACB_CLK_SIZE 2
-#define MACB_RTY_OFFSET 12 /* Retry test */
-#define MACB_RTY_SIZE 1
-#define MACB_PAE_OFFSET 13 /* Pause enable */
-#define MACB_PAE_SIZE 1
-#define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */
-#define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
-#define MACB_RBOF_OFFSET 14 /* Receive buffer offset */
-#define MACB_RBOF_SIZE 2
-#define MACB_RLCE_OFFSET 16 /* Length field error frame
- * discard
- */
-#define MACB_RLCE_SIZE 1
-#define MACB_DRFCS_OFFSET 17 /* FCS remove */
-#define MACB_DRFCS_SIZE 1
-#define MACB_EFRHD_OFFSET 18
-#define MACB_EFRHD_SIZE 1
-#define MACB_IRXFCS_OFFSET 19
-#define MACB_IRXFCS_SIZE 1
+#define MACB_SPD_OFFSET 0 /* Speed */
+#define MACB_SPD_SIZE 1
+#define MACB_FD_OFFSET 1 /* Full duplex */
+#define MACB_FD_SIZE 1
+#define MACB_BIT_RATE_OFFSET 2 /* Discard non-VLAN frames */
+#define MACB_BIT_RATE_SIZE 1
+#define MACB_JFRAME_OFFSET 3 /* reserved */
+#define MACB_JFRAME_SIZE 1
+#define MACB_CAF_OFFSET 4 /* Copy all frames */
+#define MACB_CAF_SIZE 1
+#define MACB_NBC_OFFSET 5 /* No broadcast */
+#define MACB_NBC_SIZE 1
+#define MACB_NCFGR_MTI_OFFSET 6 /* Multicast hash enable */
+#define MACB_NCFGR_MTI_SIZE 1
+#define MACB_UNI_OFFSET 7 /* Unicast hash enable */
+#define MACB_UNI_SIZE 1
+#define MACB_BIG_OFFSET 8 /* Receive 1536 byte frames */
+#define MACB_BIG_SIZE 1
+#define MACB_EAE_OFFSET 9 /* External address match enable */
+#define MACB_EAE_SIZE 1
+#define MACB_CLK_OFFSET 10
+#define MACB_CLK_SIZE 2
+#define MACB_RTY_OFFSET 12 /* Retry test */
+#define MACB_RTY_SIZE 1
+#define MACB_PAE_OFFSET 13 /* Pause enable */
+#define MACB_PAE_SIZE 1
+#define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */
+#define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */
+#define MACB_RBOF_OFFSET 14 /* Receive buffer offset */
+#define MACB_RBOF_SIZE 2
+#define MACB_RLCE_OFFSET 16 /* Length field error frame discard */
+#define MACB_RLCE_SIZE 1
+#define MACB_DRFCS_OFFSET 17 /* FCS remove */
+#define MACB_DRFCS_SIZE 1
+#define MACB_EFRHD_OFFSET 18
+#define MACB_EFRHD_SIZE 1
+#define MACB_IRXFCS_OFFSET 19
+#define MACB_IRXFCS_SIZE 1
/* GEM specific NCFGR bitfields. */
-#define GEM_GBE_OFFSET 10 /* Gigabit mode enable */
-#define GEM_GBE_SIZE 1
-#define GEM_CLK_OFFSET 18 /* MDC clock division */
-#define GEM_CLK_SIZE 3
-#define GEM_DBW_OFFSET 21 /* Data bus width */
-#define GEM_DBW_SIZE 2
-#define GEM_RXCOEN_OFFSET 24
-#define GEM_RXCOEN_SIZE 1
+#define GEM_GBE_OFFSET 10 /* Gigabit mode enable */
+#define GEM_GBE_SIZE 1
+#define GEM_CLK_OFFSET 18 /* MDC clock division */
+#define GEM_CLK_SIZE 3
+#define GEM_DBW_OFFSET 21 /* Data bus width */
+#define GEM_DBW_SIZE 2
+#define GEM_RXCOEN_OFFSET 24
+#define GEM_RXCOEN_SIZE 1
/* Constants for data bus width. */
-#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus
- * width
- */
-#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus
- * width
- */
-#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus
- * width
- */
+#define GEM_DBW32 0 /* 32 bit AMBA AHB data bus width */
+#define GEM_DBW64 1 /* 64 bit AMBA AHB data bus width */
+#define GEM_DBW128 2 /* 128 bit AMBA AHB data bus width */
/* Bitfields in DMACFG. */
-#define GEM_FBLDO_OFFSET 0 /* AHB fixed burst length for
- * DMA data operations
- */
-#define GEM_FBLDO_SIZE 5
-#define GEM_ENDIA_OFFSET 7 /* AHB endian swap mode enable
- * for packet data accesses
- */
-#define GEM_ENDIA_SIZE 1
-#define GEM_RXBMS_OFFSET 8 /* Receiver packet buffer
- * memory size select
- */
-#define GEM_RXBMS_SIZE 2
-#define GEM_TXPBMS_OFFSET 10 /* Transmitter packet buffer
- * memory size select
- */
-#define GEM_TXPBMS_SIZE 1
-#define GEM_TXCOEN_OFFSET 11 /* Transmitter IP, TCP and
- * UDP checksum generation
- * offload enable
- */
-#define GEM_TXCOEN_SIZE 1
-#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size in
- * AHB system memory
- */
-#define GEM_RXBS_SIZE 8
-#define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */
-#define GEM_DDRP_SIZE 1
+#define GEM_FBLDO_OFFSET 0 /* fixed burst length for DMA */
+#define GEM_FBLDO_SIZE 5
+#define GEM_ENDIA_OFFSET 7 /* endian swap mode for packet data access */
+#define GEM_ENDIA_SIZE 1
+#define GEM_RXBMS_OFFSET 8 /* RX packet buffer memory size select */
+#define GEM_RXBMS_SIZE 2
+#define GEM_TXPBMS_OFFSET 10 /* TX packet buffer memory size select */
+#define GEM_TXPBMS_SIZE 1
+#define GEM_TXCOEN_OFFSET 11 /* TX IP/TCP/UDP checksum gen offload */
+#define GEM_TXCOEN_SIZE 1
+#define GEM_RXBS_OFFSET 16 /* DMA receive buffer size */
+#define GEM_RXBS_SIZE 8
+#define GEM_DDRP_OFFSET 24 /* disc_when_no_ahb */
+#define GEM_DDRP_SIZE 1
/* Bitfields in NSR */
-#define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */
-#define MACB_NSR_LINK_SIZE 1
-#define MACB_MDIO_OFFSET 1 /* status of the mdio_in
- * pin
- */
-#define MACB_MDIO_SIZE 1
-#define MACB_IDLE_OFFSET 2 /* The PHY management logic is
- * idle (i.e. has completed)
- */
-#define MACB_IDLE_SIZE 1
+#define MACB_NSR_LINK_OFFSET 0 /* pcs_link_state */
+#define MACB_NSR_LINK_SIZE 1
+#define MACB_MDIO_OFFSET 1 /* status of the mdio_in pin */
+#define MACB_MDIO_SIZE 1
+#define MACB_IDLE_OFFSET 2 /* The PHY management logic is idle */
+#define MACB_IDLE_SIZE 1
/* Bitfields in TSR */
-#define MACB_UBR_OFFSET 0 /* Used bit read */
-#define MACB_UBR_SIZE 1
-#define MACB_COL_OFFSET 1 /* Collision occurred */
-#define MACB_COL_SIZE 1
-#define MACB_TSR_RLE_OFFSET 2 /* Retry limit exceeded */
-#define MACB_TSR_RLE_SIZE 1
-#define MACB_TGO_OFFSET 3 /* Transmit go */
-#define MACB_TGO_SIZE 1
-#define MACB_BEX_OFFSET 4 /* Transmit frame corruption
- * due to AHB error
- */
-#define MACB_BEX_SIZE 1
-#define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
-#define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
-#define MACB_COMP_OFFSET 5 /* Trnasmit complete */
-#define MACB_COMP_SIZE 1
-#define MACB_UND_OFFSET 6 /* Trnasmit under run */
-#define MACB_UND_SIZE 1
+#define MACB_UBR_OFFSET 0 /* Used bit read */
+#define MACB_UBR_SIZE 1
+#define MACB_COL_OFFSET 1 /* Collision occurred */
+#define MACB_COL_SIZE 1
+#define MACB_TSR_RLE_OFFSET 2 /* Retry limit exceeded */
+#define MACB_TSR_RLE_SIZE 1
+#define MACB_TGO_OFFSET 3 /* Transmit go */
+#define MACB_TGO_SIZE 1
+#define MACB_BEX_OFFSET 4 /* TX frame corruption due to AHB error */
+#define MACB_BEX_SIZE 1
+#define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */
+#define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */
+#define MACB_COMP_OFFSET 5 /* Trnasmit complete */
+#define MACB_COMP_SIZE 1
+#define MACB_UND_OFFSET 6 /* Trnasmit under run */
+#define MACB_UND_SIZE 1
/* Bitfields in RSR */
-#define MACB_BNA_OFFSET 0 /* Buffer not available */
-#define MACB_BNA_SIZE 1
-#define MACB_REC_OFFSET 1 /* Frame received */
-#define MACB_REC_SIZE 1
-#define MACB_OVR_OFFSET 2 /* Receive overrun */
-#define MACB_OVR_SIZE 1
+#define MACB_BNA_OFFSET 0 /* Buffer not available */
+#define MACB_BNA_SIZE 1
+#define MACB_REC_OFFSET 1 /* Frame received */
+#define MACB_REC_SIZE 1
+#define MACB_OVR_OFFSET 2 /* Receive overrun */
+#define MACB_OVR_SIZE 1
/* Bitfields in ISR/IER/IDR/IMR */
-#define MACB_MFD_OFFSET 0 /* Management frame sent */
-#define MACB_MFD_SIZE 1
-#define MACB_RCOMP_OFFSET 1 /* Receive complete */
-#define MACB_RCOMP_SIZE 1
-#define MACB_RXUBR_OFFSET 2 /* RX used bit read */
-#define MACB_RXUBR_SIZE 1
-#define MACB_TXUBR_OFFSET 3 /* TX used bit read */
-#define MACB_TXUBR_SIZE 1
-#define MACB_ISR_TUND_OFFSET 4 /* Enable trnasmit buffer
- * under run interrupt
- */
-#define MACB_ISR_TUND_SIZE 1
-#define MACB_ISR_RLE_OFFSET 5 /* Enable retry limit exceeded
- * or late collision interrupt
- */
-#define MACB_ISR_RLE_SIZE 1
-#define MACB_TXERR_OFFSET 6 /* Enable transmit frame
- * corruption due to AHB error
- * interrupt
- */
-#define MACB_TXERR_SIZE 1
-#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete
- * interrupt
- */
-#define MACB_TCOMP_SIZE 1
-#define MACB_ISR_LINK_OFFSET 9 /* Enable link change
- * interrupt
- */
-#define MACB_ISR_LINK_SIZE 1
-#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun
- * interrupt
- */
-#define MACB_ISR_ROVR_SIZE 1
-#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK
- * interrupt
- */
-#define MACB_HRESP_SIZE 1
-#define MACB_PFR_OFFSET 12 /* Enable pause frame with
- * non-zero pause quantum
- * interrupt
- */
-#define MACB_PFR_SIZE 1
-#define MACB_PTZ_OFFSET 13 /* Enable pause time zero
- * interrupt
- */
-#define MACB_PTZ_SIZE 1
+#define MACB_MFD_OFFSET 0 /* Management frame sent */
+#define MACB_MFD_SIZE 1
+#define MACB_RCOMP_OFFSET 1 /* Receive complete */
+#define MACB_RCOMP_SIZE 1
+#define MACB_RXUBR_OFFSET 2 /* RX used bit read */
+#define MACB_RXUBR_SIZE 1
+#define MACB_TXUBR_OFFSET 3 /* TX used bit read */
+#define MACB_TXUBR_SIZE 1
+#define MACB_ISR_TUND_OFFSET 4 /* Enable TX buffer under run interrupt */
+#define MACB_ISR_TUND_SIZE 1
+#define MACB_ISR_RLE_OFFSET 5 /* EN retry exceeded/late coll interrupt */
+#define MACB_ISR_RLE_SIZE 1
+#define MACB_TXERR_OFFSET 6 /* EN TX frame corrupt from error interrupt */
+#define MACB_TXERR_SIZE 1
+#define MACB_TCOMP_OFFSET 7 /* Enable transmit complete interrupt */
+#define MACB_TCOMP_SIZE 1
+#define MACB_ISR_LINK_OFFSET 9 /* Enable link change interrupt */
+#define MACB_ISR_LINK_SIZE 1
+#define MACB_ISR_ROVR_OFFSET 10 /* Enable receive overrun interrupt */
+#define MACB_ISR_ROVR_SIZE 1
+#define MACB_HRESP_OFFSET 11 /* Enable hrsep not OK interrupt */
+#define MACB_HRESP_SIZE 1
+#define MACB_PFR_OFFSET 12 /* Enable pause frame w/ quantum interrupt */
+#define MACB_PFR_SIZE 1
+#define MACB_PTZ_OFFSET 13 /* Enable pause time zero interrupt */
+#define MACB_PTZ_SIZE 1
/* Bitfields in MAN */
-#define MACB_DATA_OFFSET 0 /* data */
-#define MACB_DATA_SIZE 16
-#define MACB_CODE_OFFSET 16 /* Must be written to 10 */
-#define MACB_CODE_SIZE 2
-#define MACB_REGA_OFFSET 18 /* Register address */
-#define MACB_REGA_SIZE 5
-#define MACB_PHYA_OFFSET 23 /* PHY address */
-#define MACB_PHYA_SIZE 5
-#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01
- * is write.
- */
-#define MACB_RW_SIZE 2
-#define MACB_SOF_OFFSET 30 /* Must be written to 1 for
- * Clause 22 operation
- */
-#define MACB_SOF_SIZE 2
+#define MACB_DATA_OFFSET 0 /* data */
+#define MACB_DATA_SIZE 16
+#define MACB_CODE_OFFSET 16 /* Must be written to 10 */
+#define MACB_CODE_SIZE 2
+#define MACB_REGA_OFFSET 18 /* Register address */
+#define MACB_REGA_SIZE 5
+#define MACB_PHYA_OFFSET 23 /* PHY address */
+#define MACB_PHYA_SIZE 5
+#define MACB_RW_OFFSET 28 /* Operation. 10 is read. 01 is write. */
+#define MACB_RW_SIZE 2
+#define MACB_SOF_OFFSET 30 /* Must be written to 1 for Clause 22 */
+#define MACB_SOF_SIZE 2
/* Bitfields in USRIO (AVR32) */
#define MACB_MII_OFFSET 0
@@ -597,8 +435,7 @@
#define queue_writel(queue, reg, value) \
__raw_writel((value), (queue)->bp->regs + (queue)->reg)
-/*
- * Conditional GEM/MACB macros. These perform the operation to the correct
+/* Conditional GEM/MACB macros. These perform the operation to the correct
* register dependent on whether the device is a GEM or a MACB. For registers
* and bitfields that are common across both devices, use macb_{read,write}l
* to avoid the cost of the conditional.
@@ -621,8 +458,7 @@
__v; \
})
-/**
- * struct macb_dma_desc - Hardware DMA descriptor
+/* struct macb_dma_desc - Hardware DMA descriptor
* @addr: DMA address of data buffer
* @ctrl: Control and status bits
*/
@@ -711,8 +547,7 @@ struct macb_dma_desc {
/* limit RX checksum offload to TCP and UDP packets */
#define GEM_RX_CSUM_CHECKED_MASK 2
-/**
- * struct macb_tx_skb - data about an skb which is being transmitted
+/* struct macb_tx_skb - data about an skb which is being transmitted
* @skb: skb currently being transmitted, only set for the last buffer
* of the frame
* @mapping: DMA address of the skb's fragment buffer
@@ -727,8 +562,7 @@ struct macb_tx_skb {
bool mapped_as_page;
};
-/*
- * Hardware-collected statistics. Used when updating the network
+/* Hardware-collected statistics. Used when updating the network
* device stats by a periodic timer.
*/
struct macb_stats {
--
1.9.1
^ permalink raw reply related
* [PATCH v3 2/3] net/macb: Add whitespace around arithmetic operators
From: Xander Huff @ 2015-01-15 21:45 UTC (permalink / raw)
To: davem, nicolas.ferre, david.light
Cc: netdev, jaeden.amero, rich.tollerton, brad.mouring, linux-kernel,
cyrille.pitchen, Xander Huff
In-Reply-To: <1421358316-23660-1-git-send-email-xander.huff@ni.com>
Spaces should surround add, multiply, and bitshift operators.
Signed-off-by: Xander Huff <xander.huff@ni.com>
---
drivers/net/ethernet/cadence/macb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index dd8c202..9edd787 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1691,7 +1691,7 @@ static int hash_get_index(__u8 *addr)
for (j = 0; j < 6; j++) {
for (i = 0, bitval = 0; i < 8; i++)
- bitval ^= hash_bit_value(i*6 + j, addr);
+ bitval ^= hash_bit_value(i * 6 + j, addr);
hash_index |= (bitval << j);
}
@@ -1832,15 +1832,15 @@ static void gem_update_stats(struct macb *bp)
for (i = 0; i < GEM_STATS_LEN; ++i, ++p) {
u32 offset = gem_statistics[i].offset;
- u64 val = __raw_readl(bp->regs+offset);
+ u64 val = __raw_readl(bp->regs + offset);
bp->ethtool_stats[i] += val;
*p += val;
if (offset == GEM_OCTTXL || offset == GEM_OCTRXL) {
/* Add GEM_OCTTXH, GEM_OCTRXH */
- val = __raw_readl(bp->regs+offset+4);
- bp->ethtool_stats[i] += ((u64)val)<<32;
+ val = __raw_readl(bp->regs + offset + 4);
+ bp->ethtool_stats[i] += ((u64)val) << 32;
*(++p) += val;
}
}
@@ -1891,7 +1891,7 @@ static void gem_get_ethtool_stats(struct net_device *dev,
bp = netdev_priv(dev);
gem_update_stats(bp);
- memcpy(data, &bp->ethtool_stats, sizeof(u64)*GEM_STATS_LEN);
+ memcpy(data, &bp->ethtool_stats, sizeof(u64) * GEM_STATS_LEN);
}
static int gem_get_sset_count(struct net_device *dev, int sset)
--
1.9.1
^ permalink raw reply related
* [PATCH v3 3/3] net/macb: Create gem_ethtool_ops for new statistics functions
From: Xander Huff @ 2015-01-15 21:45 UTC (permalink / raw)
To: davem, nicolas.ferre, david.light
Cc: netdev, jaeden.amero, rich.tollerton, brad.mouring, linux-kernel,
cyrille.pitchen, Xander Huff
In-Reply-To: <1421358316-23660-1-git-send-email-xander.huff@ni.com>
10/100 MACB does not have the same statistics possibilities as GEM. Separate
macb_ethtool_ops to make a new GEM-specific struct with the new statistics
functions included.
Signed-off-by: Xander Huff <xander.huff@ni.com>
---
drivers/net/ethernet/cadence/macb.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 9edd787..f2f9ca0 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2032,11 +2032,21 @@ const struct ethtool_ops macb_ethtool_ops = {
.get_regs = macb_get_regs,
.get_link = ethtool_op_get_link,
.get_ts_info = ethtool_op_get_ts_info,
+};
+EXPORT_SYMBOL_GPL(macb_ethtool_ops);
+
+const struct ethtool_ops gem_ethtool_ops = {
+ .get_settings = macb_get_settings,
+ .set_settings = macb_set_settings,
+ .get_regs_len = macb_get_regs_len,
+ .get_regs = macb_get_regs,
+ .get_link = ethtool_op_get_link,
+ .get_ts_info = ethtool_op_get_ts_info,
.get_ethtool_stats = gem_get_ethtool_stats,
.get_strings = gem_get_ethtool_strings,
.get_sset_count = gem_get_sset_count,
};
-EXPORT_SYMBOL_GPL(macb_ethtool_ops);
+EXPORT_SYMBOL_GPL(gem_ethtool_ops);
int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
@@ -2325,7 +2335,6 @@ static int __init macb_probe(struct platform_device *pdev)
dev->netdev_ops = &macb_netdev_ops;
netif_napi_add(dev, &bp->napi, macb_poll, 64);
- dev->ethtool_ops = &macb_ethtool_ops;
dev->base_addr = regs->start;
@@ -2339,12 +2348,14 @@ static int __init macb_probe(struct platform_device *pdev)
bp->macbgem_ops.mog_free_rx_buffers = gem_free_rx_buffers;
bp->macbgem_ops.mog_init_rings = gem_init_rings;
bp->macbgem_ops.mog_rx = gem_rx;
+ dev->ethtool_ops = &gem_ethtool_ops;
} else {
bp->max_tx_length = MACB_MAX_TX_LEN;
bp->macbgem_ops.mog_alloc_rx_buffers = macb_alloc_rx_buffers;
bp->macbgem_ops.mog_free_rx_buffers = macb_free_rx_buffers;
bp->macbgem_ops.mog_init_rings = macb_init_rings;
bp->macbgem_ops.mog_rx = macb_rx;
+ dev->ethtool_ops = &macb_ethtool_ops;
}
/* Set features */
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next] socket: use iov_length()
From: Al Viro @ 2015-01-15 21:45 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: netdev, davem
In-Reply-To: <1421230070-4104-1-git-send-email-nicolas.dichtel@6wind.com>
On Wed, Jan 14, 2015 at 11:07:50AM +0100, Nicolas Dichtel wrote:
> Better to use available helpers.
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> net/socket.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/socket.c b/net/socket.c
> index a2c33a4dc7ba..b1f3fa4da020 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -883,10 +883,8 @@ static ssize_t do_sock_read(struct msghdr *msg, struct kiocb *iocb,
> {
> struct socket *sock = file->private_data;
> size_t size = 0;
> - int i;
>
> - for (i = 0; i < nr_segs; i++)
> - size += iov[i].iov_len;
> + size = iov_length(iov, nr_segs);
What's wrong with size = iocb->ki_nbytes instead of calling anything?
^ permalink raw reply
* [PATCH net] net: rps: fix cpu unplug
From: Eric Dumazet @ 2015-01-15 21:46 UTC (permalink / raw)
To: subashab, Prasad Sodagudi; +Cc: netdev, Tom Herbert
In-Reply-To: <1421350095.11734.88.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <edumazet@google.com>
softnet_data.input_pkt_queue is protected by a spinlock that
we must hold when transferring packets from victim queue to an active
one. This is because other cpus could still be trying to enqueue packets
into victim queue.
Based on initial patch from Prasad Sodagudi & Subash Abhinov
Kasiviswanathan.
This version is better because we do not slow down packet processing,
only make migration safer.
Reported-by: Prasad Sodagudi <psodagud@codeaurora.org>
Reported-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
---
Could you test this fix instead of yours ? Thanks !
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 1e325adc43678084418ef9e1abb1fca8059ff599..76f72762b325cfa927a793af180189c51e9eaffd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7089,7 +7089,7 @@ static int dev_cpu_callback(struct notifier_block *nfb,
netif_rx_internal(skb);
input_queue_head_incr(oldsd);
}
- while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
+ while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) {
netif_rx_internal(skb);
input_queue_head_incr(oldsd);
}
^ permalink raw reply related
* [PATCH net-next v12 0/5] openvswitch: Introduce 128-bit unique flow identifiers.
From: Joe Stringer @ 2015-01-15 21:48 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA
This series extends the openvswitch datapath interface for flow commands to use
128-bit unique identifiers as an alternative to the netlink-formatted flow key.
This significantly reduces the cost of assembling messages between the kernel
and userspace, in particular improving Open vSwitch revalidation performance by
40% or more.
v12:
- Userspace patches fully merged into Open vSwitch master
- New minor refactor patches (2,3,4)
- Merge unmasked_key, ufid representation of flow identifier in sw_flow
- Improve memory allocation sizes when serializing ufid
- Handle corner case where a flow_new is requested with a flow that has an
identical ufid as an existing flow, but a different flow key
- Limit UFID to between 1-16 octets inclusive.
- Add various helper functions to improve readibility
v11:
- Pushed most of the prerequisite patches for this series to OVS master.
- Split out openvswitch.h interface changes from datapath implementation
- Datapath implementation to be reviewed on net-next, separately
v10:
- New patch allowing datapath to serialize masked keys
- Simplify datapath interface by accepting UFID or flow_key, but not both
- Flows set up with UFID must be queried/deleted using UFID
- Reduce sw_flow memory usage for UFID
- Don't periodically rehash UFID table in linux datapath
- Remove kernel_only UFID in linux datapath
v9:
- No kernel changes
v8:
- Rename UID -> UFID
- Fix null dereference in datapath when paired with older userspace
- All patches are reviewed/acked except datapath changes.
v7:
- Remove OVS_DP_F_INDEX_BY_UID
- Rework datapath UID serialization for variable length UIDs
v6:
- Reduce netlink conversions for all datapaths
- Various bugfixes
v5:
- Various bugfixes
- Improve logging
v4:
- Datapath memory leak fixes
- Enable UID-based terse dumping and deleting by default
- Various fixes
RFCv3:
- Add datapath implementation
Joe Stringer (5):
openvswitch: Refactor ovs_nla_fill_match().
openvswitch: Refactor ovs_flow_tbl_insert().
openvswitch: Use sw_flow_key_range for key ranges.
genetlink: Add genlmsg_parse() helper function.
openvswitch: Add support for unique flow IDs.
Documentation/networking/openvswitch.txt | 13 ++
include/net/genetlink.h | 17 +++
include/uapi/linux/openvswitch.h | 20 +++
net/openvswitch/datapath.c | 240 ++++++++++++++++++++----------
net/openvswitch/flow.h | 28 +++-
net/openvswitch/flow_netlink.c | 101 ++++++++++++-
net/openvswitch/flow_netlink.h | 14 +-
net/openvswitch/flow_table.c | 226 +++++++++++++++++++++-------
net/openvswitch/flow_table.h | 8 +-
9 files changed, 532 insertions(+), 135 deletions(-)
--
1.7.10.4
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply
* [PATCH net-next v12 1/5] openvswitch: Refactor ovs_nla_fill_match().
From: Joe Stringer @ 2015-01-15 21:48 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1421358507-5992-1-git-send-email-joestringer-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Refactor the ovs_nla_fill_match() function into separate netlink
serialization functions ovs_nla_put_{unmasked_key,mask}(). Modify
ovs_nla_put_flow() to handle attribute nesting and expose the 'is_mask'
parameter - all callers need to nest the flow, and callers have better
knowledge about whether it is serializing a mask or not.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
net/openvswitch/datapath.c | 41 ++++++----------------------------------
net/openvswitch/flow_netlink.c | 38 ++++++++++++++++++++++++++++++++++---
net/openvswitch/flow_netlink.h | 7 +++++--
3 files changed, 46 insertions(+), 40 deletions(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 8bda3cc..3ded349 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -461,10 +461,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
0, upcall_info->cmd);
upcall->dp_ifindex = dp_ifindex;
- nla = nla_nest_start(user_skb, OVS_PACKET_ATTR_KEY);
- err = ovs_nla_put_flow(key, key, user_skb);
+ err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb);
BUG_ON(err);
- nla_nest_end(user_skb, nla);
if (upcall_info->userdata)
__nla_put(user_skb, OVS_PACKET_ATTR_USERDATA,
@@ -676,37 +674,6 @@ static size_t ovs_flow_cmd_msg_size(const struct sw_flow_actions *acts)
}
/* Called with ovs_mutex or RCU read lock. */
-static int ovs_flow_cmd_fill_match(const struct sw_flow *flow,
- struct sk_buff *skb)
-{
- struct nlattr *nla;
- int err;
-
- /* Fill flow key. */
- nla = nla_nest_start(skb, OVS_FLOW_ATTR_KEY);
- if (!nla)
- return -EMSGSIZE;
-
- err = ovs_nla_put_flow(&flow->unmasked_key, &flow->unmasked_key, skb);
- if (err)
- return err;
-
- nla_nest_end(skb, nla);
-
- /* Fill flow mask. */
- nla = nla_nest_start(skb, OVS_FLOW_ATTR_MASK);
- if (!nla)
- return -EMSGSIZE;
-
- err = ovs_nla_put_flow(&flow->key, &flow->mask->key, skb);
- if (err)
- return err;
-
- nla_nest_end(skb, nla);
- return 0;
-}
-
-/* Called with ovs_mutex or RCU read lock. */
static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow,
struct sk_buff *skb)
{
@@ -787,7 +754,11 @@ static int ovs_flow_cmd_fill_info(const struct sw_flow *flow, int dp_ifindex,
ovs_header->dp_ifindex = dp_ifindex;
- err = ovs_flow_cmd_fill_match(flow, skb);
+ err = ovs_nla_put_unmasked_key(flow, skb);
+ if (err)
+ goto error;
+
+ err = ovs_nla_put_mask(flow, skb);
if (err)
goto error;
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index d210d1b..398f110 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -1216,12 +1216,12 @@ int ovs_nla_get_flow_metadata(const struct nlattr *attr,
return metadata_from_nlattrs(&match, &attrs, a, false, log);
}
-int ovs_nla_put_flow(const struct sw_flow_key *swkey,
- const struct sw_flow_key *output, struct sk_buff *skb)
+static int __ovs_nla_put_key(const struct sw_flow_key *swkey,
+ const struct sw_flow_key *output, bool is_mask,
+ struct sk_buff *skb)
{
struct ovs_key_ethernet *eth_key;
struct nlattr *nla, *encap;
- bool is_mask = (swkey != output);
if (nla_put_u32(skb, OVS_KEY_ATTR_RECIRC_ID, output->recirc_id))
goto nla_put_failure;
@@ -1431,6 +1431,38 @@ nla_put_failure:
return -EMSGSIZE;
}
+int ovs_nla_put_key(const struct sw_flow_key *swkey,
+ const struct sw_flow_key *output, int attr, bool is_mask,
+ struct sk_buff *skb)
+{
+ int err;
+ struct nlattr *nla;
+
+ nla = nla_nest_start(skb, attr);
+ if (!nla)
+ return -EMSGSIZE;
+ err = __ovs_nla_put_key(swkey, output, is_mask, skb);
+ if (err)
+ return err;
+ nla_nest_end(skb, nla);
+
+ return 0;
+}
+
+/* Called with ovs_mutex or RCU read lock. */
+int ovs_nla_put_unmasked_key(const struct sw_flow *flow, struct sk_buff *skb)
+{
+ return ovs_nla_put_key(&flow->unmasked_key, &flow->unmasked_key,
+ OVS_FLOW_ATTR_KEY, false, skb);
+}
+
+/* Called with ovs_mutex or RCU read lock. */
+int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb)
+{
+ return ovs_nla_put_key(&flow->key, &flow->mask->key,
+ OVS_FLOW_ATTR_MASK, true, skb);
+}
+
#define MAX_ACTIONS_BUFSIZE (32 * 1024)
static struct sw_flow_actions *nla_alloc_flow_actions(int size, bool log)
diff --git a/net/openvswitch/flow_netlink.h b/net/openvswitch/flow_netlink.h
index 577f12b..9ed09e6 100644
--- a/net/openvswitch/flow_netlink.h
+++ b/net/openvswitch/flow_netlink.h
@@ -43,11 +43,14 @@ size_t ovs_key_attr_size(void);
void ovs_match_init(struct sw_flow_match *match,
struct sw_flow_key *key, struct sw_flow_mask *mask);
-int ovs_nla_put_flow(const struct sw_flow_key *,
- const struct sw_flow_key *, struct sk_buff *);
+int ovs_nla_put_key(const struct sw_flow_key *, const struct sw_flow_key *,
+ int attr, bool is_mask, struct sk_buff *);
int ovs_nla_get_flow_metadata(const struct nlattr *, struct sw_flow_key *,
bool log);
+int ovs_nla_put_unmasked_key(const struct sw_flow *flow, struct sk_buff *skb);
+int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb);
+
int ovs_nla_get_match(struct sw_flow_match *, const struct nlattr *key,
const struct nlattr *mask, bool log);
int ovs_nla_put_egress_tunnel_key(struct sk_buff *,
--
1.7.10.4
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply related
* [PATCH net-next v12 2/5] openvswitch: Refactor ovs_flow_tbl_insert().
From: Joe Stringer @ 2015-01-15 21:48 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: dev-yBygre7rU0TnMu66kgdUjQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1421358507-5992-1-git-send-email-joestringer-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Rework so that ovs_flow_tbl_insert() calls flow_{key,mask}_insert().
This tidies up a future patch.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
net/openvswitch/flow_table.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index 5899bf1..81b977d 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -585,16 +585,10 @@ static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow,
}
/* Must be called with OVS mutex held. */
-int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
- const struct sw_flow_mask *mask)
+static void flow_key_insert(struct flow_table *table, struct sw_flow *flow)
{
struct table_instance *new_ti = NULL;
struct table_instance *ti;
- int err;
-
- err = flow_mask_insert(table, flow, mask);
- if (err)
- return err;
flow->hash = flow_hash(&flow->key, flow->mask->range.start,
flow->mask->range.end);
@@ -613,6 +607,19 @@ int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
table_instance_destroy(ti, true);
table->last_rehash = jiffies;
}
+}
+
+/* Must be called with OVS mutex held. */
+int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow,
+ const struct sw_flow_mask *mask)
+{
+ int err;
+
+ err = flow_mask_insert(table, flow, mask);
+ if (err)
+ return err;
+ flow_key_insert(table, flow);
+
return 0;
}
--
1.7.10.4
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox