* Re: Modular arithmetic
From: David Laight @ 2012-09-10 10:41 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Jay Schulist, Andi Kleen, tcpdump-workers
In-Reply-To: <1347269124.1234.1326.camel@edumazet-glaptop>
> > What about the other OS - eg all the BSDs?
> > I had a vague idea that BPF was supposed to be reasonable portable.
>
> Yes, does it mean BPF is frozen ?
>
> Or is BSD so hard to update these days ?
Not really - but it some other places that need updating in order
to make this useful for cross-platform tools (like tcpdump).
The 'real fun (tm)' happens when NetBSD tries to run Linux binaries
that include the Linux libpcap.
David
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
^ permalink raw reply
* Re: kernel 3.5.2/amd64: iwlwifi 0000:03:00.0: failed to allocate pci memory
From: Johannes Berg @ 2012-09-10 10:24 UTC (permalink / raw)
To: Marc MERLIN
Cc: wey-yi.w.guy-ral2JQCrhuEAvxtiuMwx3w, ilw-VuQAYsv1563Yd54FQh9/CA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-q7rQbLoQdy39qxiX1TGQuw
In-Reply-To: <1347130641.11167.0.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
On Sat, 2012-09-08 at 20:57 +0200, Johannes Berg wrote:
> > [856806.497959] [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
> > [856806.497963] [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
> > [856806.497969] [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
> > [856806.497976] [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
> > [856806.497979] [<ffffffff810cecca>] __get_free_pages+0x9/0x45
> > [856806.497982] [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
> > [856806.497986] [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
> > [856806.497999] [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]
>
> Yes, unfortunately we need a whole bunch of contiguous memory to load
> the firmware.
>
> > Any ideas?
>
> Nothing we can do from the driver side, I'm afraid.
Turns out I was wrong. Here's a patch you can test. Note that we still
need a lot of DMA-coherent memory for other things, but at least for the
firmware image we don't.
http://p.sipsolutions.net/11ea33b376a5bac5.txt
johannes
--
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 -next v1] wireless: ath9k-htc: only load firmware in need
From: Mohammed Shafi @ 2012-09-10 10:23 UTC (permalink / raw)
To: Ming Lei
Cc: linux-wireless, netdev, ath9k-devel, Luis R. Rodriguez,
Jouni Malinen, Vasanthakumar Thiagarajan, Senthil Balasubramanian,
John W. Linville
In-Reply-To: <CACVXFVPX1NB5uJ6yXkNbDWoX4OVdYfRU_=tsWC529-tH+3WfDA@mail.gmail.com>
Hi,
On Sat, Sep 1, 2012 at 10:41 AM, Ming Lei <ming.lei@canonical.com> wrote:
> On Tue, Aug 21, 2012 at 4:04 PM, Ming Lei <ming.lei@canonical.com> wrote:
>> It is not necessary to hold the firmware memory during the whole
>> driver lifetime, and obviously it does waste memory. Suppose there
>> are 4 ath9k-htc usb dongles working, kernel has to consume about
>> 4*50KBytes RAM to cache firmware for all dongles. After applying the
>> patch, kernel only caches one single firmware image in RAM for
>> all ath9k-htc devices just during system suspend/resume cycle.
>>
>> When system is ready for loading firmware, ath9k-htc can request
>> the loading from usersapce. During system resume, ath9k-htc still
>> can load the firmware which was cached in kernel memory before
>> system suspend.
>>
>> Cc: ath9k-devel@lists.ath9k.org
>> Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
>> Cc: Jouni Malinen <jouni@qca.qualcomm.com>
>> Cc: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
>> Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
>> Cc: "John W. Linville" <linville@tuxdriver.com>
>> Signed-off-by: Ming Lei <ming.lei@canonical.com>
>> ---
>> v1:
>> fix double free of firmware in failue path of
>> ath9k_hif_usb_firmware_cb
>
> Gentle ping, :-)
this patch is now in wireless-testing :-)
>
>
> Thanks,
> --
> Ming Lei
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
thanks,
shafi
^ permalink raw reply
* hi!:) I am Dannielle:)
From: Dannielle Kearney @ 2012-09-10 10:15 UTC (permalink / raw)
To: latinboy12345@yahoo.com
My name is Dannielle by the way.
It's exciting, isn't it?))))
^ permalink raw reply
* Re: Failure to send fragmented IP packet in case of missing ARP entry
From: Eric Dumazet @ 2012-09-10 9:53 UTC (permalink / raw)
To: Andrei Dolnikov; +Cc: netdev
In-Reply-To: <1347270171.1234.1353.camel@edumazet-glaptop>
On Mon, 2012-09-10 at 11:42 +0200, Eric Dumazet wrote:
> On Mon, 2012-09-10 at 12:59 +0400, Andrei Dolnikov wrote:
> > Hello all,
> >
> > The following issue is observed on most Linux distributions:
> > Transmission of fragmented IP packets in case of missing ARP entry for
> > destination IP fails.
> > Actually ARP request is sent, and, once ARP response is received, only
> > few queued fragments are transmitted. Remaining fragments are lost.
> > It can be easily reproduced as follows:
> > # arp -d <dst IP>
> > # ping -s 65000 -c 1 <dst IP>
> > Ping result is: "1 packets transmitted, 0 received, 100% packet loss,
> > time 0ms".
> >
> > The latest kernel version I tried was 3.5.0-1 x86_64, but I also was
> > able to reproduce it with 3.2.x, 3.0.x and 2.6.32.
> > It doesn't depend on hardware: was able to reproduce with VMWare Player,
> > Intel based laptop, Intel Atom and ARM based custom boards.
> > As I'm not a networking standards expert I'm not sure if it's a real bug
> > or acceptable behaviour, but decided to raise the issue here as I can't
> > reproduce this anomaly with the Windows 7 PC.
> >
> > Thanks,
> > Andrei.
> > --
>
> Its a bit better with linux-3.3, with commit
> 8b5c171bb3dc0686b2647a84e990199c5faa9ef8
> (neigh: new unresolved queue limits)
>
> +neigh/default/unres_qlen_bytes - INTEGER
> + The maximum number of bytes which may be used by packets
> + queued for each unresolved address by other network layers.
> + (added in linux 3.3)
> +
> +neigh/default/unres_qlen - INTEGER
> + The maximum number of packets which may be queued for each
> + unresolved address by other network layers.
> + (deprecated in linux 3.3) : use unres_qlen_bytes instead.
>
>
> Problem is : unres_qlen_bytes default value is 65536, so its a bit too
> small once you take into account truesize overhead
>
> I guess following patch would be needed :
>
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 4780045..3395bb6 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -171,7 +171,7 @@ struct neigh_table arp_tbl = {
> .gc_staletime = 60 * HZ,
> .reachable_time = 30 * HZ,
> .delay_probe_time = 5 * HZ,
> - .queue_len_bytes = 64*1024,
> + .queue_len_bytes = 64 * SKB_TRUESIZE(1024),
> .ucast_probes = 3,
> .mcast_probes = 3,
> .anycast_delay = 1 * HZ,
In the mean time, you can also do
echo 50 >/proc/sys/net/ipv4/neigh/eth0/unres_qlen
(change eth0 by the name of your interface)
^ permalink raw reply
* Re: net/ipv4/route.c:645 suspicious rcu_dereference_check() usage!
From: Eric Dumazet @ 2012-09-10 9:46 UTC (permalink / raw)
To: chris; +Cc: netdev, linux-kernel
In-Reply-To: <84c8a8$5m6f27@orsmga001.jf.intel.com>
On Mon, 2012-09-10 at 09:44 +0100, chris@chris-wilson.co.uk wrote:
> I've not seen this reported yet, so here's a warning that happens
> occasionally:
>
> [192979.475833]
> [192979.475840] ===============================
> [192979.475841] [ INFO: suspicious RCU usage. ]
> [192979.475844] 3.6.0-rc2+ #33 Not tainted
> [192979.475846] -------------------------------
> [192979.475848] net/ipv4/route.c:645 suspicious rcu_dereference_check() usage!
> [192979.475850]
> [192979.475850] other info that might help us debug this:
> [192979.475850]
> [192979.475853]
> [192979.475853] rcu_scheduler_active = 1, debug_locks = 0
> [192979.475856] 2 locks held by firefox-bin/4634:
> [192979.475858] #0: (slock-AF_INET){+.-...}, at: [<ffffffff814261b4>] release_sock+0x34/0x1e0
> [192979.475870] #1: (fnhe_lock){+.-...}, at: [<ffffffff81461c94>] update_or_create_fnhe.isra.30+0x44/0x480
> [192979.475878]
> [192979.475878] stack backtrace:
> [192979.475881] Pid: 4634, comm: firefox-bin Not tainted 3.6.0-rc2+ #33
> [192979.475883] Call Trace:
> [192979.475891] [<ffffffff810903cd>] lockdep_rcu_suspicious+0xfd/0x130
> [192979.475895] [<ffffffff81461e8e>] update_or_create_fnhe.isra.30+0x23e/0x480
> [192979.475899] [<ffffffff814624ba>] __ip_rt_update_pmtu.isra.31+0x6a/0xb0
> [192979.475903] [<ffffffff81465038>] ip_rt_update_pmtu+0x48/0xd0
> [192979.475907] [<ffffffff814759b1>] inet_csk_update_pmtu+0x31/0x80
> [192979.475912] [<ffffffff8148b663>] tcp_v4_mtu_reduced+0x33/0xd0
> [192979.475915] [<ffffffff814888be>] tcp_release_cb+0x5e/0xb0
> [192979.475919] [<ffffffff81426289>] release_sock+0x109/0x1e0
> [192979.475922] [<ffffffff81479037>] tcp_sendmsg+0x527/0x1030
> [192979.475927] [<ffffffff814a4d9d>] inet_sendmsg+0xed/0x240
> [192979.475931] [<ffffffff814a4cb0>] ? inet_autobind+0x70/0x70
> [192979.475934] [<ffffffff81424e8a>] ? sock_update_classid+0xaa/0x370
> [192979.475937] [<ffffffff81424eb8>] ? sock_update_classid+0xd8/0x370
> [192979.475941] [<ffffffff8141ee1b>] sock_sendmsg+0xab/0xe0
> [192979.475946] [<ffffffff814222be>] sys_sendto+0x11e/0x160
> [192979.475951] [<ffffffff8153e547>] ? sysret_check+0x1b/0x56
> [192979.475956] [<ffffffff8125849e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
> [192979.475960] [<ffffffff8153e522>] system_call_fastpath+0x16/0x1b
>
Probably already fixed in commit c5ae7d41927d (ipv4: must use rcu
protection while calling fib_lookup)
3.6.0-rc2 is quite old for a dev kernel ;)
Thanks
^ permalink raw reply
* Re: Failure to send fragmented IP packet in case of missing ARP entry
From: Eric Dumazet @ 2012-09-10 9:42 UTC (permalink / raw)
To: Andrei Dolnikov; +Cc: netdev
In-Reply-To: <504DAC02.8040808@cogentembedded.com>
On Mon, 2012-09-10 at 12:59 +0400, Andrei Dolnikov wrote:
> Hello all,
>
> The following issue is observed on most Linux distributions:
> Transmission of fragmented IP packets in case of missing ARP entry for
> destination IP fails.
> Actually ARP request is sent, and, once ARP response is received, only
> few queued fragments are transmitted. Remaining fragments are lost.
> It can be easily reproduced as follows:
> # arp -d <dst IP>
> # ping -s 65000 -c 1 <dst IP>
> Ping result is: "1 packets transmitted, 0 received, 100% packet loss,
> time 0ms".
>
> The latest kernel version I tried was 3.5.0-1 x86_64, but I also was
> able to reproduce it with 3.2.x, 3.0.x and 2.6.32.
> It doesn't depend on hardware: was able to reproduce with VMWare Player,
> Intel based laptop, Intel Atom and ARM based custom boards.
> As I'm not a networking standards expert I'm not sure if it's a real bug
> or acceptable behaviour, but decided to raise the issue here as I can't
> reproduce this anomaly with the Windows 7 PC.
>
> Thanks,
> Andrei.
> --
Its a bit better with linux-3.3, with commit
8b5c171bb3dc0686b2647a84e990199c5faa9ef8
(neigh: new unresolved queue limits)
+neigh/default/unres_qlen_bytes - INTEGER
+ The maximum number of bytes which may be used by packets
+ queued for each unresolved address by other network layers.
+ (added in linux 3.3)
+
+neigh/default/unres_qlen - INTEGER
+ The maximum number of packets which may be queued for each
+ unresolved address by other network layers.
+ (deprecated in linux 3.3) : use unres_qlen_bytes instead.
Problem is : unres_qlen_bytes default value is 65536, so its a bit too
small once you take into account truesize overhead
I guess following patch would be needed :
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 4780045..3395bb6 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -171,7 +171,7 @@ struct neigh_table arp_tbl = {
.gc_staletime = 60 * HZ,
.reachable_time = 30 * HZ,
.delay_probe_time = 5 * HZ,
- .queue_len_bytes = 64*1024,
+ .queue_len_bytes = 64 * SKB_TRUESIZE(1024),
.ucast_probes = 3,
.mcast_probes = 3,
.anycast_delay = 1 * HZ,
^ permalink raw reply related
* Re: [PATCH net] ixp4xx_hss: fix build failure after logging conversion
From: Florian Fainelli @ 2012-09-10 9:35 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev, khc, David Miller, stable
In-Reply-To: <1347267855.6069.2.camel@joe2Laptop>
On Monday 10 September 2012 02:04:15 Joe Perches wrote:
> On Mon, 2012-09-10 at 10:43 +0200, Florian Fainelli wrote:
> > Commit c75bb2c6f0cf455c23e60f14d780e841dd47f801 (ixp4xx_hss: Update to
> > current logging forms) converted the ixp4xx_hss module to use the current
> > logging macros, but forgot to include linux/module.h, leading to the
> > following build failures:
>
> Bad explanation.
> This commit had nothing to do with any missing module.h.
You are right, this issue dates back from day one when this driver got merged,
I will repost a v2 with the proper commit.
--
Florian
^ permalink raw reply
* Re: [PATCH] net, cgroup: Fix boot failure due to iteration of uninitialized list
From: Srivatsa S. Bhat @ 2012-09-10 9:29 UTC (permalink / raw)
To: Neil Horman
Cc: Gao feng, eric.dumazet, davem, linux-kernel, netdev,
mark.d.rustad, john.r.fastabend, lizefan
In-Reply-To: <20120723114057.GA16518@hmsreliant.think-freely.org>
On 07/23/2012 05:10 PM, Neil Horman wrote:
> On Mon, Jul 23, 2012 at 09:15:05AM +0800, Gao feng wrote:
>> 于 2012年07月20日 00:27, Srivatsa S. Bhat 写道:
>>> After commit ef209f15 (net: cgroup: fix access the unallocated memory in
>>> netprio cgroup), boot fails with the following NULL pointer dereference:
>>>
[...]
>>> Call Trace:
>>> [<ffffffff81b1cb78>] cgroup_init_subsys+0x83/0x169
>>> [<ffffffff81b1ce13>] cgroup_init+0x36/0x119
>>> [<ffffffff81affef7>] start_kernel+0x3ba/0x3ef
>>> [<ffffffff81aff95b>] ? kernel_init+0x27b/0x27b
>>> [<ffffffff81aff356>] x86_64_start_reservations+0x131/0x136
>>> [<ffffffff81aff45e>] x86_64_start_kernel+0x103/0x112
>>> RIP [<ffffffff8145e8d6>] cgrp_create+0xf6/0x190
>>> RSP <ffffffff81a01ea8>
>>> CR2: 0000000000000698
>>> ---[ end trace a7919e7f17c0a725 ]---
>>> Kernel panic - not syncing: Attempted to kill the idle task!
>>>
>>> The code corresponds to:
>>>
>>> update_netdev_tables():
>>> for_each_netdev(&init_net, dev) {
>>> map = rtnl_dereference(dev->priomap); <---- HERE
>>>
>>>
>>> The list head is initialized in netdev_init(), which is called much
>>> later than cgrp_create(). So the problem is that we are calling
>>> update_netdev_tables() way too early (in cgrp_create()), which will
>>> end up traversing the not-yet-circular linked list. So at some point,
>>> the dev pointer will become NULL and hence dev->priomap becomes an
>>> invalid access.
>>>
>>> To fix this, just remove the update_netdev_tables() function entirely,
>>> since it appears that write_update_netdev_table() will handle things
>>> just fine.
>>
>> The reason I add update_netdev_tables in cgrp_create is to avoid additional
>> bound checkings when we accessing the dev->priomap.priomap.
>>
>> Eric,can we revert this commit 91c68ce2b26319248a32d7baa1226f819d283758 now?
>> I think it's safe enough to access priomap without bound check.
>>
>
> I think its probably safe, yes, but lets leave it there for just a bit. Its not
> hurting anything, and I'd like to look into getting Srivatsa' patch in first.
Hi Neil,
Did you get around to look into this again?
Regards,
Srivatsa S. Bhat
^ permalink raw reply
* RE: [tcpdump-workers] Modular arithmetic
From: Eric Dumazet @ 2012-09-10 9:25 UTC (permalink / raw)
To: David Laight
Cc: Andi Kleen, George Bakos, tcpdump-workers, Jay Schulist, netdev
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6FE4@saturn3.aculab.com>
On Mon, 2012-09-10 at 09:41 +0100, David Laight wrote:
> > On Fri, Sep 07, 2012 at 07:49:10AM +0000, George Bakos wrote:
> > > Gents,
> > > Any fundamental reason why the following (, etc.) shouldn't be
> > > included in net/core/filter.c?
> > >
> > > case BPF_S_ALU_MOD_X:
> > > if (X == 0)
> > > return 0;
> > > A %= X;
> > > continue;
> >
> > Copying netdev.
> >
> > In principle no reason against it, but you may need to update
> > the various BPF JITs too that Linux now has too.
>
> What about the other OS - eg all the BSDs?
> I had a vague idea that BPF was supposed to be reasonable portable.
Yes, does it mean BPF is frozen ?
Or is BSD so hard to update these days ?
modulus can be implemented using fallback to div and sub, I am not sure
libpcap should sense kernel support or not.
George, make sure libpcap optimizer correctly replaces MOD X by AND (X
- 1) if X is a power of two.
^ permalink raw reply
* Re: ndo_get_stats and rtnl_netlink
From: Eric Dumazet @ 2012-09-10 9:09 UTC (permalink / raw)
To: Shlomo Pongartz; +Cc: netdev
In-Reply-To: <504CB464.6010207@mellanox.com>
On Sun, 2012-09-09 at 18:23 +0300, Shlomo Pongartz wrote:
> Hi,
>
> Just realized that dev_get_stats which calls into a netdevice
> ndo_get_stats64/ndo_get_stats can be
> called with or without RTNL lock protection. If called from
> rtnl_fill_ifinfo e.g as of invocation of
> "ip link show <interface>, there IS locking, however if called from
> dev_seq_printf_stats e.g as of
> invocation of reading the /sys/class/net/<interface>/statistics/
> entries, etc more cases -- no locking.
>
> This turned to be problematic when implementing the ethtool
> "set_channels" directive which
> changes the number of **rings**, since we stepped on a bug where the
> rings data structure was
> changed by the ethtool flow in the same time a statistics call was done
> into the driver, etc.
>
> What would be the way to continue here, per driver lock sounds non
> generic...
RTNL locking is not needed to fetch stats, and would be overkill.
Each driver has its own way to protect/gather its stats.
^ permalink raw reply
* Re: [PATCH net] ixp4xx_hss: fix build failure after logging conversion
From: Joe Perches @ 2012-09-10 9:04 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, khc, David Miller, stable
In-Reply-To: <1347266590-884-1-git-send-email-florian@openwrt.org>
On Mon, 2012-09-10 at 10:43 +0200, Florian Fainelli wrote:
> Commit c75bb2c6f0cf455c23e60f14d780e841dd47f801 (ixp4xx_hss: Update to
> current logging forms) converted the ixp4xx_hss module to use the current
> logging macros, but forgot to include linux/module.h, leading to the
> following build failures:
Bad explanation.
This commit had nothing to do with any missing module.h.
^ permalink raw reply
* Failure to send fragmented IP packet in case of missing ARP entry
From: Andrei Dolnikov @ 2012-09-10 8:59 UTC (permalink / raw)
To: netdev
Hello all,
The following issue is observed on most Linux distributions:
Transmission of fragmented IP packets in case of missing ARP entry for
destination IP fails.
Actually ARP request is sent, and, once ARP response is received, only
few queued fragments are transmitted. Remaining fragments are lost.
It can be easily reproduced as follows:
# arp -d <dst IP>
# ping -s 65000 -c 1 <dst IP>
Ping result is: "1 packets transmitted, 0 received, 100% packet loss,
time 0ms".
The latest kernel version I tried was 3.5.0-1 x86_64, but I also was
able to reproduce it with 3.2.x, 3.0.x and 2.6.32.
It doesn't depend on hardware: was able to reproduce with VMWare Player,
Intel based laptop, Intel Atom and ARM based custom boards.
As I'm not a networking standards expert I'm not sure if it's a real bug
or acceptable behaviour, but decided to raise the issue here as I can't
reproduce this anomaly with the Windows 7 PC.
Thanks,
Andrei.
^ permalink raw reply
* [PATCH net] ixp4xx_hss: fix build failure after logging conversion
From: Florian Fainelli @ 2012-09-10 8:43 UTC (permalink / raw)
To: netdev; +Cc: khc, joe, David Miller, Florian Fainelli, stable
Commit c75bb2c6f0cf455c23e60f14d780e841dd47f801 (ixp4xx_hss: Update to
current logging forms) converted the ixp4xx_hss module to use the current
logging macros, but forgot to include linux/module.h, leading to the
following build failures:
CC [M] drivers/net/wan/ixp4xx_hss.o
drivers/net/wan/ixp4xx_hss.c:1412:20: error: expected ';', ',' or ')'
before string constant
drivers/net/wan/ixp4xx_hss.c:1413:25: error: expected ';', ',' or ')'
before string constant
drivers/net/wan/ixp4xx_hss.c:1414:21: error: expected ';', ',' or ')'
before string constant
drivers/net/wan/ixp4xx_hss.c:1415:19: error: expected ';', ',' or ')'
before string constant
make[8]: *** [drivers/net/wan/ixp4xx_hss.o] Error 1
CC: stable@vger.kernel.org
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
[stable: 3.1+]
drivers/net/wan/ixp4xx_hss.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index aaaca9a..3f575af 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -10,6 +10,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/cdev.h>
#include <linux/dma-mapping.h>
--
1.7.9.5
^ permalink raw reply related
* RE: [tcpdump-workers] Modular arithmetic
From: David Laight @ 2012-09-10 8:41 UTC (permalink / raw)
To: Andi Kleen, George Bakos, tcpdump-workers; +Cc: Jay Schulist, netdev
In-Reply-To: <20120908030311.GM17289@tassilo.jf.intel.com>
> On Fri, Sep 07, 2012 at 07:49:10AM +0000, George Bakos wrote:
> > Gents,
> > Any fundamental reason why the following (, etc.) shouldn't be
> > included in net/core/filter.c?
> >
> > case BPF_S_ALU_MOD_X:
> > if (X == 0)
> > return 0;
> > A %= X;
> > continue;
>
> Copying netdev.
>
> In principle no reason against it, but you may need to update
> the various BPF JITs too that Linux now has too.
What about the other OS - eg all the BSDs?
I had a vague idea that BPF was supposed to be reasonable portable.
David (dsl@netbsd.org)
^ permalink raw reply
* net/ipv4/route.c:645 suspicious rcu_dereference_check() usage!
From: chris @ 2012-09-10 8:44 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
I've not seen this reported yet, so here's a warning that happens
occasionally:
[192979.475833]
[192979.475840] ===============================
[192979.475841] [ INFO: suspicious RCU usage. ]
[192979.475844] 3.6.0-rc2+ #33 Not tainted
[192979.475846] -------------------------------
[192979.475848] net/ipv4/route.c:645 suspicious rcu_dereference_check() usage!
[192979.475850]
[192979.475850] other info that might help us debug this:
[192979.475850]
[192979.475853]
[192979.475853] rcu_scheduler_active = 1, debug_locks = 0
[192979.475856] 2 locks held by firefox-bin/4634:
[192979.475858] #0: (slock-AF_INET){+.-...}, at: [<ffffffff814261b4>] release_sock+0x34/0x1e0
[192979.475870] #1: (fnhe_lock){+.-...}, at: [<ffffffff81461c94>] update_or_create_fnhe.isra.30+0x44/0x480
[192979.475878]
[192979.475878] stack backtrace:
[192979.475881] Pid: 4634, comm: firefox-bin Not tainted 3.6.0-rc2+ #33
[192979.475883] Call Trace:
[192979.475891] [<ffffffff810903cd>] lockdep_rcu_suspicious+0xfd/0x130
[192979.475895] [<ffffffff81461e8e>] update_or_create_fnhe.isra.30+0x23e/0x480
[192979.475899] [<ffffffff814624ba>] __ip_rt_update_pmtu.isra.31+0x6a/0xb0
[192979.475903] [<ffffffff81465038>] ip_rt_update_pmtu+0x48/0xd0
[192979.475907] [<ffffffff814759b1>] inet_csk_update_pmtu+0x31/0x80
[192979.475912] [<ffffffff8148b663>] tcp_v4_mtu_reduced+0x33/0xd0
[192979.475915] [<ffffffff814888be>] tcp_release_cb+0x5e/0xb0
[192979.475919] [<ffffffff81426289>] release_sock+0x109/0x1e0
[192979.475922] [<ffffffff81479037>] tcp_sendmsg+0x527/0x1030
[192979.475927] [<ffffffff814a4d9d>] inet_sendmsg+0xed/0x240
[192979.475931] [<ffffffff814a4cb0>] ? inet_autobind+0x70/0x70
[192979.475934] [<ffffffff81424e8a>] ? sock_update_classid+0xaa/0x370
[192979.475937] [<ffffffff81424eb8>] ? sock_update_classid+0xd8/0x370
[192979.475941] [<ffffffff8141ee1b>] sock_sendmsg+0xab/0xe0
[192979.475946] [<ffffffff814222be>] sys_sendto+0x11e/0x160
[192979.475951] [<ffffffff8153e547>] ? sysret_check+0x1b/0x56
[192979.475956] [<ffffffff8125849e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[192979.475960] [<ffffffff8153e522>] system_call_fastpath+0x16/0x1b
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply
* Re: Regression associated with commit c8628155ece3 - "tcp: reduce out_of_order memory use"
From: Eric Dumazet @ 2012-09-10 8:39 UTC (permalink / raw)
To: Larry Finger
Cc: linville-2XuSBdqkA4R54TAoqtyWWQ,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev
In-Reply-To: <503BB49C.5010402-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
On Mon, 2012-08-27 at 12:55 -0500, Larry Finger wrote:
> I have prepared a patch to fix all the unchecked allocations.
>
> Over the weekend I made some progress. To test the latest vendor driver, I
> installed a 32-bit system. Their driver is not compatible with a 64-bit system.
> I found that not only did the vendor driver work with secure sites, but so did
> the in-kernel version. I now have tcpdump output for the 32-bit case that works,
> and the 64-bit case that fails. It seems likely that I missed some 32/64 bit
> incompatibility when I did the conversion.
>
> Thanks for all your help in trying to resolve this issue.
>
> Larry
>
>
Hi Larry
It appears I have a D-Link N300 (DWA-131) nano USB adapter, using
staging/rtl8712 driver.
I tried many kernel versions (including 3.3) and none seems to work
reliably.
Sometime, I have some traffic but only for about 50 frames...
It might be because my access point is a netgear wndr3800, because I
have following warning a bit before the freezes :
r8712u: [r8712_got_addbareq_event_callback] mac = 20:4e:7f:5a:cd:30, sea = 80, tid = 0
Thanks
--
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: Who maintains and handles patches for drivers/net/phy/ ?
From: David Miller @ 2012-09-10 8:02 UTC (permalink / raw)
To: christophe.leroy; +Cc: netdev
In-Reply-To: <504D94AB.7070404@c-s.fr>
From: leroy christophe <christophe.leroy@c-s.fr>
Date: Mon, 10 Sep 2012 09:20:11 +0200
> The MAINTAINER file doesn't include any maintainer for
> drivers/net/phy/
> Section NETWORKING DRIVERS doesn't refer to anyone.
>
> I have a patch for the Intel LXT phy driver. I submitted it to the
> list a few weeks ago but didn't get any feedback at all.
> Who shall I contact to get my patch taken into account ?
Your comments were not formatted correctly so I tossed your patch
from the queue. FOrmat comments:
/* Like
* this.
*/
not:
/* Like
* this. */
and not:
/* Like
this. */
Thanks.
^ permalink raw reply
* Re: netlink: hide struct module parameter in netlink_kernel_create
From: Pablo Neira Ayuso @ 2012-09-10 7:45 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: David S. Miller, netdev
In-Reply-To: <20120910093712.18e5718b605f84aa4e76f7d9@canb.auug.org.au>
On Mon, Sep 10, 2012 at 09:37:12AM +1000, Stephen Rothwell wrote:
> Hi all,
>
> I didn't see the original patch until it reached linux-enxt this morning,
> but just a comment:
>
> THIS_MODULE is defined in linux/export.h, so that should be included in
> linux/netlink.h instead of linux/module.h as it is much smaller.
I'll send a follow-up patch for this to David, thanks Stephen.
^ permalink raw reply
* [net-next.git 7/8] stmmac: update the doc with new IRQ mitigation
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
In-Reply-To: <1347262689-21251-1-git-send-email-peppe.cavallaro@st.com>
This patch updates the stmmac.txt adding some information
about the new rx/tx mitigation schema adopted in the driver.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
Documentation/networking/stmmac.txt | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/Documentation/networking/stmmac.txt b/Documentation/networking/stmmac.txt
index ef9ee71..f9fa6db 100644
--- a/Documentation/networking/stmmac.txt
+++ b/Documentation/networking/stmmac.txt
@@ -29,11 +29,9 @@ The kernel configuration option is STMMAC_ETH:
dma_txsize: DMA tx ring size;
buf_sz: DMA buffer size;
tc: control the HW FIFO threshold;
- tx_coe: Enable/Disable Tx Checksum Offload engine;
watchdog: transmit timeout (in milliseconds);
flow_ctrl: Flow control ability [on/off];
pause: Flow Control Pause Time;
- tmrate: timer period (only if timer optimisation is configured).
3) Command line options
Driver parameters can be also passed in command line by using:
@@ -60,17 +58,19 @@ Then the poll method will be scheduled at some future point.
The incoming packets are stored, by the DMA, in a list of pre-allocated socket
buffers in order to avoid the memcpy (Zero-copy).
-4.3) Timer-Driver Interrupt
-Instead of having the device that asynchronously notifies the frame receptions,
-the driver configures a timer to generate an interrupt at regular intervals.
-Based on the granularity of the timer, the frames that are received by the
-device will experience different levels of latency. Some NICs have dedicated
-timer device to perform this task. STMMAC can use either the RTC device or the
-TMU channel 2 on STLinux platforms.
-The timers frequency can be passed to the driver as parameter; when change it,
-take care of both hardware capability and network stability/performance impact.
-Several performance tests on STM platforms showed this optimisation allows to
-spare the CPU while having the maximum throughput.
+4.3) Interrupt Mitigation
+The driver is able to mitigate the number of its DMA interrupts
+using NAPI for the reception on chips older than the 3.50.
+New chips have an HW RX-Watchdog used for this mitigation.
+
+On Tx-side, the mitigation schema is based on a SW timer that calls the
+tx function (stmmac_tx) to reclaim the resource after transmitting the
+frames.
+Also there is another parameter (like a threshold) used to program
+the descriptors avoiding to set the interrupt on completion bit in
+when the frame is sent (xmit).
+
+Mitigation parameters can be tuned by ethtool.
4.4) WOL
Wake up on Lan feature through Magic and Unicast frames are supported for the
@@ -121,6 +121,7 @@ struct plat_stmmacenet_data {
int bugged_jumbo;
int pmt;
int force_sf_dma_mode;
+ int riwt_off;
void (*fix_mac_speed)(void *priv, unsigned int speed);
void (*bus_setup)(void __iomem *ioaddr);
int (*init)(struct platform_device *pdev);
@@ -156,6 +157,7 @@ Where:
o pmt: core has the embedded power module (optional).
o force_sf_dma_mode: force DMA to use the Store and Forward mode
instead of the Threshold.
+ o riwt_off: force to disable the RX watchdog feature and switch to NAPI mode.
o fix_mac_speed: this callback is used for modifying some syscfg registers
(on ST SoCs) according to the link speed negotiated by the
physical layer .
--
1.7.4.4
^ permalink raw reply related
* [net-next.git 8/8] stmmac: update the driver version to Sept_2012
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
In-Reply-To: <1347262689-21251-1-git-send-email-peppe.cavallaro@st.com>
Many new feauture have been introduced in the driver:
sysFS, Rx HW watchdog... so this patch updates the
driver's version.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index ad4f6b9..38662e1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -24,7 +24,7 @@
#define __STMMAC_H__
#define STMMAC_RESOURCE_NAME "stmmaceth"
-#define DRV_MODULE_VERSION "March_2012"
+#define DRV_MODULE_VERSION "Sept_2012"
#include <linux/clk.h>
#include <linux/stmmac.h>
--
1.7.4.4
^ permalink raw reply related
* [net-next.git 0/8 (V3)] stmmac: remove dead code for STMMAC_TIMER and add new mitigation schema
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
These patch series remove the STMMAC_TIMER option no longer updated
and never used and add a new mitigation schema.
Having removed the Timer opt, this has made the driver slim.
On top of this work, it has been easier to introduce the new
mitigation schema based on HW RX-watchdog (available in new cores).
In fact, 3.50 and newer cores have an HW RX-Watchdog that can be used for
mitigating the Rx-interrupts and first results look promising.
Running n-u-t-t-c-p with the following parameters:
Throughput: 500Mbps
UDP Buffer size: 1328bytes
TCP Buffer size: 65536bytes
for example, I got on ST box (arm-based) these improvements:
--------------------------------------------------------------------
Original | With New Mitigation patch
--------------------------------------------------------------------
Test CPU usage pkt/loss | CPU usage pkt/loss
Type Mbps % % |Mbps % %
--------------------------------------------------------------------
UDP-RX 395.5065 95 20.89 |499.9552 23 0.00
UDP-TX 499.5578 100 0.08915 |500.0152 100 0.00
TCP-RX 499.9221 77 |499.9217 27
TCP-TX 389.5719 99 |499.9171 80
--------------------------------------------------------------------
... no regression on ST boxes (SH based) I always test.
This is a brief explanation of the new mitigation schema although there
is a patch that updates the driver's documentation.
o On Rx-side I have:
New GMACs will use the RX-watchdog timer; old ones will continue to
use NAPI to mitigate the RX DMA interrupts.
For the RX-watchdog, there is a parameter that is the RI Watchdog
Timer count. It indicates the number of system clock cycles and can be
set via *ethtool*.
o On Tx-side, the mitigation schema is based on a SW timer
that calls the tx function (stmmac_tx) to reclaim the resource after
transmitting the frames.
Also there is another parameter (a threshold) used to program
the descriptors avoiding to set the interrupt on completion bit in
when the frame is sent (xmit). This means that the stmmac_tx can be
called by the ISR too. Also this parameter can be tuned via ethtool.
V2: these patches add the ethtool support to get/set coalesce parameters
and totally remove the sysFS support added in the first patches.
V3: added several fixes: for example NAPI and RX-watchdog work together
while in the previous implementation the HW RX-watchdog disabled NAPI.
On the tx side, erroneously the tx coalesce frame parameter was limited
to the ring size and the driver didn't take care of the segment numbers
when enable/disable the IC bit in the TDES.
Giuseppe Cavallaro (8):
stmmac: remove dead code for TIMER
stmmac: manage tx clean out of rx_poll
stmmac: add the initial tx coalesce schema
stmmac: add Rx watchdog support to mitigate the DMA irqs
stmmac: get/set coalesce parameters via ethtool
stmmac: fix and review the rx irq path after adding new mitigation
stmmac: update the doc with new IRQ mitigation
stmmac: update the driver version to Sept_2012
Documentation/networking/stmmac.txt | 28 ++-
drivers/net/ethernet/stmicro/stmmac/Kconfig | 25 --
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 -
drivers/net/ethernet/stmicro/stmmac/common.h | 42 +++-
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 3 -
.../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 10 +-
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 7 +-
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 28 ++-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 14 +-
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 89 +++++++-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 240 ++++++++------------
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 134 -----------
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h | 46 ----
include/linux/stmmac.h | 1 +
15 files changed, 266 insertions(+), 406 deletions(-)
delete mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
delete mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
--
1.7.4.4
^ permalink raw reply
* [net-next.git 1/8] stmmac: remove dead code for TIMER
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
In-Reply-To: <1347262689-21251-1-git-send-email-peppe.cavallaro@st.com>
TIMER option is not longer supported and this
code can be considered dead for this driver in
the new kernel series.
In fact, It was not updated at all and never used.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 25 ----
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 101 +--------------
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 134 --------------------
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h | 46 -------
6 files changed, 3 insertions(+), 310 deletions(-)
delete mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
delete mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 9f44827..1164930 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -54,31 +54,6 @@ config STMMAC_DA
By default, the DMA arbitration scheme is based on Round-robin
(rx:tx priority is 1:1).
-config STMMAC_TIMER
- bool "STMMAC Timer optimisation"
- default n
- depends on RTC_HCTOSYS_DEVICE
- ---help---
- Use an external timer for mitigating the number of network
- interrupts. Currently, for SH architectures, it is possible
- to use the TMU channel 2 and the SH-RTC device.
-
-choice
- prompt "Select Timer device"
- depends on STMMAC_TIMER
-
-config STMMAC_TMU_TIMER
- bool "TMU channel 2"
- depends on CPU_SH4
- ---help---
-
-config STMMAC_RTC_TIMER
- bool "Real time clock"
- depends on RTC_CLASS
- ---help---
-
-endchoice
-
choice
prompt "Select the DMA TX/RX descriptor operating modes"
depends on STMMAC_ETH
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index bc965ac..c8e8ea6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -1,5 +1,4 @@
obj-$(CONFIG_STMMAC_ETH) += stmmac.o
-stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index e872e1d..9f35769 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -31,9 +31,6 @@
#include <linux/phy.h>
#include <linux/pci.h>
#include "common.h"
-#ifdef CONFIG_STMMAC_TIMER
-#include "stmmac_timer.h"
-#endif
struct stmmac_priv {
/* Frequently used values are kept adjacent for cache effect */
@@ -78,9 +75,6 @@ struct stmmac_priv {
spinlock_t tx_lock;
int wolopts;
int wol_irq;
-#ifdef CONFIG_STMMAC_TIMER
- struct stmmac_timer *tm;
-#endif
struct plat_stmmacenet_data *plat;
struct stmmac_counters mmc;
struct dma_features dma_cap;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c136162..c8985f3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -115,16 +115,6 @@ static int tc = TC_DEFAULT;
module_param(tc, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(tc, "DMA threshold control value");
-/* Pay attention to tune this parameter; take care of both
- * hardware capability and network stabitily/performance impact.
- * Many tests showed that ~4ms latency seems to be good enough. */
-#ifdef CONFIG_STMMAC_TIMER
-#define DEFAULT_PERIODIC_RATE 256
-static int tmrate = DEFAULT_PERIODIC_RATE;
-module_param(tmrate, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(tmrate, "External timer freq. (default: 256Hz)");
-#endif
-
#define DMA_BUFFER_SIZE BUF_SIZE_2KiB
static int buf_sz = DMA_BUFFER_SIZE;
module_param(buf_sz, int, S_IRUGO | S_IWUSR);
@@ -536,12 +526,6 @@ static void init_dma_desc_rings(struct net_device *dev)
else
bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
-#ifdef CONFIG_STMMAC_TIMER
- /* Disable interrupts on completion for the reception if timer is on */
- if (likely(priv->tm->enable))
- dis_ic = 1;
-#endif
-
DBG(probe, INFO, "stmmac: txsize %d, rxsize %d, bfsize %d\n",
txsize, rxsize, bfsize);
@@ -786,22 +770,12 @@ static void stmmac_tx(struct stmmac_priv *priv)
static inline void stmmac_enable_irq(struct stmmac_priv *priv)
{
-#ifdef CONFIG_STMMAC_TIMER
- if (likely(priv->tm->enable))
- priv->tm->timer_start(tmrate);
- else
-#endif
- priv->hw->dma->enable_dma_irq(priv->ioaddr);
+ priv->hw->dma->enable_dma_irq(priv->ioaddr);
}
static inline void stmmac_disable_irq(struct stmmac_priv *priv)
{
-#ifdef CONFIG_STMMAC_TIMER
- if (likely(priv->tm->enable))
- priv->tm->timer_stop();
- else
-#endif
- priv->hw->dma->disable_dma_irq(priv->ioaddr);
+ priv->hw->dma->disable_dma_irq(priv->ioaddr);
}
static int stmmac_has_work(struct stmmac_priv *priv)
@@ -829,25 +803,6 @@ static inline void _stmmac_schedule(struct stmmac_priv *priv)
}
}
-#ifdef CONFIG_STMMAC_TIMER
-void stmmac_schedule(struct net_device *dev)
-{
- struct stmmac_priv *priv = netdev_priv(dev);
-
- priv->xstats.sched_timer_n++;
-
- _stmmac_schedule(priv);
-}
-
-static void stmmac_no_timer_started(unsigned int x)
-{;
-};
-
-static void stmmac_no_timer_stopped(void)
-{;
-};
-#endif
-
/**
* stmmac_tx_err:
* @priv: pointer to the private device structure
@@ -1049,23 +1004,6 @@ static int stmmac_open(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
int ret;
-#ifdef CONFIG_STMMAC_TIMER
- priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL);
- if (unlikely(priv->tm == NULL))
- return -ENOMEM;
-
- priv->tm->freq = tmrate;
-
- /* Test if the external timer can be actually used.
- * In case of failure continue without timer. */
- if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) {
- pr_warning("stmmaceth: cannot attach the external timer.\n");
- priv->tm->freq = 0;
- priv->tm->timer_start = stmmac_no_timer_started;
- priv->tm->timer_stop = stmmac_no_timer_stopped;
- } else
- priv->tm->enable = 1;
-#endif
clk_enable(priv->stmmac_clk);
stmmac_check_ether_addr(priv);
@@ -1152,10 +1090,6 @@ static int stmmac_open(struct net_device *dev)
priv->hw->dma->start_tx(priv->ioaddr);
priv->hw->dma->start_rx(priv->ioaddr);
-#ifdef CONFIG_STMMAC_TIMER
- priv->tm->timer_start(tmrate);
-#endif
-
/* Dump DMA/MAC registers */
if (netif_msg_hw(priv)) {
priv->hw->mac->dump_regs(priv->ioaddr);
@@ -1182,9 +1116,6 @@ open_error_wolirq:
free_irq(dev->irq, dev);
open_error:
-#ifdef CONFIG_STMMAC_TIMER
- kfree(priv->tm);
-#endif
if (priv->phydev)
phy_disconnect(priv->phydev);
@@ -1215,12 +1146,6 @@ static int stmmac_release(struct net_device *dev)
netif_stop_queue(dev);
-#ifdef CONFIG_STMMAC_TIMER
- /* Stop and release the timer */
- stmmac_close_ext_timer();
- if (priv->tm != NULL)
- kfree(priv->tm);
-#endif
napi_disable(&priv->napi);
skb_queue_purge(&priv->rx_recycle);
@@ -1336,12 +1261,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
/* Interrupt on completition only for the latest segment */
priv->hw->desc->close_tx_desc(desc);
-#ifdef CONFIG_STMMAC_TIMER
- /* Clean IC while using timer */
- if (likely(priv->tm->enable))
- priv->hw->desc->clear_tx_ic(desc);
-#endif
-
wmb();
/* To avoid raise condition */
@@ -1539,7 +1458,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget)
* stmmac_tx_timeout
* @dev : Pointer to net device structure
* Description: this function is called when a packet transmission fails to
- * complete within a reasonable tmrate. The driver will mark the error in the
+ * complete within a reasonable time. The driver will mark the error in the
* netdev structure and arrange for the device to be reset to a sane state
* in order to transmit a new packet.
*/
@@ -2157,11 +2076,6 @@ int stmmac_suspend(struct net_device *ndev)
netif_device_detach(ndev);
netif_stop_queue(ndev);
-#ifdef CONFIG_STMMAC_TIMER
- priv->tm->timer_stop();
- if (likely(priv->tm->enable))
- dis_ic = 1;
-#endif
napi_disable(&priv->napi);
/* Stop TX/RX DMA */
@@ -2212,10 +2126,6 @@ int stmmac_resume(struct net_device *ndev)
priv->hw->dma->start_tx(priv->ioaddr);
priv->hw->dma->start_rx(priv->ioaddr);
-#ifdef CONFIG_STMMAC_TIMER
- if (likely(priv->tm->enable))
- priv->tm->timer_start(tmrate);
-#endif
napi_enable(&priv->napi);
netif_start_queue(ndev);
@@ -2311,11 +2221,6 @@ static int __init stmmac_cmdline_opt(char *str)
} else if (!strncmp(opt, "eee_timer:", 6)) {
if (kstrtoint(opt + 10, 0, &eee_timer))
goto err;
-#ifdef CONFIG_STMMAC_TIMER
- } else if (!strncmp(opt, "tmrate:", 7)) {
- if (kstrtoint(opt + 7, 0, &tmrate))
- goto err;
-#endif
}
}
return 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
deleted file mode 100644
index 2a0e1ab..0000000
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- STMMAC external timer support.
-
- Copyright (C) 2007-2009 STMicroelectronics Ltd
-
- This program is free software; you can redistribute it and/or modify it
- under the terms and conditions of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- This program is distributed in the hope it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
-
- Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
-*******************************************************************************/
-
-#include <linux/kernel.h>
-#include <linux/etherdevice.h>
-#include "stmmac_timer.h"
-
-static void stmmac_timer_handler(void *data)
-{
- struct net_device *dev = (struct net_device *)data;
-
- stmmac_schedule(dev);
-}
-
-#define STMMAC_TIMER_MSG(timer, freq) \
-printk(KERN_INFO "stmmac_timer: %s Timer ON (freq %dHz)\n", timer, freq);
-
-#if defined(CONFIG_STMMAC_RTC_TIMER)
-#include <linux/rtc.h>
-static struct rtc_device *stmmac_rtc;
-static rtc_task_t stmmac_task;
-
-static void stmmac_rtc_start(unsigned int new_freq)
-{
- rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq);
- rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1);
-}
-
-static void stmmac_rtc_stop(void)
-{
- rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0);
-}
-
-int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
-{
- stmmac_task.private_data = dev;
- stmmac_task.func = stmmac_timer_handler;
-
- stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
- if (stmmac_rtc == NULL) {
- pr_err("open rtc device failed\n");
- return -ENODEV;
- }
-
- rtc_irq_register(stmmac_rtc, &stmmac_task);
-
- /* Periodic mode is not supported */
- if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) {
- pr_err("set periodic failed\n");
- rtc_irq_unregister(stmmac_rtc, &stmmac_task);
- rtc_class_close(stmmac_rtc);
- return -1;
- }
-
- STMMAC_TIMER_MSG(CONFIG_RTC_HCTOSYS_DEVICE, tm->freq);
-
- tm->timer_start = stmmac_rtc_start;
- tm->timer_stop = stmmac_rtc_stop;
-
- return 0;
-}
-
-int stmmac_close_ext_timer(void)
-{
- rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0);
- rtc_irq_unregister(stmmac_rtc, &stmmac_task);
- rtc_class_close(stmmac_rtc);
- return 0;
-}
-
-#elif defined(CONFIG_STMMAC_TMU_TIMER)
-#include <linux/clk.h>
-#define TMU_CHANNEL "tmu2_clk"
-static struct clk *timer_clock;
-
-static void stmmac_tmu_start(unsigned int new_freq)
-{
- clk_set_rate(timer_clock, new_freq);
- clk_enable(timer_clock);
-}
-
-static void stmmac_tmu_stop(void)
-{
- clk_disable(timer_clock);
-}
-
-int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
-{
- timer_clock = clk_get(NULL, TMU_CHANNEL);
-
- if (timer_clock == NULL)
- return -1;
-
- if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {
- timer_clock = NULL;
- return -1;
- }
-
- STMMAC_TIMER_MSG("TMU2", tm->freq);
- tm->timer_start = stmmac_tmu_start;
- tm->timer_stop = stmmac_tmu_stop;
-
- return 0;
-}
-
-int stmmac_close_ext_timer(void)
-{
- clk_disable(timer_clock);
- tmu2_unregister_user();
- clk_put(timer_clock);
- return 0;
-}
-#endif
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
deleted file mode 100644
index aea9b14..0000000
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- STMMAC external timer Header File.
-
- Copyright (C) 2007-2009 STMicroelectronics Ltd
-
- This program is free software; you can redistribute it and/or modify it
- under the terms and conditions of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- This program is distributed in the hope it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-
- The full GNU General Public License is included in this distribution in
- the file called "COPYING".
-
- Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
-*******************************************************************************/
-#ifndef __STMMAC_TIMER_H__
-#define __STMMAC_TIMER_H__
-
-struct stmmac_timer {
- void (*timer_start) (unsigned int new_freq);
- void (*timer_stop) (void);
- unsigned int freq;
- unsigned int enable;
-};
-
-/* Open the HW timer device and return 0 in case of success */
-int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm);
-/* Stop the timer and release it */
-int stmmac_close_ext_timer(void);
-/* Function used for scheduling task within the stmmac */
-void stmmac_schedule(struct net_device *dev);
-
-#if defined(CONFIG_STMMAC_TMU_TIMER)
-extern int tmu2_register_user(void *fnt, void *data);
-extern void tmu2_unregister_user(void);
-#endif
-
-#endif /* __STMMAC_TIMER_H__ */
--
1.7.4.4
^ permalink raw reply related
* [net-next.git 5/8] stmmac: get/set coalesce parameters via ethtool
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
In-Reply-To: <1347262689-21251-1-git-send-email-peppe.cavallaro@st.com>
This patch is to get/set the tx/rx coalesce parameters
via ethtool interface.
Tests have been done on several platform with
different GMAC chips w/o w/ RX watchdog feature.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 8 ++-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 71 ++++++++++++++++++++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 20 +++---
4 files changed, 89 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 63d4bad..3ab3684 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -169,7 +169,13 @@ struct stmmac_extra_stats {
#define DMA_HW_FEAT_SAVLANINS 0x08000000 /* Source Addr or VLAN Insertion */
#define DMA_HW_FEAT_ACTPHYIF 0x70000000 /* Active/selected PHY interface */
#define DEFAULT_DMA_PBL 8
-#define DEFAULT_DMA_RIWT 0xff /* Max RI Watchdog Timer count */
+
+/* Coalesce defines */
+#define MAX_DMA_RIWT 0xff /* Max RI Watchdog Timer count */
+#define MIN_DMA_RIWT 0x20
+#define STMMAC_COAL_TX_TIMER 40000
+#define STMMAC_MAX_COAL_TX_TICK 100000
+#define STMMAC_TX_MAX_FRAMES 32
enum rx_frame_status { /* IPC status */
good_frame = 0,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 6901e3c..ad4f6b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -93,6 +93,7 @@ struct stmmac_priv {
u32 tx_count_frames;
u32 tx_coal_frames;
u32 tx_coal_timer;
+ u32 rx_riwt;
};
extern int phyaddr;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 48ad0bc..145b97d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -522,6 +522,75 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
return phy_ethtool_set_eee(priv->phydev, edata);
}
+static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
+{
+ unsigned long clk = clk_get_rate(priv->stmmac_clk);
+
+ if (!clk)
+ return 0;
+
+ return (usec * (clk / 1000000)) / 256;
+}
+
+static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv)
+{
+ unsigned long clk = clk_get_rate(priv->stmmac_clk);
+
+ if (!clk)
+ return 0;
+
+ return (riwt * 256) / (clk / 1000000);
+}
+
+static int stmmac_get_coalesce(struct net_device *dev,
+ struct ethtool_coalesce *ec)
+{
+ struct stmmac_priv *priv = netdev_priv(dev);
+
+ ec->tx_coalesce_usecs = priv->tx_coal_timer;
+ ec->tx_max_coalesced_frames = priv->tx_coal_frames;
+
+ if (priv->use_riwt)
+ ec->rx_coalesce_usecs = stmmac_riwt2usec(priv->rx_riwt, priv);
+
+ return 0;
+}
+
+static int stmmac_set_coalesce(struct net_device *dev,
+ struct ethtool_coalesce *ec)
+{
+ struct stmmac_priv *priv = netdev_priv(dev);
+ unsigned int rx_riwt;
+
+ /* No rx interrupts will be generated if both are zero */
+ if (ec->rx_coalesce_usecs == 0)
+ return -EINVAL;
+
+ /* No tx interrupts will be generated if both are zero */
+ if ((ec->tx_coalesce_usecs == 0) &&
+ (ec->tx_max_coalesced_frames == 0))
+ return -EINVAL;
+
+ if ((ec->tx_coalesce_usecs > STMMAC_COAL_TX_TIMER) ||
+ (ec->tx_max_coalesced_frames > STMMAC_TX_MAX_FRAMES))
+ return -EINVAL;
+
+ rx_riwt = stmmac_usec2riwt(ec->rx_coalesce_usecs, priv);
+
+ if ((rx_riwt > MAX_DMA_RIWT) || (rx_riwt < MIN_DMA_RIWT))
+ return -EINVAL;
+ else if (!priv->use_riwt)
+ return -EOPNOTSUPP;
+
+ /* Only copy relevant parameters, ignore all others. */
+ priv->tx_coal_frames = ec->tx_max_coalesced_frames;
+ priv->tx_coal_timer = ec->tx_coalesce_usecs;
+ priv->rx_riwt = rx_riwt;
+ priv->hw->dma->rx_watchdog(priv->ioaddr, priv->rx_riwt);
+
+ return 0;
+}
+
static const struct ethtool_ops stmmac_ethtool_ops = {
.begin = stmmac_check_if_running,
.get_drvinfo = stmmac_ethtool_getdrvinfo,
@@ -542,6 +611,8 @@ static const struct ethtool_ops stmmac_ethtool_ops = {
.set_eee = stmmac_ethtool_op_set_eee,
.get_sset_count = stmmac_get_sset_count,
.get_ts_info = ethtool_op_get_ts_info,
+ .get_coalesce = stmmac_get_coalesce,
+ .set_coalesce = stmmac_set_coalesce,
};
void stmmac_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8e610a1..b0731e6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -77,8 +77,6 @@
#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
#define JUMBO_LEN 9000
-#define STMMAC_TX_TM 40000
-#define STMMAC_TX_MAX_FRAMES 32 /* Max coalesced frame */
/* Module parameters */
#define TX_TIMEO 5000 /* default 5 seconds */
@@ -140,6 +138,8 @@ static int stmmac_init_fs(struct net_device *dev);
static void stmmac_exit_fs(void);
#endif
+#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
+
/**
* stmmac_verify_args - verify the driver parameters.
* Description: it verifies if some wrong parameter is passed to the driver.
@@ -996,9 +996,9 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
{
/* Set Tx coalesce parameters and timers */
priv->tx_coal_frames = STMMAC_TX_MAX_FRAMES;
- priv->tx_coal_timer = jiffies + usecs_to_jiffies(STMMAC_TX_TM);
+ priv->tx_coal_timer = STMMAC_COAL_TX_TIMER;
init_timer(&priv->txtimer);
- priv->txtimer.expires = priv->tx_coal_timer;
+ priv->txtimer.expires = STMMAC_COAL_TIMER(priv->tx_coal_timer);
priv->txtimer.data = (unsigned long)priv;
priv->txtimer.function = stmmac_txtimer;
add_timer(&priv->txtimer);
@@ -1118,11 +1118,10 @@ static int stmmac_open(struct net_device *dev)
stmmac_init_tx_coalesce(priv);
- if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog))
- /* Program RX Watchdog register to the default values
- * FIXME: provide user value for RIWT
- */
- priv->hw->dma->rx_watchdog(priv->ioaddr, DEFAULT_DMA_RIWT);
+ if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
+ priv->rx_riwt = MAX_DMA_RIWT;
+ priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT);
+ }
napi_enable(&priv->napi);
@@ -1299,7 +1298,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->xstats.tx_reset_ic_bit++;
TX_DBG("\t[entry %d]: tx_count_frames %d\n", entry,
priv->tx_count_frames);
- mod_timer(&priv->txtimer, priv->tx_coal_timer);
+ mod_timer(&priv->txtimer,
+ STMMAC_COAL_TIMER(priv->tx_coal_timer));
} else
priv->tx_count_frames = 0;
--
1.7.4.4
^ permalink raw reply related
* [net-next.git 3/8 (V2)] stmmac: add the initial tx coalesce schema
From: Giuseppe CAVALLARO @ 2012-09-10 7:38 UTC (permalink / raw)
To: netdev; +Cc: bhutchings, davem, Giuseppe Cavallaro
In-Reply-To: <1347262689-21251-1-git-send-email-peppe.cavallaro@st.com>
This patch adds a new schema used for mitigating the
number of transmit interrupts.
It is based on a sw timer and a threshold value.
The timer is used to periodically call the stmmac_tx
function that can be invoked by the ISR but only for
the descriptors where the interrupt on completion
field has been set. This is tuned by a threshold.
Next step is to add the ability to tune these coalesce
values by ethtool.
Till now I have put a default that showed a real gain
on all the platforms ARM/SH4 where I performed benchmarks.
V2: review the logic to manage the IC bit in the TDESC
that was bugged because it didn't take care about the
fragments. Also fix the tx_count_frames that has not to be
limited to TX DMA ring. Thanks to Ben Hutchings.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 8 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 9 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 92 ++++++++++++--------
4 files changed, 69 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index bd32fe6..1d6bd3e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -95,11 +95,13 @@ struct stmmac_extra_stats {
unsigned long threshold;
unsigned long tx_pkt_n;
unsigned long rx_pkt_n;
- unsigned long rx_napi_poll;
+ unsigned long normal_irq_n;
unsigned long rx_normal_irq_n;
+ unsigned long rx_napi_poll;
unsigned long tx_normal_irq_n;
- unsigned long sched_timer_n;
- unsigned long normal_irq_n;
+ unsigned long txtimer;
+ unsigned long tx_clean;
+ unsigned long tx_reset_ic_bit;
unsigned long mmc_tx_irq_n;
unsigned long mmc_rx_irq_n;
unsigned long mmc_rx_csum_offload_irq_n;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f35769..0f5ab28 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -88,6 +88,10 @@ struct stmmac_priv {
int eee_enabled;
int eee_active;
int tx_lpi_timer;
+ struct timer_list txtimer;
+ u32 tx_count_frames;
+ u32 tx_coal_frames;
+ u32 tx_coal_timer;
};
extern int phyaddr;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 505fe71..48ad0bc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -90,12 +90,13 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
STMMAC_STAT(threshold),
STMMAC_STAT(tx_pkt_n),
STMMAC_STAT(rx_pkt_n),
- STMMAC_STAT(rx_napi_poll),
+ STMMAC_STAT(normal_irq_n),
STMMAC_STAT(rx_normal_irq_n),
+ STMMAC_STAT(rx_napi_poll),
STMMAC_STAT(tx_normal_irq_n),
- STMMAC_STAT(sched_timer_n),
- STMMAC_STAT(normal_irq_n),
- STMMAC_STAT(normal_irq_n),
+ STMMAC_STAT(txtimer),
+ STMMAC_STAT(tx_clean),
+ STMMAC_STAT(tx_reset_ic_bit),
STMMAC_STAT(mmc_tx_irq_n),
STMMAC_STAT(mmc_rx_irq_n),
STMMAC_STAT(mmc_rx_csum_offload_irq_n),
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8e1e53e..3df3c3b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -77,6 +77,8 @@
#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
#define JUMBO_LEN 9000
+#define STMMAC_TX_TM 40000
+#define STMMAC_TX_MAX_FRAMES 32 /* Max coalesced frame */
/* Module parameters */
#define TX_TIMEO 5000 /* default 5 seconds */
@@ -695,8 +697,11 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
static void stmmac_tx(struct stmmac_priv *priv)
{
unsigned int txsize = priv->dma_tx_size;
+ unsigned long flags;
+
+ spin_lock_irqsave(&priv->tx_lock, flags);
- spin_lock(&priv->tx_lock);
+ priv->xstats.tx_clean++;
while (priv->dirty_tx != priv->cur_tx) {
int last;
@@ -741,7 +746,7 @@ static void stmmac_tx(struct stmmac_priv *priv)
skb_recycle_check(skb, priv->dma_buf_sz))
__skb_queue_head(&priv->rx_recycle, skb);
else
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
priv->tx_skbuff[entry] = NULL;
}
@@ -765,7 +770,7 @@ static void stmmac_tx(struct stmmac_priv *priv)
stmmac_enable_eee_mode(priv);
mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_TIMER(eee_timer));
}
- spin_unlock(&priv->tx_lock);
+ spin_unlock_irqrestore(&priv->tx_lock, flags);
}
static inline void stmmac_enable_irq(struct stmmac_priv *priv)
@@ -778,29 +783,12 @@ static inline void stmmac_disable_irq(struct stmmac_priv *priv)
priv->hw->dma->disable_dma_irq(priv->ioaddr);
}
-static int stmmac_has_work(struct stmmac_priv *priv)
+static void stmmac_txtimer(unsigned long data)
{
- unsigned int has_work = 0;
- int rxret, tx_work = 0;
-
- rxret = priv->hw->desc->get_rx_owner(priv->dma_rx +
- (priv->cur_rx % priv->dma_rx_size));
-
- if (priv->dirty_tx != priv->cur_tx)
- tx_work = 1;
-
- if (likely(!rxret || tx_work))
- has_work = 1;
+ struct stmmac_priv *priv = (struct stmmac_priv *)data;
- return has_work;
-}
-
-static inline void _stmmac_schedule(struct stmmac_priv *priv)
-{
- if (likely(stmmac_has_work(priv))) {
- stmmac_disable_irq(priv);
- napi_schedule(&priv->napi);
- }
+ priv->xstats.txtimer++;
+ stmmac_tx(priv);
}
/**
@@ -824,7 +812,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
netif_wake_queue(priv->dev);
}
-static inline void stmmac_rx_schedule(struct stmmac_priv *priv)
+static void stmmac_rx_schedule(struct stmmac_priv *priv)
{
if (likely(napi_schedule_prep(&priv->napi))) {
stmmac_disable_irq(priv);
@@ -1001,6 +989,18 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
priv->dma_rx_phy);
}
+static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
+{
+ /* Set Tx coalesce parameters and timers */
+ priv->tx_coal_frames = STMMAC_TX_MAX_FRAMES;
+ priv->tx_coal_timer = jiffies + usecs_to_jiffies(STMMAC_TX_TM);
+ init_timer(&priv->txtimer);
+ priv->txtimer.expires = priv->tx_coal_timer;
+ priv->txtimer.data = (unsigned long)priv;
+ priv->txtimer.function = stmmac_txtimer;
+ add_timer(&priv->txtimer);
+}
+
/**
* stmmac_open - open entry point of the driver
* @dev : pointer to the device structure.
@@ -1113,6 +1113,8 @@ static int stmmac_open(struct net_device *dev)
priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS_TIMER;
priv->eee_enabled = stmmac_eee_init(priv);
+ stmmac_init_tx_coalesce(priv);
+
napi_enable(&priv->napi);
skb_queue_head_init(&priv->rx_recycle);
netif_start_queue(dev);
@@ -1160,6 +1162,8 @@ static int stmmac_release(struct net_device *dev)
napi_disable(&priv->napi);
skb_queue_purge(&priv->rx_recycle);
+ del_timer_sync(&priv->txtimer);
+
/* Free the IRQ lines */
free_irq(dev->irq, dev);
if (priv->wol_irq != dev->irq)
@@ -1202,6 +1206,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
int nfrags = skb_shinfo(skb)->nr_frags;
struct dma_desc *desc, *first;
unsigned int nopaged_len = skb_headlen(skb);
+ unsigned long flags;
if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) {
if (!netif_queue_stopped(dev)) {
@@ -1213,7 +1218,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_BUSY;
}
- spin_lock(&priv->tx_lock);
+ spin_lock_irqsave(&priv->tx_lock, flags);
if (priv->tx_path_in_lpi_mode)
stmmac_disable_eee_mode(priv);
@@ -1222,11 +1227,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
#ifdef STMMAC_XMIT_DEBUG
if ((skb->len > ETH_FRAME_LEN) || nfrags)
- pr_info("stmmac xmit:\n"
- "\tskb addr %p - len: %d - nopaged_len: %d\n"
- "\tn_frags: %d - ip_summed: %d - %s gso\n",
- skb, skb->len, nopaged_len, nfrags, skb->ip_summed,
- !skb_is_gso(skb) ? "isn't" : "is");
+ pr_debug("stmmac xmit: [entry %d]\n"
+ "\tskb addr %p - len: %d - nopaged_len: %d\n"
+ "\tn_frags: %d - ip_summed: %d - %s gso\n"
+ "\ttx_count_frames %d\n", entry,
+ skb, skb->len, nopaged_len, nfrags, skb->ip_summed,
+ !skb_is_gso(skb) ? "isn't" : "is",
+ priv->tx_count_frames);
#endif
csum_insertion = (skb->ip_summed == CHECKSUM_PARTIAL);
@@ -1236,9 +1243,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
#ifdef STMMAC_XMIT_DEBUG
if ((nfrags > 0) || (skb->len > ETH_FRAME_LEN))
- pr_debug("stmmac xmit: skb len: %d, nopaged_len: %d,\n"
- "\t\tn_frags: %d, ip_summed: %d\n",
- skb->len, nopaged_len, nfrags, skb->ip_summed);
+ pr_debug("\tskb len: %d, nopaged_len: %d,\n"
+ "\t\tn_frags: %d, ip_summed: %d\n",
+ skb->len, nopaged_len, nfrags, skb->ip_summed);
#endif
priv->tx_skbuff[entry] = skb;
@@ -1269,10 +1276,22 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
wmb();
}
- /* Interrupt on completition only for the latest segment */
+ /* Finalize the latest segment. */
priv->hw->desc->close_tx_desc(desc);
wmb();
+ /* According to the coalesce parameter the IC bit for the latest
+ * segment could be reset and the timer re-started to invoke the
+ * stmmac_tx function. This approach takes care about the fragments. */
+ priv->tx_count_frames += nfrags + 1;
+ if (priv->tx_coal_frames > priv->tx_count_frames) {
+ priv->hw->desc->clear_tx_ic(desc);
+ priv->xstats.tx_reset_ic_bit++;
+ TX_DBG("\t[entry %d]: tx_count_frames %d\n", entry,
+ priv->tx_count_frames);
+ mod_timer(&priv->txtimer, priv->tx_coal_timer);
+ } else
+ priv->tx_count_frames = 0;
/* To avoid raise condition */
priv->hw->desc->set_tx_owner(first);
@@ -1302,7 +1321,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
priv->hw->dma->enable_dma_transmission(priv->ioaddr);
- spin_unlock(&priv->tx_lock);
+ spin_unlock_irqrestore(&priv->tx_lock, flags);
return NETDEV_TX_OK;
}
@@ -1447,7 +1466,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
* all interfaces.
* Description :
* This function implements the the reception process.
- * Also it runs the TX completion thread
*/
static int stmmac_poll(struct napi_struct *napi, int budget)
{
--
1.7.4.4
^ 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