Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Viresh Kumar @ 2012-10-30  9:45 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <508F9D5C.2020802@linaro.org>

On 30 October 2012 14:56, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
> Well, it is the same here, no ? Except, it is up to the user to disable
> the option.

I didn't wanted to add code like this:

>> +       select NET_DSA_TAG_DSA if (!NET_DSA_TAG_EDSA &&
>> !NET_DSA_TAG_TRAILER)

Why should we select NET_DSA_TAG_DSA by default? What made us
select that?

For this reason, i went to the solution i offered.

Anyway, i just wanted to get rid of the warning. Whatever maintainer
feels is better must be selected.

--
viresh

^ permalink raw reply

* [PATCH 1/1] l2tp: fix oops in l2tp_eth_create() error path
From: Tom Parkin @ 2012-10-30  9:41 UTC (permalink / raw)
  To: netdev; +Cc: jchapman, Tom Parkin

When creating an L2TPv3 Ethernet session, if register_netdev() should fail for
any reason (for example, automatic naming for "l2tpeth%d" interfaces hits the
32k-interface limit), the netdev is freed in the error path.  However, the
l2tp_eth_sess structure's dev pointer is left uncleared, and this results in
l2tp_eth_delete() then attempting to unregister the same netdev later in the
session teardown.  This results in an oops.

To avoid this, clear the session dev pointer in the error path.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
---
 net/l2tp/l2tp_eth.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 37b8b8b..76125c5 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -291,6 +291,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
 
 out_del_dev:
 	free_netdev(dev);
+	spriv->dev = NULL;
 out_del_session:
 	l2tp_session_delete(session);
 out:
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH v2 3/3] pppoatm: protect against freeing of vcc
From: David Woodhouse @ 2012-10-30  9:39 UTC (permalink / raw)
  To: Krzysztof Mazur; +Cc: davem, netdev, linux-kernel
In-Reply-To: <1350926091-12642-3-git-send-email-krzysiek@podlesie.net>

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

On Mon, 2012-10-22 at 19:14 +0200, Krzysztof Mazur wrote:
> The pppoatm gets a reference to atmvcc, but does not increment vcc
> usage count. The vcc uses vcc->sk socket for reference counting,
> so sock_hold() and sock_put() should be used by pppoatm.
> 
> Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
> Cc: David Woodhouse <dwmw2@infradead.org>

Acked-By: David Woodhouse <David.Woodhouse@intel.com>

But did you spot what's in the end of the context of the first hunk...?

> --- a/net/atm/pppoatm.c
> +++ b/net/atm/pppoatm.c
> @@ -154,6 +154,7 @@ static void pppoatm_unassign_vcc(struct atm_vcc
> *atmvcc)
>         tasklet_kill(&pvcc->wakeup_tasklet);
>         ppp_unregister_channel(&pvcc->chan);
>         atmvcc->user_back = NULL;
> +       sock_put(sk_atm(pvcc->atmvcc));
>         kfree(pvcc);
>         /* Gee, I hope we have the big kernel lock here... */
>         module_put(THIS_MODULE);

Fairly sure that hope is unfounded these days... :)

-- 
dwmw2


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply

* Re: [PATCH v2 2/3] pppoatm: fix race condition with destroying of vcc
From: David Woodhouse @ 2012-10-30  9:37 UTC (permalink / raw)
  To: Krzysztof Mazur; +Cc: davem, netdev, linux-kernel
In-Reply-To: <1350926091-12642-2-git-send-email-krzysiek@podlesie.net>

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

On Mon, 2012-10-22 at 19:14 +0200, Krzysztof Mazur wrote:
> The pppoatm_send() calls vcc->send() and now also checks for
> some vcc flags that indicate destroyed vcc without proper locking.
> 
> The vcc_sendmsg() uses lock_sock(sk). This lock is used by
> vcc_release(), so vcc_destroy_socket() will not be called between
> check and during ->send(). The vcc_release_async() sets ATM_VF_CLOSE,
> but it should be safe to call ->send() after it, because
> vcc->dev->ops->close() is not called.
> 
> The pppoatm_send() is called with BH disabled, so bh_lock_sock()
> should be used instead of lock_sock().

Should we be locking it earlier, so that the atm_may_send() call is also
covered by the lock?

Either way, it's an obvious improvement on what we had before — and even
if the answer to my question above is 'yes', exceeding the configured
size by one packet is both harmless and almost never going to happen
since we now limit ourselves to two packets anyway. So:

Acked-By: David Woodhouse <David.Woodhouse@intel.com>

-- 
dwmw2


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply

* Re: [PATCH v2 1/3] pppoatm: don't send frames to destroyed vcc
From: David Woodhouse @ 2012-10-30  9:35 UTC (permalink / raw)
  To: Krzysztof Mazur; +Cc: davem, netdev, linux-kernel
In-Reply-To: <1350926091-12642-1-git-send-email-krzysiek@podlesie.net>

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

On Mon, 2012-10-22 at 19:14 +0200, Krzysztof Mazur wrote:
> Now pppoatm_send(), like vcc_sendmsg(), checks for vcc flags that
> indicate that vcc is not ready.

I note that vcc_sendmsg() also checks for sock->state == SS_CONNECTED.
Is that check not needed here? Otherwise, looks sane enough.

Acked-By: David Woodhouse <David.Woodhouse@intel.com>

-- 
dwmw2


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Daniel Lezcano @ 2012-10-30  9:26 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <CAKohpon8C5O4U+h3nr=8gaEQ1f-K9pqafw=5jPrhaGup_3re=g@mail.gmail.com>

On 10/30/2012 10:03 AM, Viresh Kumar wrote:
> On 30 October 2012 14:30, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>> It is very curious if we disable all the configs option, a slave
>> creation raise a BUG (cf. dsa_slave_create). IIUC, booting with NET_DSA
>> enabled and none of the NET_DSA_TAG* enabled will raise a BUG in the
>> probe function, right ?
>>
>> Maybe we should force at least one config when none are set ?
> 
> I thought of it earlier. But found the one which i posted better. As we will not
> compile DSA stuff now without these tags.

Well, it is the same here, no ? Except, it is up to the user to disable
the option.


> 
> --
> viresh
> 
>> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
>> index 274791c..86326e3 100644
>> --- a/net/dsa/Kconfig
>> +++ b/net/dsa/Kconfig
>> @@ -1,8 +1,9 @@
>> -config NET_DSA
>> +menuconfig NET_DSA
>>         tristate "Distributed Switch Architecture support"
>>         default n
>>         depends on EXPERIMENTAL && NETDEVICES && !S390
>>         select PHYLIB
>> +       select NET_DSA_TAG_DSA if (!NET_DSA_TAG_EDSA &&
>> !NET_DSA_TAG_TRAILER)
>>         ---help---
>>           This allows you to use hardware switch chips that use
>>           the Distributed Switch Architecture.
>> @@ -12,15 +13,15 @@ if NET_DSA
>>
>>  # tagging formats
>>  config NET_DSA_TAG_DSA
>> -       bool
>> +       bool "tag dsa"
>>         default n
>>
>>  config NET_DSA_TAG_EDSA
>> -       bool
>> +       bool "tag edsa"
>>         default n
>>
>>  config NET_DSA_TAG_TRAILER
>> -       bool
>> +       bool "tag trailer"
>>         default n
>>
>>  endif
>>
>>
>> --
>>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>>
>> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
>> <http://twitter.com/#!/linaroorg> Twitter |
>> <http://www.linaro.org/linaro-blog/> Blog
>>


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply

* Re: [uclinux-dist-devel] [PATCH RFC net-next 2/4] bfin_mac: replace sys time stamps with raw ones instead.
From: Bob Liu @ 2012-10-30  9:17 UTC (permalink / raw)
  To: Richard Cochran
  Cc: netdev, Miroslav Lichvar, John Ronciak, John Stultz, Jeff Kirsher,
	device-drivers-devel, Jacob Keller, uclinux-dist-devel,
	Patrick Ohly, David Miller
In-Reply-To: <84396eacd75b4abed36a7819d8c2c33f9ced1ad5.1348851539.git.richardcochran@gmail.com>

On Sat, Sep 29, 2012 at 1:20 AM, Richard Cochran
<richardcochran@gmail.com> wrote:
> This patch replaces the sys time stamps and timecompare code with simple
> raw hardware time stamps in nanosecond resolution. The only tricky bit is
> to find a PTP Hardware Clock period slower than the input clock period
> and a power of two.
>
> Compile tested only.
>
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
> ---
>  drivers/net/ethernet/adi/bfin_mac.c |   91 ++++++++++-------------------------
>  drivers/net/ethernet/adi/bfin_mac.h |    7 +--
>  2 files changed, 28 insertions(+), 70 deletions(-)
>
> diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
> index 2349abb..393d1b5 100644
> --- a/drivers/net/ethernet/adi/bfin_mac.c
> +++ b/drivers/net/ethernet/adi/bfin_mac.c
> @@ -555,7 +555,7 @@ static int bfin_mac_ethtool_get_ts_info(struct net_device *dev,
>         info->so_timestamping =
>                 SOF_TIMESTAMPING_TX_HARDWARE |
>                 SOF_TIMESTAMPING_RX_HARDWARE |
> -               SOF_TIMESTAMPING_SYS_HARDWARE;
> +               SOF_TIMESTAMPING_RAW_HARDWARE;
>         info->phc_index = -1;
>         info->tx_types =
>                 (1 << HWTSTAMP_TX_OFF) |
> @@ -653,6 +653,20 @@ static int bfin_mac_set_mac_address(struct net_device *dev, void *p)
>  #ifdef CONFIG_BFIN_MAC_USE_HWSTAMP
>  #define bfin_mac_hwtstamp_is_none(cfg) ((cfg) == HWTSTAMP_FILTER_NONE)
>
> +static u32 bfin_select_phc_clock(u32 input_clk, unsigned int *shift_result)
> +{
> +       u32 ipn = 1000000000UL / input_clk;
> +       u32 ppn = 1;
> +       unsigned int shift = 0;
> +
> +       while (ppn <= ipn) {
> +               ppn <<= 1;
> +               shift++;
> +       }
> +       *shift_result = shift;
> +       return 1000000000UL / ppn;
> +}
> +
>  static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
>                 struct ifreq *ifr, int cmd)
>  {
> @@ -802,19 +816,7 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
>                 bfin_read_EMAC_PTP_TXSNAPLO();
>                 bfin_read_EMAC_PTP_TXSNAPHI();
>
> -               /*
> -                * Set registers so that rollover occurs soon to test this.
> -                */
> -               bfin_write_EMAC_PTP_TIMELO(0x00000000);
> -               bfin_write_EMAC_PTP_TIMEHI(0xFF800000);
> -
>                 SSYNC();
> -
> -               lp->compare.last_update = 0;
> -               timecounter_init(&lp->clock,
> -                               &lp->cycles,
> -                               ktime_to_ns(ktime_get_real()));
> -               timecompare_update(&lp->compare, 0);
>         }
>
>         lp->stamp_cfg = config;
> @@ -822,15 +824,6 @@ static int bfin_mac_hwtstamp_ioctl(struct net_device *netdev,
>                 -EFAULT : 0;
>  }
>
> -static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompare *cmp)
> -{
> -       ktime_t sys = ktime_get_real();
> -
> -       pr_debug("%s %s hardware:%d,%d transform system:%d,%d system:%d,%d, cmp:%lld, %lld\n",
> -                       __func__, s, hw->tv.sec, hw->tv.nsec, ts->tv.sec, ts->tv.nsec, sys.tv.sec,
> -                       sys.tv.nsec, cmp->offset, cmp->skew);
> -}
> -
>  static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
>  {
>         struct bfin_mac_local *lp = netdev_priv(netdev);
> @@ -861,15 +854,9 @@ static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
>                         regval = bfin_read_EMAC_PTP_TXSNAPLO();
>                         regval |= (u64)bfin_read_EMAC_PTP_TXSNAPHI() << 32;
>                         memset(&shhwtstamps, 0, sizeof(shhwtstamps));
> -                       ns = timecounter_cyc2time(&lp->clock,
> -                                       regval);
> -                       timecompare_update(&lp->compare, ns);
> +                       ns = regval >> lp->shift;
>                         shhwtstamps.hwtstamp = ns_to_ktime(ns);
> -                       shhwtstamps.syststamp =
> -                               timecompare_transform(&lp->compare, ns);
>                         skb_tstamp_tx(skb, &shhwtstamps);
> -
> -                       bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp, &shhwtstamps.syststamp, &lp->compare);
>                 }
>         }
>  }
> @@ -892,51 +879,25 @@ static void bfin_rx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
>
>         regval = bfin_read_EMAC_PTP_RXSNAPLO();
>         regval |= (u64)bfin_read_EMAC_PTP_RXSNAPHI() << 32;
> -       ns = timecounter_cyc2time(&lp->clock, regval);
> -       timecompare_update(&lp->compare, ns);
> +       ns = regval >> lp->shift;
>         memset(shhwtstamps, 0, sizeof(*shhwtstamps));
>         shhwtstamps->hwtstamp = ns_to_ktime(ns);
> -       shhwtstamps->syststamp = timecompare_transform(&lp->compare, ns);
> -
> -       bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp, &shhwtstamps->syststamp, &lp->compare);
> -}

In my test,  system time in slave side can't be updated although here
have set shhwtstamps->hwtstamp = ns_to_ktime(ns).
Any idea?

> -
> -/*
> - * bfin_read_clock - read raw cycle counter (to be used by time counter)
> - */
> -static cycle_t bfin_read_clock(const struct cyclecounter *tc)
> -{
> -       u64 stamp;
> -
> -       stamp =  bfin_read_EMAC_PTP_TIMELO();
> -       stamp |= (u64)bfin_read_EMAC_PTP_TIMEHI() << 32ULL;
> -
> -       return stamp;
>  }
>
> -#define PTP_CLK 25000000
> -
>  static void bfin_mac_hwtstamp_init(struct net_device *netdev)
>  {
>         struct bfin_mac_local *lp = netdev_priv(netdev);
> -       u64 append;
> +       u64 addend;
> +       u32 input_clk, phc_clk;
>
>         /* Initialize hardware timer */
> -       append = PTP_CLK * (1ULL << 32);
> -       do_div(append, get_sclk());
> -       bfin_write_EMAC_PTP_ADDEND((u32)append);
> -
> -       memset(&lp->cycles, 0, sizeof(lp->cycles));
> -       lp->cycles.read = bfin_read_clock;
> -       lp->cycles.mask = CLOCKSOURCE_MASK(64);
> -       lp->cycles.mult = 1000000000 / PTP_CLK;
> -       lp->cycles.shift = 0;
> -
> -       /* Synchronize our NIC clock against system wall clock */
> -       memset(&lp->compare, 0, sizeof(lp->compare));
> -       lp->compare.source = &lp->clock;
> -       lp->compare.target = ktime_get_real;
> -       lp->compare.num_samples = 10;
> +       input_clk = get_sclk();
> +       phc_clk = bfin_select_phc_clock(input_clk, &lp->shift);
> +       addend = phc_clk * (1ULL << 32);
> +       do_div(addend, input_clk);
> +       bfin_write_EMAC_PTP_ADDEND((u32)addend);
> +
> +       lp->addend = addend;
>
>         /* Initialize hwstamp config */
>         lp->stamp_cfg.rx_filter = HWTSTAMP_FILTER_NONE;
> diff --git a/drivers/net/ethernet/adi/bfin_mac.h b/drivers/net/ethernet/adi/bfin_mac.h
> index 960905c..57f042c 100644
> --- a/drivers/net/ethernet/adi/bfin_mac.h
> +++ b/drivers/net/ethernet/adi/bfin_mac.h
> @@ -11,8 +11,6 @@
>  #define _BFIN_MAC_H_
>
>  #include <linux/net_tstamp.h>
> -#include <linux/clocksource.h>
> -#include <linux/timecompare.h>
>  #include <linux/timer.h>
>  #include <linux/etherdevice.h>
>  #include <linux/bfin_mac.h>
> @@ -94,9 +92,8 @@ struct bfin_mac_local {
>         struct mii_bus *mii_bus;
>
>  #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
> -       struct cyclecounter cycles;
> -       struct timecounter clock;
> -       struct timecompare compare;
> +       u32 addend;
> +       unsigned int shift;
>         struct hwtstamp_config stamp_cfg;
>  #endif
>  };
> --
> 1.7.2.5
>
> _______________________________________________
> Uclinux-dist-devel mailing list
> Uclinux-dist-devel@blackfin.uclinux.org
> https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel



-- 
Regards,
--Bob

^ permalink raw reply

* IPV6_PKTINFO seems not to be honored correctly by RAW-sockets
From: Steven Barth @ 2012-10-30  8:58 UTC (permalink / raw)
  To: netdev; +Cc: Steven Barth

Hi,

I recently noticed that there might be an unexpected behavior in the 
handling of IPV6_PKTINFO for RAW-sockets. It seems that the given 
destination interface is ignored.

I just reproduced this on 3.7.0-rc3 vanilla but some quick tests with 
2.6.32 and 3.5 distro-kernels on different machines showed the same.

I've noticed this first in my own software but I could also reproduce it 
easily with standard tools like ping6 from iputils:

Have 2 network interfaces with (global) IPv6-addresses assigned (e.g. 
eth0 with fd00::1/64 and eth1 with fd01::1/64) and do a ping6 -I eth1 
fd00::1 (ping6 from iputils uses IPV6_PKTINFO internally).

For me the result was that even though I set the interface to eth1 the 
ECHO was still send to eth0.

Also (although probably unrelated) forwarding for IPv6 was disabled.

If I try something similar with IPv4 and ping -I ... the ECHO doesn't go 
out on eth0 but - as expected - on eth1.

However if I use traceroute(6) with -I (ICMP-traceroute) and the -i 
option to determine the interface, packages seem to be sent through the 
expected interface. Internally it seems that traceroute(6) uses 
SO_BINDTODEVICE instead of IP(V6)_PKTINFO which seems to work.

So it seems there might be something wrong with IPV6_PKTINFO or is this 
expected behavior?


Thanks and Regards,

Steven

^ permalink raw reply

* Re: switching network namespace midway
From: James Chapman @ 2012-10-30  8:55 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Stephen Hemminger, Benjamin LaHaise, rsa, netdev
In-Reply-To: <87a9v47qsl.fsf@xmission.com>

On 30/10/12 00:21, Eric W. Biederman wrote:
> Stephen Hemminger <shemminger@vyatta.com> writes:
> 
>> On Sat, 27 Oct 2012 22:43:13 -0700
>> ebiederm@xmission.com (Eric W. Biederman) wrote:
>>
>>> Stephen Hemminger <shemminger@vyatta.com> writes:
>>>
>>>> I noticed that the L2TP sockets are not being moved to the correct name
>>>> space.
>>>>
>>>> Something like this is probably needed.
>>>
>>> This is almost right.
>>>
>>> There needs to be a line in l2tp_tunnel_create that verifies
>>> the network namespace of the socket derived from a file descriptor
>>> and the passed in network namespace match.
>>>
>>> For the l2tp_tunnel_sock_create case where we have a socket that is not
>>> exported to userspace using sk_change_net seems appropriate to avoid
>>> reference counting problems.  And it may be worth moving that work into
>>> sk_create_kern.  But we need a network namespace hook that will lookup
>>> all l2tp tunnel sockets when a network namespace is being destroyed and
>>> remove them.  I think we can hit this bug with rmmod as well.
>>
>> Since I don't use netns or L2TP for real, someone else needs to take
>> up the crusade here.
> 
> Let's see if James Chapman is interested.  I don't use L2TP for real either.
> 
> James are you at all interested in the network namespace bugs that have
> been found in the l2tp code?

Very much so, Eric. Thanks for keeping me in the loop. Unfortunately, I
am busy on other things at the moment. It's in my queue. I'll get to it
as soon as I can.

> 
> Eric


-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Viresh Kumar @ 2012-10-30  9:03 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <508F9724.50804@linaro.org>

On 30 October 2012 14:30, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
> It is very curious if we disable all the configs option, a slave
> creation raise a BUG (cf. dsa_slave_create). IIUC, booting with NET_DSA
> enabled and none of the NET_DSA_TAG* enabled will raise a BUG in the
> probe function, right ?
>
> Maybe we should force at least one config when none are set ?

I thought of it earlier. But found the one which i posted better. As we will not
compile DSA stuff now without these tags.

--
viresh

> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 274791c..86326e3 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -1,8 +1,9 @@
> -config NET_DSA
> +menuconfig NET_DSA
>         tristate "Distributed Switch Architecture support"
>         default n
>         depends on EXPERIMENTAL && NETDEVICES && !S390
>         select PHYLIB
> +       select NET_DSA_TAG_DSA if (!NET_DSA_TAG_EDSA &&
> !NET_DSA_TAG_TRAILER)
>         ---help---
>           This allows you to use hardware switch chips that use
>           the Distributed Switch Architecture.
> @@ -12,15 +13,15 @@ if NET_DSA
>
>  # tagging formats
>  config NET_DSA_TAG_DSA
> -       bool
> +       bool "tag dsa"
>         default n
>
>  config NET_DSA_TAG_EDSA
> -       bool
> +       bool "tag edsa"
>         default n
>
>  config NET_DSA_TAG_TRAILER
> -       bool
> +       bool "tag trailer"
>         default n
>
>  endif
>
>
> --
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog
>

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Daniel Lezcano @ 2012-10-30  9:00 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <CAKohpokmfFSFsADmtOyN9JRCX8aVdNs+tDFhUQuM6sSQ+dFfUA@mail.gmail.com>

On 10/30/2012 08:55 AM, Viresh Kumar wrote:
> On 30 October 2012 13:23, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>> From: Viresh Kumar <viresh.kumar@linaro.org>
> 
>>>  config NET_DSA_TAG_DSA
>>> -     bool
>>> +     bool "Original DSA packet tagging format"
>>> +     select NET_DSt
>>
>> typo NET_DSA
> 
> Unbelievable mistake :(
> 
> Will fix it after some reviews now :)

Yeah, has to be ! ;)

It is very curious if we disable all the configs option, a slave
creation raise a BUG (cf. dsa_slave_create). IIUC, booting with NET_DSA
enabled and none of the NET_DSA_TAG* enabled will raise a BUG in the
probe function, right ?

Maybe we should force at least one config when none are set ?

diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 274791c..86326e3 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -1,8 +1,9 @@
-config NET_DSA
+menuconfig NET_DSA
        tristate "Distributed Switch Architecture support"
        default n
        depends on EXPERIMENTAL && NETDEVICES && !S390
        select PHYLIB
+       select NET_DSA_TAG_DSA if (!NET_DSA_TAG_EDSA &&
!NET_DSA_TAG_TRAILER)
        ---help---
          This allows you to use hardware switch chips that use
          the Distributed Switch Architecture.
@@ -12,15 +13,15 @@ if NET_DSA

 # tagging formats
 config NET_DSA_TAG_DSA
-       bool
+       bool "tag dsa"
        default n

 config NET_DSA_TAG_EDSA
-       bool
+       bool "tag edsa"
        default n

 config NET_DSA_TAG_TRAILER
-       bool
+       bool "tag trailer"
        default n

 endif


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply related

* Re: WARNING: at net/core/skbuff.c:573
From: Cong Wang @ 2012-10-30  8:46 UTC (permalink / raw)
  To: netdev
In-Reply-To: <508F8612.2040301@mellanox.com>

On Tue, 30 Oct 2012 at 07:47 GMT, Haggai Eran <haggaie@mellanox.com> wrote:
> Hi,
>
> Running kernel v3.7-rc2 I'm getting these warnings at
> skb_release_head_state. It is called from netconsole, due to printk
> from mlx4_core's interrupt handler. The warning is due to the function 
> being run in interrupt context. However, according to the documentation,
> netconsole is supposed to be fine running from within interrupts.
>
> I'm not sure I can reproduce it reliably though.

This comes from:

        if (skb->destructor) {
                WARN_ON(in_irq());
                skb->destructor(skb);
        }
						
when mlx4_eq_int() calls printk() in interrupt context, thus
netconsole triggered this warning.

So, I am wondering if you can get netconsole message on the remote
successfully after removing that offending WARN_ON()?

I don't know the reason why we warn for calling sbk destructors in IRQ
context, seems the code is very code.


>
> Haggai
>
> [73550.981930] ------------[ cut here ]------------
> [73550.981933] WARNING: at net/core/skbuff.c:573 skb_release_head_state+0x10f/0x120()
> [73550.981933] Hardware name: PowerEdge R710
> [73550.981961] Modules linked in: rdma_ucm rdma_cm iw_cm ib_addr ib_ipoib ib_cm ib_uverbs ib_umad mlx4_ib ib_sa ib_mad ib_core mlx4_en mlx4_core mmu_trace(O) mst_pciconf(O) mst_pci(O) netconsole configfs nfsv3 nfs_acl nfsv4 auth_rpcgss nfs fscache lockd autofs4 sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod uinput iTCO_wdt iTCO_vendor_support dcdbas sg ses enclosure coretemp hwmon kvm_intel kvm crc32c_intel ghash_clmulni_intel serio_raw pcspkr lpc_ich mfd_core bnx2 ext3 jbd mbcache sr_mod cdrom sd_mod crc_t10dif aesni_intel ablk_helper cryptd lrw aes_x86_64 xts gf128mul pata_acpi ata_generic ata_piix megaraid_sas [last unloaded: mlx4_core]
> [73550.981962] Pid: 9167, comm: odp Tainted: G        W  O 3.7.0-rc2-odp+ #8
> [73550.981963] Call Trace:
> [73550.981965]  <IRQ>  [<ffffffff8104619f>] warn_slowpath_common+0x7f/0xc0
> [73550.981967]  [<ffffffff810461fa>] warn_slowpath_null+0x1a/0x20
> [73550.981969]  [<ffffffff8147e9ff>] skb_release_head_state+0x10f/0x120
> [73550.981971]  [<ffffffff8147e766>] __kfree_skb+0x16/0xa0
> [73550.981973]  [<ffffffff8147eab1>] consume_skb+0x31/0xe0
> [73550.981978]  [<ffffffffa00f7369>] bnx2_poll_work+0x2d9/0x13f0 [bnx2]
> [73550.981980]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
> [73550.981982]  [<ffffffff8157d577>] ? _raw_spin_unlock_irqrestore+0x77/0x80
> [73550.981984]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
> [73550.981986]  [<ffffffff8157d577>] ? _raw_spin_unlock_irqrestore+0x77/0x80
> [73550.981988]  [<ffffffff810abc89>] ? trace_hardirqs_off_caller+0x29/0xc0
> [73550.981990]  [<ffffffff810abd2d>] ? trace_hardirqs_off+0xd/0x10
> [73550.981995]  [<ffffffffa00f84c3>] bnx2_poll_msix+0x43/0xd0 [bnx2]
> [73550.981996]  [<ffffffff8157d6cc>] ? _raw_spin_trylock+0x6c/0x80
> [73550.981998]  [<ffffffff814a8dce>] netpoll_poll_dev+0x14e/0x7a0
> [73550.982001]  [<ffffffff814a972c>] netpoll_send_skb_on_dev+0x30c/0x400
> [73550.982003]  [<ffffffff814a9b13>] netpoll_send_udp+0x263/0x2b0
> [73550.982006]  [<ffffffffa00812f3>] write_msg+0xc3/0x120 [netconsole]
> [73550.982008]  [<ffffffff810483f3>] call_console_drivers.clone.3+0xa3/0x1c0
> [73550.982010]  [<ffffffff810487c8>] console_unlock+0x2b8/0x450
> [73550.982012]  [<ffffffff81048d7e>] vprintk_emit+0x1de/0x5b0
> [73550.982014]  [<ffffffff81579aed>] printk+0x4d/0x4f
> [73550.982015]  [<ffffffff8129e41c>] ? ___ratelimit+0xac/0x150
> [73550.982020]  [<ffffffffa03f5829>] mlx4_eq_int+0x779/0xc50 [mlx4_core]
> [73550.982025]  [<ffffffffa000152f>] ? megasas_isr+0x5f/0x200 [megaraid_sas]
> [73550.982027]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
> [73550.982029]  [<ffffffff813636c1>] ? add_interrupt_randomness+0x41/0x190
> [73550.982034]  [<ffffffffa03f5d14>] mlx4_msi_x_interrupt+0x14/0x20 [mlx4_core]
> [73550.982036]  [<ffffffff810e3fd5>] handle_irq_event_percpu+0x95/0x390
> [73550.982039]  [<ffffffff8139be30>] ? scsi_get_command+0xc0/0xc0
> [73550.982040]  [<ffffffff810e4318>] handle_irq_event+0x48/0x70
> [73550.982043]  [<ffffffff810e796d>] handle_edge_irq+0x6d/0x130
> [73550.982044]  [<ffffffff8100470c>] handle_irq+0x5c/0x150
> [73550.982046]  [<ffffffff8104fdcb>] ? irq_enter+0x1b/0x90
> [73550.982048]  [<ffffffff8158855d>] do_IRQ+0x5d/0xe0
> [73550.982050]  [<ffffffff8157d9b2>] common_interrupt+0x72/0x72
> [73550.982052]  [<ffffffff8157da73>] ? retint_restore_args+0x13/0x13
> [73550.982054]  [<ffffffff8157d540>] ? _raw_spin_unlock_irqrestore+0x40/0x80
> [73550.982056]  [<ffffffff8157d545>] ? _raw_spin_unlock_irqrestore+0x45/0x80
> [73550.982061]  [<ffffffffa00011d7>] megasas_queue_command+0x77/0x170 [megaraid_sas]
> [73550.982063]  [<ffffffff8139bfdb>] scsi_dispatch_cmd+0xeb/0x380
> [73550.982065]  [<ffffffff813a2f18>] scsi_request_fn+0x408/0x6f0
> [73550.982067]  [<ffffffff8127158e>] __blk_run_queue+0x1e/0x20
> [73550.982069]  [<ffffffff81273f30>] blk_run_queue+0x30/0x50
> [73550.982071]  [<ffffffff813a23e2>] scsi_run_queue+0xd2/0x2a0
> [73550.982073]  [<ffffffff810af0ad>] ? trace_hardirqs_on+0xd/0x10
> [73550.982075]  [<ffffffff813a3452>] scsi_next_command+0x42/0x60
> [73550.982077]  [<ffffffff813a41c6>] scsi_io_completion+0x2b6/0x670
> [73550.982079]  [<ffffffff8139b2f9>] scsi_finish_command+0xc9/0x130
> [73550.982081]  [<ffffffff813a46e7>] scsi_softirq_done+0x147/0x170
> [73550.982083]  [<ffffffff8127e9ea>] blk_done_softirq+0x8a/0xa0
> [73550.982086]  [<ffffffff81050810>] __do_softirq+0x110/0x3c0
> [73550.982088]  [<ffffffff8139be30>] ? scsi_get_command+0xc0/0xc0
> [73550.982090]  [<ffffffff81587e3c>] call_softirq+0x1c/0x30
> [73550.982092]  [<ffffffff8100467d>] do_softirq+0xad/0xe0
> [73550.982094]  [<ffffffff8104fc75>] irq_exit+0xe5/0x100
> [73550.982095]  [<ffffffff81588566>] do_IRQ+0x66/0xe0
> [73550.982097]  [<ffffffff8157d9b2>] common_interrupt+0x72/0x72
> [73550.982100]  <EOI>  [<ffffffff8157d540>] ? _raw_spin_unlock_irqrestore+0x40/0x80
> [73550.982102]  [<ffffffff8157d545>] ? _raw_spin_unlock_irqrestore+0x45/0x80
> [73550.982106]  [<ffffffffa00011d7>] megasas_queue_command+0x77/0x170 [megaraid_sas]
> [73550.982109]  [<ffffffff8139bfdb>] scsi_dispatch_cmd+0xeb/0x380
> [73550.982111]  [<ffffffff813a2f18>] scsi_request_fn+0x408/0x6f0
> [73550.982113]  [<ffffffff81293c5c>] ? cfq_insert_request+0x4c/0x630
> [73550.982115]  [<ffffffff8127158e>] __blk_run_queue+0x1e/0x20
> [73550.982117]  [<ffffffff81293f77>] cfq_insert_request+0x367/0x630
> [73550.982118]  [<ffffffff81293c5c>] ? cfq_insert_request+0x4c/0x630
> [73550.982121]  [<ffffffff81278db0>] ? blk_flush_plug_list+0x180/0x270
> [73550.982123]  [<ffffffff812ad173>] ? debug_object_activate+0x83/0x190
> [73550.982125]  [<ffffffff81270e88>] __elv_add_request+0x138/0x2b0
> [73550.982127]  [<ffffffff81278de4>] blk_flush_plug_list+0x1b4/0x270
> [73550.982129]  [<ffffffff8157c010>] schedule+0x50/0x70
> [73550.982130]  [<ffffffff81579cce>] schedule_timeout+0x15e/0x2c0
> [73550.982132]  [<ffffffff810581c0>] ? lock_timer_base+0x70/0x70
> [73550.982135]  [<ffffffff8157be8b>] wait_for_common+0x12b/0x180
> [73550.982136]  [<ffffffff81086c10>] ? try_to_wake_up+0x300/0x300
> [73550.982138]  [<ffffffff8157bf93>] wait_for_completion_timeout+0x13/0x20
> [73550.982143]  [<ffffffffa03f28f2>] __mlx4_cmd+0x2a2/0x5c0 [mlx4_core]
> [73550.982149]  [<ffffffffa04021d6>] mlx4_SYNC_TPT+0x36/0x40 [mlx4_core]
> [73550.982151]  [<ffffffff8157a80e>] ? mutex_unlock+0xe/0x10
> [73550.982156]  [<ffffffffa0436e3d>] invalidation_handler+0x22d/0x3b0 [mlx4_ib]
> [73550.982161]  [<ffffffffa0436c10>] ? mlx4_ib_qp_pfault_action+0x40/0x40 [mlx4_ib]
> [73550.982166]  [<ffffffffa043702d>] mlx4_ib_invalidate_page+0x2d/0x30 [mlx4_ib]
> [73550.982170]  [<ffffffffa025c764>] invalidate_page_trampoline+0x34/0x50 [ib_core]
> [73550.982175]  [<ffffffffa025d7e4>] rbt_ib_umem_for_each_in_range+0xa4/0x150 [ib_core]
> [73550.982179]  [<ffffffffa025c730>] ? invalidate_range_start_trampoline+0x60/0x60 [ib_core]
> [73550.982183]  [<ffffffffa025cf33>] ib_umem_notifier_invalidate_page+0x63/0x80 [ib_core]
> [73550.982185]  [<ffffffff8117ace5>] __mmu_notifier_invalidate_page+0xa5/0x1b0
> [73550.982188]  [<ffffffff8117ac40>] ? mmu_notifier_unregister+0x1e0/0x1e0
> [73550.982190]  [<ffffffff811660f8>] try_to_unmap_one+0x3f8/0x470
> [73550.982192]  [<ffffffff81164ff1>] ? page_lock_anon_vma+0x151/0x2b0
> [73550.982194]  [<ffffffff81164ea0>] ? page_get_anon_vma+0x1b0/0x1b0
> [73550.982196]  [<ffffffff811668fc>] try_to_unmap_anon+0xbc/0x160
> [73550.982198]  [<ffffffff81166a6b>] try_to_unmap+0x6b/0xa0
> [73550.982201]  [<ffffffff811407ab>] shrink_page_list+0x3eb/0xa50
> [73550.982203]  [<ffffffff8114210f>] shrink_inactive_list+0x17f/0x4c0
> [73550.982205]  [<ffffffff811426ec>] ? shrink_active_list+0x29c/0x340
> [73550.982207]  [<ffffffff81142c25>] shrink_lruvec+0x495/0x5b0
> [73550.982209]  [<ffffffff812943dc>] ? cfq_dispatch_requests+0x19c/0xd20
> [73550.982211]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
> [73550.982213]  [<ffffffff81142da6>] shrink_zone+0x66/0xc0
> [73550.982215]  [<ffffffff8114451b>] do_try_to_free_pages+0xeb/0x630
> [73550.982217]  [<ffffffff81144c0b>] try_to_free_mem_cgroup_pages+0xbb/0x200
> [73550.982219]  [<ffffffff810aef10>] ? trace_hardirqs_on_caller+0x20/0x1b0
> [73550.982221]  [<ffffffff8119069e>] mem_cgroup_reclaim+0x4e/0xe0
> [73550.982223]  [<ffffffff8119101c>] __mem_cgroup_try_charge+0x4cc/0x9e0
> [73550.982225]  [<ffffffff81194874>] ? swap_cgroup_record+0x34/0x60
> [73550.982228]  [<ffffffff81191943>] __mem_cgroup_try_charge_swapin+0xa3/0xc0
> [73550.982231]  [<ffffffff811919af>] mem_cgroup_try_charge_swapin+0x4f/0x60
> [73550.982232]  [<ffffffff8115b5ec>] handle_pte_fault+0x30c/0x9d0
> [73550.982234]  [<ffffffff8119410f>] ? mem_cgroup_count_vm_event+0x1f/0x190
> [73550.982236]  [<ffffffff8115bf01>] handle_mm_fault+0x251/0x310
> [73550.982238]  [<ffffffff81581943>] __do_page_fault+0x223/0x510
> [73550.982240]  [<ffffffff810aef10>] ? trace_hardirqs_on_caller+0x20/0x1b0
> [73550.982242]  [<ffffffff810af0ad>] ? trace_hardirqs_on+0xd/0x10
> [73550.982244]  [<ffffffff8157d4e0>] ? _raw_spin_unlock_irq+0x30/0x50
> [73550.982246]  [<ffffffff81080ee5>] ? finish_task_switch+0x85/0x120
> [73550.982248]  [<ffffffff81080ea8>] ? finish_task_switch+0x48/0x120
> [73550.982250]  [<ffffffff8157df06>] ? error_sti+0x5/0x6
> [73550.982252]  [<ffffffff810abc89>] ? trace_hardirqs_off_caller+0x29/0xc0
> [73550.982254]  [<ffffffff812a5ebd>] ? trace_hardirqs_off_thunk+0x3a/0x3c
> [73550.982256]  [<ffffffff81581c3e>] do_page_fault+0xe/0x10
> [73550.982258]  [<ffffffff8157dcb8>] page_fault+0x28/0x30
> [73550.982259] ---[ end trace 12bb14f2b81db036 ]---
>
>

^ permalink raw reply

* Re: [PATCH 3/4] arm: mvebu: add Ethernet controllers using mvneta driver for Armada 370/XP
From: Thomas Petazzoni @ 2012-10-30  8:36 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: David S. Miller, Lennert Buytenhek, Lior Amsalem, Andrew Lunn,
	Jason Cooper, netdev, Maen Suleiman, Gregory Clement,
	linux-arm-kernel
In-Reply-To: <CABMQnVKswTJr9Nd4Etx4Htv0Ckn+pDNqGO8MoPBH-x8y6CwZyA@mail.gmail.com>

Hello,

On Tue, 30 Oct 2012 13:19:15 +0900, Nobuhiro Iwamatsu wrote:

> > diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
> > index 16cc82c..d484492 100644
> > --- a/arch/arm/boot/dts/armada-370-xp.dtsi
> > +++ b/arch/arm/boot/dts/armada-370-xp.dtsi
> > @@ -68,6 +68,20 @@
> >                         compatible = "marvell,armada-addr-decoding-controller";
> >                         reg = <0xd0020000 0x258>;
> >                 };
> > +
> > +                ethernet@d0070000 {
> > +                               compatible = "marvell,armada-370-neta";
> > +                               reg = <0xd0070000 0x2500>;
> > +                               interrupts = <8>;
> > +                               status = "disabled";
> > +                };
> > +
> > +                ethernet@d0074000 {
> > +                               compatible = "marvell,armada-370-neta";
> > +                               reg = <0xd0074000 0x2500>;
> > +                               interrupts = <10>;
> > +                               status = "disabled";
> > +                };
> 
> Could you fit an indent?

Right, thanks, will fix.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Viresh Kumar @ 2012-10-30  7:55 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <508F8779.8070300@linaro.org>

On 30 October 2012 13:23, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>> From: Viresh Kumar <viresh.kumar@linaro.org>

>>  config NET_DSA_TAG_DSA
>> -     bool
>> +     bool "Original DSA packet tagging format"
>> +     select NET_DSt
>
> typo NET_DSA

Unbelievable mistake :(

Will fix it after some reviews now :)

--
viresh

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Daniel Lezcano @ 2012-10-30  7:53 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Ben Hutchings, netdev, linaro-dev, davem, linux-kernel, patches
In-Reply-To: <CAKohponOKk5e2Sxyhjw-XvzVxF3tNp66rsnYCwvwHazAPAauKw@mail.gmail.com>

On 10/30/2012 08:31 AM, Viresh Kumar wrote:
> On 30 October 2012 12:15, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> And so, if we select NET_DSA from these tagging drivers, then only slave.c will
>> get compiled. Otherwise slave.c dsa.c dsa_core.c wouldn't be compiled and so
>> no warnings.
> 
> If my above explanation/assumption is correct, then please review following
> patch:
> 
> --------------------------x-----------------------x----------------
> 
> From: Viresh Kumar <viresh.kumar@linaro.org>
> Date: Mon, 29 Oct 2012 22:19:14 +0530
> Subject: [PATCH] net: dsa/slave: Fix compilation warnings
> 
> Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
> CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation warnings:
> 
> net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used
> [-Wunused-function]
> net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined
> but not used [-Wunused-function]
> net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but
> not used [-Wunused-function]
> net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined
> but not used [-Wunused-function]
> net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not
> used [-Wunused-function]
> 
> Earlier approach to fix this was discussed here:
> 
> lkml.org/lkml/2012/10/29/549
> 
> This is another approach to fix it. This is done by some changes in config
> options, which make more sense than the earlier approach. As, atleast one
> tagging option must always be selected for using net/dsa/ infrastructure, this
> patch selects NET_DSA from tagging configs instead of having it as an selectable
> config.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/net/dsa/Kconfig |  1 -
>  net/dsa/Kconfig         | 16 +++++++++-------
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
> index dd151d5..96eae22 100644
> --- a/drivers/net/dsa/Kconfig
> +++ b/drivers/net/dsa/Kconfig
> @@ -1,5 +1,4 @@
>  menu "Distributed Switch Architecture drivers"
> -	depends on NET_DSA
> 
>  config NET_DSA_MV88E6XXX
>  	tristate
> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 274791c..f7c6cef 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -1,5 +1,5 @@
>  config NET_DSA
> -	tristate "Distributed Switch Architecture support"
> +	tristate
>  	default n
>  	depends on EXPERIMENTAL && NETDEVICES && !S390
>  	select PHYLIB
> @@ -8,19 +8,21 @@ config NET_DSA
>  	  the Distributed Switch Architecture.
> 
> 
> -if NET_DSA
> +menu "Distributed Switch Architecture support"
> 
>  # tagging formats
>  config NET_DSA_TAG_DSA
> -	bool
> +	bool "Original DSA packet tagging format"
> +	select NET_DSt

typo NET_DSA

>  	default n
> 
>  config NET_DSA_TAG_EDSA
> -	bool
> +	bool "Ethertype DSA packet tagging format"
> +	select NET_DSA
>  	default n
> 
>  config NET_DSA_TAG_TRAILER
> -	bool
> +	bool "Trailer DSA packet tagging format"
> +	select NET_DSA
>  	default n
> -
> -endif
> +endmenu
> 
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply

* WARNING: at net/core/skbuff.c:573
From: Haggai Eran @ 2012-10-30  7:47 UTC (permalink / raw)
  To: netdev
In-Reply-To: <B855DA7245737D4B83EDD9C0B7698E652B7D29DA@MTRDAG01.mtl.com>

Hi,

Running kernel v3.7-rc2 I'm getting these warnings at
skb_release_head_state. It is called from netconsole, due to printk
from mlx4_core's interrupt handler. The warning is due to the function 
being run in interrupt context. However, according to the documentation,
netconsole is supposed to be fine running from within interrupts.

I'm not sure I can reproduce it reliably though.

Haggai

[73550.981930] ------------[ cut here ]------------
[73550.981933] WARNING: at net/core/skbuff.c:573 skb_release_head_state+0x10f/0x120()
[73550.981933] Hardware name: PowerEdge R710
[73550.981961] Modules linked in: rdma_ucm rdma_cm iw_cm ib_addr ib_ipoib ib_cm ib_uverbs ib_umad mlx4_ib ib_sa ib_mad ib_core mlx4_en mlx4_core mmu_trace(O) mst_pciconf(O) mst_pci(O) netconsole configfs nfsv3 nfs_acl nfsv4 auth_rpcgss nfs fscache lockd autofs4 sunrpc ipv6 dm_mirror dm_region_hash dm_log dm_mod uinput iTCO_wdt iTCO_vendor_support dcdbas sg ses enclosure coretemp hwmon kvm_intel kvm crc32c_intel ghash_clmulni_intel serio_raw pcspkr lpc_ich mfd_core bnx2 ext3 jbd mbcache sr_mod cdrom sd_mod crc_t10dif aesni_intel ablk_helper cryptd lrw aes_x86_64 xts gf128mul pata_acpi ata_generic ata_piix megaraid_sas [last unloaded: mlx4_core]
[73550.981962] Pid: 9167, comm: odp Tainted: G        W  O 3.7.0-rc2-odp+ #8
[73550.981963] Call Trace:
[73550.981965]  <IRQ>  [<ffffffff8104619f>] warn_slowpath_common+0x7f/0xc0
[73550.981967]  [<ffffffff810461fa>] warn_slowpath_null+0x1a/0x20
[73550.981969]  [<ffffffff8147e9ff>] skb_release_head_state+0x10f/0x120
[73550.981971]  [<ffffffff8147e766>] __kfree_skb+0x16/0xa0
[73550.981973]  [<ffffffff8147eab1>] consume_skb+0x31/0xe0
[73550.981978]  [<ffffffffa00f7369>] bnx2_poll_work+0x2d9/0x13f0 [bnx2]
[73550.981980]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
[73550.981982]  [<ffffffff8157d577>] ? _raw_spin_unlock_irqrestore+0x77/0x80
[73550.981984]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
[73550.981986]  [<ffffffff8157d577>] ? _raw_spin_unlock_irqrestore+0x77/0x80
[73550.981988]  [<ffffffff810abc89>] ? trace_hardirqs_off_caller+0x29/0xc0
[73550.981990]  [<ffffffff810abd2d>] ? trace_hardirqs_off+0xd/0x10
[73550.981995]  [<ffffffffa00f84c3>] bnx2_poll_msix+0x43/0xd0 [bnx2]
[73550.981996]  [<ffffffff8157d6cc>] ? _raw_spin_trylock+0x6c/0x80
[73550.981998]  [<ffffffff814a8dce>] netpoll_poll_dev+0x14e/0x7a0
[73550.982001]  [<ffffffff814a972c>] netpoll_send_skb_on_dev+0x30c/0x400
[73550.982003]  [<ffffffff814a9b13>] netpoll_send_udp+0x263/0x2b0
[73550.982006]  [<ffffffffa00812f3>] write_msg+0xc3/0x120 [netconsole]
[73550.982008]  [<ffffffff810483f3>] call_console_drivers.clone.3+0xa3/0x1c0
[73550.982010]  [<ffffffff810487c8>] console_unlock+0x2b8/0x450
[73550.982012]  [<ffffffff81048d7e>] vprintk_emit+0x1de/0x5b0
[73550.982014]  [<ffffffff81579aed>] printk+0x4d/0x4f
[73550.982015]  [<ffffffff8129e41c>] ? ___ratelimit+0xac/0x150
[73550.982020]  [<ffffffffa03f5829>] mlx4_eq_int+0x779/0xc50 [mlx4_core]
[73550.982025]  [<ffffffffa000152f>] ? megasas_isr+0x5f/0x200 [megaraid_sas]
[73550.982027]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
[73550.982029]  [<ffffffff813636c1>] ? add_interrupt_randomness+0x41/0x190
[73550.982034]  [<ffffffffa03f5d14>] mlx4_msi_x_interrupt+0x14/0x20 [mlx4_core]
[73550.982036]  [<ffffffff810e3fd5>] handle_irq_event_percpu+0x95/0x390
[73550.982039]  [<ffffffff8139be30>] ? scsi_get_command+0xc0/0xc0
[73550.982040]  [<ffffffff810e4318>] handle_irq_event+0x48/0x70
[73550.982043]  [<ffffffff810e796d>] handle_edge_irq+0x6d/0x130
[73550.982044]  [<ffffffff8100470c>] handle_irq+0x5c/0x150
[73550.982046]  [<ffffffff8104fdcb>] ? irq_enter+0x1b/0x90
[73550.982048]  [<ffffffff8158855d>] do_IRQ+0x5d/0xe0
[73550.982050]  [<ffffffff8157d9b2>] common_interrupt+0x72/0x72
[73550.982052]  [<ffffffff8157da73>] ? retint_restore_args+0x13/0x13
[73550.982054]  [<ffffffff8157d540>] ? _raw_spin_unlock_irqrestore+0x40/0x80
[73550.982056]  [<ffffffff8157d545>] ? _raw_spin_unlock_irqrestore+0x45/0x80
[73550.982061]  [<ffffffffa00011d7>] megasas_queue_command+0x77/0x170 [megaraid_sas]
[73550.982063]  [<ffffffff8139bfdb>] scsi_dispatch_cmd+0xeb/0x380
[73550.982065]  [<ffffffff813a2f18>] scsi_request_fn+0x408/0x6f0
[73550.982067]  [<ffffffff8127158e>] __blk_run_queue+0x1e/0x20
[73550.982069]  [<ffffffff81273f30>] blk_run_queue+0x30/0x50
[73550.982071]  [<ffffffff813a23e2>] scsi_run_queue+0xd2/0x2a0
[73550.982073]  [<ffffffff810af0ad>] ? trace_hardirqs_on+0xd/0x10
[73550.982075]  [<ffffffff813a3452>] scsi_next_command+0x42/0x60
[73550.982077]  [<ffffffff813a41c6>] scsi_io_completion+0x2b6/0x670
[73550.982079]  [<ffffffff8139b2f9>] scsi_finish_command+0xc9/0x130
[73550.982081]  [<ffffffff813a46e7>] scsi_softirq_done+0x147/0x170
[73550.982083]  [<ffffffff8127e9ea>] blk_done_softirq+0x8a/0xa0
[73550.982086]  [<ffffffff81050810>] __do_softirq+0x110/0x3c0
[73550.982088]  [<ffffffff8139be30>] ? scsi_get_command+0xc0/0xc0
[73550.982090]  [<ffffffff81587e3c>] call_softirq+0x1c/0x30
[73550.982092]  [<ffffffff8100467d>] do_softirq+0xad/0xe0
[73550.982094]  [<ffffffff8104fc75>] irq_exit+0xe5/0x100
[73550.982095]  [<ffffffff81588566>] do_IRQ+0x66/0xe0
[73550.982097]  [<ffffffff8157d9b2>] common_interrupt+0x72/0x72
[73550.982100]  <EOI>  [<ffffffff8157d540>] ? _raw_spin_unlock_irqrestore+0x40/0x80
[73550.982102]  [<ffffffff8157d545>] ? _raw_spin_unlock_irqrestore+0x45/0x80
[73550.982106]  [<ffffffffa00011d7>] megasas_queue_command+0x77/0x170 [megaraid_sas]
[73550.982109]  [<ffffffff8139bfdb>] scsi_dispatch_cmd+0xeb/0x380
[73550.982111]  [<ffffffff813a2f18>] scsi_request_fn+0x408/0x6f0
[73550.982113]  [<ffffffff81293c5c>] ? cfq_insert_request+0x4c/0x630
[73550.982115]  [<ffffffff8127158e>] __blk_run_queue+0x1e/0x20
[73550.982117]  [<ffffffff81293f77>] cfq_insert_request+0x367/0x630
[73550.982118]  [<ffffffff81293c5c>] ? cfq_insert_request+0x4c/0x630
[73550.982121]  [<ffffffff81278db0>] ? blk_flush_plug_list+0x180/0x270
[73550.982123]  [<ffffffff812ad173>] ? debug_object_activate+0x83/0x190
[73550.982125]  [<ffffffff81270e88>] __elv_add_request+0x138/0x2b0
[73550.982127]  [<ffffffff81278de4>] blk_flush_plug_list+0x1b4/0x270
[73550.982129]  [<ffffffff8157c010>] schedule+0x50/0x70
[73550.982130]  [<ffffffff81579cce>] schedule_timeout+0x15e/0x2c0
[73550.982132]  [<ffffffff810581c0>] ? lock_timer_base+0x70/0x70
[73550.982135]  [<ffffffff8157be8b>] wait_for_common+0x12b/0x180
[73550.982136]  [<ffffffff81086c10>] ? try_to_wake_up+0x300/0x300
[73550.982138]  [<ffffffff8157bf93>] wait_for_completion_timeout+0x13/0x20
[73550.982143]  [<ffffffffa03f28f2>] __mlx4_cmd+0x2a2/0x5c0 [mlx4_core]
[73550.982149]  [<ffffffffa04021d6>] mlx4_SYNC_TPT+0x36/0x40 [mlx4_core]
[73550.982151]  [<ffffffff8157a80e>] ? mutex_unlock+0xe/0x10
[73550.982156]  [<ffffffffa0436e3d>] invalidation_handler+0x22d/0x3b0 [mlx4_ib]
[73550.982161]  [<ffffffffa0436c10>] ? mlx4_ib_qp_pfault_action+0x40/0x40 [mlx4_ib]
[73550.982166]  [<ffffffffa043702d>] mlx4_ib_invalidate_page+0x2d/0x30 [mlx4_ib]
[73550.982170]  [<ffffffffa025c764>] invalidate_page_trampoline+0x34/0x50 [ib_core]
[73550.982175]  [<ffffffffa025d7e4>] rbt_ib_umem_for_each_in_range+0xa4/0x150 [ib_core]
[73550.982179]  [<ffffffffa025c730>] ? invalidate_range_start_trampoline+0x60/0x60 [ib_core]
[73550.982183]  [<ffffffffa025cf33>] ib_umem_notifier_invalidate_page+0x63/0x80 [ib_core]
[73550.982185]  [<ffffffff8117ace5>] __mmu_notifier_invalidate_page+0xa5/0x1b0
[73550.982188]  [<ffffffff8117ac40>] ? mmu_notifier_unregister+0x1e0/0x1e0
[73550.982190]  [<ffffffff811660f8>] try_to_unmap_one+0x3f8/0x470
[73550.982192]  [<ffffffff81164ff1>] ? page_lock_anon_vma+0x151/0x2b0
[73550.982194]  [<ffffffff81164ea0>] ? page_get_anon_vma+0x1b0/0x1b0
[73550.982196]  [<ffffffff811668fc>] try_to_unmap_anon+0xbc/0x160
[73550.982198]  [<ffffffff81166a6b>] try_to_unmap+0x6b/0xa0
[73550.982201]  [<ffffffff811407ab>] shrink_page_list+0x3eb/0xa50
[73550.982203]  [<ffffffff8114210f>] shrink_inactive_list+0x17f/0x4c0
[73550.982205]  [<ffffffff811426ec>] ? shrink_active_list+0x29c/0x340
[73550.982207]  [<ffffffff81142c25>] shrink_lruvec+0x495/0x5b0
[73550.982209]  [<ffffffff812943dc>] ? cfq_dispatch_requests+0x19c/0xd20
[73550.982211]  [<ffffffff8157ccc9>] ? _raw_spin_lock_irqsave+0x29/0x70
[73550.982213]  [<ffffffff81142da6>] shrink_zone+0x66/0xc0
[73550.982215]  [<ffffffff8114451b>] do_try_to_free_pages+0xeb/0x630
[73550.982217]  [<ffffffff81144c0b>] try_to_free_mem_cgroup_pages+0xbb/0x200
[73550.982219]  [<ffffffff810aef10>] ? trace_hardirqs_on_caller+0x20/0x1b0
[73550.982221]  [<ffffffff8119069e>] mem_cgroup_reclaim+0x4e/0xe0
[73550.982223]  [<ffffffff8119101c>] __mem_cgroup_try_charge+0x4cc/0x9e0
[73550.982225]  [<ffffffff81194874>] ? swap_cgroup_record+0x34/0x60
[73550.982228]  [<ffffffff81191943>] __mem_cgroup_try_charge_swapin+0xa3/0xc0
[73550.982231]  [<ffffffff811919af>] mem_cgroup_try_charge_swapin+0x4f/0x60
[73550.982232]  [<ffffffff8115b5ec>] handle_pte_fault+0x30c/0x9d0
[73550.982234]  [<ffffffff8119410f>] ? mem_cgroup_count_vm_event+0x1f/0x190
[73550.982236]  [<ffffffff8115bf01>] handle_mm_fault+0x251/0x310
[73550.982238]  [<ffffffff81581943>] __do_page_fault+0x223/0x510
[73550.982240]  [<ffffffff810aef10>] ? trace_hardirqs_on_caller+0x20/0x1b0
[73550.982242]  [<ffffffff810af0ad>] ? trace_hardirqs_on+0xd/0x10
[73550.982244]  [<ffffffff8157d4e0>] ? _raw_spin_unlock_irq+0x30/0x50
[73550.982246]  [<ffffffff81080ee5>] ? finish_task_switch+0x85/0x120
[73550.982248]  [<ffffffff81080ea8>] ? finish_task_switch+0x48/0x120
[73550.982250]  [<ffffffff8157df06>] ? error_sti+0x5/0x6
[73550.982252]  [<ffffffff810abc89>] ? trace_hardirqs_off_caller+0x29/0xc0
[73550.982254]  [<ffffffff812a5ebd>] ? trace_hardirqs_off_thunk+0x3a/0x3c
[73550.982256]  [<ffffffff81581c3e>] do_page_fault+0xe/0x10
[73550.982258]  [<ffffffff8157dcb8>] page_fault+0x28/0x30
[73550.982259] ---[ end trace 12bb14f2b81db036 ]---

^ permalink raw reply

* Re: [PATCH] net: dsa/slave: Fix compilation warnings
From: Viresh Kumar @ 2012-10-30  7:31 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: davem, linaro-dev, patches, netdev, linux-kernel
In-Reply-To: <CAKohponL_3m2KVytiWm8ZHyB5aimk8CzGrqr5J0LMy8MFGodHg@mail.gmail.com>

On 30 October 2012 12:15, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> And so, if we select NET_DSA from these tagging drivers, then only slave.c will
> get compiled. Otherwise slave.c dsa.c dsa_core.c wouldn't be compiled and so
> no warnings.

If my above explanation/assumption is correct, then please review following
patch:

--------------------------x-----------------------x----------------

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Mon, 29 Oct 2012 22:19:14 +0530
Subject: [PATCH] net: dsa/slave: Fix compilation warnings

Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation warnings:

net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used
[-Wunused-function]
net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used
[-Wunused-function]
net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used
[-Wunused-function]
net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined
but not used [-Wunused-function]
net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but
not used [-Wunused-function]
net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined
but not used [-Wunused-function]
net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not
used [-Wunused-function]

Earlier approach to fix this was discussed here:

lkml.org/lkml/2012/10/29/549

This is another approach to fix it. This is done by some changes in config
options, which make more sense than the earlier approach. As, atleast one
tagging option must always be selected for using net/dsa/ infrastructure, this
patch selects NET_DSA from tagging configs instead of having it as an selectable
config.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/net/dsa/Kconfig |  1 -
 net/dsa/Kconfig         | 16 +++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index dd151d5..96eae22 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -1,5 +1,4 @@
 menu "Distributed Switch Architecture drivers"
-	depends on NET_DSA

 config NET_DSA_MV88E6XXX
 	tristate
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 274791c..f7c6cef 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -1,5 +1,5 @@
 config NET_DSA
-	tristate "Distributed Switch Architecture support"
+	tristate
 	default n
 	depends on EXPERIMENTAL && NETDEVICES && !S390
 	select PHYLIB
@@ -8,19 +8,21 @@ config NET_DSA
 	  the Distributed Switch Architecture.


-if NET_DSA
+menu "Distributed Switch Architecture support"

 # tagging formats
 config NET_DSA_TAG_DSA
-	bool
+	bool "Original DSA packet tagging format"
+	select NET_DSt
 	default n

 config NET_DSA_TAG_EDSA
-	bool
+	bool "Ethertype DSA packet tagging format"
+	select NET_DSA
 	default n

 config NET_DSA_TAG_TRAILER
-	bool
+	bool "Trailer DSA packet tagging format"
+	select NET_DSA
 	default n
-
-endif
+endmenu

^ permalink raw reply related

* [PATCH 1/1] net: fix compile warning in af_unix.c
From: Jing Wang @ 2012-10-30  7:16 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov; +Cc: netdev, Jing Wang

This patch fix some compile warning as follows:
net/unix/af_unix.c: In function 'unix_bind':
net/unix/af_unix.c:895: warning: 'path.dentry' may be used uninitialized in this function
net/unix/af_unix.c:895: warning: 'path.mnt' may be used uninitialized in this function

Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
 net/unix/af_unix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5b5c876..9f710ac 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -895,6 +895,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 		struct path path;
 		umode_t mode = S_IFSOCK |
 		       (SOCK_INODE(sock)->i_mode & ~current_umask());
+		path.mnt = NULL;
+		path.dentry = NULL;
 		err = unix_mknod(sun_path, mode, &path);
 		if (err) {
 			if (err == -EEXIST)
-- 
1.7.5.4

^ permalink raw reply related

* [net-next 01/13] ixgbe: Add support for pipeline reset
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Don Skidmore, netdev, gospo, sassmann, Martin Josefsson,
	Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Don Skidmore <donald.c.skidmore@intel.com>

Calling the ixgbe_reset_pipeline_82599 function will ensure a full pipeline
reset on all 82599 devices.  This is necessary to avoid possible link issues.
Since this patch accomplishes this by modifying AUTOC.LMS we need to wrap
all AUTOC writes when LESM is enabled.

v2- fix LMS behaviour based on feedback by Martin Josefsson

CC: Martin Josefsson <gandalf@mjufs.se>
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h        |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c  | 114 ++++++++++++++++++------
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |  70 ++++++++++++++-
 3 files changed, 153 insertions(+), 32 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index c64a777..a17116b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -693,6 +693,7 @@ extern s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw,
 						 u16 soft_id);
 extern void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
 						 union ixgbe_atr_input *mask);
+extern bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
 extern void ixgbe_set_rx_mode(struct net_device *netdev);
 #ifdef CONFIG_IXGBE_DCB
 extern void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index b527813..e75f5a4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -62,7 +62,6 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
                                          bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
-static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
 
 static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
 {
@@ -99,9 +98,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
 static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
 {
 	s32 ret_val = 0;
-	u32 reg_anlp1 = 0;
-	u32 i = 0;
 	u16 list_offset, data_offset, data_value;
+	bool got_lock = false;
 
 	if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) {
 		ixgbe_init_mac_link_ops_82599(hw);
@@ -137,28 +135,36 @@ static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw)
 		usleep_range(hw->eeprom.semaphore_delay * 1000,
 			     hw->eeprom.semaphore_delay * 2000);
 
-		/* Now restart DSP by setting Restart_AN and clearing LMS */
-		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw,
-		                IXGBE_AUTOC) & ~IXGBE_AUTOC_LMS_MASK) |
-		                IXGBE_AUTOC_AN_RESTART));
-
-		/* Wait for AN to leave state 0 */
-		for (i = 0; i < 10; i++) {
-			usleep_range(4000, 8000);
-			reg_anlp1 = IXGBE_READ_REG(hw, IXGBE_ANLP1);
-			if (reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)
-				break;
+		/* Need SW/FW semaphore around AUTOC writes if LESM on,
+		 * likewise reset_pipeline requires lock as it also writes
+		 * AUTOC.
+		 */
+		if (ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+			ret_val = hw->mac.ops.acquire_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+			if (ret_val)
+				goto setup_sfp_out;
+
+			got_lock = true;
+		}
+
+		/* Restart DSP and set SFI mode */
+		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw,
+				IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL));
+
+		ret_val = ixgbe_reset_pipeline_82599(hw);
+
+		if (got_lock) {
+			hw->mac.ops.release_swfw_sync(hw,
+						      IXGBE_GSSR_MAC_CSR_SM);
+			got_lock = false;
 		}
-		if (!(reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)) {
-			hw_dbg(hw, "sfp module setup not complete\n");
+
+		if (ret_val) {
+			hw_dbg(hw, " sfp module setup not complete\n");
 			ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE;
 			goto setup_sfp_out;
 		}
-
-		/* Restart DSP by setting Restart_AN and return to SFI mode */
-		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw,
-		                IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL |
-		                IXGBE_AUTOC_AN_RESTART));
 	}
 
 setup_sfp_out:
@@ -394,14 +400,26 @@ static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
 	u32 links_reg;
 	u32 i;
 	s32 status = 0;
+	bool got_lock = false;
+
+	if (ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+		status = hw->mac.ops.acquire_swfw_sync(hw,
+						IXGBE_GSSR_MAC_CSR_SM);
+		if (status)
+			goto out;
+
+		got_lock = true;
+	}
 
 	/* Restart link */
-	autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
-	autoc_reg |= IXGBE_AUTOC_AN_RESTART;
-	IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
+	ixgbe_reset_pipeline_82599(hw);
+
+	if (got_lock)
+		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
 
 	/* Only poll for autoneg to complete if specified to do so */
 	if (autoneg_wait_to_complete) {
+		autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
 		if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
 		     IXGBE_AUTOC_LMS_KX4_KX_KR ||
 		    (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
@@ -425,6 +443,7 @@ static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
 	/* Add delay to filter out noises during initial link setup */
 	msleep(50);
 
+out:
 	return status;
 }
 
@@ -779,6 +798,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
 	u32 links_reg;
 	u32 i;
 	ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
+	bool got_lock = false;
 
 	/* Check to see if speed passed in is supported. */
 	status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities,
@@ -836,9 +856,26 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
 	}
 
 	if (autoc != start_autoc) {
+		/* Need SW/FW semaphore around AUTOC writes if LESM is on,
+		 * likewise reset_pipeline requires us to hold this lock as
+		 * it also writes to AUTOC.
+		 */
+		if (ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+			status = hw->mac.ops.acquire_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+			if (status != 0)
+				goto out;
+
+			got_lock = true;
+		}
+
 		/* Restart link */
-		autoc |= IXGBE_AUTOC_AN_RESTART;
 		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
+		ixgbe_reset_pipeline_82599(hw);
+
+		if (got_lock)
+			hw->mac.ops.release_swfw_sync(hw,
+						      IXGBE_GSSR_MAC_CSR_SM);
 
 		/* Only poll for autoneg to complete if specified to do so */
 		if (autoneg_wait_to_complete) {
@@ -994,9 +1031,28 @@ mac_reset_top:
 		hw->mac.orig_autoc2 = autoc2;
 		hw->mac.orig_link_settings_stored = true;
 	} else {
-		if (autoc != hw->mac.orig_autoc)
-			IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc |
-			                IXGBE_AUTOC_AN_RESTART));
+		if (autoc != hw->mac.orig_autoc) {
+			/* Need SW/FW semaphore around AUTOC writes if LESM is
+			 * on, likewise reset_pipeline requires us to hold
+			 * this lock as it also writes to AUTOC.
+			 */
+			bool got_lock = false;
+			if (ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+				status = hw->mac.ops.acquire_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+				if (status)
+					goto reset_hw_out;
+
+				got_lock = true;
+			}
+
+			IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
+			ixgbe_reset_pipeline_82599(hw);
+
+			if (got_lock)
+				hw->mac.ops.release_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+		}
 
 		if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) !=
 		    (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) {
@@ -1983,7 +2039,7 @@ fw_version_out:
  *  Returns true if the LESM FW module is present and enabled. Otherwise
  *  returns false. Smart Speed must be disabled if LESM FW module is enabled.
  **/
-static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
+bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
 {
 	bool lesm_enabled = false;
 	u16 fw_offset, fw_lesm_param_offset, fw_lesm_state;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index a2a9bcc..8f285ed 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -90,6 +90,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
 	s32 ret_val = 0;
 	u32 reg = 0, reg_bp = 0;
 	u16 reg_cu = 0;
+	bool got_lock = false;
 
 	/*
 	 * Validate the requested mode.  Strict IEEE mode does not allow
@@ -210,8 +211,29 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
 	 *
 	 */
 	if (hw->phy.media_type == ixgbe_media_type_backplane) {
-		reg_bp |= IXGBE_AUTOC_AN_RESTART;
+		/* Need the SW/FW semaphore around AUTOC writes if 82599 and
+		 * LESM is on, likewise reset_pipeline requries the lock as
+		 * it also writes AUTOC.
+		 */
+		if ((hw->mac.type == ixgbe_mac_82599EB) &&
+		    ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+			ret_val = hw->mac.ops.acquire_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+			if (ret_val)
+				goto out;
+
+			got_lock = true;
+		}
+
 		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_bp);
+
+		if (hw->mac.type == ixgbe_mac_82599EB)
+			ixgbe_reset_pipeline_82599(hw);
+
+		if (got_lock)
+			hw->mac.ops.release_swfw_sync(hw,
+						      IXGBE_GSSR_MAC_CSR_SM);
+
 	} else if ((hw->phy.media_type == ixgbe_media_type_copper) &&
 		    (ixgbe_device_supports_autoneg_fc(hw) == 0)) {
 		hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE,
@@ -2616,6 +2638,7 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
 	bool link_up = false;
 	u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
 	u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+	s32 ret_val = 0;
 
 	/*
 	 * Link must be up to auto-blink the LEDs;
@@ -2624,10 +2647,28 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
 	hw->mac.ops.check_link(hw, &speed, &link_up, false);
 
 	if (!link_up) {
+		/* Need the SW/FW semaphore around AUTOC writes if 82599 and
+		 * LESM is on.
+		 */
+		bool got_lock = false;
+
+		if ((hw->mac.type == ixgbe_mac_82599EB) &&
+		    ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+			ret_val = hw->mac.ops.acquire_swfw_sync(hw,
+							IXGBE_GSSR_MAC_CSR_SM);
+			if (ret_val)
+				goto out;
+
+			got_lock = true;
+		}
 		autoc_reg |= IXGBE_AUTOC_AN_RESTART;
 		autoc_reg |= IXGBE_AUTOC_FLU;
 		IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
 		IXGBE_WRITE_FLUSH(hw);
+
+		if (got_lock)
+			hw->mac.ops.release_swfw_sync(hw,
+						      IXGBE_GSSR_MAC_CSR_SM);
 		usleep_range(10000, 20000);
 	}
 
@@ -2636,7 +2677,8 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
 	IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
 	IXGBE_WRITE_FLUSH(hw);
 
-	return 0;
+out:
+	return ret_val;
 }
 
 /**
@@ -2648,18 +2690,40 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
 {
 	u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
 	u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+	s32 ret_val = 0;
+	bool got_lock = false;
+
+	/* Need the SW/FW semaphore around AUTOC writes if 82599 and
+	 * LESM is on.
+	 */
+	if ((hw->mac.type == ixgbe_mac_82599EB) &&
+	    ixgbe_verify_lesm_fw_enabled_82599(hw)) {
+		ret_val = hw->mac.ops.acquire_swfw_sync(hw,
+						IXGBE_GSSR_MAC_CSR_SM);
+		if (ret_val)
+			goto out;
+
+		got_lock = true;
+	}
 
 	autoc_reg &= ~IXGBE_AUTOC_FLU;
 	autoc_reg |= IXGBE_AUTOC_AN_RESTART;
 	IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
 
+	if (hw->mac.type == ixgbe_mac_82599EB)
+		ixgbe_reset_pipeline_82599(hw);
+
+	if (got_lock)
+		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
+
 	led_reg &= ~IXGBE_LED_MODE_MASK(index);
 	led_reg &= ~IXGBE_LED_BLINK(index);
 	led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index);
 	IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg);
 	IXGBE_WRITE_FLUSH(hw);
 
-	return 0;
+out:
+	return ret_val;
 }
 
 /**
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 00/13][pull request] Intel Wired LAN Driver Updates
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann

This series contains updates to ixgbe, ixgbevf, igbvf, igb and
networking core (bridge).  Most notably is the addition of support
for local link multicast addresses in SR-IOV mode to the networking
core.

Also note, the ixgbe patch "ixgbe: Add support for pipeline reset" and
"ixgbe: Fix return value from macvlan filter function" is revised based
on community feedback.

The following are changes since commit a932657f51eadb8280166e82dc7034dfbff3985a:
  net: sierra: shut up sparse restricted type warnings
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master

Alexander Duyck (2):
  ixgbe: Do not decrement budget in ixgbe_clean_rx_irq
  igb: Fix sparse warning in igb_ptp_rx_pktstamp

Carolyn Wyborny (1):
  igb: Update firmware version info for ethtool output.

Don Skidmore (1):
  ixgbe: Add support for pipeline reset

Emil Tantilov (1):
  ixgbe: clean up the condition for turning on/off the laser

Greg Rose (4):
  ixgbe: Fix return value from macvlan filter function
  ixgbe: Return success or failure on VF MAC filter set
  ixgbevf: Do not forward LLDP type frames
  igbvf: Check for error on dma_map_single call

Jiri Benc (1):
  ixgbe: reduce PTP rx path overhead

John Fastabend (1):
  net, ixgbe: handle link local multicast addresses in SR-IOV mode

Josh Hay (1):
  ixgbe: add/update descriptor maps in comments

Matthew Vick (1):
  igb: Enable auto-crossover during forced operation on 82580 and
    above.

 drivers/net/ethernet/intel/igb/e1000_defines.h    |  14 +++
 drivers/net/ethernet/intel/igb/e1000_mac.c        |   4 +
 drivers/net/ethernet/intel/igb/e1000_nvm.c        |  70 +++++++++++++
 drivers/net/ethernet/intel/igb/e1000_nvm.h        |  16 +++
 drivers/net/ethernet/intel/igb/e1000_phy.c        |  29 +++---
 drivers/net/ethernet/intel/igb/igb_main.c         |  76 +++++----------
 drivers/net/ethernet/intel/igb/igb_ptp.c          |   2 +-
 drivers/net/ethernet/intel/igbvf/netdev.c         |  13 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe.h          |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c    | 114 ++++++++++++++++------
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c   |  70 ++++++++++++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     | 103 ++++++++++++-------
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c      |   6 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c    |   5 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   5 +
 drivers/net/ethernet/intel/ixgbevf/vf.c           |   3 +
 include/linux/etherdevice.h                       |  19 ++++
 net/bridge/br_device.c                            |   2 +-
 net/bridge/br_input.c                             |  15 ---
 net/bridge/br_private.h                           |   1 -
 net/bridge/br_sysfs_br.c                          |   3 +-
 21 files changed, 419 insertions(+), 152 deletions(-)

-- 
1.7.11.7

^ permalink raw reply

* [net-next 13/13] igb: Fix sparse warning in igb_ptp_rx_pktstamp
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This change fixes a sparse warning triggered by us casting the timestamp in
the packet as a u64 instead of as a __le64.  This change corrects that in
order to resolve the sparse warning.

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>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index a7db4ce..aa10f69 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -455,7 +455,7 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector,
 			 unsigned char *va,
 			 struct sk_buff *skb)
 {
-	u64 *regval = (u64 *)va;
+	__le64 *regval = (__le64 *)va;
 
 	/*
 	 * The timestamp is recorded in little endian format.
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 12/13] igb: Update firmware version info for ethtool output.
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Carolyn Wyborny, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

There are multiple places in our device nvm where the version is stored.
This update fixes some output errors with some types of images and
refactors the way the version data is gathered and stored for ethtool output.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/e1000_defines.h | 14 +++++
 drivers/net/ethernet/intel/igb/e1000_nvm.c     | 70 ++++++++++++++++++++++++
 drivers/net/ethernet/intel/igb/e1000_nvm.h     | 16 ++++++
 drivers/net/ethernet/intel/igb/igb_main.c      | 76 +++++++++-----------------
 4 files changed, 126 insertions(+), 50 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
index de4b41e..e647cff 100644
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
@@ -636,6 +636,7 @@
 /* NVM Word Offsets */
 #define NVM_COMPAT                 0x0003
 #define NVM_ID_LED_SETTINGS        0x0004 /* SERDES output amplitude */
+#define NVM_VERSION                0x0005
 #define NVM_INIT_CONTROL2_REG      0x000F
 #define NVM_INIT_CONTROL3_PORT_B   0x0014
 #define NVM_INIT_CONTROL3_PORT_A   0x0024
@@ -653,6 +654,19 @@
 #define NVM_LED_1_CFG              0x001C
 #define NVM_LED_0_2_CFG            0x001F
 
+/* NVM version defines */
+#define NVM_ETRACK_WORD            0x0042
+#define NVM_COMB_VER_OFF           0x0083
+#define NVM_COMB_VER_PTR           0x003d
+#define NVM_MAJOR_MASK             0xF000
+#define NVM_MINOR_MASK             0x0FF0
+#define NVM_BUILD_MASK             0x000F
+#define NVM_COMB_VER_MASK          0x00FF
+#define NVM_MAJOR_SHIFT                12
+#define NVM_MINOR_SHIFT                 4
+#define NVM_COMB_VER_SHFT               8
+#define NVM_VER_INVALID            0xFFFF
+#define NVM_ETRACK_SHIFT               16
 
 #define E1000_NVM_CFG_DONE_PORT_0  0x040000 /* MNG config cycle done */
 #define E1000_NVM_CFG_DONE_PORT_1  0x080000 /* ...for second port */
diff --git a/drivers/net/ethernet/intel/igb/e1000_nvm.c b/drivers/net/ethernet/intel/igb/e1000_nvm.c
index aa5fcdf..54ff539 100644
--- a/drivers/net/ethernet/intel/igb/e1000_nvm.c
+++ b/drivers/net/ethernet/intel/igb/e1000_nvm.c
@@ -710,3 +710,73 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
 out:
 	return ret_val;
 }
+
+/**
+ *  igb_get_fw_version - Get firmware version information
+ *  @hw: pointer to the HW structure
+ *  @fw_vers: pointer to output structure
+ *
+ *  unsupported MAC types will return all 0 version structure
+ **/
+void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers)
+{
+	u16 eeprom_verh, eeprom_verl, comb_verh, comb_verl, comb_offset;
+	u16 fw_version;
+
+	memset(fw_vers, 0, sizeof(struct e1000_fw_version));
+
+	switch (hw->mac.type) {
+	case e1000_i211:
+		return;
+	case e1000_82575:
+	case e1000_82576:
+	case e1000_82580:
+	case e1000_i350:
+	case e1000_i210:
+		break;
+	default:
+		return;
+	}
+	/* basic eeprom version numbers */
+	hw->nvm.ops.read(hw, NVM_VERSION, 1, &fw_version);
+	fw_vers->eep_major = (fw_version & NVM_MAJOR_MASK) >> NVM_MAJOR_SHIFT;
+	fw_vers->eep_minor = (fw_version & NVM_MINOR_MASK);
+
+	/* etrack id */
+	hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verl);
+	hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verh);
+	fw_vers->etrack_id = (eeprom_verh << NVM_ETRACK_SHIFT) | eeprom_verl;
+
+	switch (hw->mac.type) {
+	case e1000_i210:
+	case e1000_i350:
+		/* find combo image version */
+		hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset);
+		if ((comb_offset != 0x0) && (comb_offset != NVM_VER_INVALID)) {
+
+			hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset
+					 + 1), 1, &comb_verh);
+			hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset),
+					 1, &comb_verl);
+
+			/* get Option Rom version if it exists and is valid */
+			if ((comb_verh && comb_verl) &&
+			    ((comb_verh != NVM_VER_INVALID) &&
+			     (comb_verl != NVM_VER_INVALID))) {
+
+				fw_vers->or_valid = true;
+				fw_vers->or_major =
+					comb_verl >> NVM_COMB_VER_SHFT;
+				fw_vers->or_build =
+					((comb_verl << NVM_COMB_VER_SHFT)
+					| (comb_verh >> NVM_COMB_VER_SHFT));
+				fw_vers->or_patch =
+					comb_verh & NVM_COMB_VER_MASK;
+			}
+		}
+		break;
+	default:
+		break;
+	}
+	return;
+}
diff --git a/drivers/net/ethernet/intel/igb/e1000_nvm.h b/drivers/net/ethernet/intel/igb/e1000_nvm.h
index 825b022..7012d45 100644
--- a/drivers/net/ethernet/intel/igb/e1000_nvm.h
+++ b/drivers/net/ethernet/intel/igb/e1000_nvm.h
@@ -40,4 +40,20 @@ s32  igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
 s32  igb_validate_nvm_checksum(struct e1000_hw *hw);
 s32  igb_update_nvm_checksum(struct e1000_hw *hw);
 
+struct e1000_fw_version {
+	u32 etrack_id;
+	u16 eep_major;
+	u16 eep_minor;
+
+	u8 invm_major;
+	u8 invm_minor;
+	u8 invm_img_type;
+
+	bool or_valid;
+	u16 or_major;
+	u16 or_build;
+	u16 or_patch;
+};
+void igb_get_fw_version(struct e1000_hw *hw, struct e1000_fw_version *fw_vers);
+
 #endif
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index b07d679..df1e790 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1785,58 +1785,34 @@ static const struct net_device_ops igb_netdev_ops = {
 void igb_set_fw_version(struct igb_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
-	u16 eeprom_verh, eeprom_verl, comb_verh, comb_verl, comb_offset;
-	u16 major, build, patch, fw_version;
-	u32 etrack_id;
-
-	hw->nvm.ops.read(hw, 5, 1, &fw_version);
-	if (adapter->hw.mac.type != e1000_i211) {
-		hw->nvm.ops.read(hw, NVM_ETRACK_WORD, 1, &eeprom_verh);
-		hw->nvm.ops.read(hw, (NVM_ETRACK_WORD + 1), 1, &eeprom_verl);
-		etrack_id = (eeprom_verh << IGB_ETRACK_SHIFT) | eeprom_verl;
-
-		/* combo image version needs to be found */
-		hw->nvm.ops.read(hw, NVM_COMB_VER_PTR, 1, &comb_offset);
-		if ((comb_offset != 0x0) &&
-		    (comb_offset != IGB_NVM_VER_INVALID)) {
-			hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset
-					 + 1), 1, &comb_verh);
-			hw->nvm.ops.read(hw, (NVM_COMB_VER_OFF + comb_offset),
-					 1, &comb_verl);
-
-			/* Only display Option Rom if it exists and is valid */
-			if ((comb_verh && comb_verl) &&
-			    ((comb_verh != IGB_NVM_VER_INVALID) &&
-			     (comb_verl != IGB_NVM_VER_INVALID))) {
-				major = comb_verl >> IGB_COMB_VER_SHFT;
-				build = (comb_verl << IGB_COMB_VER_SHFT) |
-					(comb_verh >> IGB_COMB_VER_SHFT);
-				patch = comb_verh & IGB_COMB_VER_MASK;
-				snprintf(adapter->fw_version,
-					 sizeof(adapter->fw_version),
-					 "%d.%d%d, 0x%08x, %d.%d.%d",
-					 (fw_version & IGB_MAJOR_MASK) >>
-					 IGB_MAJOR_SHIFT,
-					 (fw_version & IGB_MINOR_MASK) >>
-					 IGB_MINOR_SHIFT,
-					 (fw_version & IGB_BUILD_MASK),
-					 etrack_id, major, build, patch);
-				goto out;
-			}
-		}
-		snprintf(adapter->fw_version, sizeof(adapter->fw_version),
-			 "%d.%d%d, 0x%08x",
-			 (fw_version & IGB_MAJOR_MASK) >> IGB_MAJOR_SHIFT,
-			 (fw_version & IGB_MINOR_MASK) >> IGB_MINOR_SHIFT,
-			 (fw_version & IGB_BUILD_MASK), etrack_id);
-	} else {
+	struct e1000_fw_version fw;
+
+	igb_get_fw_version(hw, &fw);
+
+	switch (hw->mac.type) {
+	case e1000_i211:
 		snprintf(adapter->fw_version, sizeof(adapter->fw_version),
-			 "%d.%d%d",
-			 (fw_version & IGB_MAJOR_MASK) >> IGB_MAJOR_SHIFT,
-			 (fw_version & IGB_MINOR_MASK) >> IGB_MINOR_SHIFT,
-			 (fw_version & IGB_BUILD_MASK));
+			 "%2d.%2d-%d",
+			 fw.invm_major, fw.invm_minor, fw.invm_img_type);
+		break;
+
+	default:
+		/* if option is rom valid, display its version too */
+		if (fw.or_valid) {
+			snprintf(adapter->fw_version,
+				 sizeof(adapter->fw_version),
+				 "%d.%d, 0x%08x, %d.%d.%d",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id,
+				 fw.or_major, fw.or_build, fw.or_patch);
+		/* no option rom */
+		} else {
+			snprintf(adapter->fw_version,
+				 sizeof(adapter->fw_version),
+				 "%d.%d, 0x%08x",
+				 fw.eep_major, fw.eep_minor, fw.etrack_id);
+		}
+		break;
 	}
-out:
 	return;
 }
 
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 10/13] igbvf: Check for error on dma_map_single call
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Greg Rose, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Greg Rose <gregory.v.rose@intel.com>

Ignoring the return value from a call to the kernel dma_map API functions
can cause data corruption and system instability.  Check the return value
and take appropriate action.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igbvf/netdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index 0ac11f5..4051ec4 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -184,6 +184,13 @@ static void igbvf_alloc_rx_buffers(struct igbvf_ring *rx_ring,
 				             buffer_info->page_offset,
 				             PAGE_SIZE / 2,
 					     DMA_FROM_DEVICE);
+			if (dma_mapping_error(&pdev->dev,
+					      buffer_info->page_dma)) {
+				__free_page(buffer_info->page);
+				buffer_info->page = NULL;
+				dev_err(&pdev->dev, "RX DMA map failed\n");
+				break;
+			}
 		}
 
 		if (!buffer_info->skb) {
@@ -197,6 +204,12 @@ static void igbvf_alloc_rx_buffers(struct igbvf_ring *rx_ring,
 			buffer_info->dma = dma_map_single(&pdev->dev, skb->data,
 			                                  bufsz,
 							  DMA_FROM_DEVICE);
+			if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+				dev_kfree_skb(buffer_info->skb);
+				buffer_info->skb = NULL;
+				dev_err(&pdev->dev, "RX DMA map failed\n");
+				goto no_buffers;
+			}
 		}
 		/* Refresh the desc even if buffer_addrs didn't change because
 		 * each write-back erases this info. */
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 09/13] ixgbevf: Do not forward LLDP type frames
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Greg Rose, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Greg Rose <gregory.v.rose@intel.com>

The driver should not forward LLDP type frames.  Inspect the ether type and
do not send if it is an LLDP ethertype frame.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 07d7eab..b5979ba 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2968,6 +2968,11 @@ static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 #if PAGE_SIZE > IXGBE_MAX_DATA_PER_TXD
 	unsigned short f;
 #endif
+	u8 *dst_mac = skb_header_pointer(skb, 0, 0, NULL);
+	if (!dst_mac || is_link_local(dst_mac)) {
+		dev_kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
 
 	tx_ring = &adapter->tx_ring[r_idx];
 
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 11/13] igb: Enable auto-crossover during forced operation on 82580 and above.
From: Jeff Kirsher @ 2012-10-30  7:04 UTC (permalink / raw)
  To: davem; +Cc: Matthew Vick, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1351580670-8292-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Matthew Vick <matthew.vick@intel.com>

Newer devices supported by igb can support auto-crossover detection in
forced operation modes. Enable this in the driver, rather than clobbering
this functionality in forced operation.

Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/e1000_mac.c |  4 ++++
 drivers/net/ethernet/intel/igb/e1000_phy.c | 29 +++++++++++++++++------------
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c
index 819c145..7acddfe 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mac.c
+++ b/drivers/net/ethernet/intel/igb/e1000_mac.c
@@ -1391,6 +1391,10 @@ s32 igb_validate_mdi_setting(struct e1000_hw *hw)
 {
 	s32 ret_val = 0;
 
+	/* All MDI settings are supported on 82580 and newer. */
+	if (hw->mac.type >= e1000_82580)
+		goto out;
+
 	if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) {
 		hw_dbg("Invalid MDI setting detected\n");
 		hw->phy.mdix = 1;
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index c62a4c3..fe76004 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -1207,20 +1207,25 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
 	u16 phy_data;
 	bool link;
 
-	/*
-	 * Clear Auto-Crossover to force MDI manually.  M88E1000 requires MDI
-	 * forced whenever speed and duplex are forced.
-	 */
-	ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
-	if (ret_val)
-		goto out;
+	/* I210 and I211 devices support Auto-Crossover in forced operation. */
+	if (phy->type != e1000_phy_i210) {
+		/*
+		 * Clear Auto-Crossover to force MDI manually.  M88E1000
+		 * requires MDI forced whenever speed and duplex are forced.
+		 */
+		ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL,
+					    &phy_data);
+		if (ret_val)
+			goto out;
 
-	phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
-	ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-	if (ret_val)
-		goto out;
+		phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
+		ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL,
+					     phy_data);
+		if (ret_val)
+			goto out;
 
-	hw_dbg("M88E1000 PSCR: %X\n", phy_data);
+		hw_dbg("M88E1000 PSCR: %X\n", phy_data);
+	}
 
 	ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
 	if (ret_val)
-- 
1.7.11.7

^ 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