Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] bridge; Automatically filter vlans configured on top of bridge
From: Vlad Yasevich @ 2014-09-15 15:19 UTC (permalink / raw)
  To: Toshiaki Makita, Vladislav Yasevich, netdev; +Cc: shemminger, bridge
In-Reply-To: <5415B6C2.5030702@gmail.com>

On 09/14/2014 11:39 AM, Toshiaki Makita wrote:
> (14/09/13 (土) 5:44), Vladislav Yasevich wrote:
>> If the user configures vlan devices on top of the bridge,
>> automatically set up filter entries for it as long as
>> bridge vlan protocol matches that of the vlan.
>> This allows the user to atomatically receive vlan traffic
>> for the vlans that are convifgured.
> 
> Changing br->vlan_proto seems to cause inconsistency between vlan
> interfaces and filter settings.
> Can we automatically change filters when setting vlan_proto?
> 

I thought we already do that in br_vlan_set_proto()?  Nothing
here introduces any new kinds of issue with that code.

>>
> ...
>> +static int br_vlan_rx_kill_vid(struct net_device *br_dev,
>> +			       __be16 proto, u16 vid)
> ...
>> +	/* Don't report error.  This will fail if the vlan was
>> +	 * previousely remove by some other means and we don't
>> +	 * wan't to polute the log/bug the user.
>> +	 */
>> +	br_vlan_delete(br, vid);
>> +	return 0;
>> +}
> 
> It might lead to unexpected behaviour, for example,
> 1. create br0.10
> 2. set pvid to 10 on br0
> 3. delete br0.10
> Then, pvid will also be cleared?
> Something like ref counting is needed?

Gah!  The bitmap implementation is really starting to annoy me.  Yes, it's fast, but it
is so restrictive...

We'd need tracking per vlan id and we can't that right now.  OK, this one needs more
thought.  I'll drop it for now.

Thanks
-vlad
> 
> Thanks,
> Toshiaki Makita
> 

^ permalink raw reply

* Re: [PATCH v2 net-next 1/7] net: Export inet_offloads and inet6_offloads
From: Tom Herbert @ 2014-09-15 15:13 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: Jerry Chu, David Miller, Linux Netdev List
In-Reply-To: <CAJ3xEMgNqZ=qHmALiN_bFC5b3n8Ev-27Z7-KFG5Au6+x2A7=5g@mail.gmail.com>

On Mon, Sep 15, 2014 at 6:33 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
> On Mon, Sep 15, 2014 at 6:07 AM, Tom Herbert <therbert@google.com> wrote:
>> Want to be able to call this in foo-over-udp offloads, etc.
>
> In the L2 gro case, we did dedicated helpers
> gro_find_receive/complete_by_type, not sure what was
> the exact rational there but worth checking, jerry?
>
It allows offload_base to be kept a static, but then
gro_find_receive_by_type can't be inlined.

>
>>
>> Signed-off-by: Tom Herbert <therbert@google.com>
>> ---
>>  net/ipv4/protocol.c | 1 +
>>  net/ipv6/protocol.c | 1 +
>>  2 files changed, 2 insertions(+)
>>
>> diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
>> index 46d6a1c..4b7c0ec 100644
>> --- a/net/ipv4/protocol.c
>> +++ b/net/ipv4/protocol.c
>> @@ -30,6 +30,7 @@
>>
>>  const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly;
>>  const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
>> +EXPORT_SYMBOL(inet_offloads);
>>
>>  int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
>>  {
>> diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
>> index e048cf1..e3770ab 100644
>> --- a/net/ipv6/protocol.c
>> +++ b/net/ipv6/protocol.c
>> @@ -51,6 +51,7 @@ EXPORT_SYMBOL(inet6_del_protocol);
>>  #endif
>>
>>  const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS] __read_mostly;
>> +EXPORT_SYMBOL(inet6_offloads);
>>
>>  int inet6_add_offload(const struct net_offload *prot, unsigned char protocol)
>>  {
>> --
>> 2.1.0.rc2.206.gedb03e5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v2 net-next 3/7] fou: Add GRO support
From: Tom Herbert @ 2014-09-15 15:10 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: David Miller, Linux Netdev List
In-Reply-To: <CAJ3xEMhwdkNDZxSZGw3dtnfoyPHBiOTw-c5DvQPpFZTf1yhEhQ@mail.gmail.com>

On Mon, Sep 15, 2014 at 8:00 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
> On Mon, Sep 15, 2014 at 6:07 AM, Tom Herbert <therbert@google.com> wrote:
>> Implement fou_gro_receive and fou_gro_complete, and populate these
>> in the correponsing udp_offloads for the socket. Added ipproto to
>> udp_offloads and pass this from UDP to the fou GRO routine in proto
>> field of napi_gro_cb structure.
>
>
> Do we really need that  extra hop of fou4_gro_receive/complete?
> can't we somehow plant the gro receive/complete (say) GRE handlers in
> the udp offload
> struct with the UDP port that related to (say) GRE over UDP tunneling?
>
That would be nice, but it isn't obvious to me how to manage the
references. The offload functions are accessed with RCU pretty
consistently.

Tom

> Or.

^ permalink raw reply

* Re: [Bridge] [PATCH 2/3] bridge: Add filtering support for default_pvid
From: Vlad Yasevich @ 2014-09-15 15:09 UTC (permalink / raw)
  To: Toshiaki Makita, Vladislav Yasevich, netdev; +Cc: shemminger, bridge
In-Reply-To: <5415B27A.2000508@gmail.com>

On 09/14/2014 11:21 AM, Toshiaki Makita wrote:
> (14/09/13 (土) 5:44), Vladislav Yasevich wrote:
>> Currently when vlan filtering is turned on on the bridge, the bridge
>> will drop all traffic untill the user configures the filter.  This
>> isn't very nice for ports that don't care about vlans and just
>> want untagged traffic.
>>
>> A concept of a default_pvid was recently introduced.  This patch
>> adds filtering support for default_pvid.   Now, ports that don't
>> care about vlans and don't define there own filter will belong
>> to the VLAN of the default_pvid and continue to receive untagged
>> traffic.
> 
> If user sets pvid, then vid 1 (default_pvid) will become non-pvid but
> still not be filtered, right?

Right.

> vlan_bitmap of default_pvid shouldn't be cleared on setting pvid?

I can see arguments for both.  Just because the user wishes to set a
different pvid may not always mean that vlan associated with default pvid
shouldn't be filtered.  I think it's at user's discretion.  I hesitate
to do too many things automatically.

-vlad
> 
> Thanks,
> Toshiaki Makita
> 

^ permalink raw reply

* Re: [Patch v4 net-next 04/12] net: fec: parser max queue number from dt file
From: Lothar Waßmann @ 2014-09-15 15:08 UTC (permalink / raw)
  To: Zhi Li
  Cc: Frank.Li@freescale.com, Duan Fugang-B38611, David Miller,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	Russell King - ARM Linux, Shawn Guo,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <CAHrpEqTCBMn-P2O7VZOOLUN=Zbc8h_Ow9MKrv5cV5gZPENRqUw@mail.gmail.com>

Hi,

Zhi Li wrote:
> On Mon, Sep 15, 2014 at 2:39 AM, Lothar Waßmann <LW@karo-electronics.de> wrote:
> > Hi,
> >
> > Frank.Li@freescale.com wrote:
> >> From: Fugang Duan <B38611@freescale.com>
> >>
> >> By default, the tx/rx queue number is 1, user can config the queue number
> >> at DTS file like this:
> >>       fsl,num-tx-queues=<3>;
> >>       fsl,num-rx-queues=<3>
> >>
> >> Since i.MX6SX enet-AVB IP support multi queues, so use multi queues
> >> interface to allocate and set up an Ethernet device.
> >>
> >> Signed-off-by: Fugang Duan <B38611@freescale.com>
> >> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> >> ---
> >>  drivers/net/ethernet/freescale/fec.h      |  2 ++
> >>  drivers/net/ethernet/freescale/fec_main.c | 46 ++++++++++++++++++++++++++++++-
> >>  2 files changed, 47 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
> >> index b2b91f8..72fb90f 100644
> >> --- a/drivers/net/ethernet/freescale/fec.h
> >> +++ b/drivers/net/ethernet/freescale/fec.h
> >> @@ -356,6 +356,8 @@ struct fec_enet_private {
> >>
> >>       bool ptp_clk_on;
> >>       struct mutex ptp_clk_mutex;
> >> +     unsigned int num_tx_queues;
> >> +     unsigned int num_rx_queues;
> >>
> >>       /* The saved address of a sent-in-place packet/buffer, for skfree(). */
> >>       struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS];
> >> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> >> index 4c0d2ee..2240df0 100644
> >> --- a/drivers/net/ethernet/freescale/fec_main.c
> >> +++ b/drivers/net/ethernet/freescale/fec_main.c
> >> @@ -2709,6 +2709,42 @@ static void fec_reset_phy(struct platform_device *pdev)
> >>  }
> >>  #endif /* CONFIG_OF */
> >>
> >> +static void
> >> +fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx)
> >> +{
> >> +     struct device_node *np = pdev->dev.of_node;
> >> +     int err;
> >> +
> >> +     *num_tx = *num_rx = 1;
> >> +
> >> +     if (!np || !of_device_is_available(np))
> >> +             return;
> >> +
> >> +     /* parse the num of tx and rx queues */
> >> +     err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx);
> >> +     err |= of_property_read_u32(np, "fsl,num-rx-queues", num_rx);
> >> +     if (err) {
> >> +             *num_tx = 1;
> >> +             *num_rx = 1;
> > Shouldn't these be handled seperately? So that if only one of those
> > properties is given in DT the specified value for that property should
> > be used?
> 
> I worry about asymmetric design in future.
>
Then why do you use two distinct properties in the first place?

> And use two property is the easy debug two directory.
> 
I don't understand this sentence.


Lothar Waßmann
-- 
___________________________________________________________

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: [PATCH 1/2] bridge: Check if vlan filtering is enabled only once.
From: Vlad Yasevich @ 2014-09-15 15:04 UTC (permalink / raw)
  To: Toshiaki Makita, Vladislav Yasevich, netdev; +Cc: shemminger, Toshiaki Makita
In-Reply-To: <5415A9AC.1020400@gmail.com>

On 09/14/2014 10:43 AM, Toshiaki Makita wrote:
> (14/09/13 (土) 5:26), Vladislav Yasevich wrote:
>> The bridge code checks if vlan filtering is enabled on both
>> ingress and egress.   When the state flip happens, it
>> is possible for the bridge to currently be forwarding packets
>> and forwarding behavior becomes non-deterministic.  Bridge
>> may drop packets on some interfaces, but not others.
>>
>> This patch solves this by caching the filtered state of the
>> packet into skb_cb on ingress.  The skb_cb is guaranteed to
>> not be over-written between the time packet entres bridge
>> forwarding path and the time it leaves it.  On egress, we
>> can then check the cached state to see if we need to
>> apply filtering information.
> ...
>> @@ -270,7 +275,8 @@ bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid)
>>   	struct net_bridge *br = p->br;
>>   	struct net_port_vlans *v;
>>   
>> -	if (!br->vlan_enabled)
>> +	/* If filtering was disabled at input, let it pass. */
>> +	if (!BR_INPUT_SKB_CB(skb)->vlan_filtered)
>>   		return true;
>>   
>>   	v = rcu_dereference(p->vlan_info);
>>
> I'm afraid br_should_learn() is not called after calling
> br_allowed_ingress(), so vlan_filtered doesn't seem to be initialized at
> this point.
> 

You are right.  This the local input path so it can still use vlan_enabled. I'll resubmit.

Thanks
-vlad
> Thanks,
> Toshiaki Makita
> 

^ permalink raw reply

* Re: [PATCH v2 net-next 3/7] fou: Add GRO support
From: Or Gerlitz @ 2014-09-15 15:00 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev
In-Reply-To: <1410750483-3236-4-git-send-email-therbert@google.com>

On Mon, Sep 15, 2014 at 6:07 AM, Tom Herbert <therbert@google.com> wrote:
> Implement fou_gro_receive and fou_gro_complete, and populate these
> in the correponsing udp_offloads for the socket. Added ipproto to
> udp_offloads and pass this from UDP to the fou GRO routine in proto
> field of napi_gro_cb structure.


Do we really need that  extra hop of fou4_gro_receive/complete?
can't we somehow plant the gro receive/complete (say) GRE handlers in
the udp offload
struct with the UDP port that related to (say) GRE over UDP tunneling?

Or.

^ permalink raw reply

* Re: [PATCH 1/5] rhashtable: Remove gfp_flags from insert and remove functions
From: Thomas Graf @ 2014-09-15 14:56 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, paulmck, john.r.fastabend, kaber, netdev, linux-kernel
In-Reply-To: <1410792596.7106.166.camel@edumazet-glaptop2.roam.corp.google.com>

On 09/15/14 at 07:49am, Eric Dumazet wrote:
> On Mon, 2014-09-15 at 13:49 +0100, Thomas Graf wrote:
> 
> > Agreed. Will introduce this through a table parameter option when
> > converting the inet hash table.
> 
> I am not sure you covered the /proc/net/tcp problem yet ? (or inet_diag)

I haven't digged through inet_diag in all detail yet but was planning to
acquire ht->mutex to block expansions and then take bucket locks during
bucket traverals as done now. I will do that next but wanted to get this
out for comments in the meantime.

^ permalink raw reply

* [net-next PATCH] net: Correct TOS priority mapping for DSCP EF
From: Jesper Dangaard Brouer @ 2014-09-15 14:50 UTC (permalink / raw)
  To: Jesper Dangaard Brouer, netdev
  Cc: David S. Miller, Eric Dumazet, Stephen Hemminger
In-Reply-To: <=1410783785.7106.154.camel@edumazet-glaptop2.roam.corp.google.com>

The DSCP value for Expedited Forwarding (EF) got mapped to
internal priority TC_PRIO_INTERACTIVE_BULK, which ends up in
medium/best-effort priority band(1) of pfifo_fast

This patch change TOS mapping, causing the DSCP EF to get mapped
to TC_PRIO_INTERACTIVE, which end up in high priority band(0)
of pfifo_fast.

While performing this policy change, document the TOS to priority
lookup table ip_tos2prio[16].  Thus, making it easier to
understand this table for reviewers.

The DSCP AFxx mappings are also suboptimal, but we choose not to
change those mapping, only document the mapping in the code.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---

 net/ipv4/route.c |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 234a43e..800b6f4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -168,23 +168,34 @@ static struct dst_ops ipv4_dst_ops = {
 
 #define ECN_OR_COST(class)	TC_PRIO_##class
 
+/* lookup: tos bitmasked 0x1E and shifted right (tos>>1) in rt_tos2priority() */
 const __u8 ip_tos2prio[16] = {
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK)
+	/* Desc format: two least-significant bits should have been
+	 * for ECN (see "-" split). The hex values represent the TOS
+	 * byte in IP-header (masked with 0x1E)
+	 */
+	TC_PRIO_BESTEFFORT,           /* [0] 000-00 = 0x00 default            */
+	ECN_OR_COST(BESTEFFORT),      /* [1] 000-10 = 0x02 TOS-"mincost"      */
+	TC_PRIO_BESTEFFORT,           /* [2] 001-00 = 0x04 TOS-"reliability"  */
+	ECN_OR_COST(BESTEFFORT),      /* [3] 001-10 = 0x06                    */
+	TC_PRIO_BULK,                 /* [4] 010-00 = 0x08 TOS-"throughput"
+				       * (incidentally maps) DSCP(AF11+21+31+41)
+				       */
+	ECN_OR_COST(BULK),            /* [5] 010-10 = 0x0A                    */
+	TC_PRIO_BULK,                 /* [6] 011-00 = 0x0C                    */
+	ECN_OR_COST(BULK),            /* [7] 011-10 = 0x0E                    */
+	TC_PRIO_INTERACTIVE,          /* [8] 100-00 = 0x10 TOS-"lowdelay"
+				       * (incidentally maps) DSCP(AF12+22+32+42)
+				       */
+	ECN_OR_COST(INTERACTIVE),     /* [9] 100-10 = 0x12                    */
+	TC_PRIO_INTERACTIVE,          /*[10] 101-00 = 0x14                    */
+	ECN_OR_COST(INTERACTIVE),     /*[11] 101-10 = 0x16                    */
+	TC_PRIO_INTERACTIVE_BULK,     /*[12] 110-00 = 0x18
+				       * (incidentally maps) DSCP(AF13+23+33+43)
+				       */
+	ECN_OR_COST(INTERACTIVE_BULK),/*[13] 110-10 = 0x1A                    */
+	TC_PRIO_INTERACTIVE,          /*[14] 111-00 = 0x1C maps DSCP(EF)      */
+	ECN_OR_COST(INTERACTIVE_BULK) /*[15] 111-10 = 0x1E                    */
 };
 EXPORT_SYMBOL(ip_tos2prio);
 

^ permalink raw reply related

* Re: [PATCH 1/5] rhashtable: Remove gfp_flags from insert and remove functions
From: Eric Dumazet @ 2014-09-15 14:49 UTC (permalink / raw)
  To: Thomas Graf; +Cc: davem, paulmck, john.r.fastabend, kaber, netdev, linux-kernel
In-Reply-To: <20140915124937.GB21541@casper.infradead.org>

On Mon, 2014-09-15 at 13:49 +0100, Thomas Graf wrote:

> Agreed. Will introduce this through a table parameter option when
> converting the inet hash table.

I am not sure you covered the /proc/net/tcp problem yet ? (or inet_diag)

^ permalink raw reply

* how to figure out which device a given IFB is connected to
From: Sebastian Moeller @ 2014-09-15 14:37 UTC (permalink / raw)
  To: netdev

Hi All,

I hope I am directing this to the correct mailing list, otherwise please excuse the distraction… 

I am trying to figure out a way to semi-automatically manage a set of IFB devices for a number of network interfaces. Currently I have no problem finding out if a given “real” interfaces is connected to an IFB:

root@nacktmulle:~# tc -s filter show parent ffff: dev ge00
filter protocol all pref 10 u32 
filter protocol all pref 10 u32 fh 800: ht divisor 1 
filter protocol all pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 
  match 00000000/00000000 at 0
	action order 1: mirred (Egress Redirect to device ifb1) stolen
 	index 47 ref 1 bind 1 installed 521 sec used 3 sec


I am looking for a way of doing the reverse,i.e.  figuring out for a given IFB if it is “connected” to a real interface and, if yes, which interface. Basically, I want to recycle unused IFBs, but want to make sure that they really are unused…

Thanks in advance
	Sebastian Moeller

^ permalink raw reply

* Figuring out how vti works
From: Joe M @ 2014-09-15 14:20 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 3531 bytes --]

Hello Steffen Klassert,

Very sorry for this bother.

I could not figure out how vti works with ipsec and your patch was the
latest to ip_vti.c. If you cannot help, please excuse me.

I cannot get the vpn traffic to get on the vti tunnel. tcpdump on vti
does not show anything. I think the tunnel lookup code, for some
reason, is not able to use the "vtil" tunnel.

The pings worked fine if I remove the ip_vti and ip_tunnel modules,
the "mark=1" from /etc/ipsec.conf and the iptables mangle rules to
set-mark.

This is with strongswan 5.2.0. Can you please help?

This is my setup on moon (master hostname)

cat /etc/ipsec.conf
# /etc/ipsec.conf - strongSwan IPsec configuration file

config setup

conn %default
        ikelifetime=60m
        keylife=20m
        rekeymargin=3m
        keyingtries=1
        keyexchange=ikev2
        mobike=no

conn master-bnglr
        leftid="C=CH, O=strongSwan, CN=master"
        leftcert=masterCert.der
        left=192.168.0.11
        leftsubnet=192.168.0.0/24
        rightid="C=CH, O=strongSwan, CN=bnglr"
        right=%any
        rightsubnet=192.168.1.0/24
        auto=add
        mark=1


sudo cat /etc/ipsec.secrets
# /etc/ipsec.secrets - strongSwan IPsec secrets file

  : RSA masterKey.der


sudo ip tunnel list
vtil: ip/ip  remote 192.168.1.232  local 192.168.0.11  ttl inherit ikey 0  okey 1
ip_vti0: ip/ip  remote any  local any  ttl inherit  nopmtudisc key 0

sudo ip route list
default via 192.168.0.1 dev enp4s0  metric 202
127.0.0.0/8 dev lo  scope host
192.168.0.0/24 dev enp4s0  proto kernel  scope link  src 192.168.0.11
metric 202
192.168.1.0/24 dev vtil  scope link


sudo ip xfrm policy
src 192.168.1.0/24 dst 192.168.0.0/24
        dir fwd priority 2883
        mark 1/0xffffffff
        tmpl src <bnglr public ip> dst 192.168.0.11
                proto esp reqid 2 mode tunnel
src 192.168.1.0/24 dst 192.168.0.0/24
        dir in priority 2883
        mark 1/0xffffffff
        tmpl src <bnglr public ip> dst 192.168.0.11
                proto esp reqid 2 mode tunnel
src 192.168.0.0/24 dst 192.168.1.0/24
        dir out priority 2883
        mark 1/0xffffffff
        tmpl src 192.168.0.11 dst <bnglr public ip>
                proto esp reqid 2 mode tunnel
src 0.0.0.0/0 dst 0.0.0.0/0
        socket in priority 0
src 0.0.0.0/0 dst 0.0.0.0/0
        socket out priority 0
src 0.0.0.0/0 dst 0.0.0.0/0
        socket in priority 0
src 0.0.0.0/0 dst 0.0.0.0/0
        socket out priority 0
src ::/0 dst ::/0
        socket in priority 0
src ::/0 dst ::/0
        socket out priority 0
src ::/0 dst ::/0
        socket in priority 0
src ::/0 dst ::/0
        socket out priority 0

sudo ip xfrm state
src 192.168.0.11 dst <bnglr public ip>
        proto esp spi 0xc3b23fb1 reqid 2 mode tunnel
        replay-window 32 flag af-unspec
        mark 1/0xffffffff
        auth-trunc hmac(sha1) 0x33f17d71abbc9ccdbef83ecba9e1c0711c3767a0 96
        enc cbc(aes) 0xe790b24d9e9f71aec28f8ed00013f411
        encap type espinudp sport 4500 dport 8993 addr 0.0.0.0
src <bnglr public ip> dst 192.168.0.11
        proto esp spi 0xc8bcf9b0 reqid 2 mode tunnel
        replay-window 32 flag af-unspec
        mark 1/0xffffffff
        auth-trunc hmac(sha1) 0xb780288b0cf20aa7f010552837cc03a04e29198a 96
        enc cbc(aes) 0xd0db2ec7e9bb83cbc6a9d20feb6eab49
        encap type espinudp sport 8993 dport 4500 addr 0.0.0.0


I tried setting the mangle rules to set-mark but that did not help. I
could not find any more documentation.

Thanks again and Sorry for the bother,
Joe


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* [PATCH v3 9/9] ARM: dts: berlin: enable the Ethernet port on the BG2Q DMP
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

This patch enables the Ethernet port on the Marvell Berlin2Q DMP board.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index a357ce02a64e..ea1f99b8eed6 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -45,3 +45,7 @@
 &uart0 {
 	status = "okay";
 };
+
+&eth0 {
+	status = "okay";
+};
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 8/9] ARM: dts: berlin: add the Ethernet node
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

This patch adds the Ethernet node, enabling the network unit on Berlin
BG2Q SoCs.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 arch/arm/boot/dts/berlin2q.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 902eddb19cd8..a88db4097b47 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -114,6 +114,16 @@
 			#interrupt-cells = <3>;
 		};
 
+		eth0: ethernet@b90000 {
+			compatible = "marvell,pxa168-eth";
+			reg = <0xb90000 0x10000>;
+			clocks = <&chip CLKID_GETH0>;
+			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+			/* set by bootloader */
+			local-mac-address = [00 00 00 00 00 00];
+			status = "disabled";
+		};
+
 		cpu-ctrl@dd0000 {
 			compatible = "marvell,berlin-cpu-ctrl";
 			reg = <0xdd0000 0x10000>;
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 7/9] net: pxa168_eth: allow Berlin SoCs to use the pxa168_eth driver
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w
  Cc: Antoine Tenart,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	zmxu-eYqpPyKDWXRBDgjK7y7TUQ, jszhang-eYqpPyKDWXRBDgjK7y7TUQ,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Berlin SoCs have an Ethernet controller compatible with the pxa168.
Allow these SoCs to use the pxa168_eth driver.

Signed-off-by: Antoine Tenart <antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/net/ethernet/marvell/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index 1b4fc7c639e6..48b9466d1781 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -64,7 +64,7 @@ config MVPP2
 
 config PXA168_ETH
 	tristate "Marvell pxa168 ethernet support"
-	depends on CPU_PXA168
+	depends on CPU_PXA168 || ARCH_BERLIN
 	select PHYLIB
 	---help---
 	  This driver supports the pxa168 Ethernet ports.
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v3 6/9] net: pxa168_eth: rework the MAC address setup
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

This patch rework the way the MAC address is retrieved. The MAC address
can now, in addition to being random, be set in the device tree or
retrieved from the Ethernet controller MAC address registers. The
probing function will try to get a MAC address in the following order:
- From the device tree.
- From the Ethernet controller MAC address registers.
- Generate a random one.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index d9f4f7d05a1e..4a57f640b424 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_net.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/pxa168_eth.h>
@@ -1481,6 +1482,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	struct net_device *dev = NULL;
 	struct resource *res;
 	struct clk *clk;
+	const unsigned char *mac_addr = NULL;
 	int err;
 
 	printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
@@ -1522,8 +1524,19 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
 	INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
 
-	dev_info(&pdev->dev, "Using random mac address\n");
-	eth_hw_addr_random(dev);
+	if (pdev->dev.of_node)
+		mac_addr = of_get_mac_address(pdev->dev.of_node);
+
+	if (mac_addr && is_valid_ether_addr(mac_addr)) {
+		ether_addr_copy(dev->dev_addr, mac_addr);
+	} else {
+		/* try reading the mac address, if set by the bootloader */
+		pxa168_eth_get_mac_address(dev, dev->dev_addr);
+		if (!is_valid_ether_addr(dev->dev_addr)) {
+			dev_info(&pdev->dev, "Using random mac address\n");
+			eth_hw_addr_random(dev);
+		}
+	}
 
 	pep->rx_ring_size = NUM_RX_DESCS;
 	pep->tx_ring_size = NUM_TX_DESCS;
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 5/9] net: pxa168_eth: get and set the mac address on the Ethernet controller
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

When changing the MAC address, in addition to updating the dev_addr in
the net_device structure, this patch also update the MAC address
registers (high and low) of the Ethernet controller with the new MAC.
The address stored in these registers is used for IEEE 802.3x Ethernet
flow control, which is already enabled.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 5aa2ce2625b4..d9f4f7d05a1e 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -60,6 +60,8 @@
 #define PORT_COMMAND		0x0410
 #define PORT_STATUS		0x0418
 #define HTPR			0x0428
+#define MAC_ADDR_LOW		0x0430
+#define MAC_ADDR_HIGH		0x0438
 #define SDMA_CONFIG		0x0440
 #define SDMA_CMD		0x0448
 #define INT_CAUSE		0x0450
@@ -604,16 +606,42 @@ static void pxa168_eth_set_rx_mode(struct net_device *dev)
 		update_hash_table_mac_address(pep, NULL, ha->addr);
 }
 
+static void pxa168_eth_get_mac_address(struct net_device *dev,
+				       unsigned char *addr)
+{
+	struct pxa168_eth_private *pep = netdev_priv(dev);
+	unsigned int mac_h = rdl(pep, MAC_ADDR_HIGH);
+	unsigned int mac_l = rdl(pep, MAC_ADDR_LOW);
+
+	addr[0] = (mac_h >> 24) & 0xff;
+	addr[1] = (mac_h >> 16) & 0xff;
+	addr[2] = (mac_h >> 8) & 0xff;
+	addr[3] = mac_h & 0xff;
+	addr[4] = (mac_l >> 8) & 0xff;
+	addr[5] = mac_l & 0xff;
+}
+
 static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr)
 {
 	struct sockaddr *sa = addr;
 	struct pxa168_eth_private *pep = netdev_priv(dev);
 	unsigned char oldMac[ETH_ALEN];
+	u32 mac_h, mac_l;
 
 	if (!is_valid_ether_addr(sa->sa_data))
 		return -EADDRNOTAVAIL;
 	memcpy(oldMac, dev->dev_addr, ETH_ALEN);
 	memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
+
+	mac_h = sa->sa_data[0] << 24;
+	mac_h |= sa->sa_data[1] << 16;
+	mac_h |= sa->sa_data[2] << 8;
+	mac_h |= sa->sa_data[3];
+	mac_l = sa->sa_data[4] << 8;
+	mac_l |= sa->sa_data[5];
+	wrl(pep, MAC_ADDR_HIGH, mac_h);
+	wrl(pep, MAC_ADDR_LOW, mac_l);
+
 	netif_addr_lock_bh(dev);
 	update_hash_table_mac_address(pep, oldMac, dev->dev_addr);
 	netif_addr_unlock_bh(dev);
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 4/9] net: pxa168_eth: fix Ethernet flow control status
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
	linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

IEEE 802.3x Ethernet flow control is disabled when bit (1 << 2) is set
in the port status register. Fix the flow control detection in the link
event handling function which was relying on the opposite assumption.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index a27cd85c030d..5aa2ce2625b4 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -163,7 +163,7 @@
 /* Bit definitions for Port status */
 #define PORT_SPEED_100		(1 << 0)
 #define FULL_DUPLEX		(1 << 1)
-#define FLOW_CONTROL_ENABLED	(1 << 2)
+#define FLOW_CONTROL_DISABLED	(1 << 2)
 #define LINK_UP			(1 << 3)
 
 /* Bit definitions for work to be done */
@@ -885,7 +885,7 @@ static void handle_link_event(struct pxa168_eth_private *pep)
 		speed = 10;
 
 	duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
-	fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
+	fc = (port_status & FLOW_CONTROL_DISABLED) ? 0 : 1;
 	netdev_info(dev, "link up, %d Mb/s, %s duplex, flow control %sabled\n",
 		    speed, duplex ? "full" : "half", fc ? "en" : "dis");
 	if (!netif_carrier_ok(dev))
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 3/9] Documentation: bindings: net: add the Marvell PXA168 Ethernet controller
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
	linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

This adds the binding documentation for the Marvell PXA168 Ethernet
controller, following its DT support.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 .../devicetree/bindings/net/marvell-pxa168.txt      | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/marvell-pxa168.txt

diff --git a/Documentation/devicetree/bindings/net/marvell-pxa168.txt b/Documentation/devicetree/bindings/net/marvell-pxa168.txt
new file mode 100644
index 000000000000..4177abf3dac3
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/marvell-pxa168.txt
@@ -0,0 +1,21 @@
+* Marvell PXA168 Ethernet Controller
+
+Required properties:
+- compatible: should be "marvell,pxa168-eth".
+- reg: address and length of the register set for the device.
+- interrupts: interrupt for the device.
+- clocks: pointer to the clock for the device.
+
+Optional properties:
+- port-id: should be '0','1' or '2'.
+- phy-addr: MDIO address of the PHY.
+- local-mac-address: see ethernet.txt file in the same directory.
+
+Example:
+
+	eth0: ethernet@f7b90000 {
+		compatible = "marvell,pxa168-eth";
+		reg = <0xf7b90000 0x10000>;
+		clocks = <&chip CLKID_GETH0>;
+		interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+	};
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 2/9] net: pxa168_eth: add device tree support
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
	linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

Add the device tree support to the pxa168_eth driver.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 67 ++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index b370162dbe02..a27cd85c030d 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -193,6 +193,7 @@ struct tx_desc {
 
 struct pxa168_eth_private {
 	int port_num;		/* User Ethernet port number    */
+	int phy_addr;
 
 	int rx_resource_err;	/* Rx ring resource error flag */
 
@@ -1360,24 +1361,25 @@ static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr)
 	return phydev;
 }
 
-static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex)
+static void phy_init(struct pxa168_eth_private *pep)
 {
 	struct phy_device *phy = pep->phy;
 
 	phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII);
 
-	if (speed == 0) {
+	if (pep->pd && pep->pd->speed != 0) {
+		phy->autoneg = AUTONEG_DISABLE;
+		phy->advertising = 0;
+		phy->speed = pep->pd->speed;
+		phy->duplex = pep->pd->duplex;
+	} else {
 		phy->autoneg = AUTONEG_ENABLE;
 		phy->speed = 0;
 		phy->duplex = 0;
 		phy->supported &= PHY_BASIC_FEATURES;
 		phy->advertising = phy->supported | ADVERTISED_Autoneg;
-	} else {
-		phy->autoneg = AUTONEG_DISABLE;
-		phy->advertising = 0;
-		phy->speed = speed;
-		phy->duplex = duplex;
 	}
+
 	phy_start_aneg(phy);
 }
 
@@ -1385,11 +1387,13 @@ static int ethernet_phy_setup(struct net_device *dev)
 {
 	struct pxa168_eth_private *pep = netdev_priv(dev);
 
-	if (pep->pd->init)
+	if (pep->pd && pep->pd->init)
 		pep->pd->init();
-	pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f);
+
+	pep->phy = phy_scan(pep, pep->phy_addr & 0x1f);
 	if (pep->phy != NULL)
-		phy_init(pep, pep->pd->speed, pep->pd->duplex);
+		phy_init(pep);
+
 	update_hash_table_mac_address(pep, NULL, dev->dev_addr);
 
 	return 0;
@@ -1453,12 +1457,12 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
 	printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
 
-	clk = clk_get(&pdev->dev, "MFUCLK");
+	clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
 		dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
 		return -ENODEV;
 	}
-	clk_enable(clk);
+	clk_prepare_enable(clk);
 
 	dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
 	if (!dev) {
@@ -1475,8 +1479,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 		err = -ENODEV;
 		goto err_netdev;
 	}
-	pep->base = ioremap(res->start, resource_size(res));
-	if (pep->base == NULL) {
+	pep->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(pep->base)) {
 		err = -ENOMEM;
 		goto err_netdev;
 	}
@@ -1493,16 +1497,26 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "Using random mac address\n");
 	eth_hw_addr_random(dev);
 
-	pep->pd = dev_get_platdata(&pdev->dev);
 	pep->rx_ring_size = NUM_RX_DESCS;
-	if (pep->pd->rx_queue_size)
-		pep->rx_ring_size = pep->pd->rx_queue_size;
-
 	pep->tx_ring_size = NUM_TX_DESCS;
-	if (pep->pd->tx_queue_size)
-		pep->tx_ring_size = pep->pd->tx_queue_size;
 
-	pep->port_num = pep->pd->port_number;
+	pep->pd = dev_get_platdata(&pdev->dev);
+	if (pep->pd) {
+		if (pep->pd->rx_queue_size)
+			pep->rx_ring_size = pep->pd->rx_queue_size;
+
+		if (pep->pd->tx_queue_size)
+			pep->tx_ring_size = pep->pd->tx_queue_size;
+
+		pep->port_num = pep->pd->port_number;
+		pep->phy_addr = pep->pd->phy_addr;
+	} else if (pdev->dev.of_node) {
+		of_property_read_u32(pdev->dev.of_node, "port-id",
+				     &pep->port_num);
+		of_property_read_u32(pdev->dev.of_node, "phy-addr",
+				     &pep->phy_addr);
+	}
+
 	/* Hardware supports only 3 ports */
 	BUG_ON(pep->port_num > 2);
 	netif_napi_add(dev, &pep->napi, pxa168_rx_poll, pep->rx_ring_size);
@@ -1603,6 +1617,12 @@ static int pxa168_eth_suspend(struct platform_device *pdev, pm_message_t state)
 #define pxa168_eth_suspend NULL
 #endif
 
+static const struct of_device_id pxa168_eth_of_match[] = {
+	{ .compatible = "marvell,pxa168-eth" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, pxa168_eth_of_match)
+
 static struct platform_driver pxa168_eth_driver = {
 	.probe = pxa168_eth_probe,
 	.remove = pxa168_eth_remove,
@@ -1610,8 +1630,9 @@ static struct platform_driver pxa168_eth_driver = {
 	.resume = pxa168_eth_resume,
 	.suspend = pxa168_eth_suspend,
 	.driver = {
-		   .name = DRIVER_NAME,
-		   },
+		.name		= DRIVER_NAME,
+		.of_match_table	= of_match_ptr(pxa168_eth_of_match),
+	},
 };
 
 module_platform_driver(pxa168_eth_driver);
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 1/9] net: pxa168_eth: clean up
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: thomas.petazzoni, zmxu, devicetree, netdev, Antoine Tenart,
	linux-kernel, alexandre.belloni, jszhang, linux-arm-kernel
In-Reply-To: <1410789713-15341-1-git-send-email-antoine.tenart@free-electrons.com>

Clean up a bit the pxa168_eth driver before adding the device tree
support.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 102 +++++++++++++++---------------
 1 file changed, 50 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 8f5aa7c62b18..b370162dbe02 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -22,27 +22,29 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
-#include <linux/etherdevice.h>
 #include <linux/bitops.h>
+#include <linux/clk.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
 #include <linux/ethtool.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
+#include <linux/in.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/ip.h>
 #include <linux/kernel.h>
-#include <linux/workqueue.h>
-#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/of.h>
 #include <linux/phy.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/pxa168_eth.h>
+#include <linux/tcp.h>
 #include <linux/types.h>
+#include <linux/udp.h>
+#include <linux/workqueue.h>
+
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
-#include <linux/pxa168_eth.h>
 
 #define DRIVER_NAME	"pxa168-eth"
 #define DRIVER_VERSION	"0.3"
@@ -296,7 +298,7 @@ static void abort_dma(struct pxa168_eth_private *pep)
 	} while (max_retries-- > 0 && delay <= 0);
 
 	if (max_retries <= 0)
-		printk(KERN_ERR "%s : DMA Stuck\n", __func__);
+		netdev_err(pep->dev, "%s : DMA Stuck\n", __func__);
 }
 
 static int ethernet_phy_get(struct pxa168_eth_private *pep)
@@ -507,9 +509,10 @@ static int add_del_hash_entry(struct pxa168_eth_private *pep,
 
 	if (i == HOP_NUMBER) {
 		if (!del) {
-			printk(KERN_INFO "%s: table section is full, need to "
-					"move to 16kB implementation?\n",
-					 __FILE__);
+			netdev_info(pep->dev,
+				    "%s: table section is full, need to "
+				    "move to 16kB implementation?\n",
+				    __FILE__);
 			return -ENOSPC;
 		} else
 			return 0;
@@ -726,7 +729,7 @@ static int txq_reclaim(struct net_device *dev, int force)
 
 		if (cmd_sts & TX_ERROR) {
 			if (net_ratelimit())
-				printk(KERN_ERR "%s: Error in TX\n", dev->name);
+				netdev_err(dev, "Error in TX\n");
 			dev->stats.tx_errors++;
 		}
 		dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
@@ -743,8 +746,7 @@ static void pxa168_eth_tx_timeout(struct net_device *dev)
 {
 	struct pxa168_eth_private *pep = netdev_priv(dev);
 
-	printk(KERN_INFO "%s: TX timeout  desc_count %d\n",
-	       dev->name, pep->tx_desc_count);
+	netdev_info(dev, "TX timeout  desc_count %d\n", pep->tx_desc_count);
 
 	schedule_work(&pep->tx_timeout_task);
 }
@@ -814,9 +816,8 @@ static int rxq_process(struct net_device *dev, int budget)
 			if ((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) !=
 			    (RX_FIRST_DESC | RX_LAST_DESC)) {
 				if (net_ratelimit())
-					printk(KERN_ERR
-					       "%s: Rx pkt on multiple desc\n",
-					       dev->name);
+					netdev_err(dev,
+						   "Rx pkt on multiple desc\n");
 			}
 			if (cmd_sts & RX_ERROR)
 				stats->rx_errors++;
@@ -871,7 +872,7 @@ static void handle_link_event(struct pxa168_eth_private *pep)
 	port_status = rdl(pep, PORT_STATUS);
 	if (!(port_status & LINK_UP)) {
 		if (netif_carrier_ok(dev)) {
-			printk(KERN_INFO "%s: link down\n", dev->name);
+			netdev_info(dev, "link down\n");
 			netif_carrier_off(dev);
 			txq_reclaim(dev, 1);
 		}
@@ -884,9 +885,8 @@ static void handle_link_event(struct pxa168_eth_private *pep)
 
 	duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
 	fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
-	printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, "
-	       "flow control %sabled\n", dev->name,
-	       speed, duplex ? "full" : "half", fc ? "en" : "dis");
+	netdev_info(dev, "link up, %d Mb/s, %s duplex, flow control %sabled\n",
+		    speed, duplex ? "full" : "half", fc ? "en" : "dis");
 	if (!netif_carrier_ok(dev))
 		netif_carrier_on(dev);
 }
@@ -1039,9 +1039,8 @@ static void rxq_deinit(struct net_device *dev)
 		}
 	}
 	if (pep->rx_desc_count)
-		printk(KERN_ERR
-		       "Error in freeing Rx Ring. %d skb's still\n",
-		       pep->rx_desc_count);
+		netdev_err(dev, "Error in freeing Rx Ring. %d skb's still\n",
+			   pep->rx_desc_count);
 	/* Free RX ring */
 	if (pep->p_rx_desc_area)
 		dma_free_coherent(pep->dev->dev.parent, pep->rx_desc_area_size,
@@ -1280,15 +1279,15 @@ static int pxa168_smi_read(struct mii_bus *bus, int phy_addr, int regnum)
 	int val;
 
 	if (smi_wait_ready(pep)) {
-		printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
+		netdev_warn(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
 		return -ETIMEDOUT;
 	}
 	wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | SMI_OP_R);
 	/* now wait for the data to be valid */
 	for (i = 0; !((val = rdl(pep, SMI)) & SMI_R_VALID); i++) {
 		if (i == PHY_WAIT_ITERATIONS) {
-			printk(KERN_WARNING
-				"pxa168_eth: SMI bus read not valid\n");
+			netdev_warn(pep->dev,
+				    "pxa168_eth: SMI bus read not valid\n");
 			return -ENODEV;
 		}
 		msleep(10);
@@ -1303,7 +1302,7 @@ static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum,
 	struct pxa168_eth_private *pep = bus->priv;
 
 	if (smi_wait_ready(pep)) {
-		printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n");
+		netdev_warn(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
 		return -ETIMEDOUT;
 	}
 
@@ -1311,7 +1310,7 @@ static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum,
 	    SMI_OP_W | (value & 0xffff));
 
 	if (smi_wait_ready(pep)) {
-		printk(KERN_ERR "pxa168_eth: SMI bus busy timeout\n");
+		netdev_err(pep->dev, "pxa168_eth: SMI bus busy timeout\n");
 		return -ETIMEDOUT;
 	}
 
@@ -1425,23 +1424,23 @@ static void pxa168_get_drvinfo(struct net_device *dev,
 }
 
 static const struct ethtool_ops pxa168_ethtool_ops = {
-	.get_settings = pxa168_get_settings,
-	.set_settings = pxa168_set_settings,
-	.get_drvinfo = pxa168_get_drvinfo,
-	.get_link = ethtool_op_get_link,
-	.get_ts_info = ethtool_op_get_ts_info,
+	.get_settings	= pxa168_get_settings,
+	.set_settings	= pxa168_set_settings,
+	.get_drvinfo	= pxa168_get_drvinfo,
+	.get_link	= ethtool_op_get_link,
+	.get_ts_info	= ethtool_op_get_ts_info,
 };
 
 static const struct net_device_ops pxa168_eth_netdev_ops = {
-	.ndo_open = pxa168_eth_open,
-	.ndo_stop = pxa168_eth_stop,
-	.ndo_start_xmit = pxa168_eth_start_xmit,
-	.ndo_set_rx_mode = pxa168_eth_set_rx_mode,
-	.ndo_set_mac_address = pxa168_eth_set_mac_address,
-	.ndo_validate_addr = eth_validate_addr,
-	.ndo_do_ioctl = pxa168_eth_do_ioctl,
-	.ndo_change_mtu = pxa168_eth_change_mtu,
-	.ndo_tx_timeout = pxa168_eth_tx_timeout,
+	.ndo_open		= pxa168_eth_open,
+	.ndo_stop		= pxa168_eth_stop,
+	.ndo_start_xmit		= pxa168_eth_start_xmit,
+	.ndo_set_rx_mode	= pxa168_eth_set_rx_mode,
+	.ndo_set_mac_address	= pxa168_eth_set_mac_address,
+	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_do_ioctl		= pxa168_eth_do_ioctl,
+	.ndo_change_mtu		= pxa168_eth_change_mtu,
+	.ndo_tx_timeout		= pxa168_eth_tx_timeout,
 };
 
 static int pxa168_eth_probe(struct platform_device *pdev)
@@ -1456,8 +1455,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
 	clk = clk_get(&pdev->dev, "MFUCLK");
 	if (IS_ERR(clk)) {
-		printk(KERN_ERR "%s: Fast Ethernet failed to get clock\n",
-			DRIVER_NAME);
+		dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
 		return -ENODEV;
 	}
 	clk_enable(clk);
@@ -1492,7 +1490,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
 	INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
 
-	printk(KERN_INFO "%s:Using random mac address\n", DRIVER_NAME);
+	dev_info(&pdev->dev, "Using random mac address\n");
 	eth_hw_addr_random(dev);
 
 	pep->pd = dev_get_platdata(&pdev->dev);
-- 
1.9.1

^ permalink raw reply related

* [PATCH v3 0/9] ARM: Berlin: Ethernet support
From: Antoine Tenart @ 2014-09-15 14:01 UTC (permalink / raw)
  To: sebastian.hesselbarth
  Cc: Antoine Tenart, alexandre.belloni, thomas.petazzoni, zmxu,
	jszhang, netdev, linux-arm-kernel, devicetree, linux-kernel

Hi all,

This series introduce support for the Ethernet controller on Berlin SoCs,
using the existing pxa168 Ethernet driver. In order to do this, DT
support is added to the driver alongside some other modifications and
fixes.

This has been tested on a Berlin BG2Q DMP board.

Changes since v2:
	- reworked how the MAC address is configured
	- made the clock anonymous

Changes since v1:
        - removed custom Berlin Ethernet driver
        - used the pxa168 Ethernet driver instead
        - made modifications to the pxa168 driver (DT support, fixes)

Antoine Tenart (9):
  net: pxa168_eth: clean up
  net: pxa168_eth: add device tree support
  Documentation: bindings: net: add the Marvell PXA168 Ethernet
    controller
  net: pxa168_eth: fix Ethernet flow control status
  net: pxa168_eth: get and set the mac address on the Ethernet
    controller
  net: pxa168_eth: rework the MAC address setup
  net: pxa168_eth: allow Berlin SoCs to use the pxa168_eth driver
  ARM: dts: berlin: add the Ethernet node
  ARM: dts: berlin: enable the Ethernet port on the BG2Q DMP

 .../devicetree/bindings/net/marvell-pxa168.txt     |  21 ++
 arch/arm/boot/dts/berlin2q-marvell-dmp.dts         |   4 +
 arch/arm/boot/dts/berlin2q.dtsi                    |  10 +
 drivers/net/ethernet/marvell/Kconfig               |   2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c          | 216 +++++++++++++--------
 5 files changed, 174 insertions(+), 79 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/marvell-pxa168.txt

-- 
1.9.1

^ permalink raw reply

* Re: [PATCH v2 net-next 1/7] net: Export inet_offloads and inet6_offloads
From: Or Gerlitz @ 2014-09-15 13:33 UTC (permalink / raw)
  To: Tom Herbert, Jerry Chu; +Cc: davem, netdev
In-Reply-To: <1410750483-3236-2-git-send-email-therbert@google.com>

On Mon, Sep 15, 2014 at 6:07 AM, Tom Herbert <therbert@google.com> wrote:
> Want to be able to call this in foo-over-udp offloads, etc.

In the L2 gro case, we did dedicated helpers
gro_find_receive/complete_by_type, not sure what was
the exact rational there but worth checking, jerry?


>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  net/ipv4/protocol.c | 1 +
>  net/ipv6/protocol.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
> index 46d6a1c..4b7c0ec 100644
> --- a/net/ipv4/protocol.c
> +++ b/net/ipv4/protocol.c
> @@ -30,6 +30,7 @@
>
>  const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly;
>  const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
> +EXPORT_SYMBOL(inet_offloads);
>
>  int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
>  {
> diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
> index e048cf1..e3770ab 100644
> --- a/net/ipv6/protocol.c
> +++ b/net/ipv6/protocol.c
> @@ -51,6 +51,7 @@ EXPORT_SYMBOL(inet6_del_protocol);
>  #endif
>
>  const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS] __read_mostly;
> +EXPORT_SYMBOL(inet6_offloads);
>
>  int inet6_add_offload(const struct net_offload *prot, unsigned char protocol)
>  {
> --
> 2.1.0.rc2.206.gedb03e5
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Patch v4 net-next 04/12] net: fec: parser max queue number from dt file
From: Zhi Li @ 2014-09-15 13:24 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	Duan Fugang-B38611, David Miller,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Russell King - ARM Linux, Shawn Guo,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <20140915093926.11bdbc32-VjFSrY7JcPWvSplVBqRQBQ@public.gmane.org>

On Mon, Sep 15, 2014 at 2:39 AM, Lothar Waßmann <LW@karo-electronics.de> wrote:
> Hi,
>
> Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org wrote:
>> From: Fugang Duan <B38611-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>>
>> By default, the tx/rx queue number is 1, user can config the queue number
>> at DTS file like this:
>>       fsl,num-tx-queues=<3>;
>>       fsl,num-rx-queues=<3>
>>
>> Since i.MX6SX enet-AVB IP support multi queues, so use multi queues
>> interface to allocate and set up an Ethernet device.
>>
>> Signed-off-by: Fugang Duan <B38611-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> Signed-off-by: Frank Li <Frank.Li-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
>> ---
>>  drivers/net/ethernet/freescale/fec.h      |  2 ++
>>  drivers/net/ethernet/freescale/fec_main.c | 46 ++++++++++++++++++++++++++++++-
>>  2 files changed, 47 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
>> index b2b91f8..72fb90f 100644
>> --- a/drivers/net/ethernet/freescale/fec.h
>> +++ b/drivers/net/ethernet/freescale/fec.h
>> @@ -356,6 +356,8 @@ struct fec_enet_private {
>>
>>       bool ptp_clk_on;
>>       struct mutex ptp_clk_mutex;
>> +     unsigned int num_tx_queues;
>> +     unsigned int num_rx_queues;
>>
>>       /* The saved address of a sent-in-place packet/buffer, for skfree(). */
>>       struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS];
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
>> index 4c0d2ee..2240df0 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -2709,6 +2709,42 @@ static void fec_reset_phy(struct platform_device *pdev)
>>  }
>>  #endif /* CONFIG_OF */
>>
>> +static void
>> +fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx)
>> +{
>> +     struct device_node *np = pdev->dev.of_node;
>> +     int err;
>> +
>> +     *num_tx = *num_rx = 1;
>> +
>> +     if (!np || !of_device_is_available(np))
>> +             return;
>> +
>> +     /* parse the num of tx and rx queues */
>> +     err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx);
>> +     err |= of_property_read_u32(np, "fsl,num-rx-queues", num_rx);
>> +     if (err) {
>> +             *num_tx = 1;
>> +             *num_rx = 1;
> Shouldn't these be handled seperately? So that if only one of those
> properties is given in DT the specified value for that property should
> be used?

I worry about asymmetric design in future.
And use two property is the easy debug two directory.

best regards
Frank Li


>
>> +             return;
>> +     }
>> +
>> +     if (*num_tx < 1 || *num_tx > FEC_ENET_MAX_TX_QS) {
>> +             dev_err(&pdev->dev, "Invalidate num_tx(=%d), fail back to 1\n",
>>
> s/Invalidate/Invalid/
> s/fail/fall/
> If the problem is fixed up by the driver rather than leading to an
> error exit it should be dev_warn() rather than dev_err().
>
>> +                     *num_tx);
>> +             *num_tx = 1;
>> +             return;
>> +     }
>> +
>> +     if (*num_rx < 1 || *num_rx > FEC_ENET_MAX_RX_QS) {
>> +             dev_err(&pdev->dev, "Invalidate num_rx(=%d), fail back to 1\n",
> dto.
>
>> +                     *num_rx);
>> +             *num_rx = 1;
>> +             return;
>> +     }
>> +
>> +}
>> +
>>  static int
>>  fec_probe(struct platform_device *pdev)
>>  {
>> @@ -2720,13 +2756,18 @@ fec_probe(struct platform_device *pdev)
>>       const struct of_device_id *of_id;
>>       static int dev_id;
>>       struct device_node *np = pdev->dev.of_node, *phy_node;
>> +     int num_tx_qs = 1;
>> +     int num_rx_qs = 1;
>>
> useless initialization. These variables are initialized in
> fec_enet_get_queue_num() anyway.
>
>>       of_id = of_match_device(fec_dt_ids, &pdev->dev);
>>       if (of_id)
>>               pdev->id_entry = of_id->data;
>>
>> +     fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
>> +
>
>
> Lothar Waßmann
> --
> ___________________________________________________________
>
> 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-AvR2QvxeiV7DiMYJYoSAnRvVK+yQ3ZXh@public.gmane.org
> ___________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Patch v4 net-next 04/12] net: fec: parser max queue number from dt file
From: Zhi Li @ 2014-09-15 13:21 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Frank.Li@freescale.com, Duan Fugang-B38611, David Miller,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	Russell King - ARM Linux, Shawn Guo,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20140915093926.11bdbc32@ipc1.ka-ro>

On Mon, Sep 15, 2014 at 2:39 AM, Lothar Waßmann <LW@karo-electronics.de> wrote:
> Hi,
>
> Frank.Li@freescale.com wrote:
>> From: Fugang Duan <B38611@freescale.com>
>>
>> By default, the tx/rx queue number is 1, user can config the queue number
>> at DTS file like this:
>>       fsl,num-tx-queues=<3>;
>>       fsl,num-rx-queues=<3>
>>
>> Since i.MX6SX enet-AVB IP support multi queues, so use multi queues
>> interface to allocate and set up an Ethernet device.
>>
>> Signed-off-by: Fugang Duan <B38611@freescale.com>
>> Signed-off-by: Frank Li <Frank.Li@freescale.com>
>> ---
>>  drivers/net/ethernet/freescale/fec.h      |  2 ++
>>  drivers/net/ethernet/freescale/fec_main.c | 46 ++++++++++++++++++++++++++++++-
>>  2 files changed, 47 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
>> index b2b91f8..72fb90f 100644
>> --- a/drivers/net/ethernet/freescale/fec.h
>> +++ b/drivers/net/ethernet/freescale/fec.h
>> @@ -356,6 +356,8 @@ struct fec_enet_private {
>>
>>       bool ptp_clk_on;
>>       struct mutex ptp_clk_mutex;
>> +     unsigned int num_tx_queues;
>> +     unsigned int num_rx_queues;
>>
>>       /* The saved address of a sent-in-place packet/buffer, for skfree(). */
>>       struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS];
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
>> index 4c0d2ee..2240df0 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -2709,6 +2709,42 @@ static void fec_reset_phy(struct platform_device *pdev)
>>  }
>>  #endif /* CONFIG_OF */
>>
>> +static void
>> +fec_enet_get_queue_num(struct platform_device *pdev, int *num_tx, int *num_rx)
>> +{
>> +     struct device_node *np = pdev->dev.of_node;
>> +     int err;
>> +
>> +     *num_tx = *num_rx = 1;
>> +
>> +     if (!np || !of_device_is_available(np))
>> +             return;
>> +
>> +     /* parse the num of tx and rx queues */
>> +     err = of_property_read_u32(np, "fsl,num-tx-queues", num_tx);
>> +     err |= of_property_read_u32(np, "fsl,num-rx-queues", num_rx);
>> +     if (err) {
>> +             *num_tx = 1;
>> +             *num_rx = 1;
> Shouldn't these be handled seperately? So that if only one of those
> properties is given in DT the specified value for that property should
> be used?
>
>> +             return;
>> +     }
>> +
>> +     if (*num_tx < 1 || *num_tx > FEC_ENET_MAX_TX_QS) {
>> +             dev_err(&pdev->dev, "Invalidate num_tx(=%d), fail back to 1\n",
>>
> s/Invalidate/Invalid/
> s/fail/fall/
> If the problem is fixed up by the driver rather than leading to an
> error exit it should be dev_warn() rather than dev_err().
>
>> +                     *num_tx);
>> +             *num_tx = 1;
>> +             return;
>> +     }
>> +
>> +     if (*num_rx < 1 || *num_rx > FEC_ENET_MAX_RX_QS) {
>> +             dev_err(&pdev->dev, "Invalidate num_rx(=%d), fail back to 1\n",
> dto.
>
>> +                     *num_rx);
>> +             *num_rx = 1;
>> +             return;
>> +     }
>> +
>> +}
>> +
>>  static int
>>  fec_probe(struct platform_device *pdev)
>>  {
>> @@ -2720,13 +2756,18 @@ fec_probe(struct platform_device *pdev)
>>       const struct of_device_id *of_id;
>>       static int dev_id;
>>       struct device_node *np = pdev->dev.of_node, *phy_node;
>> +     int num_tx_qs = 1;
>> +     int num_rx_qs = 1;
>>
> useless initialization. These variables are initialized in
> fec_enet_get_queue_num() anyway.


David have applied the whole patch serials.
How to handle it? use new patch?

best regards
Frank Li

>
>>       of_id = of_match_device(fec_dt_ids, &pdev->dev);
>>       if (of_id)
>>               pdev->id_entry = of_id->data;
>>
>> +     fec_enet_get_queue_num(pdev, &num_tx_qs, &num_rx_qs);
>> +
>
>
> Lothar Waßmann
> --
> ___________________________________________________________
>
> 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


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