Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
From: Ian Campbell @ 2011-10-10 16:27 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: linux-mm@kvack.org, linux-kernel, Jens Axboe, Christoph Hellwig
In-Reply-To: <1318245101-16890-1-git-send-email-ian.campbell@citrix.com>

(reposting including LKML to catch other potential users)

Is this structure of any use to unify other instances of a similar
tuple, e.g. biovec, pagefrag etc?

Ian.

On Mon, 2011-10-10 at 12:11 +0100, Ian Campbell wrote:
> A few network drivers currently use skb_frag_struct for this purpose but I have
> patches which add additional fields and semantics there which these other uses
> do not want.
> 
> A structure for reference sub-page regions seems like a generally useful thing
> so do so instead of adding a network subsystem specific structure.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: linux-mm@kvack.org
> ---
>  include/linux/mm_types.h |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 774b895..dc1d103 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -135,6 +135,17 @@ struct page {
>  #endif
>  ;
>  
> +struct subpage {
> +	struct page *page;
> +#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
> +	__u32 page_offset;
> +	__u32 size;
> +#else
> +	__u16 page_offset;
> +	__u16 size;
> +#endif
> +};
> +
>  typedef unsigned long __nocast vm_flags_t;
>  
>  /*


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: [net-next 02/11] igb: Use node specific allocations for the q_vectors and rings
From: Alexander Duyck @ 2011-10-10 16:25 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Jeff Kirsher, davem, netdev, gospo, sassmann
In-Reply-To: <m21uum2g28.fsf@firstfloor.org>

On 10/09/2011 11:08 AM, Andi Kleen wrote:
> Jeff Kirsher <jeffrey.t.kirsher@intel.com> writes:
>>  
>>  	for (i = 0; i < adapter->num_tx_queues; i++) {
>> -		ring = kzalloc(sizeof(struct igb_ring), GFP_KERNEL);
>> +		if (orig_node == -1) {
>> +			int cur_node = next_online_node(adapter->node);
>> +			if (cur_node == MAX_NUMNODES)
>> +				cur_node = first_online_node;
> 
> RR seems quite arbitrary. Who guarantees those nodes have any
> relationship with the CPUs submitting on those queues? Or the node
> the device is on.
> 
> Anyways if it's a good idea probably need to add a
> dma_alloc_coherent_node() too
> 
> -Andi
> 

The RR configuration is somewhat arbitrary.  However it is still better
than dumping everyting on a single node, and it works with the
configuration when the rings numbers line up with the CPU numbers since
normally the CPUs are RR on the nodes.  From what I have seen it does
work quite well and it prevents almost all cross-node memory accesses
when running a routing workload.

I was thinking along the same lines for dma_alloc_coherent_node as well.
 I've been meaning to get to it but I just haven't had the time.  I'm
intentionally holding off on the ixgbe version of these patches until I
get the time to write up such a function.  At which time I was going to
write up a patch to convert igb over to it.

Thanks,

Alex

^ permalink raw reply

* Re: [PATCH] net: ipv6: Allow netlink to set IPv6 address scope
From: Brian Haley @ 2011-10-10 16:16 UTC (permalink / raw)
  To: Lorenzo Colitti; +Cc: maze, yoshfuji, netdev, c
In-Reply-To: <20111005201559.E544016A599@drone1.mtv.corp.google.com>

On 10/05/2011 04:15 PM, Lorenzo Colitti wrote:
> net: ipv6: Allow netlink to set IPv6 address scope
> 
> Currently, userspace cannot specify the scope of IPv6
> addresses when creating or modifying them. Instead, the
> scope is automatically determined from the address itself.
> In IPv4, userspace can set whatever scope it likes.
> 
> Allow userspace to specify the scope of IPv6 addresses in
> a backwards-compatible way: if the scope passed in is zero,
> use the old behaviour of automatically determining the
> scope based on the address.
> 
> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>

Hi Lorenzo,

I remember someone proposing a similar patch before and it was not accepted, do
you have a use case for doing this?  It just seems like it will cause problems.

Also, there are other parts of the kernel (NFS, SCTP, IPv6 multicast) that are
still calling ipv6_addr_scope() on a plain address - won't those be broken since
they'll return the correct, RFC-implied scope?

-Brian

^ permalink raw reply

* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
From: Christoph Hellwig @ 2011-10-10 16:19 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Christoph Hellwig, netdev@vger.kernel.org, linux-mm@kvack.org
In-Reply-To: <1318263059.21903.462.camel@zakaz.uk.xensource.com>

On Mon, Oct 10, 2011 at 05:10:59PM +0100, Ian Campbell wrote:
> This version sizes the fields according to page size, was there
> somewhere which wanted to use an offset > PAGE_SIZE (or size > PAGE_SIZE
> for that matter). That would be pretty odd and/or not really a candidate
> for using this datastructure?

I wasn't ever part of the fight myself and only vaguely remember it.
Try to get linux-kernel and Jens onto the Cc list to at least have the
major stakeholders informed.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: [net-next 02/11] igb: Use node specific allocations for the q_vectors and rings
From: Alexander Duyck @ 2011-10-10 16:15 UTC (permalink / raw)
  To: David Miller; +Cc: jeffrey.t.kirsher, netdev, gospo, sassmann
In-Reply-To: <20111008.155158.566839176815794249.davem@davemloft.net>

On 10/08/2011 12:51 PM, David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Fri,  7 Oct 2011 23:47:32 -0700
> 
>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>>
>> This change is meant to update the ring and vector allocations so that they
>> are per node instead of allocating everything on the node that
>> ifconfig/modprobe is called on.  By doing this we can cut down
>> significantly on cross node traffic.
>>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> Tested-by:  Aaron Brown  <aaron.f.brown@intel.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> 
> adapter->node seems superfluous.
> 
> It's always "-1" when we enter the allocation functions, and we
> always restore it to it's original value upon exit from such
> functions.
> 
> Just get rid of it and use a local variable in these functions
> to keep track of the current allocation node.
> 
> Also, what ensures that MSI-X interrupts are targetted to a cpu
> on the the node where you've made these allocations?  I was
> pretty sure Ben Hutchings added infrastructure that's usable
> to ensure this, but I can't see where you're using it.

Actually the main reason for having adapter->node is because in our
out-of-tree driver we end up using it as a module parameter in the event
that someone is running in single queue mode and wants to split up the
ports between nodes.  As such I would prefer to keep the parameter
around and just default it to -1 as I am currently doing.  However if it
must go I guess I can work around that sync-up issue.

In this case we don't have any guarantee other than the fact that most
people when trying to get performance will arrange their IRQs in a round
robin fashion.  However this approach is still preferred over just
allocating all of the rings on one node and incurring the possible
overhead for all of the access being primarily on a single node.  The
igb implementation doesn't have the code in place yet for the irq
affinity hints.  It is one of the few things remaining for me to sync up
between igb and ixgbe, however it is on my list of things to do.

Thanks,

Alex

^ permalink raw reply

* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
From: Ian Campbell @ 2011-10-10 16:10 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: netdev@vger.kernel.org, linux-mm@kvack.org
In-Reply-To: <20111010155557.GA15503@infradead.org>

On Mon, 2011-10-10 at 16:55 +0100, Christoph Hellwig wrote:
> On Mon, Oct 10, 2011 at 12:11:33PM +0100, Ian Campbell wrote:
> > A few network drivers currently use skb_frag_struct for this purpose but I have
> > patches which add additional fields and semantics there which these other uses
> > do not want.
> > 
> > A structure for reference sub-page regions seems like a generally useful thing
> > so do so instead of adding a network subsystem specific structure.
> 
> Subpage seems like a fairly bad name.  page_frag would fit into the
> scheme used in a few other places.

ok.

> The brings back the discussion of unifying the various incarnations we
> have of this (biovec, skb frag and there were a few more at times),
> but IIRC one of the sticking points back then was that one offset
> insistet in 32-bit offset/len and the other on 16-bit.

This version sizes the fields according to page size, was there
somewhere which wanted to use an offset > PAGE_SIZE (or size > PAGE_SIZE
for that matter). That would be pretty odd and/or not really a candidate
for using this datastructure?

Ian.

^ permalink raw reply

* Re: [PATCH] af_packet: tpacket_destruct_skb, deref skb after BUG_ON assertion
From: Eric Dumazet @ 2011-10-10 16:06 UTC (permalink / raw)
  To: danborkmann; +Cc: David S. Miller, netdev
In-Reply-To: <20111010100203.15066m7nvqod58cb@webmail.your-server.de>

Le lundi 10 octobre 2011 à 10:02 +0200, danborkmann@iogearbox.net a
écrit :

> Thanks, you're absolutely right! Here's the trivial patch:
> 
> af_packet: removed unnecessary BUG_ON assertion in tpacket_destruct_skb
> 

OK but a proper title should be 

[PATCH] af_packet: remove unnecessary BUG_ON() in tpacket_destruct_skb


> If skb is NULL, then stack trace is thrown on anyway on dereference.  
> Therefore,
> the stack trace triggered by BUG_ON is duplicate.
> 
> Signed-off-by: Daniel Borkmann <danborkmann@googlemail.com>
> 

missing "---" separator

> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index fabb4fa..886ae50 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -1170,8 +1170,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
>   	struct packet_sock *po = pkt_sk(skb->sk);
>   	void *ph;
> 
> -	BUG_ON(skb == NULL);
> -
>   	if (likely(po->tx_ring.pg_vec)) {
>   		ph = skb_shinfo(skb)->destructor_arg;
>   		BUG_ON(__packet_get_status(po, ph) != TP_STATUS_SENDING);
> 
> 

Please send a complete new mail without any history.

^ permalink raw reply

* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
From: Christoph Hellwig @ 2011-10-10 15:55 UTC (permalink / raw)
  To: Ian Campbell; +Cc: netdev, linux-mm
In-Reply-To: <1318245101-16890-1-git-send-email-ian.campbell@citrix.com>

On Mon, Oct 10, 2011 at 12:11:33PM +0100, Ian Campbell wrote:
> A few network drivers currently use skb_frag_struct for this purpose but I have
> patches which add additional fields and semantics there which these other uses
> do not want.
> 
> A structure for reference sub-page regions seems like a generally useful thing
> so do so instead of adding a network subsystem specific structure.

Subpage seems like a fairly bad name.  page_frag would fit into the
scheme used in a few other places.

The brings back the discussion of unifying the various incarnations we
have of this (biovec, skb frag and there were a few more at times),
but IIRC one of the sticking points back then was that one offset
insistet in 32-bit offset/len and the other on 16-bit.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: e100 + VLANs?
From: Eric Dumazet @ 2011-10-10 15:50 UTC (permalink / raw)
  To: David Lamparter; +Cc: Michael Tokarev, jeffrey.t.kirsher, netdev
In-Reply-To: <20111010152845.GC3260852@jupiter.n2.diac24.net>

Le lundi 10 octobre 2011 à 17:28 +0200, David Lamparter a écrit :

> Huh? The remote sends the ARP request to ff:f..f:ff, which has a VLAN
> tag in both dumps - but the packet sent from the e100 only has a tag in
> its own tcpdump... so it might pretty much wind up on the wire without a
> tag due to some TX bug...
> 

I read the reverse from the mail.

But this is probably the reverse :

MAC address of partner : 00:1f:c6:ef:e5:1b  (ASUSTek prefix)

MAC address of e100 : 00:90:27:30:6d:1c

^ permalink raw reply

* Re: e100 + VLANs?
From: David Lamparter @ 2011-10-10 15:28 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Lamparter, Michael Tokarev, jeffrey.t.kirsher, netdev
In-Reply-To: <1318260235.3227.5.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, Oct 10, 2011 at 05:23:55PM +0200, Eric Dumazet wrote:
> Le lundi 10 octobre 2011 à 17:13 +0200, David Lamparter a écrit :
> > On Mon, Oct 10, 2011 at 05:05:52PM +0200, Eric Dumazet wrote:
> > > > When pinging this NIC from another machine over VLAN5, I see
> > > > ARP packets coming to it, gets recognized and replies going
> > > > back, all on vlan 5.  But on the other side, replies comes
> > > > WITHOUT a VLAN tag!
> > > > 
> > > > From this NIC's point of view, capturing on whole ethX:
> > > > 
> > > > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 42
> > > > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 28
> > > > 
> > > > From the partner point of view, also on whole ethX:
> > > > 
> > > > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 28
> > > > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 46
> > > > 
> > > > So, the tag gets eaten somewhere along the way... ;)
> > 
> > Hmm. Looks like broken VLAN TX offload, but the driver doesn't even
> > implement VLAN offload. Maybe it's broken in its non-implementation...
> > 
> > Your "partner" is a known-good setup and can be assumed to be working
> > correctly? This is over a crossover cable, no evil switches involved?
> > 
> > > > And I can't really recreate the situation which I had - I know
> > > > some packets were flowing, so at least ARP worked.  Now it
> > > > does not work anymore.
> > > 
> > > What the 'partner' setup looks like ?
> > > 
> > > ip link
> > > ip addr
> > > ip ro
> > 
> > 'local' setup too please :)
> 
> But here, the remote cleary sends an answer without VLAN tag ;)

Huh? The remote sends the ARP request to ff:f..f:ff, which has a VLAN
tag in both dumps - but the packet sent from the e100 only has a tag in
its own tcpdump... so it might pretty much wind up on the wire without a
tag due to some TX bug...

-David

^ permalink raw reply

* Re: loopback IP alias breaks tftp?
From: Olaf van der Spek @ 2011-10-10 15:25 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Josh Boyer, Joel Sing, Julian Anastasov, netdev, francis.souyri
In-Reply-To: <1318260126.3227.4.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, Oct 10, 2011 at 5:22 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> Isn't that a bad way to work around this issue?
>> It'd require you to duplicate your IP config for every daemon that
>> listens on UDP interfaces.
>> What about IP addresses that are added/deleted after the daemon is launchad?
>>
>> Olaf
>
> Thats a pretty common problem, even prior to discussed commit.
>
> If you take a look at common UDP daemons, they have to setup a listener
> for each IP address, OR use the correct API ( setsockopt(fd, IPPROTO_IP,
> &on, sizeof(on)) and handle IP_PKTINFO ancillary message)

Only the latter solution seems right.

Olaf

^ permalink raw reply

* Re: e100 + VLANs?
From: Eric Dumazet @ 2011-10-10 15:23 UTC (permalink / raw)
  To: David Lamparter; +Cc: Michael Tokarev, jeffrey.t.kirsher, netdev
In-Reply-To: <20111010151343.GB3260852@jupiter.n2.diac24.net>

Le lundi 10 octobre 2011 à 17:13 +0200, David Lamparter a écrit :
> On Mon, Oct 10, 2011 at 05:05:52PM +0200, Eric Dumazet wrote:
> > > When pinging this NIC from another machine over VLAN5, I see
> > > ARP packets coming to it, gets recognized and replies going
> > > back, all on vlan 5.  But on the other side, replies comes
> > > WITHOUT a VLAN tag!
> > > 
> > > From this NIC's point of view, capturing on whole ethX:
> > > 
> > > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 42
> > > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 28
> > > 
> > > From the partner point of view, also on whole ethX:
> > > 
> > > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 28
> > > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 46
> > > 
> > > So, the tag gets eaten somewhere along the way... ;)
> 
> Hmm. Looks like broken VLAN TX offload, but the driver doesn't even
> implement VLAN offload. Maybe it's broken in its non-implementation...
> 
> Your "partner" is a known-good setup and can be assumed to be working
> correctly? This is over a crossover cable, no evil switches involved?
> 
> > > And I can't really recreate the situation which I had - I know
> > > some packets were flowing, so at least ARP worked.  Now it
> > > does not work anymore.
> > 
> > What the 'partner' setup looks like ?
> > 
> > ip link
> > ip addr
> > ip ro
> 
> 'local' setup too please :)

But here, the remote cleary sends an answer without VLAN tag ;)

Maybe its a tg3 (we had a buggy driver until very recent change), or
tcpdump is not up2date...

^ permalink raw reply

* Re: loopback IP alias breaks tftp?
From: Eric Dumazet @ 2011-10-10 15:22 UTC (permalink / raw)
  To: Olaf van der Spek
  Cc: Josh Boyer, Joel Sing, Julian Anastasov, netdev, francis.souyri
In-Reply-To: <CAGVGHmsF3JBqpqzKa_Fp6oOcVKX5BKgJUG=UJvPZcNgKiSsrRA@mail.gmail.com>

Le lundi 10 octobre 2011 à 17:15 +0200, Olaf van der Spek a écrit :
> > On Fri, Oct 07, 2011 at 02:23:21PM +0200, Eric Dumazet wrote:
> >> By the way, there is no need for tftp change :
> >>
> >> Just launch several tftpd instances, and bind each them to one
> >> particular IP.
> >>
> >> If started from xinetd.d :
> 
> Isn't that a bad way to work around this issue?
> It'd require you to duplicate your IP config for every daemon that
> listens on UDP interfaces.
> What about IP addresses that are added/deleted after the daemon is launchad?
> 
> Olaf

Thats a pretty common problem, even prior to discussed commit.

If you take a look at common UDP daemons, they have to setup a listener
for each IP address, OR use the correct API ( setsockopt(fd, IPPROTO_IP,
&on, sizeof(on)) and handle IP_PKTINFO ancillary message)

^ permalink raw reply

* Re: loopback IP alias breaks tftp?
From: Olaf van der Spek @ 2011-10-10 15:15 UTC (permalink / raw)
  To: Josh Boyer
  Cc: Eric Dumazet, Joel Sing, Julian Anastasov, netdev, francis.souyri
In-Reply-To: <20111010151058.GD1165@zod.bos.redhat.com>

> On Fri, Oct 07, 2011 at 02:23:21PM +0200, Eric Dumazet wrote:
>> By the way, there is no need for tftp change :
>>
>> Just launch several tftpd instances, and bind each them to one
>> particular IP.
>>
>> If started from xinetd.d :

Isn't that a bad way to work around this issue?
It'd require you to duplicate your IP config for every daemon that
listens on UDP interfaces.
What about IP addresses that are added/deleted after the daemon is launchad?

Olaf

^ permalink raw reply

* Re: [PATCH 9/9] net: add opaque struct around skb frag page
From: Ian Campbell @ 2011-10-10 15:13 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev@vger.kernel.org
In-Reply-To: <1318259375.3227.1.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, 2011-10-10 at 16:09 +0100, Eric Dumazet wrote:
> Le lundi 10 octobre 2011 à 12:11 +0100, Ian Campbell a écrit :
> > I've split this bit out of the skb frag destructor patch since it helps enforce
> > the use of the fragment API.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> >  include/linux/skbuff.h |   10 ++++++----
> >  net/core/skbuff.c      |    6 +++---
> >  2 files changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index ac6b05a..f881d75 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -135,7 +135,9 @@ struct sk_buff;
> >  typedef struct skb_frag_struct skb_frag_t;
> >  
> >  struct skb_frag_struct {
> > -	struct page *page;
> > +	struct {
> > +		struct page *p;
> > +	} page;
> 
> Oh well, why dont you rename page to something else, say frag_page ?

I looked at renaming this field and the impact was far larger than this
(already huge) set of series.

Keeping the name for the outer struct also has the nice property that
when the struct becomes something like:

	struct {
		struct page *p;
		struct skb_frag_destructor *destr;
	} page;

existing code which does
	fraga->page = fragb->page
will carry the destructor along magically without needing modification.

Ian.

> 
> 
> 

^ permalink raw reply

* Re: e100 + VLANs?
From: David Lamparter @ 2011-10-10 15:13 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Michael Tokarev, David Lamparter, jeffrey.t.kirsher, netdev
In-Reply-To: <1318259152.3227.0.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Mon, Oct 10, 2011 at 05:05:52PM +0200, Eric Dumazet wrote:
> > When pinging this NIC from another machine over VLAN5, I see
> > ARP packets coming to it, gets recognized and replies going
> > back, all on vlan 5.  But on the other side, replies comes
> > WITHOUT a VLAN tag!
> > 
> > From this NIC's point of view, capturing on whole ethX:
> > 
> > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 42
> > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 28
> > 
> > From the partner point of view, also on whole ethX:
> > 
> > 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 28
> > 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 46
> > 
> > So, the tag gets eaten somewhere along the way... ;)

Hmm. Looks like broken VLAN TX offload, but the driver doesn't even
implement VLAN offload. Maybe it's broken in its non-implementation...

Your "partner" is a known-good setup and can be assumed to be working
correctly? This is over a crossover cable, no evil switches involved?

> > And I can't really recreate the situation which I had - I know
> > some packets were flowing, so at least ARP worked.  Now it
> > does not work anymore.
> 
> What the 'partner' setup looks like ?
> 
> ip link
> ip addr
> ip ro

'local' setup too please :)


-David

^ permalink raw reply

* Re: loopback IP alias breaks tftp?
From: Josh Boyer @ 2011-10-10 15:10 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Joel Sing, Julian Anastasov, netdev, francis.souyri
In-Reply-To: <1317990201.3207.15.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On Fri, Oct 07, 2011 at 02:23:21PM +0200, Eric Dumazet wrote:
> Le vendredi 07 octobre 2011 à 14:04 +0200, Eric Dumazet a écrit :
> 
> > Its a completely different problem IMHO : You describe a tftp server
> > bug.
> > 
> > Say your tftp server is multihomed with 3 different IPS : 
> > 
> > 192.168.20.21, 192.168.20.22, 192.168.20.23
> > 
> > And tftp server listens to any address (UDP port 69) : 0.0.0.0:69
> > 
> > When receiving a request on 192.168.20.22, it should use same source
> > address, not let the system chose a "random or whatever policy" one.
> > 
> > 
> > 
> > So I would suggest to check/fix if TFTP server uses the correct socket
> > API to get both the client IP and its own IP in each UDP datagram
> > 
> > -> setsockopt(fd, IPPROTO_IP, &on, sizeof(on))
> 
> > This permits tftp server to use the same "struct in_pktinfo" for replies, forcing a correct source address.
> > 
> 
> By the way, there is no need for tftp change :
> 
> Just launch several tftpd instances, and bind each them to one
> particular IP.
> 
> If started from xinetd.d :
> 
> $ cat /etc/xinetd.d/tftp1
> service tftp
> {
> 	socket_type		= dgram
> 	protocol		= udp
> 	wait			= yes
> 	user			= root
> 	server			= /usr/sbin/in.tftpd
> 	server_args		= -s /tftpboot
> 	disable			= no
> 	bind		= 192.168.20.21
> 	per_source		= 11
> 	cps			= 100 2
> 	flags			= IPv4
> }

(I've CC'd the original bug reporter now.)

I did this locally and it still timed out.  So the bind alone is not
enough to fix the problem.  At least not on lo:0 127.0.0.2.

Changing the source address in the routing table as Joel suggested does
work around the problem.

So, in summary,  either the TFTP server needs to be changed per your
original suggestion, or the routing table needs to be altered for every
alias?  Is that correct?

josh

^ permalink raw reply

* Re: [PATCH 9/9] net: add opaque struct around skb frag page
From: Eric Dumazet @ 2011-10-10 15:09 UTC (permalink / raw)
  To: Ian Campbell; +Cc: netdev
In-Reply-To: <1318245101-16890-9-git-send-email-ian.campbell@citrix.com>

Le lundi 10 octobre 2011 à 12:11 +0100, Ian Campbell a écrit :
> I've split this bit out of the skb frag destructor patch since it helps enforce
> the use of the fragment API.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  include/linux/skbuff.h |   10 ++++++----
>  net/core/skbuff.c      |    6 +++---
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index ac6b05a..f881d75 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -135,7 +135,9 @@ struct sk_buff;
>  typedef struct skb_frag_struct skb_frag_t;
>  
>  struct skb_frag_struct {
> -	struct page *page;
> +	struct {
> +		struct page *p;
> +	} page;

Oh well, why dont you rename page to something else, say frag_page ?

^ permalink raw reply

* Re: e100 + VLANs?
From: Eric Dumazet @ 2011-10-10 15:05 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: David Lamparter, jeffrey.t.kirsher, netdev
In-Reply-To: <4E9307CB.4050704@msgid.tls.msk.ru>

Le lundi 10 octobre 2011 à 18:57 +0400, Michael Tokarev a écrit :
> 10.10.2011 14:19, David Lamparter wrote:
> > On Sat, Oct 08, 2011 at 11:34:40AM -0700, Jeff Kirsher wrote:
> >> On 10/08/2011 09:24 AM, Eric Dumazet wrote:
> >>> Le samedi 08 octobre 2011 à 14:08 +0400, Michael Tokarev a écrit :
> >>>>> Yesterday I tried to use 802.1Q VLAN tagging with an (oldish)
> >>>>> e100-driven network card, identified by lspci like this:
> >>>>>
> >>>>>  00:12.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 02)
> >>>>>
> >>>>> Just to discover that it does not quite work: packets of
> >>>>> size 1497+ bytes gets lost.
> > [...]
> >>> e100 driver seems VLAN enabled at a first glance.
> >> Eric is correct, that e100 does support VLANs.
> >>
> >> In addition to Eric's suggestion, can you also provide all the output of
> >> lspci -vvv for the network card?
> > 
> > I'm opening the lore box here, but early e100 cards AFAIK have a 
> > hardware limit at 1500 (+18 src/dst/proto) bytes. At least, Juniper's
> > JUNOS does not support full-sized .1Q on their e100 control plane
> > interfaces...
> 
> Thank you all for the suggestions and feedback.
> 
> The card may indeed be quite old, I don't know where it come from and
> when.  Here's lspci -vvv for it:
> 
> 00:12.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 02)
> 	Subsystem: Intel Corporation EtherExpress PRO/100B (TX)
> 	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
> 	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> 	Latency: 66 (2000ns min, 14000ns max)
> 	Interrupt: pin A routed to IRQ 11
> 	Region 0: Memory at fe200000 (32-bit, prefetchable) [size=4K]
> 	Region 1: I/O ports at 2400 [size=32]
> 	Region 2: Memory at fc000000 (32-bit, non-prefetchable) [size=1M]
> 	[virtual] Expansion ROM at 30100000 [disabled] [size=1M]
> 	Kernel driver in use: e100
> 
> 
> I tried to set it up to talk to another machine in order to find
> out where the packets gets lost.  But had another complication
> on the way: it does not "want" to work with 802.1Q VLANs anymore
> at all... ;)
> 
> When pinging this NIC from another machine over VLAN5, I see
> ARP packets coming to it, gets recognized and replies going
> back, all on vlan 5.  But on the other side, replies comes
> WITHOUT a VLAN tag!
> 
> From this NIC's point of view, capturing on whole ethX:
> 
> 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 42
> 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 28
> 
> From the partner point of view, also on whole ethX:
> 
> 00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 28
> 00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 46
> 
> So, the tag gets eaten somewhere along the way... ;)
> 
> And I can't really recreate the situation which I had - I know
> some packets were flowing, so at least ARP worked.  Now it
> does not work anymore.

What the 'partner' setup looks like ?

ip link
ip addr
ip ro

^ permalink raw reply

* Re: e100 + VLANs?
From: Michael Tokarev @ 2011-10-10 14:57 UTC (permalink / raw)
  To: David Lamparter; +Cc: jeffrey.t.kirsher, Eric Dumazet, netdev
In-Reply-To: <20111010101954.GB2840382@jupiter.n2.diac24.net>

10.10.2011 14:19, David Lamparter wrote:
> On Sat, Oct 08, 2011 at 11:34:40AM -0700, Jeff Kirsher wrote:
>> On 10/08/2011 09:24 AM, Eric Dumazet wrote:
>>> Le samedi 08 octobre 2011 à 14:08 +0400, Michael Tokarev a écrit :
>>>>> Yesterday I tried to use 802.1Q VLAN tagging with an (oldish)
>>>>> e100-driven network card, identified by lspci like this:
>>>>>
>>>>>  00:12.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 02)
>>>>>
>>>>> Just to discover that it does not quite work: packets of
>>>>> size 1497+ bytes gets lost.
> [...]
>>> e100 driver seems VLAN enabled at a first glance.
>> Eric is correct, that e100 does support VLANs.
>>
>> In addition to Eric's suggestion, can you also provide all the output of
>> lspci -vvv for the network card?
> 
> I'm opening the lore box here, but early e100 cards AFAIK have a 
> hardware limit at 1500 (+18 src/dst/proto) bytes. At least, Juniper's
> JUNOS does not support full-sized .1Q on their e100 control plane
> interfaces...

Thank you all for the suggestions and feedback.

The card may indeed be quite old, I don't know where it come from and
when.  Here's lspci -vvv for it:

00:12.0 Ethernet controller: Intel Corporation 82557/8/9/0/1 Ethernet Pro 100 (rev 02)
	Subsystem: Intel Corporation EtherExpress PRO/100B (TX)
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 66 (2000ns min, 14000ns max)
	Interrupt: pin A routed to IRQ 11
	Region 0: Memory at fe200000 (32-bit, prefetchable) [size=4K]
	Region 1: I/O ports at 2400 [size=32]
	Region 2: Memory at fc000000 (32-bit, non-prefetchable) [size=1M]
	[virtual] Expansion ROM at 30100000 [disabled] [size=1M]
	Kernel driver in use: e100


I tried to set it up to talk to another machine in order to find
out where the packets gets lost.  But had another complication
on the way: it does not "want" to work with 802.1Q VLANs anymore
at all... ;)

When pinging this NIC from another machine over VLAN5, I see
ARP packets coming to it, gets recognized and replies going
back, all on vlan 5.  But on the other side, replies comes
WITHOUT a VLAN tag!

From this NIC's point of view, capturing on whole ethX:

00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 60: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 42
00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 28

From the partner point of view, also on whole ethX:

00:1f:c6:ef:e5:1b > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 5, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.48.11.2 tell 10.48.11.1, length 28
00:90:27:30:6d:1c > 00:1f:c6:ef:e5:1b, ethertype ARP (0x0806), length 60: Ethernet (len 6), IPv4 (len 4), Reply 10.48.11.2 is-at 00:90:27:30:6d:1c, length 46

So, the tag gets eaten somewhere along the way... ;)

And I can't really recreate the situation which I had - I know
some packets were flowing, so at least ARP worked.  Now it
does not work anymore.

Hmm.... ;)

Thank you!

/mjt

^ permalink raw reply

* Re: net/fec on i.MX28: failure after network cable unplug or device down
From: Lothar Waßmann @ 2011-10-10 13:52 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: netdev, Shawn Guo, Wolfram Sang
In-Reply-To: <20111010131705.GA25293@pengutronix.de>

[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 846 bytes --]

Hi,

Uwe Kleine-König writes:
> Hello,
> 
> I currently see the problem on two different i.MX28 based system
> (Freescale's mx28evk and a Karo TX28) that after unplugging and
> reconnection of the network cable or ifconfig down; ifconfig up; the
> network is dead. That means nothing is sent or received anymore.
> 
I already solved this problem (and some others too), but wasn't able
to send any patch yet.

The FEC of the i.MX28 requires the ETHER_EN bit in the ECR to be set
for the MII interface to work. Resetting the interface upon shutdown
is required though, because otherwise the receiver will remain active
and use the stale DMA descriptors in memory to store received packets!

Furthermore the (R)MII mode must be configured correctly in the RCR
register.

The current state of my patch is appended for reference.


Lothar Waßmann
-- 

[-- Attachment #2: fec-cleanup --]
[-- Type: application/octet-stream, Size: 3610 bytes --]

Index: linux/drivers/net/fec.c
===================================================================
--- linux.orig/drivers/net/fec.c	2011-09-13 09:58:38.000000000 +0200
+++ linux/drivers/net/fec.c	2011-09-13 09:58:41.000000000 +0200
@@ -486,10 +486,16 @@
 	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 }
 
+/* prevent the FEC from transmitting/receiving packets, but leave
+ * the MII interface active to detect link change
+ */
 static void
 fec_stop(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
+	const struct platform_device_id *id_entry =
+				platform_get_device_id(fep->pdev);
+	u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8);
 
 	/* We cannot expect a graceful transmit stop without link !!! */
 	if (fep->link) {
@@ -504,8 +510,33 @@
 	udelay(10);
 	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
 	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+
+	if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
+		/* i.MX28 requires ETHER_EN enabled to be able to
+		 * access the PHY registers and the RMII mode properly set to
+		 * be able to detect link changes
+		 */
+		writel(2, fep->hwp + FEC_ECNTRL);
+		writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
+	}
 }
 
+/* shutdown the FEC and the MII interface */
+static void
+fec_shutdown(struct net_device *ndev)
+{
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	/* We cannot expect a graceful transmit stop without link !!! */
+	if (fep->link) {
+		writel(1, fep->hwp + FEC_X_CNTRL); /* Graceful transmit stop */
+		udelay(10);
+		if (!(readl(fep->hwp + FEC_IEVENT) & FEC_ENET_GRA))
+			printk("fec_stop : Graceful transmit stop did not complete !\n");
+	}
+
+	writel(0, fep->hwp + FEC_ECNTRL);
+}
 
 static void
 fec_timeout(struct net_device *ndev)
@@ -789,7 +820,7 @@
 			iap = (unsigned char *)FEC_FLASHMAC;
 #else
 		if (pdata)
-			memcpy(iap, pdata->mac, ETH_ALEN);
+			iap = (unsigned char *)&pdata->mac;
 #endif
 	}
 
@@ -836,6 +867,8 @@
 	if (phy_dev->link) {
 		if (fep->full_duplex != phy_dev->duplex) {
 			fec_restart(ndev, phy_dev->duplex);
+			/* prevent unnecessary second fec_restart() below */
+			fep->link = phy_dev->link;
 			status_change = 1;
 		}
 	}
@@ -1052,8 +1085,6 @@
 
 static void fec_enet_mii_remove(struct fec_enet_private *fep)
 {
-	if (fep->phy_dev)
-		phy_disconnect(fep->phy_dev);
 	mdiobus_unregister(fep->mii_bus);
 	kfree(fep->mii_bus->irq);
 	mdiobus_free(fep->mii_bus);
@@ -1184,6 +1215,8 @@
 fec_enet_open(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
+	const struct platform_device_id *id_entry =
+				platform_get_device_id(fep->pdev);
 	int ret;
 
 	/* I should reset the ring buffers here, but I don't yet know
@@ -1214,7 +1247,7 @@
 	/* Don't know what to do yet. */
 	fep->opened = 0;
 	netif_stop_queue(ndev);
-	fec_stop(ndev);
+	fec_shutdown(ndev);
 
 	if (fep->phy_dev) {
 		phy_stop(fep->phy_dev);
@@ -1518,7 +1551,7 @@
 		}
 	}
 
-	fep->clk = clk_get(&pdev->dev, "fec_clk");
+	fep->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(fep->clk)) {
 		ret = PTR_ERR(fep->clk);
 		goto failed_clk;
@@ -1570,13 +1603,18 @@
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	struct resource *r;
+	int i;
 
-	fec_stop(ndev);
+	unregister_netdev(ndev);
 	fec_enet_mii_remove(fep);
+	for (i = 0; i < 3; i++) {
+		int irq = platform_get_irq(pdev, i);
+		if (irq > 0)
+			free_irq(irq, ndev);
+	}
 	clk_disable(fep->clk);
 	clk_put(fep->clk);
 	iounmap(fep->hwp);
-	unregister_netdev(ndev);
 	free_netdev(ndev);
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);

[-- Attachment #3: message body text --]
[-- Type: text/plain, Size: 367 bytes --]

___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

^ permalink raw reply

* Re:await your response
From: Chang @ 2011-10-10 10:15 UTC (permalink / raw)


My name is Mr Young Chang, Head of operation Mevas Bank here in Hong Kong. I have a business proposal that i will like you to handle with me from my bank worth 19.7m USD 

^ permalink raw reply

* net/fec on i.MX28: failure after network cable unplug or device down
From: Uwe Kleine-König @ 2011-10-10 13:17 UTC (permalink / raw)
  To: netdev; +Cc: Shawn Guo, Wolfram Sang, Lothar Waßmann

Hello,

I currently see the problem on two different i.MX28 based system
(Freescale's mx28evk and a Karo TX28) that after unplugging and
reconnection of the network cable or ifconfig down; ifconfig up; the
network is dead. That means nothing is sent or received anymore.

ifconfig up dies with:

	[   32.120000] FEC: MDIO read timeout
	[   32.120000] eth0: could not attach to PHY
	ifconfig: SIOCSIFFLAGS: Connection timed out

after unplugging the network cable I get:

	[   25.520000] PHY: 1:00 - Link is Down
	[   26.530000] FEC: MDIO read timeout

In both cases the mdio read operation doesn't fire the mii irq, though
the FEC_MII_DATA contains data that looks right and the interrupt
register (FEC_IEVENT) has the mii bit set and according to the mask
register (FEC_IMASK) the irq isn't masked.

When commenting out

	writel(1, fep->hwp + FEC_ECNTRL);

(i.e. don't reset the network unit) in fec_stop it works (but Wolfram
seems to remember that doing so breaks e.g. i.MX35. We have not checked
yet).

Strange enough with the reset commented out in fec_stop, fec_restart
resets the fec (when the cable is reconnected) but without breaking it.

I tried to restore more registers in fec_stop (most notably FEC_R_CNTRL
that has some mii fields) but without success.

Do you see this problem, too? Maybe do you have an idea to fix it?
Currently I use the following patch:

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 5b631fe..8c1330f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -458,6 +458,8 @@ static void
 fec_stop(struct net_device *ndev)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
+	const struct platform_device_id *id_entry =
+				platform_get_device_id(fep->pdev);
 
 	/* We cannot expect a graceful transmit stop without link !!! */
 	if (fep->link) {
@@ -467,11 +469,13 @@ fec_stop(struct net_device *ndev)
 			printk("fec_stop : Graceful transmit stop did not complete !\n");
 	}
 
-	/* Whack a reset.  We should wait for this. */
-	writel(1, fep->hwp + FEC_ECNTRL);
-	udelay(10);
-	writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
-	writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+	if (!(id_entry->driver_data & FEC_QUIRK_ENET_MAC)) {
+		/* Whack a reset.  We should wait for this. */
+		writel(1, fep->hwp + FEC_ECNTRL);
+		udelay(10);
+		writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
+		writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
+	}
 }
 
but this feels wrong because sending and receiving isn't disabled in
hardware without link then.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply related

* Re: [PATCH 1/9] mm: add a "struct subpage" type containing a page, offset and length
From: Ian Campbell @ 2011-10-10 12:27 UTC (permalink / raw)
  To: linux-mm@kvack.org; +Cc: netdev@vger.kernel.org
In-Reply-To: <1318245101-16890-1-git-send-email-ian.campbell@citrix.com>

On Mon, 2011-10-10 at 12:11 +0100, Ian Campbell wrote:

> Cc: linux-mm@kvack.org
> ---
>  include/linux/mm_types.h |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)

get_maintainers.pl didn't pick up on this CC. Since mm_types.h was split
out of mm.h does the following make sense? Not sure if mm_*.h (or just
mm_inline.hm?) also makes sense.

8<--------------------------

Subject: MAINTAINER: mm subsystem includes mm_types.h

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff --git a/MAINTAINERS b/MAINTAINERS
index ae8820e..f10a7ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4212,6 +4212,7 @@ L:	linux-mm@kvack.org
 W:	http://www.linux-mm.org
 S:	Maintained
 F:	include/linux/mm.h
+F:	include/linux/mm_types.h
 F:	mm/
 
 MEMORY RESOURCE CONTROLLER


> 
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 774b895..dc1d103 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -135,6 +135,17 @@ struct page {
>  #endif
>  ;
>  
> +struct subpage {
> +	struct page *page;
> +#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
> +	__u32 page_offset;
> +	__u32 size;
> +#else
> +	__u16 page_offset;
> +	__u16 size;
> +#endif
> +};
> +
>  typedef unsigned long __nocast vm_flags_t;
>  
>  /*


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related

* [PATCH 9/9] net: add opaque struct around skb frag page
From: Ian Campbell @ 2011-10-10 11:11 UTC (permalink / raw)
  To: netdev; +Cc: Ian Campbell
In-Reply-To: <1318245076.21903.408.camel@zakaz.uk.xensource.com>

I've split this bit out of the skb frag destructor patch since it helps enforce
the use of the fragment API.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 include/linux/skbuff.h |   10 ++++++----
 net/core/skbuff.c      |    6 +++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ac6b05a..f881d75 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -135,7 +135,9 @@ struct sk_buff;
 typedef struct skb_frag_struct skb_frag_t;
 
 struct skb_frag_struct {
-	struct page *page;
+	struct {
+		struct page *p;
+	} page;
 #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
 	__u32 page_offset;
 	__u32 size;
@@ -1149,7 +1151,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
 {
 	skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
 
-	frag->page		  = page;
+	frag->page.p		  = page;
 	frag->page_offset	  = off;
 	frag->size		  = size;
 }
@@ -1673,7 +1675,7 @@ static inline void netdev_free_page(struct net_device *dev, struct page *page)
  */
 static inline struct page *skb_frag_page(const skb_frag_t *frag)
 {
-	return frag->page;
+	return frag->page.p;
 }
 
 /**
@@ -1759,7 +1761,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag)
  */
 static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
 {
-	frag->page = page;
+	frag->page.p = page;
 	__skb_frag_ref(frag);
 }
 
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5b2c5f1..6305076 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -657,14 +657,14 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)
 
 	/* skb frags release userspace buffers */
 	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
-		put_page(skb_shinfo(skb)->frags[i].page);
+		skb_frag_unref(skb, i);
 
 	uarg->callback(uarg);
 
 	/* skb frags point to kernel buffers */
 	for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) {
-		skb_shinfo(skb)->frags[i - 1].page_offset = 0;
-		skb_shinfo(skb)->frags[i - 1].page = head;
+		__skb_fill_page_desc(skb, i-1, head, 0,
+				     skb_shinfo(skb)->frags[i - 1].size);
 		head = (struct page *)head->private;
 	}
 
-- 
1.7.2.5

^ permalink raw reply related


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