* RE: [PATCH] net: fec: add the initial to set the physical mac address
From: Duan Fugang-B38611 @ 2013-08-28 2:11 UTC (permalink / raw)
To: Lucas Stach
Cc: Li Frank-B20596, Zhou Luwei-B45643, davem@davemloft.net,
netdev@vger.kernel.org, shawn.guo@linaro.org,
bhutchings@solarflare.com, Estevam Fabio-R49496,
stephen@networkplumber.org
In-Reply-To: <1377613134.4246.12.camel@weser.hi.pengutronix.de>
From: Lucas Stach [mailto:l.stach@pengutronix.de]
Data: Tuesday, August 27, 2013 10:19 PM
> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.org
> Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> address
>
> Am Donnerstag, den 22.08.2013, 19:17 +0800 schrieb Fugang Duan:
> > For imx6slx evk platform, the fec driver cannot work since there have
> > no valid mac address set in physical mac registers.
> >
> > For imx serial platform, fec/enet IPs both need the physical MAC
> > address initial, otherwise it cannot work.
> >
> > After acquiring the valid MAC address from devices tree/pfuse/ kernel
> > command line/random mac address, and then set it to the physical MAC
> > address registers.
> >
> Yeah, we have also seen that we need to set this explicitly. The strange
> thing is that I recall this used to work without calling
> fec_set_mac_address() explicitly, so either the netdev core was calling it
> at some point, or our userspace was. I didn't got around to investigate
> this further.
Netdev core don't call the function willingly, if only user config MAC address such as call ioctl(sockfd, SIOCSIFHWADDR, ifreq).
> So anyway:
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
>
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/fec_main.c | 9 ++++++---
> > 1 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 4349a9e..9b5e08c 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -1867,10 +1867,12 @@ fec_set_mac_address(struct net_device *ndev,
> void *p)
> > struct fec_enet_private *fep = netdev_priv(ndev);
> > struct sockaddr *addr = p;
> >
> > - if (!is_valid_ether_addr(addr->sa_data))
> > - return -EADDRNOTAVAIL;
> > + if (p) {
> > + if (!is_valid_ether_addr(addr->sa_data))
> > + return -EADDRNOTAVAIL;
> >
> > - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> > + memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> > + }
> >
> > writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
> > (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24), @@ -
> 1969,6
> > +1971,7 @@ static int fec_enet_init(struct net_device *ndev)
> >
> > /* Get the Ethernet address */
> > fec_get_mac(ndev);
> > + fec_set_mac_address(ndev, NULL);
> >
> > /* Set receive and transmit descriptor base. */
> > fep->rx_bd_base = cbd_base;
>
> --
> Pengutronix e.K. | Lucas Stach |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
^ permalink raw reply
* Re: [GIT net-next] Open vSwitch
From: David Miller @ 2013-08-28 2:11 UTC (permalink / raw)
To: jesse; +Cc: netdev, dev
In-Reply-To: <1377634848-34327-1-git-send-email-jesse@nicira.com>
From: Jesse Gross <jesse@nicira.com>
Date: Tue, 27 Aug 2013 13:20:37 -0700
> A number of significant new features and optimizations for net-next/3.12.
> Highlights are:
> * "Megaflows", an optimization that allows userspace to specify which
> flow fields were used to compute the results of the flow lookup.
> This allows for a major reduction in flow setups (the major
> performance bottleneck in Open vSwitch) without reducing flexibility.
> * Converting netlink dump operations to use RCU, allowing for
> additional parallelism in userspace.
> * Matching and modifying SCTP protocol fields.
Pulled, thanks Jesse.
^ permalink raw reply
* Re: [PATCH 0/8] netfilter updates for net-next
From: David Miller @ 2013-08-28 2:07 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
In-Reply-To: <1377644018-15685-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Wed, 28 Aug 2013 00:53:30 +0200
> The following patchset contains Netfilter updates for your net-next tree,
> they are:
>
> * The new SYNPROXY target for iptables, including IPv4 and IPv6 support,
> from Patrick McHardy.
>
> * nf_defrag_ipv6.o should be only linked to nf_defrag_ipv6.ko, from
> Nathan Hintz.
>
> * Fix an old bug in REJECT, which replies with wrong MAC source address
> from the bridge, by Phil Oester.
>
> * Fix uninitialized helper variable in the expectation support over
> nfnetlink_queue, from Florian Westphal.
>
> You can pull these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
Pulled, thanks Pablo.
^ permalink raw reply
* Re: [PATCH net 0/5] bnx2x: Bug fixes patch series
From: David Miller @ 2013-08-28 2:04 UTC (permalink / raw)
To: yuvalmin; +Cc: netdev, ariele, eilong
In-Reply-To: <1377641584-2939-1-git-send-email-yuvalmin@broadcom.com>
From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Wed, 28 Aug 2013 01:12:59 +0300
> This patch series contains VF bug fixes (with the exception of one unrelated
> bug fix).
>
> Please consider applying these patches to `net'.
Series applied, thanks.
^ permalink raw reply
* Re: Pull request: sfc-next 2013-08-27
From: David Miller @ 2013-08-28 2:02 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1377635844.13272.69.camel@bwh-desktop.uk.level5networks.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 27 Aug 2013 21:37:24 +0100
> More refactoring and cleanup, particularly around filter management.
Pulled, thanks Ben.
^ permalink raw reply
* Re: Source routing without rules?
From: Hannes Frederic Sowa @ 2013-08-28 1:51 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrWSgSnMdARZPGii5G1Yf43JjEPpeNgL2_yfDBd7W9650A@mail.gmail.com>
On Tue, Aug 27, 2013 at 06:46:35PM -0700, Andy Lutomirski wrote:
> On Tue, Aug 27, 2013 at 6:14 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
> >> I'm about to implement a trivial source routing policy for the third
> >> time, and this is IMO stupid. I want to have two routes to a network.
> >> Each route should specify a src, and, if the flow matches the src,
> >> then that route should win.
> >>
> >> The rules that don't work are:
> >>
> >> ip route add <net> via <gw1> dev <dev1> metric 0
> >> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
> >
> > src is actually the preferred src address. In ipv6 land there is a RTA_SRC
> > (look for ip route *from* parameter) route attribute settable to only
> > select routes if the from-source matches the route. If you implement
> > such a feature I would go with the same design (IPV6_SUBTREES).
>
> Interesting. The Kconfig help text for IPV6_SUBTREES is incredibly
> confusing. What are the actual semantics? I'm guessing that only
> routes that match the source address in their "from" clause are
> considered and ties are broken in favor of the longest from prefix.
At first normal longest-prefix lookup is done with the destination
address. The resulting fib6_node can now hold a subtree where a source
lookup will be done. If a node matches, this is the result. Otherwise
backtracking takes place in the "main" fib6_table.
Greetings,
Hannes
^ permalink raw reply
* Re: Source routing without rules?
From: Andy Lutomirski @ 2013-08-28 1:46 UTC (permalink / raw)
To: Andy Lutomirski, Network Development
In-Reply-To: <20130828011437.GA30092@order.stressinduktion.org>
On Tue, Aug 27, 2013 at 6:14 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
>> I'm about to implement a trivial source routing policy for the third
>> time, and this is IMO stupid. I want to have two routes to a network.
>> Each route should specify a src, and, if the flow matches the src,
>> then that route should win.
>>
>> The rules that don't work are:
>>
>> ip route add <net> via <gw1> dev <dev1> metric 0
>> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>
> src is actually the preferred src address. In ipv6 land there is a RTA_SRC
> (look for ip route *from* parameter) route attribute settable to only
> select routes if the from-source matches the route. If you implement
> such a feature I would go with the same design (IPV6_SUBTREES).
Interesting. The Kconfig help text for IPV6_SUBTREES is incredibly
confusing. What are the actual semantics? I'm guessing that only
routes that match the source address in their "from" clause are
considered and ties are broken in favor of the longest from prefix.
This is considerably more complicated than my suggestion, but it's
also more powerful. Implementing this will require actually
understanding how the trie code works :/
--Andy
^ permalink raw reply
* Re: [E1000-devel] [PATCH net-next] drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent
From: Jeff Kirsher @ 2013-08-28 1:44 UTC (permalink / raw)
To: Joe Perches
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
e1000-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1377582323.2658.10.camel@joe-AO722>
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
On Mon, 2013-08-26 at 22:45 -0700, Joe Perches wrote:
> __GFP_ZERO is an uncommon flag and perhaps is better
> not used. static inline dma_zalloc_coherent exists
> so convert the uses of dma_alloc_coherent with __GFP_ZERO
> to the more common kernel style with zalloc.
>
> Remove memset from the static inline dma_zalloc_coherent
> and add just one use of __GFP_ZERO instead.
>
> Trivially reduces the size of the existing uses of
> dma_zalloc_coherent.
>
> Realign arguments as appropriate.
>
> Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] tipc: set sk_err correctly when connection fails
From: Ying Xue @ 2013-08-28 1:32 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Erik Hugne, netdev, jon.maloy, tipc-discussion, nhan.tt.vo
In-Reply-To: <521CEBF7.4040103@windriver.com>
On 08/28/2013 02:12 AM, Paul Gortmaker wrote:
> On 13-08-27 11:18 AM, Erik Hugne wrote:
>> On Tue, Aug 27, 2013 at 09:20:23AM -0400, Paul Gortmaker wrote:
>>> What was the high level user visible symptom in this case?
>>> Stalled connections or ... ?
>>
>> Should the connect fail, if the publication/server is unavailable or some other
>> error. The connect() call returns the error code directly (as a positive value).
>
> Please send a v2 with the end-user visible symptom clearly described;
> as this information is what people use in order to triage whether
> commits belong in stable, or net vs. net-next etc. For example:
>
> Should the connect fail, say if the publication/server is unavailable or
> some other error, then the code returns a positive return value. Since
> most code only checks for a negative return on connect(), it tries to
> continue, but will ultimately fail on the 1st sendto() as the strace
> snippet below shows.
>
> I've said "most code" since I simply don't know what it was that you were
> tracing below. It would help if we knew if this part of a common application
> or similar.
>
Firstly it's absolutely wrong that connect() returns a positive error
code - 111(i.e, ECONNREFUSED) if connect() is failed, that is, it
violates POSIX standard.
As the patch's changelog describes, sk_err is incorrectly set to a
negative value instead of positive value in filter_connect(). In
connect(), it will set its return value with sock_error(sk) if it fails.
As the return value of sock_error(sk) almost can be deemed as -sk_err,
this is why we see a positive error code of connect() in below strace log.
But, the patch is absolutely able to fix the issue.
Regards,
Ying
> Thanks,
> Paul.
> --
>
>>
>> [...]
>> socket(0x1e /* PF_??? */, SOCK_SEQPACKET, 0) = 3
>> setsockopt(3, 0x10f /* SOL_?? */, 129, [0], 4) = 0
>> setsockopt(3, 0x10f /* SOL_?? */, 127, [0], 4) = 0
>> connect(3, {sa_family=0x1e /* AF_??? */, sa_data="\2\1\322\4\0\0\322\4\0\0\0\0\0\0"}, 16) = 111
>> sendto(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 66000, 0, NULL, 0) = -1 EPIPE (Broken pipe)
>>
>> In the strace above, error checking was done as:
>> if (connect(fd,.....) < 0)
>> perror("connect");
>>
>> //E
>>
>
>
^ permalink raw reply
* Re: [net-next v2 1/8] i40e: main driver core
From: David Miller @ 2013-08-28 1:31 UTC (permalink / raw)
To: shannon.nelson
Cc: jeffrey.t.kirsher, e1000-devel, netdev, jesse.brandeburg, gospo,
sassmann
In-Reply-To: <FC41C24E35F18A40888AACA1A36F3E416C617400@FMSMSX102.amr.corp.intel.com>
From: "Nelson, Shannon" <shannon.nelson@intel.com>
Date: Tue, 27 Aug 2013 20:34:04 +0000
> I understand the aesthetics as it does make the code look a little
> cleaner, and we can do this with a lot of our functions. However,
> there are several instances where one declaration initialization
> depends on a previous declaration, and trying to organize by line
> length breaks these relationships. Do you mind if we're not perfect
> on following this one?
Put the assignments that can match the ordering rule into the
declarations, put the remaining ones on seperate lines after
the declarations.
^ permalink raw reply
* Re: Source routing without rules?
From: Andy Lutomirski @ 2013-08-28 1:29 UTC (permalink / raw)
To: Brian Haley; +Cc: Network Development
In-Reply-To: <521D4AFD.2000102@hp.com>
On Tue, Aug 27, 2013 at 5:57 PM, Brian Haley <brian.haley@hp.com> wrote:
> On 08/27/2013 08:16 PM, Andy Lutomirski wrote:
>> I'm about to implement a trivial source routing policy for the third
>> time, and this is IMO stupid. I want to have two routes to a network.
>> Each route should specify a src, and, if the flow matches the src,
>> then that route should win.
>>
>> The rules that don't work are:
>>
>> ip route add <net> via <gw1> dev <dev1> metric 0
>> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>>
>> Even if I bind a socket to dev2addr, the outgoing packets go out dev1
>> to gw1. This is exactly what I don't want to have happen.
>
> Look at this page on routing rules:
>
> http://lartc.org/howto/lartc.rpdb.html
Been there, done that. I want to do this in a way that's easy and
scalable, and rules are neither.
--Andy
^ permalink raw reply
* Re: Source routing without rules?
From: Hannes Frederic Sowa @ 2013-08-28 1:14 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrVRZF0XLtH9o37Y=ZVMyyExBs7dLYFLOgJ-=vFqy+a_ig@mail.gmail.com>
On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
> I'm about to implement a trivial source routing policy for the third
> time, and this is IMO stupid. I want to have two routes to a network.
> Each route should specify a src, and, if the flow matches the src,
> then that route should win.
>
> The rules that don't work are:
>
> ip route add <net> via <gw1> dev <dev1> metric 0
> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
src is actually the preferred src address. In ipv6 land there is a RTA_SRC
(look for ip route *from* parameter) route attribute settable to only
select routes if the from-source matches the route. If you implement
such a feature I would go with the same design (IPV6_SUBTREES).
Greetings,
Hannes
^ permalink raw reply
* Re: Source routing without rules?
From: Brian Haley @ 2013-08-28 0:57 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrVRZF0XLtH9o37Y=ZVMyyExBs7dLYFLOgJ-=vFqy+a_ig@mail.gmail.com>
On 08/27/2013 08:16 PM, Andy Lutomirski wrote:
> I'm about to implement a trivial source routing policy for the third
> time, and this is IMO stupid. I want to have two routes to a network.
> Each route should specify a src, and, if the flow matches the src,
> then that route should win.
>
> The rules that don't work are:
>
> ip route add <net> via <gw1> dev <dev1> metric 0
> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>
> Even if I bind a socket to dev2addr, the outgoing packets go out dev1
> to gw1. This is exactly what I don't want to have happen.
Look at this page on routing rules:
http://lartc.org/howto/lartc.rpdb.html
-Brian
^ permalink raw reply
* [PATCH net-next 2/2] sh_eth: Enable Rx descriptor word 0 shift for r8a7790
From: Simon Horman @ 2013-08-28 0:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-sh
Cc: Magnus Damm, Sergei Shtylyov, Kouei Abe, Simon Horman
In-Reply-To: <1377650589-20960-1-git-send-email-horms+renesas@verge.net.au>
From: Kouei Abe <kouei.abe.cp@renesas.com>
This corrects an oversight when r8a7790 support was added to sh_eth.
Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/net/ethernet/renesas/sh_eth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index f386a8f..095ca8e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -416,6 +416,7 @@ static struct sh_eth_cpu_data r8a7790_data = {
.tpauser = 1,
.hw_swap = 1,
.rmiimode = 1,
+ .shift_rd0 = 1,
};
static void sh_eth_set_rate_sh7724(struct net_device *ndev)
--
1.8.3.2
^ permalink raw reply related
* [PATCH net-next 1/2] sh_eth: Fix cache invalidation omission of receive buffer
From: Simon Horman @ 2013-08-28 0:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-sh
Cc: Magnus Damm, Sergei Shtylyov, Kouei Abe, Simon Horman
In-Reply-To: <1377650589-20960-1-git-send-email-horms+renesas@verge.net.au>
From: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/net/ethernet/renesas/sh_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index c357076..f386a8f 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1342,6 +1342,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
mdp->rx_skbuff[entry] = NULL;
if (mdp->cd->rpadir)
skb_reserve(skb, NET_IP_ALIGN);
+ dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr,
+ mdp->rx_buf_sz, DMA_FROM_DEVICE);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, ndev);
netif_rx(skb);
--
1.8.3.2
^ permalink raw reply related
* [PATCH net-next 0/2] sh_eth Updates
From: Simon Horman @ 2013-08-28 0:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-sh
Cc: Magnus Damm, Sergei Shtylyov, Kouei Abe, Simon Horman
Hi,
please consider the following updates to the sh_eth driver
by Abe-san. They were developed during his testing of the
driver on the r8a7790/lager board.
Kouei Abe (2):
sh_eth: Fix cache invalidation omission of receive buffer
sh_eth: Enable Rx descriptor word 0 shift for r8a7790
drivers/net/ethernet/renesas/sh_eth.c | 3 +++
1 file changed, 3 insertions(+)
--
1.8.3.2
^ permalink raw reply
* Re: [PATCH v3 net-next] tcp: TSO packets automatic sizing
From: Neal Cardwell @ 2013-08-28 0:21 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, netdev, Yuchung Cheng, Van Jacobson, Tom Herbert
In-Reply-To: <1377607592.8828.149.camel@edumazet-glaptop>
On Tue, Aug 27, 2013 at 8:46 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> After hearing many people over past years complaining against TSO being
> bursty or even buggy, we are proud to present automatic sizing of TSO
> packets.
>
> One part of the problem is that tcp_tso_should_defer() uses an heuristic
> relying on upcoming ACKS instead of a timer, but more generally, having
> big TSO packets makes little sense for low rates, as it tends to create
> micro bursts on the network, and general consensus is to reduce the
> buffering amount.
>
> This patch introduces a per socket sk_pacing_rate, that approximates
> the current sending rate, and allows us to size the TSO packets so
> that we try to send one packet every ms.
>
> This field could be set by other transports.
>
> Patch has no impact for high speed flows, where having large TSO packets
> makes sense to reach line rate.
>
> For other flows, this helps better packet scheduling and ACK clocking.
>
> This patch increases performance of TCP flows in lossy environments.
>
> A new sysctl (tcp_min_tso_segs) is added, to specify the
> minimal size of a TSO packet (default being 2).
>
> A follow-up patch will provide a new packet scheduler (FQ), using
> sk_pacing_rate as an input to perform optional per flow pacing.
>
> This explains why we chose to set sk_pacing_rate to twice the current
> rate, allowing 'slow start' ramp up.
>
> sk_pacing_rate = 2 * cwnd * mss / srtt
>
> v2: Neal Cardwell reported a suspect deferring of last two segments on
> initial write of 10 MSS, I had to change tcp_tso_should_defer() to take
> into account tp->xmit_size_goal_segs
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Yuchung Cheng <ycheng@google.com>
> Cc: Van Jacobson <vanj@google.com>
> Cc: Tom Herbert <therbert@google.com>
> ---
> v3: The change Yuchung suggested added a possibility of a divide by 0:
> On some (retransmits) case, srtt can be 0 because
> tcp_rtt_estimator() has not yet been called.
> Change the computation to remove this, and do not yet use usec
> as the units, but HZ. [ Its interesting to see jiffies_to_usecs()
> being an out of line function :( ]
>
> This version passed all our tests.
>
> Documentation/networking/ip-sysctl.txt | 9 ++++++
> include/net/sock.h | 2 +
> include/net/tcp.h | 1
> net/ipv4/sysctl_net_ipv4.c | 10 +++++++
> net/ipv4/tcp.c | 28 ++++++++++++++++----
> net/ipv4/tcp_input.c | 32 ++++++++++++++++++++++-
> net/ipv4/tcp_output.c | 2 -
> 7 files changed, 77 insertions(+), 7 deletions(-)
Acked-by: Neal Cardwell <ncardwell@google.com>
neal
^ permalink raw reply
* Re: [PATCH v3 net-next] tcp: TSO packets automatic sizing
From: Yuchung Cheng @ 2013-08-28 0:17 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, netdev, Neal Cardwell, Van Jacobson, Tom Herbert
In-Reply-To: <1377607592.8828.149.camel@edumazet-glaptop>
On Tue, Aug 27, 2013 at 5:46 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> After hearing many people over past years complaining against TSO being
> bursty or even buggy, we are proud to present automatic sizing of TSO
> packets.
>
> One part of the problem is that tcp_tso_should_defer() uses an heuristic
> relying on upcoming ACKS instead of a timer, but more generally, having
> big TSO packets makes little sense for low rates, as it tends to create
> micro bursts on the network, and general consensus is to reduce the
> buffering amount.
>
> This patch introduces a per socket sk_pacing_rate, that approximates
> the current sending rate, and allows us to size the TSO packets so
> that we try to send one packet every ms.
>
> This field could be set by other transports.
>
> Patch has no impact for high speed flows, where having large TSO packets
> makes sense to reach line rate.
>
> For other flows, this helps better packet scheduling and ACK clocking.
>
> This patch increases performance of TCP flows in lossy environments.
>
> A new sysctl (tcp_min_tso_segs) is added, to specify the
> minimal size of a TSO packet (default being 2).
>
> A follow-up patch will provide a new packet scheduler (FQ), using
> sk_pacing_rate as an input to perform optional per flow pacing.
>
> This explains why we chose to set sk_pacing_rate to twice the current
> rate, allowing 'slow start' ramp up.
>
> sk_pacing_rate = 2 * cwnd * mss / srtt
>
> v2: Neal Cardwell reported a suspect deferring of last two segments on
> initial write of 10 MSS, I had to change tcp_tso_should_defer() to take
> into account tp->xmit_size_goal_segs
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> Cc: Yuchung Cheng <ycheng@google.com>
> Cc: Van Jacobson <vanj@google.com>
> Cc: Tom Herbert <therbert@google.com>
> ---
> v3: The change Yuchung suggested added a possibility of a divide by 0:
> On some (retransmits) case, srtt can be 0 because
> tcp_rtt_estimator() has not yet been called.
> Change the computation to remove this, and do not yet use usec
> as the units, but HZ. [ Its interesting to see jiffies_to_usecs()
> being an out of line function :( ]
>
> This version passed all our tests.
>
> Documentation/networking/ip-sysctl.txt | 9 ++++++
> include/net/sock.h | 2 +
> include/net/tcp.h | 1
> net/ipv4/sysctl_net_ipv4.c | 10 +++++++
> net/ipv4/tcp.c | 28 ++++++++++++++++----
> net/ipv4/tcp_input.c | 32 ++++++++++++++++++++++-
> net/ipv4/tcp_output.c | 2 -
> 7 files changed, 77 insertions(+), 7 deletions(-)
Acked-by: Yuchung Cheng <ycheng@google.com>
>
> diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
> index debfe85..ce5bb43 100644
> --- a/Documentation/networking/ip-sysctl.txt
> +++ b/Documentation/networking/ip-sysctl.txt
> @@ -482,6 +482,15 @@ tcp_syn_retries - INTEGER
> tcp_timestamps - BOOLEAN
> Enable timestamps as defined in RFC1323.
>
> +tcp_min_tso_segs - INTEGER
> + Minimal number of segments per TSO frame.
> + Since linux-3.12, TCP does an automatic sizing of TSO frames,
> + depending on flow rate, instead of filling 64Kbytes packets.
> + For specific usages, it's possible to force TCP to build big
> + TSO frames. Note that TCP stack might split too big TSO packets
> + if available window is too small.
> + Default: 2
> +
> tcp_tso_win_divisor - INTEGER
> This allows control over what percentage of the congestion window
> can be consumed by a single TSO frame.
> diff --git a/include/net/sock.h b/include/net/sock.h
> index e4bbcbf..6ba2e7b 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -232,6 +232,7 @@ struct cg_proto;
> * @sk_napi_id: id of the last napi context to receive data for sk
> * @sk_ll_usec: usecs to busypoll when there is no data
> * @sk_allocation: allocation mode
> + * @sk_pacing_rate: Pacing rate (if supported by transport/packet scheduler)
> * @sk_sndbuf: size of send buffer in bytes
> * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
> * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
> @@ -361,6 +362,7 @@ struct sock {
> kmemcheck_bitfield_end(flags);
> int sk_wmem_queued;
> gfp_t sk_allocation;
> + u32 sk_pacing_rate; /* bytes per second */
> netdev_features_t sk_route_caps;
> netdev_features_t sk_route_nocaps;
> int sk_gso_type;
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 09cb5c1..73fcd7c 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -281,6 +281,7 @@ extern int sysctl_tcp_early_retrans;
> extern int sysctl_tcp_limit_output_bytes;
> extern int sysctl_tcp_challenge_ack_limit;
> extern unsigned int sysctl_tcp_notsent_lowat;
> +extern int sysctl_tcp_min_tso_segs;
>
> extern atomic_long_t tcp_memory_allocated;
> extern struct percpu_counter tcp_sockets_allocated;
> diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
> index 8ed7c32..540279f 100644
> --- a/net/ipv4/sysctl_net_ipv4.c
> +++ b/net/ipv4/sysctl_net_ipv4.c
> @@ -29,6 +29,7 @@
> static int zero;
> static int one = 1;
> static int four = 4;
> +static int gso_max_segs = GSO_MAX_SEGS;
> static int tcp_retr1_max = 255;
> static int ip_local_port_range_min[] = { 1, 1 };
> static int ip_local_port_range_max[] = { 65535, 65535 };
> @@ -761,6 +762,15 @@ static struct ctl_table ipv4_table[] = {
> .extra2 = &four,
> },
> {
> + .procname = "tcp_min_tso_segs",
> + .data = &sysctl_tcp_min_tso_segs,
> + .maxlen = sizeof(int),
> + .mode = 0644,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = &zero,
> + .extra2 = &gso_max_segs,
> + },
> + {
> .procname = "udp_mem",
> .data = &sysctl_udp_mem,
> .maxlen = sizeof(sysctl_udp_mem),
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 4e42c03..fdf7409 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -283,6 +283,8 @@
>
> int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT;
>
> +int sysctl_tcp_min_tso_segs __read_mostly = 2;
> +
> struct percpu_counter tcp_orphan_count;
> EXPORT_SYMBOL_GPL(tcp_orphan_count);
>
> @@ -785,12 +787,28 @@ static unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now,
> xmit_size_goal = mss_now;
>
> if (large_allowed && sk_can_gso(sk)) {
> - xmit_size_goal = ((sk->sk_gso_max_size - 1) -
> - inet_csk(sk)->icsk_af_ops->net_header_len -
> - inet_csk(sk)->icsk_ext_hdr_len -
> - tp->tcp_header_len);
> + u32 gso_size, hlen;
> +
> + /* Maybe we should/could use sk->sk_prot->max_header here ? */
> + hlen = inet_csk(sk)->icsk_af_ops->net_header_len +
> + inet_csk(sk)->icsk_ext_hdr_len +
> + tp->tcp_header_len;
> +
> + /* Goal is to send at least one packet per ms,
> + * not one big TSO packet every 100 ms.
> + * This preserves ACK clocking and is consistent
> + * with tcp_tso_should_defer() heuristic.
> + */
> + gso_size = sk->sk_pacing_rate / (2 * MSEC_PER_SEC);
> + gso_size = max_t(u32, gso_size,
> + sysctl_tcp_min_tso_segs * mss_now);
> +
> + xmit_size_goal = min_t(u32, gso_size,
> + sk->sk_gso_max_size - 1 - hlen);
>
> - /* TSQ : try to have two TSO segments in flight */
> + /* TSQ : try to have at least two segments in flight
> + * (one in NIC TX ring, another in Qdisc)
> + */
> xmit_size_goal = min_t(u32, xmit_size_goal,
> sysctl_tcp_limit_output_bytes >> 1);
>
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index ec492ea..436c7e8 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -688,6 +688,34 @@ static void tcp_rtt_estimator(struct sock *sk, const __u32 mrtt)
> }
> }
>
> +/* Set the sk_pacing_rate to allow proper sizing of TSO packets.
> + * Note: TCP stack does not yet implement pacing.
> + * FQ packet scheduler can be used to implement cheap but effective
> + * TCP pacing, to smooth the burst on large writes when packets
> + * in flight is significantly lower than cwnd (or rwin)
> + */
> +static void tcp_update_pacing_rate(struct sock *sk)
> +{
> + const struct tcp_sock *tp = tcp_sk(sk);
> + u64 rate;
> +
> + /* set sk_pacing_rate to 200 % of current rate (mss * cwnd / srtt) */
> + rate = (u64)tp->mss_cache * 2 * (HZ << 3);
> +
> + rate *= max(tp->snd_cwnd, tp->packets_out);
> +
> + /* Correction for small srtt : minimum srtt being 8 (1 jiffy << 3),
> + * be conservative and assume srtt = 1 (125 us instead of 1.25 ms)
> + * We probably need usec resolution in the future.
> + * Note: This also takes care of possible srtt=0 case,
> + * when tcp_rtt_estimator() was not yet called.
> + */
> + if (tp->srtt > 8 + 2)
> + do_div(rate, tp->srtt);
> +
> + sk->sk_pacing_rate = min_t(u64, rate, ~0U);
> +}
> +
> /* Calculate rto without backoff. This is the second half of Van Jacobson's
> * routine referred to above.
> */
> @@ -3278,7 +3306,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
> u32 ack_seq = TCP_SKB_CB(skb)->seq;
> u32 ack = TCP_SKB_CB(skb)->ack_seq;
> bool is_dupack = false;
> - u32 prior_in_flight;
> + u32 prior_in_flight, prior_cwnd = tp->snd_cwnd, prior_rtt = tp->srtt;
> u32 prior_fackets;
> int prior_packets = tp->packets_out;
> const int prior_unsacked = tp->packets_out - tp->sacked_out;
> @@ -3383,6 +3411,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
>
> if (icsk->icsk_pending == ICSK_TIME_RETRANS)
> tcp_schedule_loss_probe(sk);
> + if (tp->srtt != prior_rtt || tp->snd_cwnd != prior_cwnd)
> + tcp_update_pacing_rate(sk);
> return 1;
>
> no_queue:
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 884efff..e63ae4c 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1631,7 +1631,7 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
>
> /* If a full-sized TSO skb can be sent, do it. */
> if (limit >= min_t(unsigned int, sk->sk_gso_max_size,
> - sk->sk_gso_max_segs * tp->mss_cache))
> + tp->xmit_size_goal_segs * tp->mss_cache))
> goto send_now;
>
> /* Middle in queue won't get any more data, full sendable already? */
>
>
^ permalink raw reply
* Source routing without rules?
From: Andy Lutomirski @ 2013-08-28 0:16 UTC (permalink / raw)
To: Network Development
I'm about to implement a trivial source routing policy for the third
time, and this is IMO stupid. I want to have two routes to a network.
Each route should specify a src, and, if the flow matches the src,
then that route should win.
The rules that don't work are:
ip route add <net> via <gw1> dev <dev1> metric 0
ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
Even if I bind a socket to dev2addr, the outgoing packets go out dev1
to gw1. This is exactly what I don't want to have happen.
This would fix it:
ip route add <net> via <gw1> dev <dev1> src <dev1addr> metric 0 match_src
ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
The semantics of match_src would be that, if set, the route only
matches if the flow has no assigned source address or if the assigned
source address matches.
(Also, if SO_BINDTODEVICE didn't require privilege, that would already
work. Should there be a sysctl to allow anyone to use
SO_BINDTODEVICE?)
--Andy
^ permalink raw reply
* [ethtool 3/3] ethtool: add ixgbevf support for register dump
From: Jeff Kirsher @ 2013-08-28 0:08 UTC (permalink / raw)
To: bhutchings; +Cc: Jacob Keller, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1377648529-8297-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
This patch adds support for the ixgbevf driver, which previously was printing
out as hex dump, and in the driver via printk. This patch corrects the
implementation to have a new ixgbevf_reg_dump function that will format the
register output in a more human readable format.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
Makefile.am | 2 +-
ethtool.c | 1 +
internal.h | 2 +
ixgbevf.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 184 insertions(+), 1 deletion(-)
create mode 100644 ixgbevf.c
diff --git a/Makefile.am b/Makefile.am
index ba1faa6..db89d94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,7 @@ ethtool_SOURCES = ethtool.c ethtool-copy.h internal.h net_tstamp-copy.h \
fec_8xx.c ibm_emac.c ixgb.c ixgbe.c natsemi.c \
pcnet32.c realtek.c tg3.c marvell.c vioc.c \
smsc911x.c at76c50x-usb.c sfc.c stmmac.c \
- rxclass.c sfpid.c sfpdiag.c
+ rxclass.c sfpid.c sfpdiag.c ixgbevf.c
TESTS = test-cmdline test-features
check_PROGRAMS = test-cmdline test-features
diff --git a/ethtool.c b/ethtool.c
index 3544f0e..dcdc0a9 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -875,6 +875,7 @@ static const struct {
{ "igb", igb_dump_regs },
{ "ixgb", ixgb_dump_regs },
{ "ixgbe", ixgbe_dump_regs },
+ { "ixgbevf", ixgbevf_dump_regs },
{ "natsemi", natsemi_dump_regs },
{ "e100", e100_dump_regs },
{ "amd8111e", amd8111e_dump_regs },
diff --git a/internal.h b/internal.h
index e977a81..86a64f2 100644
--- a/internal.h
+++ b/internal.h
@@ -213,6 +213,8 @@ int ixgb_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
int ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+int ixgbevf_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
+
/* Broadcom Tigon3 Ethernet controller */
int tg3_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs);
diff --git a/ixgbevf.c b/ixgbevf.c
new file mode 100644
index 0000000..dae1178
--- /dev/null
+++ b/ixgbevf.c
@@ -0,0 +1,180 @@
+/* Copyright (c) 2007 Intel Corporation */
+#include <stdio.h>
+#include "internal.h"
+
+int
+ixgbevf_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
+{
+ u32 *regs_buff = (u32 *)regs->data;
+ u8 version = (u8)(regs->version >> 24);
+ u8 i;
+
+ if (version == 0)
+ return -1;
+
+ fprintf(stdout,
+ "0x00000: VFCTRL (VF Control Register) (Write Only) N/A\n");
+
+ fprintf(stdout,
+ "0x00008: VFSTATUS (VF Status Register) 0x%08X\n",
+ regs_buff[1]);
+
+ fprintf(stdout,
+ "0x00010: VFLINKS (VF Link Status Register) 0x%08X\n",
+ regs_buff[2]);
+
+ fprintf(stdout,
+ "0x03190: VFRXMEMWRAP (Rx Packet Buffer Flush Detect) 0x%08X\n",
+ regs_buff[3]);
+
+ fprintf(stdout,
+ "0x00048: VFFRTIMER (VF Free Running Timer) 0x%08X\n",
+ regs_buff[4]);
+
+ fprintf(stdout,
+ "0x00100: VFEICR (VF Extended Interrupt Cause) 0x%08X\n",
+ regs_buff[5]);
+
+ fprintf(stdout,
+ "0x00104: VFEICS (VF Extended Interrupt Cause Set) 0x%08X\n",
+ regs_buff[6]);
+
+ fprintf(stdout,
+ "0x00108: VFEIMS (VF Extended Interrupt Mask Set) 0x%08X\n",
+ regs_buff[7]);
+
+ fprintf(stdout,
+ "0x0010C: VFEIMC (VF Extended Interrupt Mask Clear) 0x%08X\n",
+ regs_buff[8]);
+
+ fprintf(stdout,
+ "0x00110: VFEIAC (VF Extended Interrupt Auto Clear) 0x%08X\n",
+ regs_buff[9]);
+
+ fprintf(stdout,
+ "0x00114: VFEIAM (VF Extended Interrupt Auto Mask) 0x%08X\n",
+ regs_buff[10]);
+
+ fprintf(stdout,
+ "0x00820: VFEITR(0) (VF Extended Interrupt Throttle) 0x%08X\n",
+ regs_buff[11]);
+
+ fprintf(stdout,
+ "0x00120: VFIVAR(0) (VF Interrupt Vector Allocation) 0x%08X\n",
+ regs_buff[12]);
+
+ fprintf(stdout,
+ "0x00140: VFIVAR_MISC (VF Interrupt Vector Misc) 0x%08X\n",
+ regs_buff[13]);
+
+ fprintf(stdout,
+ "0x00104: VFPSRTYPE (VF Replication Packet Split Type) 0x%08X\n",
+ regs_buff[28]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDBAL(%d) (VF Rx Desc. Base Addr Low %d) 0x%08X\n",
+ 0x1000 + 0x40*i,
+ i, i,
+ regs_buff[14+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDBAH(%d) (VF Rx Desc. Base Addr High %d) 0x%08X\n",
+ 0x1004 + 0x40*i,
+ i, i,
+ regs_buff[16+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDLEN(%d) (VF Rx Desc. Length %d) 0x%08X\n",
+ 0x1008 + 0x40*i,
+ i, i,
+ regs_buff[18+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDH(%d) (VF Rx Desc. Head %d) 0x%08X\n",
+ 0x1010 + 0x40*i,
+ i, i,
+ regs_buff[20+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDT(%d) (VF Rx Desc. Tail %d) 0x%08X\n",
+ 0x1018 + 0x40*i,
+ i, i,
+ regs_buff[22+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFRDT(%d) (VF Rx Desc. Control %d), 0x%08X\n",
+ 0x1028 + 0x40*i,
+ i, i,
+ regs_buff[24+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFSRRCTL(%d) (VF Split Rx Control %d) 0x%08X\n",
+ 0x1014 + 0x40*i,
+ i, i,
+ regs_buff[26+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDBAL(%d) (VF Tx Desc. Base Addr Low %d) 0x%08X\n",
+ 0x2000 + 0x40*i,
+ i, i,
+ regs_buff[29+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDBAH(%d) (VF Tx Desc. Base Addr High %d) 0x%08X\n",
+ 0x2004 + 0x40*i,
+ i, i,
+ regs_buff[31+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDLEN(%d) (VF Tx Desc. Length %d) 0x%08X\n",
+ 0x2008 + 0x40*i,
+ i, i,
+ regs_buff[33+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDH(%d) (VF Tx Desc. Head %d) 0x%08X\n",
+ 0x2010 + 0x40*i,
+ i, i,
+ regs_buff[35+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDT(%d) (VF Tx Desc. Tail %d) 0x%08X\n",
+ 0x2018 + 0x40*i,
+ i, i,
+ regs_buff[37+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDT(%d) (VF Tx Desc. Control %d) 0x%08X\n",
+ 0x2028 + 0x40*i,
+ i, i,
+ regs_buff[39+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDWBAL(%d) (VF Tx Desc. Write Back Addr Lo %d) 0x%08X\n",
+ 0x2038 + 0x40*i,
+ i, i,
+ regs_buff[41+i]);
+
+ for (i = 0; i < 2; i++)
+ fprintf(stdout,
+ "0x%05x: VFTDWBAH(%d) (VF Tx Desc. Write Back Addr Hi %d) 0x%08X\n",
+ 0x203C + 0x40*i,
+ i, i,
+ regs_buff[43+i]);
+
+ return 0;
+}
--
1.8.3.1
^ permalink raw reply related
* [ethtool 1/3] ethtool: fix ixgbe 82598EB only registers
From: Jeff Kirsher @ 2013-08-28 0:08 UTC (permalink / raw)
To: bhutchings; +Cc: Jacob Keller, netdev, gospo, sassmann, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
This patch fixes ixgbe_reg_dump to only display registers specific to the
82598EB part, as these registers display 0xDEADBEEF otherwise, and clutter up
the register dump.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
ixgbe.c | 144 +++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 75 insertions(+), 69 deletions(-)
diff --git a/ixgbe.c b/ixgbe.c
index 9b005f2..89cb6be 100644
--- a/ixgbe.c
+++ b/ixgbe.c
@@ -342,9 +342,10 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x00000: MSIXT (MSI-X Table) 0x%08X\n",
regs_buff[26]);
- fprintf(stdout,
- "0x02000: MSIXPBA (MSI-X Pending Bit Array) 0x%08X\n",
- regs_buff[27]);
+ if (mac_type == ixgbe_mac_82598EB)
+ fprintf(stdout,
+ "0x02000: MSIXPBA (MSI-X Pending Bit Array) 0x%08X\n",
+ regs_buff[27]);
fprintf(stdout,
"0x11068: PBACL (MSI-X PBA Clear) 0x%08X\n",
@@ -436,9 +437,10 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x03000: RXCTRL (Receive Control) 0x%08X\n",
regs_buff[478]);
- fprintf(stdout,
- "0x03D04: DROPEN (Drop Enable Control) 0x%08X\n",
- regs_buff[479]);
+ if (mac_type == ixgbe_mac_82598EB)
+ fprintf(stdout,
+ "0x03D04: DROPEN (Drop Enable Control) 0x%08X\n",
+ regs_buff[479]);
/* Receive */
fprintf(stdout,
@@ -539,9 +541,10 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x%05X: DCA_TXCTRL%02d (Tx DCA Control %02d) 0x%08X\n",
0x07200 + (4 * i), i, i, regs_buff[794 + i]);
- fprintf(stdout,
- "0x0CB00: TIPG (Transmit IPG Control) 0x%08X\n",
- regs_buff[810]);
+ if (mac_type == ixgbe_mac_82598EB)
+ fprintf(stdout,
+ "0x0CB00: TIPG (Transmit IPG Control) 0x%08X\n",
+ regs_buff[810]);
for (i = 0; i < 8; i++)
fprintf(stdout,
@@ -598,29 +601,31 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x0CD00: PDPMCS (Pkt Data Plan Music ctrl Stat) 0x%08X\n",
regs_buff[831]);
- fprintf(stdout,
- "0x050A0: RUPPBMR (Rx User Prior to Pkt Buff Map) 0x%08X\n",
- regs_buff[832]);
-
- for (i = 0; i < 8; i++)
- fprintf(stdout,
- "0x%05X: RT2CR%d (Receive T2 Configure %d) 0x%08X\n",
- 0x03C20 + (4 * i), i, i, regs_buff[833 + i]);
-
- for (i = 0; i < 8; i++)
- fprintf(stdout,
- "0x%05X: RT2SR%d (Recieve T2 Status %d) 0x%08X\n",
- 0x03C40 + (4 * i), i, i, regs_buff[841 + i]);
-
- for (i = 0; i < 8; i++)
- fprintf(stdout,
- "0x%05X: TDTQ2TCCR%d (Tx Desc TQ2 TC Config %d) 0x%08X\n",
- 0x0602C + (0x40 * i), i, i, regs_buff[849 + i]);
-
- for (i = 0; i < 8; i++)
+ if (mac_type == ixgbe_mac_82598EB) {
fprintf(stdout,
- "0x%05X: TDTQ2TCSR%d (Tx Desc TQ2 TC Status %d) 0x%08X\n",
- 0x0622C + (0x40 * i), i, i, regs_buff[857 + i]);
+ "0x050A0: RUPPBMR (Rx User Prior to Pkt Buff Map) 0x%08X\n",
+ regs_buff[832]);
+
+ for (i = 0; i < 8; i++)
+ fprintf(stdout,
+ "0x%05X: RT2CR%d (Receive T2 Configure %d) 0x%08X\n",
+ 0x03C20 + (4 * i), i, i, regs_buff[833 + i]);
+
+ for (i = 0; i < 8; i++)
+ fprintf(stdout,
+ "0x%05X: RT2SR%d (Recieve T2 Status %d) 0x%08X\n",
+ 0x03C40 + (4 * i), i, i, regs_buff[841 + i]);
+
+ for (i = 0; i < 8; i++)
+ fprintf(stdout,
+ "0x%05X: TDTQ2TCCR%d (Tx Desc TQ2 TC Config %d) 0x%08X\n",
+ 0x0602C + (0x40 * i), i, i, regs_buff[849 + i]);
+
+ for (i = 0; i < 8; i++)
+ fprintf(stdout,
+ "0x%05X: TDTQ2TCSR%d (Tx Desc TQ2 TC Status %d) 0x%08X\n",
+ 0x0622C + (0x40 * i), i, i, regs_buff[857 + i]);
+ }
for (i = 0; i < 8; i++)
fprintf(stdout,
@@ -984,43 +989,42 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x042B0: ANLP2 (Auto Neg Lnk Part. Ctrl Word 2) 0x%08X\n",
regs_buff[1069]);
- fprintf(stdout,
- "0x04800: ATLASCTL (Atlas Analog Configuration) 0x%08X\n",
- regs_buff[1070]);
-
- /* Diagnostic */
- fprintf(stdout,
- "0x02C20: RDSTATCTL (Rx DMA Statistic Control) 0x%08X\n",
- regs_buff[1071]);
+ if (mac_type == ixgbe_mac_82598EB) {
+ fprintf(stdout,
+ "0x04800: ATLASCTL (Atlas Analog Configuration) 0x%08X\n",
+ regs_buff[1070]);
- for (i = 0; i < 8; i++)
+ /* Diagnostic */
fprintf(stdout,
- "0x%05X: RDSTAT%d (Rx DMA Statistics %d) 0x%08X\n",
- 0x02C00 + (4 * i), i, i, regs_buff[1072 + i]);
+ "0x02C20: RDSTATCTL (Rx DMA Statistic Control) 0x%08X\n",
+ regs_buff[1071]);
- fprintf(stdout,
- "0x02F08: RDHMPN (Rx Desc Handler Mem Page num) 0x%08X\n",
- regs_buff[1080]);
+ for (i = 0; i < 8; i++)
+ fprintf(stdout,
+ "0x%05X: RDSTAT%d (Rx DMA Statistics %d) 0x%08X\n",
+ 0x02C00 + (4 * i), i, i, regs_buff[1072 + i]);
- fprintf(stdout,
- "0x02F10: RIC_DW0 (Rx Desc Hand. Mem Read Data 0) 0x%08X\n",
- regs_buff[1081]);
+ fprintf(stdout,
+ "0x02F08: RDHMPN (Rx Desc Handler Mem Page num) 0x%08X\n",
+ regs_buff[1080]);
- fprintf(stdout,
- "0x02F14: RIC_DW1 (Rx Desc Hand. Mem Read Data 1) 0x%08X\n",
- regs_buff[1082]);
+ fprintf(stdout,
+ "0x02F10: RIC_DW0 (Rx Desc Hand. Mem Read Data 0) 0x%08X\n",
+ regs_buff[1081]);
- fprintf(stdout,
- "0x02F18: RIC_DW2 (Rx Desc Hand. Mem Read Data 2) 0x%08X\n",
- regs_buff[1083]);
+ fprintf(stdout,
+ "0x02F14: RIC_DW1 (Rx Desc Hand. Mem Read Data 1) 0x%08X\n",
+ regs_buff[1082]);
- fprintf(stdout,
- "0x02F1C: RIC_DW3 (Rx Desc Hand. Mem Read Data 3) 0x%08X\n",
- regs_buff[1084]);
+ fprintf(stdout,
+ "0x02F18: RIC_DW2 (Rx Desc Hand. Mem Read Data 2) 0x%08X\n",
+ regs_buff[1083]);
+
+ fprintf(stdout,
+ "0x02F1C: RIC_DW3 (Rx Desc Hand. Mem Read Data 3) 0x%08X\n",
+ regs_buff[1084]);
+ }
- fprintf(stdout,
- "0x02F20: RDPROBE (Rx Probe Mode Status) 0x%08X\n",
- regs_buff[1085]);
fprintf(stdout,
"0x07C20: TDSTATCTL (Tx DMA Statistic Control) 0x%08X\n",
@@ -1124,17 +1128,19 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x042CC: MDFTS (MAC DFT Status) 0x%08X\n",
regs_buff[1124]);
- fprintf(stdout,
- "0x1106C: PCIEECCCTL (PCIe ECC Control) 0x%08X\n",
- regs_buff[1125]);
+ if (mac_type == ixgbe_mac_82598EB) {
+ fprintf(stdout,
+ "0x1106C: PCIEECCCTL (PCIe ECC Control) 0x%08X\n",
+ regs_buff[1125]);
- fprintf(stdout,
- "0x0C300: PBTXECC (Packet Buffer Tx ECC) 0x%08X\n",
- regs_buff[1126]);
+ fprintf(stdout,
+ "0x0C300: PBTXECC (Packet Buffer Tx ECC) 0x%08X\n",
+ regs_buff[1126]);
- fprintf(stdout,
- "0x03300: PBRXECC (Packet Buffer Rx ECC) 0x%08X\n",
- regs_buff[1127]);
+ fprintf(stdout,
+ "0x03300: PBRXECC (Packet Buffer Rx ECC) 0x%08X\n",
+ regs_buff[1127]);
+ }
return 0;
}
--
1.8.3.1
^ permalink raw reply related
* [ethtool 2/3] ethtool: don't display some registers on ixgbe X540
From: Jeff Kirsher @ 2013-08-28 0:08 UTC (permalink / raw)
To: bhutchings; +Cc: Jacob Keller, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1377648529-8297-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
This patch modifies ixgbe_reg_dump to take into account registers removed in the
ixgbe X540 adapter. This adapter no longer has some of the registers, and thus
returns 0xDEADBEAF for the value. Rather than display this invalid register
value, modify ixgbe_reg_dump to only display these registers on older mac types.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
ixgbe.c | 154 ++++++++++++++++++++++++++++++++++------------------------------
1 file changed, 82 insertions(+), 72 deletions(-)
diff --git a/ixgbe.c b/ixgbe.c
index 89cb6be..854e463 100644
--- a/ixgbe.c
+++ b/ixgbe.c
@@ -869,41 +869,43 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
0x06034 + (0x40 * i), i, i, regs_buff[1022 + i]);
/* MAC */
- fprintf(stdout,
- "0x04200: PCS1GCFIG (PCS_1G Gloabal Config 1) 0x%08X\n",
- regs_buff[1038]);
+ if (mac_type < ixgbe_mac_X540) {
+ fprintf(stdout,
+ "0x04200: PCS1GCFIG (PCS_1G Gloabal Config 1) 0x%08X\n",
+ regs_buff[1038]);
- fprintf(stdout,
- "0x04208: PCS1GLCTL (PCS_1G Link Control) 0x%08X\n",
- regs_buff[1039]);
+ fprintf(stdout,
+ "0x04208: PCS1GLCTL (PCS_1G Link Control) 0x%08X\n",
+ regs_buff[1039]);
- fprintf(stdout,
- "0x0420C: PCS1GLSTA (PCS_1G Link Status) 0x%08X\n",
- regs_buff[1040]);
+ fprintf(stdout,
+ "0x0420C: PCS1GLSTA (PCS_1G Link Status) 0x%08X\n",
+ regs_buff[1040]);
- fprintf(stdout,
- "0x04210: PCS1GDBG0 (PCS_1G Debug 0) 0x%08X\n",
- regs_buff[1041]);
+ fprintf(stdout,
+ "0x04210: PCS1GDBG0 (PCS_1G Debug 0) 0x%08X\n",
+ regs_buff[1041]);
- fprintf(stdout,
- "0x04214: PCS1GDBG1 (PCS_1G Debug 1) 0x%08X\n",
- regs_buff[1042]);
+ fprintf(stdout,
+ "0x04214: PCS1GDBG1 (PCS_1G Debug 1) 0x%08X\n",
+ regs_buff[1042]);
- fprintf(stdout,
- "0x04218: PCS1GANA (PCS-1G Auto Neg. Adv.) 0x%08X\n",
- regs_buff[1043]);
+ fprintf(stdout,
+ "0x04218: PCS1GANA (PCS-1G Auto Neg. Adv.) 0x%08X\n",
+ regs_buff[1043]);
- fprintf(stdout,
- "0x0421C: PCS1GANLP (PCS-1G AN LP Ability) 0x%08X\n",
- regs_buff[1044]);
+ fprintf(stdout,
+ "0x0421C: PCS1GANLP (PCS-1G AN LP Ability) 0x%08X\n",
+ regs_buff[1044]);
- fprintf(stdout,
- "0x04220: PCS1GANNP (PCS_1G Auto Neg Next Page Tx) 0x%08X\n",
- regs_buff[1045]);
+ fprintf(stdout,
+ "0x04220: PCS1GANNP (PCS_1G Auto Neg Next Page Tx) 0x%08X\n",
+ regs_buff[1045]);
- fprintf(stdout,
- "0x04224: PCS1GANLPNP (PCS_1G Auto Neg LPs Next Page) 0x%08X\n",
- regs_buff[1046]);
+ fprintf(stdout,
+ "0x04224: PCS1GANLPNP (PCS_1G Auto Neg LPs Next Page) 0x%08X\n",
+ regs_buff[1046]);
+ }
fprintf(stdout,
"0x04244: HLREG1 (Highlander Status 1) 0x%08X\n",
@@ -949,45 +951,47 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x0426C: TREG (Test Register) 0x%08X\n",
regs_buff[1058]);
- fprintf(stdout,
- "0x04288: PCSS1 (XGXS Status 1) 0x%08X\n",
- regs_buff[1059]);
+ if (mac_type < ixgbe_mac_X540) {
+ fprintf(stdout,
+ "0x04288: PCSS1 (XGXS Status 1) 0x%08X\n",
+ regs_buff[1059]);
- fprintf(stdout,
- "0x0428C: PCSS2 (XGXS Status 2) 0x%08X\n",
- regs_buff[1060]);
+ fprintf(stdout,
+ "0x0428C: PCSS2 (XGXS Status 2) 0x%08X\n",
+ regs_buff[1060]);
- fprintf(stdout,
- "0x04290: XPCSS (10GBASE-X PCS Status) 0x%08X\n",
- regs_buff[1061]);
+ fprintf(stdout,
+ "0x04290: XPCSS (10GBASE-X PCS Status) 0x%08X\n",
+ regs_buff[1061]);
- fprintf(stdout,
- "0x04298: SERDESC (SERDES Interface Control) 0x%08X\n",
- regs_buff[1062]);
+ fprintf(stdout,
+ "0x04298: SERDESC (SERDES Interface Control) 0x%08X\n",
+ regs_buff[1062]);
- fprintf(stdout,
- "0x0429C: MACS (FIFO Status/CNTL Report) 0x%08X\n",
- regs_buff[1063]);
+ fprintf(stdout,
+ "0x0429C: MACS (FIFO Status/CNTL Report) 0x%08X\n",
+ regs_buff[1063]);
- fprintf(stdout,
- "0x042A0: AUTOC (Auto Negotiation Control) 0x%08X\n",
- regs_buff[1064]);
+ fprintf(stdout,
+ "0x042A0: AUTOC (Auto Negotiation Control) 0x%08X\n",
+ regs_buff[1064]);
- fprintf(stdout,
- "0x042A8: AUTOC2 (Auto Negotiation Control 2) 0x%08X\n",
- regs_buff[1066]);
+ fprintf(stdout,
+ "0x042A8: AUTOC2 (Auto Negotiation Control 2) 0x%08X\n",
+ regs_buff[1066]);
- fprintf(stdout,
- "0x042AC: AUTOC3 (Auto Negotiation Control 3) 0x%08X\n",
- regs_buff[1067]);
+ fprintf(stdout,
+ "0x042AC: AUTOC3 (Auto Negotiation Control 3) 0x%08X\n",
+ regs_buff[1067]);
- fprintf(stdout,
- "0x042B0: ANLP1 (Auto Neg Lnk Part. Ctrl Word 1) 0x%08X\n",
- regs_buff[1068]);
+ fprintf(stdout,
+ "0x042B0: ANLP1 (Auto Neg Lnk Part. Ctrl Word 1) 0x%08X\n",
+ regs_buff[1068]);
- fprintf(stdout,
- "0x042B0: ANLP2 (Auto Neg Lnk Part. Ctrl Word 2) 0x%08X\n",
- regs_buff[1069]);
+ fprintf(stdout,
+ "0x042B0: ANLP2 (Auto Neg Lnk Part. Ctrl Word 2) 0x%08X\n",
+ regs_buff[1069]);
+ }
if (mac_type == ixgbe_mac_82598EB) {
fprintf(stdout,
@@ -1025,6 +1029,10 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
regs_buff[1084]);
}
+ if (mac_type < ixgbe_mac_X540)
+ fprintf(stdout,
+ "0x02F20: RDPROBE (Rx Probe Mode Status) 0x%08X\n",
+ regs_buff[1085]);
fprintf(stdout,
"0x07C20: TDSTATCTL (Tx DMA Statistic Control) 0x%08X\n",
@@ -1108,25 +1116,27 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
"0x050A4: RFVAL (Receive Filter Validation) 0x%08X\n",
regs_buff[1119]);
- fprintf(stdout,
- "0x042B8: MDFTC1 (MAC DFT Control 1) 0x%08X\n",
- regs_buff[1120]);
+ if (mac_type < ixgbe_mac_X540) {
+ fprintf(stdout,
+ "0x042B8: MDFTC1 (MAC DFT Control 1) 0x%08X\n",
+ regs_buff[1120]);
- fprintf(stdout,
- "0x042C0: MDFTC2 (MAC DFT Control 2) 0x%08X\n",
- regs_buff[1121]);
+ fprintf(stdout,
+ "0x042C0: MDFTC2 (MAC DFT Control 2) 0x%08X\n",
+ regs_buff[1121]);
- fprintf(stdout,
- "0x042C4: MDFTFIFO1 (MAC DFT FIFO 1) 0x%08X\n",
- regs_buff[1122]);
+ fprintf(stdout,
+ "0x042C4: MDFTFIFO1 (MAC DFT FIFO 1) 0x%08X\n",
+ regs_buff[1122]);
- fprintf(stdout,
- "0x042C8: MDFTFIFO2 (MAC DFT FIFO 2) 0x%08X\n",
- regs_buff[1123]);
+ fprintf(stdout,
+ "0x042C8: MDFTFIFO2 (MAC DFT FIFO 2) 0x%08X\n",
+ regs_buff[1123]);
- fprintf(stdout,
- "0x042CC: MDFTS (MAC DFT Status) 0x%08X\n",
- regs_buff[1124]);
+ fprintf(stdout,
+ "0x042CC: MDFTS (MAC DFT Status) 0x%08X\n",
+ regs_buff[1124]);
+ }
if (mac_type == ixgbe_mac_82598EB) {
fprintf(stdout,
--
1.8.3.1
^ permalink raw reply related
* [PATCH] tcp: tcp_make_synack() should use sock_wmalloc
From: Phil Oester @ 2013-08-27 23:41 UTC (permalink / raw)
To: netdev, netfilter-devel; +Cc: eric.dumazet, pablo
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
In commit 90ba9b19 (tcp: tcp_make_synack() can use alloc_skb()), Eric changed
the call to sock_wmalloc in tcp_make_synack to alloc_skb. In doing so,
the netfilter owner match lost its ability to block the SYNACK packet on
outbound listening sockets. Revert the change, restoring the owner match
functionality.
This closes netfilter bugzilla #847.
Signed-off-by: Phil Oester <kernel@linuxace.com>
[-- Attachment #2: patch-tcp_make_synack --]
[-- Type: text/plain, Size: 469 bytes --]
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 92fde8d..362c5f7 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2670,7 +2670,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
int tcp_header_size;
int mss;
- skb = alloc_skb(MAX_TCP_HEADER + 15, sk_gfp_atomic(sk, GFP_ATOMIC));
+ skb = sock_wmalloc(sk, MAX_TCP_HEADER + 15, 1, GFP_ATOMIC);
if (unlikely(!skb)) {
dst_release(dst);
return NULL;
^ permalink raw reply related
* Re: [PATCH net-next] qdisc: allow setting default queuing discipline
From: Ben Greear @ 2013-08-27 23:22 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130827161908.26062336@nehalam.linuxnetplumber.net>
On 08/27/2013 04:19 PM, Stephen Hemminger wrote:
> By default, the pfifo_fast queue discipline has been used by default
> for all devices. But we have better choices now.
>
> This patch allow setting the default queueing discipline with sysctl.
> This allows easy use of better queueing disciplines on all devices
> without having to use tc qdisc scripts. It is intended to allow
> an easy path for distributions to make fq_codel or sfq the default
> qdisc.
>
> This patch also makes pfifo_fast more of a first class qdisc, since
> it is now possible to manually override the default and explicitly
> use pfifo_fast. The behavior for systems who do not use the sysctl
> is unchanged, they still get pfifo_fast
>
> Also removes leftover random # in sysctl net core.
> +CoDel (codel) or fair queue CoDel (fq_codel). Dont' use queuing disciplines
nit: Don't has typo above....
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH net-next] qdisc: allow setting default queuing discipline
From: Stephen Hemminger @ 2013-08-27 23:19 UTC (permalink / raw)
To: David Miller; +Cc: netdev
By default, the pfifo_fast queue discipline has been used by default
for all devices. But we have better choices now.
This patch allow setting the default queueing discipline with sysctl.
This allows easy use of better queueing disciplines on all devices
without having to use tc qdisc scripts. It is intended to allow
an easy path for distributions to make fq_codel or sfq the default
qdisc.
This patch also makes pfifo_fast more of a first class qdisc, since
it is now possible to manually override the default and explicitly
use pfifo_fast. The behavior for systems who do not use the sysctl
is unchanged, they still get pfifo_fast
Also removes leftover random # in sysctl net core.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
Documentation/sysctl/net.txt | 13 +++++++++
include/net/pkt_sched.h | 3 ++
include/net/sch_generic.h | 1
net/core/sysctl_net_core.c | 30 +++++++++++++++++++++-
net/sched/sch_api.c | 58 +++++++++++++++++++++++++++++++++++++++++++
net/sched/sch_generic.c | 11 ++++----
net/sched/sch_mq.c | 2 -
net/sched/sch_mqprio.c | 2 -
8 files changed, 112 insertions(+), 8 deletions(-)
--- a/net/core/sysctl_net_core.c 2013-08-25 22:08:17.927755151 -0700
+++ b/net/core/sysctl_net_core.c 2013-08-25 22:09:21.918913894 -0700
@@ -20,6 +20,7 @@
#include <net/sock.h>
#include <net/net_ratelimit.h>
#include <net/busy_poll.h>
+#include <net/pkt_sched.h>
static int zero = 0;
static int one = 1;
@@ -193,6 +194,26 @@ static int flow_limit_table_len_sysctl(s
}
#endif /* CONFIG_NET_FLOW_LIMIT */
+#ifdef CONFIG_NET_SCHED
+static int set_default_qdisc(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ char id[IFNAMSIZ];
+ struct ctl_table tbl = {
+ .data = id,
+ .maxlen = IFNAMSIZ,
+ };
+ int ret;
+
+ qdisc_get_default(id, IFNAMSIZ);
+
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+ if (write && ret == 0)
+ ret = qdisc_set_default(id);
+ return ret;
+}
+#endif
+
static struct ctl_table net_core_table[] = {
#ifdef CONFIG_NET
{
@@ -315,7 +336,14 @@ static struct ctl_table net_core_table[]
.mode = 0644,
.proc_handler = proc_dointvec
},
-#
+#endif
+#ifdef CONFIG_NET_SCHED
+ {
+ .procname = "default_qdisc",
+ .mode = 0644,
+ .maxlen = IFNAMSIZ,
+ .proc_handler = set_default_qdisc
+ },
#endif
#endif /* CONFIG_NET */
{
--- a/include/net/pkt_sched.h 2013-08-25 22:08:17.927755151 -0700
+++ b/include/net/pkt_sched.h 2013-08-25 22:09:21.918913894 -0700
@@ -85,6 +85,9 @@ struct Qdisc *fifo_create_dflt(struct Qd
int register_qdisc(struct Qdisc_ops *qops);
int unregister_qdisc(struct Qdisc_ops *qops);
+void qdisc_get_default(char *id, size_t len);
+int qdisc_set_default(const char *id);
+
void qdisc_list_del(struct Qdisc *q);
struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
--- a/include/net/sch_generic.h 2013-08-25 22:08:19.703731803 -0700
+++ b/include/net/sch_generic.h 2013-08-26 08:27:55.003303740 -0700
@@ -316,6 +316,7 @@ extern struct Qdisc noop_qdisc;
extern struct Qdisc_ops noop_qdisc_ops;
extern struct Qdisc_ops pfifo_fast_ops;
extern struct Qdisc_ops mq_qdisc_ops;
+extern const struct Qdisc_ops *default_qdisc_ops;
struct Qdisc_class_common {
u32 classid;
--- a/net/sched/sch_api.c 2013-08-25 22:08:17.927755151 -0700
+++ b/net/sched/sch_api.c 2013-08-26 08:35:17.793894501 -0700
@@ -131,6 +131,11 @@ static DEFINE_RWLOCK(qdisc_mod_lock);
************************************************/
+/* Qdisc to use by default */
+
+const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops;
+EXPORT_SYMBOL(default_qdisc_ops);
+
/* The list of all installed queueing disciplines. */
static struct Qdisc_ops *qdisc_base;
@@ -200,6 +205,58 @@ int unregister_qdisc(struct Qdisc_ops *q
}
EXPORT_SYMBOL(unregister_qdisc);
+/* Get default qdisc if not otherwise specified */
+void qdisc_get_default(char *name, size_t len)
+{
+ read_lock(&qdisc_mod_lock);
+ strlcpy(name, default_qdisc_ops->id, len);
+ read_unlock(&qdisc_mod_lock);
+}
+
+static struct Qdisc_ops *qdisc_lookup_default(const char *name)
+{
+ struct Qdisc_ops *q = NULL;
+
+ for (q = qdisc_base; q; q = q->next) {
+ if (!strcmp(name, q->id)) {
+ if (!try_module_get(q->owner))
+ q = NULL;
+ break;
+ }
+ }
+
+ return q;
+}
+
+/* Set new default qdisc to use */
+int qdisc_set_default(const char *name)
+{
+ const struct Qdisc_ops *ops;
+
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
+ write_lock(&qdisc_mod_lock);
+ ops = qdisc_lookup_default(name);
+ if (!ops) {
+ /* Not found, drop lock and try to load module */
+ write_unlock(&qdisc_mod_lock);
+ request_module("sch_%s", name);
+ write_lock(&qdisc_mod_lock);
+
+ ops = qdisc_lookup_default(name);
+ }
+
+ if (ops) {
+ /* Set new default */
+ module_put(default_qdisc_ops->owner);
+ default_qdisc_ops = ops;
+ }
+ write_unlock(&qdisc_mod_lock);
+
+ return ops ? 0 : -ENOENT;
+}
+
/* We know handle. Find qdisc among all qdisc's attached to device
(root qdisc, all its children, children of children etc.)
*/
@@ -1854,6 +1911,7 @@ static int __init pktsched_init(void)
return err;
}
+ register_qdisc(&pfifo_fast_ops);
register_qdisc(&pfifo_qdisc_ops);
register_qdisc(&bfifo_qdisc_ops);
register_qdisc(&pfifo_head_drop_qdisc_ops);
--- a/net/sched/sch_generic.c 2013-08-25 22:08:51.911308395 -0700
+++ b/net/sched/sch_generic.c 2013-08-26 08:27:27.819607861 -0700
@@ -530,7 +530,6 @@ struct Qdisc_ops pfifo_fast_ops __read_m
.dump = pfifo_fast_dump,
.owner = THIS_MODULE,
};
-EXPORT_SYMBOL(pfifo_fast_ops);
static struct lock_class_key qdisc_tx_busylock;
@@ -584,6 +583,9 @@ struct Qdisc *qdisc_create_dflt(struct n
{
struct Qdisc *sch;
+ if (!try_module_get(ops->owner))
+ goto errout;
+
sch = qdisc_alloc(dev_queue, ops);
if (IS_ERR(sch))
goto errout;
@@ -687,7 +689,7 @@ static void attach_one_default_qdisc(str
if (dev->tx_queue_len) {
qdisc = qdisc_create_dflt(dev_queue,
- &pfifo_fast_ops, TC_H_ROOT);
+ default_qdisc_ops, TC_H_ROOT);
if (!qdisc) {
netdev_info(dev, "activation failed\n");
return;
@@ -740,9 +742,8 @@ void dev_activate(struct net_device *dev
int need_watchdog;
/* No queueing discipline is attached to device;
- create default one i.e. pfifo_fast for devices,
- which need queueing and noqueue_qdisc for
- virtual interfaces
+ * create default one for devices, which need queueing
+ * and noqueue_qdisc for virtual interfaces
*/
if (dev->qdisc == &noop_qdisc)
--- a/net/sched/sch_mq.c 2013-08-25 22:08:17.927755151 -0700
+++ b/net/sched/sch_mq.c 2013-08-25 22:09:21.918913894 -0700
@@ -57,7 +57,7 @@ static int mq_init(struct Qdisc *sch, st
for (ntx = 0; ntx < dev->num_tx_queues; ntx++) {
dev_queue = netdev_get_tx_queue(dev, ntx);
- qdisc = qdisc_create_dflt(dev_queue, &pfifo_fast_ops,
+ qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops,
TC_H_MAKE(TC_H_MAJ(sch->handle),
TC_H_MIN(ntx + 1)));
if (qdisc == NULL)
--- a/net/sched/sch_mqprio.c 2013-08-25 22:08:17.927755151 -0700
+++ b/net/sched/sch_mqprio.c 2013-08-25 22:09:21.918913894 -0700
@@ -124,7 +124,7 @@ static int mqprio_init(struct Qdisc *sch
for (i = 0; i < dev->num_tx_queues; i++) {
dev_queue = netdev_get_tx_queue(dev, i);
- qdisc = qdisc_create_dflt(dev_queue, &pfifo_fast_ops,
+ qdisc = qdisc_create_dflt(dev_queue, default_qdisc_ops,
TC_H_MAKE(TC_H_MAJ(sch->handle),
TC_H_MIN(i + 1)));
if (qdisc == NULL) {
--- a/Documentation/sysctl/net.txt 2013-08-10 10:36:08.097545035 -0700
+++ b/Documentation/sysctl/net.txt 2013-08-25 22:37:26.658331785 -0700
@@ -50,6 +50,19 @@ The maximum number of packets that kerne
it's a Per-CPU variable.
Default: 64
+default_qdisc
+--------------
+
+The default queuing discipline to use for network devices. This allows
+overriding the default queue discipline of pfifo_fast with an
+alternative. Since the default queuing discipline is created with the
+no additional parameters so is best suited to queuing disciplines that
+work well without configuration like stochastic fair queue (sfq),
+CoDel (codel) or fair queue CoDel (fq_codel). Dont' use queuing disciplines
+like Hierarchical Token Bucket or Deficit Round Robin which require setting
+up classes and bandwidths.
+Default: pfifo_fast
+
busy_read
----------------
Low latency busy poll timeout for socket reads. (needs CONFIG_NET_RX_BUSY_POLL)
^ permalink raw reply
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