linux-2.6-microblaze.git
11 years agobatman-adv: unify and properly print hex values
Antonio Quartulli [Mon, 19 Nov 2012 08:01:43 +0000 (09:01 +0100)]
batman-adv: unify and properly print hex values

Values are printed in hexadecimal format in several points in the
code, but they are not printed using the same format string.

This patches unifies the format used for such numbers so that they
look the same everywhere.

Given the fact that all the variables printed as hexadecimal are 16
bit long, this is the chosen printing format: %#.4x

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
11 years agobatman-adv: print the CRC together with the translation tables
Antonio Quartulli [Mon, 19 Nov 2012 08:01:42 +0000 (09:01 +0100)]
batman-adv: print the CRC together with the translation tables

To simplify debugging operations, it is better to print the related
CRC together with the translation table (local CRC for the local
table and global CRC for each entry in the global table)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
11 years agobatman-adv: improve local translation table output
Antonio Quartulli [Thu, 8 Nov 2012 21:16:16 +0000 (22:16 +0100)]
batman-adv: improve local translation table output

This patch adds a nice header to the local translation table and
the last_seen time for each local entry

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
11 years agobatman-adv: reduce local TT entry timeout to 10 minutes
Antonio Quartulli [Thu, 8 Nov 2012 21:16:15 +0000 (22:16 +0100)]
batman-adv: reduce local TT entry timeout to 10 minutes

The current timeout is set to one hour. However a client connected to the mesh
network will always generate traffic. In the worst case it will send ARP
requests every 4 or 5 minutes. On the other hand having a long timeout means
storing dead entries for one hour and it leads to very big trans-tables
containing useless clients.

This patch reduces the timeout to 10 minutes

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
11 years agobatman-adv: Do not add multicast MAC addresses to translation table
Linus Lüssing [Wed, 17 Oct 2012 13:07:35 +0000 (15:07 +0200)]
batman-adv: Do not add multicast MAC addresses to translation table

The current translation table mechanism is not suitable for multicast
addresses and we are currently flooding such frames anyway.

Therefore this patch prevents multicast MAC addresses being added to the
translation table.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
11 years agobatman-adv: use per_cpu_add helper
Shan Wei [Tue, 13 Nov 2012 01:53:26 +0000 (09:53 +0800)]
batman-adv: use per_cpu_add helper

this_cpu_add is an atomic operation.
and be more faster than per_cpu_ptr operation.

Signed-off-by: Shan Wei <davidshan@tencent.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
11 years agonetworking/cs89x0.txt: delete stale information about hand patching
Paul Gortmaker [Fri, 11 Jan 2013 14:45:58 +0000 (14:45 +0000)]
networking/cs89x0.txt: delete stale information about hand patching

Output of a git grep happened to make me look into this file, and
I found instructions about how to hand patch (without using patch)
the driver into the kernel tree.

Since the driver has been a part of the mainline kernel for years,
we can dump this whole section.  Fortunately it doesn't even cause
a renumbering of the sections to do so.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: splice: fix __splice_segment()
Eric Dumazet [Fri, 11 Jan 2013 14:46:37 +0000 (14:46 +0000)]
net: splice: fix __splice_segment()

commit 9ca1b22d6d2 (net: splice: avoid high order page splitting)
forgot that skb->head could need a copy into several page frags.

This could be the case for loopback traffic mostly.

Also remove now useless skb argument from linear_to_page()
and __splice_segment() prototypes.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agogianfar: use more portable i/o accessors
Kim Phillips [Fri, 11 Jan 2013 12:18:21 +0000 (12:18 +0000)]
gianfar: use more portable i/o accessors

in/out_be32 accessors are Power arch centric whereas
ioread/writebe32 are available in other arches.  Also, unlike
in/out_be32, ioread/writebe32 expect non-volatile address arguments.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: fib: fix a comment.
Rami Rosen [Fri, 11 Jan 2013 09:59:20 +0000 (09:59 +0000)]
ipv4: fib: fix a comment.

In fib_frontend.c, there is a confusing comment; NETLINK_CB(skb).portid does not
refer to a pid of sending process, but rather to a netlink portid.

Signed-off-by: Rami Rosen <ramirose@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Export __netdev_pick_tx so that it can be used in modules
Alexander Duyck [Fri, 11 Jan 2013 18:38:42 +0000 (10:38 -0800)]
net: Export __netdev_pick_tx so that it can be used in modules

When testing with FCoE enabled we discovered that I had not exported
__netdev_pick_tx.  As a result ixgbe doesn't build with the RFC patches
applied because ixgbe_select_queue was calling the function.  This change
corrects that build issue by correctly exporting __netdev_pick_tx so it
can be used by modules.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotg3: missing break statement in tg3_get_5720_nvram_info()
Dan Carpenter [Fri, 11 Jan 2013 06:57:33 +0000 (09:57 +0300)]
tg3: missing break statement in tg3_get_5720_nvram_info()

There is a missing break statement so FLASH_5762_EEPROM_HD gets treated
like FLASH_5762_EEPROM_LD.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Add support for XPS without sysfs being defined
Alexander Duyck [Thu, 10 Jan 2013 08:57:46 +0000 (08:57 +0000)]
net: Add support for XPS without sysfs being defined

This patch makes it so that we can support transmit packet steering without
sysfs needing to be enabled.  The reason for making this change is to make
it so that a driver can make use of the XPS even while the sysfs portion of
the interface is not present.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Rewrite netif_set_xps_queues to address several issues
Alexander Duyck [Thu, 10 Jan 2013 08:57:35 +0000 (08:57 +0000)]
net: Rewrite netif_set_xps_queues to address several issues

This change is meant to address several issues I found within the
netif_set_xps_queues function.

If the allocation of one of the maps to be assigned to new_dev_maps failed
we could end up with the device map in an inconsistent state since we had
already worked through a number of CPUs and removed or added the queue.  To
address that I split the process into several steps.  The first of which is
just the allocation of updated maps for CPUs that will need larger maps to
store the queue.  By doing this we can fail gracefully without actually
altering the contents of the current device map.

The second issue I found was the fact that we were always allocating a new
device map even if we were not adding any queues.  I have updated the code
so that we only allocate a new device map if we are adding queues,
otherwise if we are not adding any queues to CPUs we just skip to the
removal process.

The last change I made was to reuse the code from remove_xps_queue to remove
the queue from the CPU.  By making this change we can be consistent in how
we go about adding and removing the queues from the CPUs.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Rewrite netif_reset_xps_queue to allow for better code reuse
Alexander Duyck [Thu, 10 Jan 2013 08:57:17 +0000 (08:57 +0000)]
net: Rewrite netif_reset_xps_queue to allow for better code reuse

This patch does a minor refactor on netif_reset_xps_queue to address a few
items I noticed.

First is the fact that we are doing removal of queues in both
netif_reset_xps_queue and netif_set_xps_queue.  Since there is no need to
have the code in two places I am pushing it out into a separate function
and will come back in another patch and reuse the code in
netif_set_xps_queue.

The second item this change addresses is the fact that the Tx queues were
not getting their numa_node value cleared as a part of the XPS queue reset.
This patch resolves that by resetting the numa_node value if the dev_maps
value is set.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Add functions netif_reset_xps_queue and netif_set_xps_queue
Alexander Duyck [Thu, 10 Jan 2013 08:57:02 +0000 (08:57 +0000)]
net: Add functions netif_reset_xps_queue and netif_set_xps_queue

This patch adds two functions, netif_reset_xps_queue and
netif_set_xps_queue.  The main idea behind these two functions is to
provide a mechanism through which drivers can update their defaults in
regards to XPS.

Currently no such mechanism exists and as a result we cannot use XPS for
things such as ATR which would require a basic configuration to start in
which the Tx queues are mapped to CPUs via a 1:1 mapping.  With this change
I am making it possible for drivers such as ixgbe to be able to use the XPS
feature by controlling the default configuration.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: Split core bits of netdev_pick_tx into __netdev_pick_tx
Alexander Duyck [Thu, 10 Jan 2013 08:56:51 +0000 (08:56 +0000)]
net: Split core bits of netdev_pick_tx into __netdev_pick_tx

This change splits the core bits of netdev_pick_tx into a separate function.
The main idea behind this is to make this code accessible to select queue
functions when they decide to process the standard path instead of their
own custom path in their select queue routine.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agosoftirq: reduce latencies
Eric Dumazet [Thu, 10 Jan 2013 23:26:34 +0000 (15:26 -0800)]
softirq: reduce latencies

In various network workloads, __do_softirq() latencies can be up
to 20 ms if HZ=1000, and 200 ms if HZ=100.

This is because we iterate 10 times in the softirq dispatcher,
and some actions can consume a lot of cycles.

This patch changes the fallback to ksoftirqd condition to :

- A time limit of 2 ms.
- need_resched() being set on current task

When one of this condition is met, we wakeup ksoftirqd for further
softirq processing if we still have pending softirqs.

Using need_resched() as the only condition can trigger RCU stalls,
as we can keep BH disabled for too long.

I ran several benchmarks and got no significant difference in
throughput, but a very significant reduction of latencies (one order
of magnitude) :

In following bench, 200 antagonist "netperf -t TCP_RR" are started in
background, using all available cpus.

Then we start one "netperf -t TCP_RR", bound to the cpu handling the NIC
IRQ (hard+soft)

Before patch :

# netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
RT_LATENCY=550110.424
MIN_LATENCY=146858
MAX_LATENCY=997109
P50_LATENCY=305000
P90_LATENCY=550000
P99_LATENCY=710000
MEAN_LATENCY=376989.12
STDDEV_LATENCY=184046.92

After patch :

# netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
RT_LATENCY=40545.492
MIN_LATENCY=9834
MAX_LATENCY=78366
P50_LATENCY=33583
P90_LATENCY=59000
P99_LATENCY=69000
MEAN_LATENCY=38364.67
STDDEV_LATENCY=12865.26

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Miller <davem@davemloft.net>
Cc: Tom Herbert <therbert@google.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet_sched: more precise pkt_len computation
Eric Dumazet [Thu, 10 Jan 2013 12:36:42 +0000 (12:36 +0000)]
net_sched: more precise pkt_len computation

One long standing problem with TSO/GSO/GRO packets is that skb->len
doesn't represent a precise amount of bytes on wire.

Headers are only accounted for the first segment.
For TCP, thats typically 66 bytes per 1448 bytes segment missing,
an error of 4.5 % for normal MSS value.

As consequences :

1) TBF/CBQ/HTB/NETEM/... can send more bytes than the assigned limits.
2) Device stats are slightly under estimated as well.

Fix this by taking account of headers in qdisc_skb_cb(skb)->pkt_len
computation.

Packet schedulers should use qdisc pkt_len instead of skb->len for their
bandwidth limitations, and TSO enabled devices drivers could use pkt_len
if their statistics are not hardware assisted, and if they don't scratch
skb->cb[] first word.

Both egress and ingress paths work, thanks to commit fda55eca5a
(net: introduce skb_transport_header_was_set()) : If GRO built
a GSO packet, it also set the transport header for us.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Paolo Valente <paolo.valente@unimore.it>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agodoc: Clarify behavior when sysctl tcp_ecn = 1
Vijay Subramanian [Wed, 9 Jan 2013 12:21:30 +0000 (12:21 +0000)]
doc: Clarify behavior when sysctl tcp_ecn = 1

Recent commit (commit 7e3a2dc52953 doc: make the description of how tcp_ecn
works more explicit and clear ) clarified the behavior of tcp_ecn sysctl
variable but description is inconsistent. When requested by incoming conections,
ECN is enabled with not just tcp_ecn = 2 but also with tcp_ecn = 1.

This patch makes it clear that with tcp_ecn = 1, ECN is enabled when requested
by incoming connections.

Also fix spelling of 'incoming'.

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobnx2x: align define usage to satisfy static checkers
Ariel Elior [Wed, 9 Jan 2013 07:04:35 +0000 (07:04 +0000)]
bnx2x: align define usage to satisfy static checkers

Static checkers complained that the E1H_FUNC_MAX define is used
incorrectly in bnx2x_pretend_func(). The complaint was justified,
although its not a real bug, as the first part of the conditional
protects us in this case (a real bug would happen if a VF tried to
use the pretend func, but there are no VFs in E1H chips).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoveth: fix a NULL deref in netif_carrier_off
Eric Dumazet [Thu, 10 Jan 2013 08:32:45 +0000 (08:32 +0000)]
veth: fix a NULL deref in netif_carrier_off

In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one)
we now clear the peer pointers in veth_dellink()

veth_close() must therefore make sure the peer pointer is set.

Reported-by: Tom Parkin <tom.parkin@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agocxgb4: Fix incorrect PFVF CMASK
Vipul Pandya [Wed, 9 Jan 2013 07:42:49 +0000 (07:42 +0000)]
cxgb4: Fix incorrect PFVF CMASK

With Hard-Wired firmware configuration it was incorrectly provisioning the VFs
Channel Access Rights Mask.

Signed-off-by: Jay Hernandez <jay@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoDSA: Convert spaces to tabs where appropriate
Barry Grussling [Tue, 8 Jan 2013 16:05:56 +0000 (16:05 +0000)]
DSA: Convert spaces to tabs where appropriate

Fix DSA whitespace issues reported by checkpatch.pl

Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoDSA: Convert printk calls to netdev_info calls
Barry Grussling [Tue, 8 Jan 2013 16:05:55 +0000 (16:05 +0000)]
DSA: Convert printk calls to netdev_info calls

Convert DSA printk calls to netdev_info calls as recommended by
checkpatch.pl.

Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoDSA: Convert repeated msleep calls to timeouts
Barry Grussling [Tue, 8 Jan 2013 16:05:54 +0000 (16:05 +0000)]
DSA: Convert repeated msleep calls to timeouts

Convert DSA msleep calls to timeout/usleep_range calls
as reported by checkpatch.pl.

Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoDSA: Convert DSA comments to network-style comments
Barry Grussling [Tue, 8 Jan 2013 16:05:53 +0000 (16:05 +0000)]
DSA: Convert DSA comments to network-style comments

Convert DSA driver comments to network-style comments as reported by
checkpatch.pl.  Fix spelling error.

Signed-off-by: Barry Grussling <barry@grussling.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: Optimize ipv6_change_dsfield().
YOSHIFUJI Hideaki / 吉藤英明 [Tue, 8 Jan 2013 06:47:08 +0000 (06:47 +0000)]
ipv6: Optimize ipv6_change_dsfield().

Do not convert endian back and forth.
If the caller uses contant "mask" argument (and most callers do),
we can omit runtime endian conversion here.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: Use container_of macro instead of magic number to get ipv6 header.
YOSHIFUJI Hideaki / 吉藤英明 [Tue, 8 Jan 2013 06:44:23 +0000 (06:44 +0000)]
ipv6: Use container_of macro instead of magic number to get ipv6 header.

In ipv6_recv_error(), addr_offset points to daddr field of the ip header.
To get ipv6 header, use container_of() macro instead of substracting magic
number (24).

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobnx2x: NULL dereference on error in debug code
Dan Carpenter [Tue, 8 Jan 2013 03:42:14 +0000 (03:42 +0000)]
bnx2x: NULL dereference on error in debug code

"vfop" is NULL here.  I've changed the debugging to not use it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ariel Elior <ariele@broadcom.com>
Acked-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agounix: Use FIELD_SIZEOF() in af_unix_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:20:07 +0000 (07:20 +0000)]
unix: Use FIELD_SIZEOF() in af_unix_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agorxrpc: Use FIELD_SIZEOF() in af_rxrpc_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:20:01 +0000 (07:20 +0000)]
rxrpc: Use FIELD_SIZEOF() in af_rxrpc_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoopenvswitch: Use FIELD_SIZEOF() in dp_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:19:55 +0000 (07:19 +0000)]
openvswitch: Use FIELD_SIZEOF() in dp_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetlink: Use FIELD_SIZEOF() in netlink_proto_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:19:48 +0000 (07:19 +0000)]
netlink: Use FIELD_SIZEOF() in netlink_proto_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: Use FIELD_SIZEOF() in inet6_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:19:43 +0000 (07:19 +0000)]
ipv6: Use FIELD_SIZEOF() in inet6_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv4: Use FIELD_SIZEOF() in inet_init().
YOSHIFUJI Hideaki / 吉藤英明 [Wed, 9 Jan 2013 07:19:37 +0000 (07:19 +0000)]
ipv4: Use FIELD_SIZEOF() in inet_init().

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobgmac: driver for GBit MAC core on BCMA bus
Rafał Miłecki [Tue, 8 Jan 2013 20:06:23 +0000 (20:06 +0000)]
bgmac: driver for GBit MAC core on BCMA bus

BCMA is a Broadcom specific bus with devices AKA cores. All recent BCMA
based SoCs have gigabit ethernet provided by the GBit MAC core. This
patch adds driver for such a cores registering itself as a netdev. It
has been tested on a BCM4706 and BCM4718 chipsets.

In the kernel tree there is already b44 driver which has some common
things with bgmac, however there are many differences that has led to
the decision or writing a new driver:
1) GBit MAC cores appear on BCMA bus (not SSB as in case of b44)
2) There is 64bit DMA engine which differs from 32bit one
3) There is no CAM (Content Addressable Memory) in GBit MAC
4) We have 4 TX queues on GBit MAC devices (instead of 1)
5) Many registers have different addresses/values
6) RX header flags are also different

The driver in it's state is functional how, however there is of course
place for improvements:
1) Supporting more net_device_ops
2) SUpporting more ethtool_ops
3) Unaligned addressing in DMA
4) Writing separated PHY driver

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoremove init of dev->perm_addr in drivers
Jiri Pirko [Tue, 8 Jan 2013 01:38:26 +0000 (01:38 +0000)]
remove init of dev->perm_addr in drivers

perm_addr is initialized correctly in register_netdevice() so to init it in
drivers is no longer needed.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: init perm_addr in register_netdevice()
Jiri Pirko [Tue, 8 Jan 2013 01:38:25 +0000 (01:38 +0000)]
net: init perm_addr in register_netdevice()

Benefit from the fact that dev->addr_assign_type is set to NET_ADDR_PERM
in case the device has permanent address.

This also fixes the problem that many drivers do not set perm_addr at
all.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetconsole: add IPv6 example in doc
Cong Wang [Mon, 7 Jan 2013 20:52:42 +0000 (20:52 +0000)]
netconsole: add IPv6 example in doc

Update the netconsole document as well.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetpoll: add IPv6 support
Cong Wang [Mon, 7 Jan 2013 20:52:41 +0000 (20:52 +0000)]
netpoll: add IPv6 support

Currently, netpoll only supports IPv4. This patch adds IPv6
support to netpoll so that we can run netconsole over IPv6 network.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoipv6: move csum_ipv6_magic() and udp6_csum_init() into static library
Cong Wang [Mon, 7 Jan 2013 20:52:40 +0000 (20:52 +0000)]
ipv6: move csum_ipv6_magic() and udp6_csum_init() into static library

As suggested by David, udp6_csum_init() is too big to be inlined,
move it to ipv6 static library, net/ipv6/ip6_checksum.c.

And the generic csum_ipv6_magic() too.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetpoll: prepare for ipv6
Cong Wang [Mon, 7 Jan 2013 20:52:39 +0000 (20:52 +0000)]
netpoll: prepare for ipv6

This patch adjusts some struct and functions, to prepare
for supporting IPv6.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: fec: Remove 'inline' declarations
Fabio Estevam [Mon, 7 Jan 2013 17:42:56 +0000 (17:42 +0000)]
net: fec: Remove 'inline' declarations

Fix the following warning when building with W=1 option:

drivers/net/ethernet/freescale/fec.c:810:1: warning: '__inline__' is not at beginning of declaration [-Wold-style-declaration]

The inline declaration is pointless in this function, so just remove it.

While at it, also remove the other 'inline' declarations.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: introduce skb_transport_header_was_set()
Eric Dumazet [Mon, 7 Jan 2013 09:28:21 +0000 (09:28 +0000)]
net: introduce skb_transport_header_was_set()

We have skb_mac_header_was_set() helper to tell if mac_header
was set on a skb. We would like the same for transport_header.

__netif_receive_skb() doesn't reset the transport header if already
set by GRO layer.

Note that network stacks usually reset the transport header anyway,
after pulling the network header, so this change only allows
a followup patch to have more precise qdisc pkt_len computation
for GSO packets at ingress side.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoMerge branch 'delete-8390-EISA' of git://git.kernel.org/pub/scm/linux/kernel/git...
David S. Miller [Wed, 9 Jan 2013 01:49:28 +0000 (17:49 -0800)]
Merge branch 'delete-8390-EISA' of git://git./linux/kernel/git/paulg/linux

Paul Gortmaker says:

====================
I'd like to propose that we get rid of these old 8390 EISA drivers.
Of the five deleted here, I wrote four -- and while that doesn't give
me any authority for deletion above anyone else, it does at least
allow me to comment on the absolute absence of anyone reaching
out to the driver author for assistance in the last dozen years.

Eventually we'll probably get rid of EISA bus support, since in
x86, the hardware is close to 20 years old and already too resource
constrained to be useful today.  However there might still be
a few DEC Alpha enthusiasts with old EISA machines kept alive,
and so I expect we'll have to wait a bit longer to get unanimous
agreement to proceed with the full EISA removal (although I'd
love to be proven wrong on that).

Most of the DEC Alpha machines shipped in a PCI configuration, and
even the few that were EISA had DEC tulip based ethernet and no
reason to be needing the inferior 8390 technology.  So the interest
here for any possible DEC enthusiasts with EISA boxes about these
old 8390 drivers should be nil.

These really were rare cards -- in fact the smc-ultra32 is the only
one that I'd ever seen in person.  Even back in the mid 90's when
the drivers were written, I would guess that the user base was less
than 10 people across all of them.

The following patch was created with --irreversible-delete for
ease of review (it skips showing the content of files that are
deleted); however the complete patch can be pulled as per below.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoethtool: consolidate work with ethtool_ops
Jiri Pirko [Mon, 7 Jan 2013 09:02:08 +0000 (09:02 +0000)]
ethtool: consolidate work with ethtool_ops

No need to check if ethtool_ops == NULL since it can't be.
Use local variable "ops" in functions where it is present
instead of dev->ethtool_ops
Introduce local variable "ops" in functions where dev->ethtool_ops is used
many times.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
Reviewed-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobnx2x: Segregate SR-IOV code
Ariel Elior [Mon, 7 Jan 2013 00:50:23 +0000 (00:50 +0000)]
bnx2x: Segregate SR-IOV code

In this patch the SR-IOV code is segregated from the main bulk of
the bnx2x code. The CONFIG_BNX2X_SRIOV define is added to Broadcom's
Kconfig, and allows the elision of the building of all the SR-IOV
support code in the driver.
The define is dependant on the kernel CONFIG_PCI_IOV configuration
define.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: fec: report correct hardware stamping info to ethtool
Frank Li [Sun, 6 Jan 2013 16:25:07 +0000 (16:25 +0000)]
net: fec: report correct hardware stamping info to ethtool

Report correct hardware stamping capability by ethtool interface.
The v1.0 ptp4l check it.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoveth: avoid a NULL deref in veth_stats_one
Eric Dumazet [Fri, 4 Jan 2013 15:42:40 +0000 (15:42 +0000)]
veth: avoid a NULL deref in veth_stats_one

commit 2681128f0ced8a (veth: extend device features) added a NULL deref
in veth_stats_one(), as veth_get_stats64() was not testing if the peer
device was setup or not.

At init time, we call dev_get_stats() before veth pair is fully setup.

[  178.854758]  [<ffffffffa00f5677>] veth_get_stats64+0x47/0x70 [veth]
[  178.861013]  [<ffffffff814f0a2d>] dev_get_stats+0x6d/0x130
[  178.866486]  [<ffffffff81504efc>] rtnl_fill_ifinfo+0x47c/0x930
[  178.872299]  [<ffffffff81505b93>] rtmsg_ifinfo+0x83/0x100
[  178.877678]  [<ffffffff81505cc6>] rtnl_configure_link+0x76/0xa0
[  178.883580]  [<ffffffffa00f52fa>] veth_newlink+0x16a/0x350 [veth]
[  178.889654]  [<ffffffff815061cc>] rtnl_newlink+0x4dc/0x5e0
[  178.895128]  [<ffffffff81505e1e>] ? rtnl_newlink+0x12e/0x5e0
[  178.900769]  [<ffffffff8150587d>] rtnetlink_rcv_msg+0x11d/0x310
[  178.906669]  [<ffffffff81505760>] ? __rtnl_unlock+0x20/0x20
[  178.912225]  [<ffffffff81521f89>] netlink_rcv_skb+0xa9/0xd0
[  178.917779]  [<ffffffff81502d55>] rtnetlink_rcv+0x25/0x40
[  178.923159]  [<ffffffff815218d1>] netlink_unicast+0x1b1/0x230
[  178.928887]  [<ffffffff81521c4e>] netlink_sendmsg+0x2fe/0x3b0
[  178.934615]  [<ffffffff814dbe22>] sock_sendmsg+0xd2/0xf0

So we must check if peer was setup in veth_get_stats64()

As pointed out by Ben Hutchings, priv->peer is missing proper
synchronization. Adding RCU protection is a safe and well documented
way to make sure we don't access about to be freed or already
freed data.

Reported-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agochelsio: Use netdev_<level> and pr_<level>
Joe Perches [Sun, 6 Jan 2013 13:34:49 +0000 (13:34 +0000)]
chelsio: Use netdev_<level> and pr_<level>

Use more current logging styles.

Convert printks to pr_<level> and
printks with ("%s: ...", dev->name to netdev_<level>(dev, "...

Add pr_fmt #defines where appropriate.
Coalesce formats.
Use pr_<level>_once where appropriate.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agodrivers/net: delete 8390 based EISA drivers.
Paul Gortmaker [Sun, 6 Jan 2013 01:23:12 +0000 (20:23 -0500)]
drivers/net: delete 8390 based EISA drivers.

The NS8390 chip was essentially the 1st widespread PC ethernet
chip, starting its life on 8 bit ISA cards in the late 1980s.
Even with better technologies available (bus mastering etc)
the 8390 managed to get used on a few rare EISA cards in the
early to mid 1990s.

The EISA bus in the x86 world was largely confined to systems
ranging from 486 to 586 (essentially 200MHz or lower, and less
than 100MB RAM) -- i.e. machines unlikely to be still in service,
and even less likely to be running a 3.9+ kernel.

On top of that, only one of the five really ever was considered
non-experimental; the smc-ultra32 was the one -- since it was
largely just an EISA version of the popular smc-ultra ISA card.
All the others had such a tiny user base that they simply never
could be considered anything more than experimental.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
11 years agodrivers/net: remove orphaned references to micro channel
Paul Gortmaker [Fri, 4 Jan 2013 16:57:17 +0000 (16:57 +0000)]
drivers/net: remove orphaned references to micro channel

We threw away the microchannel support, but the removal wasn't
completely trivial since there was namespace overlap with the
machine check support, and hence some orphaned dependencies
survived the deletion.  This attempts to sweep those up and
send them to the bit-bucket.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoteam: use strlcpy with ethtool_drvinfo fields
Flavio Leitner [Sat, 5 Jan 2013 02:53:10 +0000 (02:53 +0000)]
team: use strlcpy with ethtool_drvinfo fields

The fields must be null-terminated.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotcp: make sysctl_tcp_ecn namespace aware
Hannes Frederic Sowa [Sat, 5 Jan 2013 16:10:48 +0000 (16:10 +0000)]
tcp: make sysctl_tcp_ecn namespace aware

As per suggestion from Eric Dumazet this patch makes tcp_ecn sysctl
namespace aware.  The reason behind this patch is to ease the testing
of ecn problems on the internet and allows applications to tune their
own use of ecn.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agondisc: Use struct rd_msg for redirect message.
YOSHIFUJI Hideaki / 吉藤英明 [Sat, 5 Jan 2013 16:34:51 +0000 (16:34 +0000)]
ndisc: Use struct rd_msg for redirect message.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: splice: avoid high order page splitting
Eric Dumazet [Sat, 5 Jan 2013 21:31:18 +0000 (21:31 +0000)]
net: splice: avoid high order page splitting

splice() can handle pages of any order, but network code tries hard to
split them in PAGE_SIZE units. Not quite successfully anyway, as
__splice_segment() assumed poff < PAGE_SIZE. This is true for
the skb->data part, not necessarily for the fragments.

This patch removes this logic to give the pages as they are in the skb.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: use ETHTOOL_FWVERS_LEN instead of ETHTOOL_BUSINFO_LEN for fw_ver strings
Jiri Pirko [Sun, 6 Jan 2013 02:12:51 +0000 (02:12 +0000)]
net: use ETHTOOL_FWVERS_LEN instead of ETHTOOL_BUSINFO_LEN for fw_ver strings

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoethtool: fix drvinfo strings set in drivers
Jiri Pirko [Sun, 6 Jan 2013 00:44:26 +0000 (00:44 +0000)]
ethtool: fix drvinfo strings set in drivers

Use strlcpy where possible to ensure the string is \0 terminated.
Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN
and custom defines.
Use snprintf instead of sprint.
Remove unnecessary inits of ->fw_version
Remove unnecessary inits of drvinfo struct.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create
Jiri Pirko [Sun, 6 Jan 2013 12:41:57 +0000 (12:41 +0000)]
ethtool: set addr_assign_type to NET_ADDR_SET when addr is passed on create

In case user passed address via netlink during create, NET_ADDR_PERM was set.
That is not correct so fix this by setting NET_ADDR_SET.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoethoc: fix mac address set
Jiri Pirko [Sun, 6 Jan 2013 03:25:45 +0000 (03:25 +0000)]
ethoc: fix mac address set

Function ethoc_set_mac_address() was incorrectly using passed pointer as
pointer to address, that is not correct.
Struct sockaddr have to be be used here.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotg3: Remove IS_ENABLED(CONFIG_HWMON) check
Nithin Nayak Sujir [Sun, 6 Jan 2013 12:51:10 +0000 (12:51 +0000)]
tg3: Remove IS_ENABLED(CONFIG_HWMON) check

Commit de0a41484c47d783dd4d442914815076aa2caac2 added Kconfig logic to
select HWMON and removed all the IS_ENABLED(CONFIG_HWMON) checks in the
tg3.c file. It missed this one check in the header.

Update version to 3.129 and update copyright year.

Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotg3: Improve PCI function number detection.
Michael Chan [Sun, 6 Jan 2013 12:51:09 +0000 (12:51 +0000)]
tg3: Improve PCI function number detection.

Simplify the code to detect PCI function number on 5717, 5719, and 5720.
If shared memory does not have proper signature, read the function number
from register directly.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotg3: Add NVRAM support for 5762
Michael Chan [Sun, 6 Jan 2013 12:51:08 +0000 (12:51 +0000)]
tg3: Add NVRAM support for 5762

Detect NVRAM types for 5762 and read OTP firmware version.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agotg3: Add support for new 5762 ASIC
Michael Chan [Sun, 6 Jan 2013 12:51:07 +0000 (12:51 +0000)]
tg3: Add support for new 5762 ASIC

Add basic support for 5762 which is a 57765_PLUS class device.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agondisc: Remove unused space at tail of skb for ndisc messages. (TAKE 3)
YOSHIFUJI Hideaki / 吉藤英明 [Fri, 4 Jan 2013 03:58:04 +0000 (03:58 +0000)]
ndisc: Remove unused space at tail of skb for ndisc messages. (TAKE 3)

Currently, the size of skb allocated for NDISC is MAX_HEADER +
LL_RESERVED_SPACE(dev) + packet length + dev->needed_tailroom,
but only LL_RESERVED_SPACE(dev) bytes is "reserved" for headers.
As a result, the skb looks like this (after construction of the
message):

head       data                   tail                       end
+--------------------------------------------------------------+
+           |                      |          |                |
+--------------------------------------------------------------+
|<-hlen---->|<---ipv6 packet------>|<--tlen-->|<--MAX_HEADER-->|
    =LL_                               = dev
     RESERVED_                           ->needed_
     SPACE(dev)                            tailroom

As the name implies, "MAX_HEADER" is used for headers, and should
be "reserved" in prior to packet construction.  Or, if some space
is really required at the tail of ther skb, it should be
explicitly documented.

We have several option after construction of NDISC message:

Option 1:

head       data                   tail       end
+---------------------------------------------+
+           |                      |          |
+---------------------------------------------+
|<-hlen---->|<---ipv6 packet------>|<--tlen-->|
   =LL_                                = dev
    RESERVED_                           ->needed_
    SPACE(dev)                            tailroom

Option 2:

head            data                   tail       end
+--------------------------------------------------+
+                |                      |          |
+--------------------------------------------------+
|<--MAX_HEADER-->|<---ipv6 packet------>|<--tlen-->|
                                            = dev
                                             ->needed_
                                               tailroom

Option 3:

head                        data                   tail       end
+--------------------------------------------------------------+
+                |           |                      |          |
+--------------------------------------------------------------+
|<--MAX_HEADER-->|<-hlen---->|<---ipv6 packet------>|<--tlen-->|
                    =LL_                                = dev
                     RESERVED_                          ->needed_
                     SPACE(dev)                           tailroom

Our tunnel drivers try expanding headroom and the space for tunnel
encapsulation was not a mandatory space -- so we are not seeing
bugs here --, but just for optimization for performance critial
situations.

Since NDISC messages are not performance critical unlike TCP,
and as we know outgoing device, LL_RESERVED_SPACE(dev) should be
just enough for the device in most (if not all) cases:
  LL_RESERVED_SPACE(dev) <= LL_MAX_HEADER <= MAX_HEADER
Note that LL_RESERVED_SPACE(dev) is also enough for NDISC over
SIT (e.g., ISATAP).

So, I think Option 1 is just fine here.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoNET: FEC: dynamtic check DMA desc buff type
Frank Li [Thu, 3 Jan 2013 16:04:23 +0000 (16:04 +0000)]
NET: FEC: dynamtic check DMA desc buff type

MX6 and mx28 support enhanced DMA descriptor buff to support 1588
ptp. But MX25, MX3x, MX5x can't support enhanced DMA descriptor buff.
Check fec type and choose correct DMA descriptor buff type.

Remove static config CONFIG_FEC_PTP.
ptp function will be auto detected.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoethernet/broadcom/tg3: Fix sparse warning: constant 0x7fffffffffffffff is so big...
Peter Hüwe [Thu, 3 Jan 2013 04:23:50 +0000 (04:23 +0000)]
ethernet/broadcom/tg3: Fix sparse warning: constant 0x7fffffffffffffff is so big it is long long

Sparse complains that:
drivers/net/ethernet/broadcom/tg3.c:5670:55: sparse: constant
0x7fffffffffffffff is so big it is long long (on x86/32 bit)

so we suffix the constant with LL in the header file.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agosmsc95xx: enable dynamic autosuspend
Steve Glendinning [Thu, 3 Jan 2013 03:00:16 +0000 (03:00 +0000)]
smsc95xx: enable dynamic autosuspend

This patch enables USB dynamic autosuspend for LAN9500A.  This
saves very little power in itself, but it allows power saving
in upstream hubs/hosts.

The earlier devices in this family (LAN9500/9512/9514) do not
support this feature.

Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agosmsc95xx: eliminate duplicate warnings on io failure
Steve Glendinning [Thu, 3 Jan 2013 03:00:15 +0000 (03:00 +0000)]
smsc95xx: eliminate duplicate warnings on io failure

The register read/write functions already log a warning if
an access fails, so this patch removes the additional warnings
logged by callers that don't add any more information.

This patch makes the resulting driver smaller by not containing
as many warning strings.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: introduce upper device lists and remove dev->master
David S. Miller [Fri, 4 Jan 2013 21:32:04 +0000 (13:32 -0800)]
net: introduce upper device lists and remove dev->master

Jiri Pirko says:

====================
This is a V6 of a repost of my previous patchset:
"[patch net-next v2 00/15] net: introduce upper device lists and remove dev->master" from Aug 14

The discussion around
"[net-next] bonding: don't allow the master to become its slave"
forced me to think about upper<->lower device connections.

This patchset adds a possibility to record upper device linkage.
All upper<->lower devices are converted to use this mechanism right after.
That leads to dev->master removal because this info becomes redundant since
"master links" have the same value.

After all changes, there is no longer possible to do things as:
"bond->someotherdevice->samebond"

Also I think that drivers like cxgb3, qlcnic, qeth would benefit by this
in future by being able to get more appropriate info about l3 addresses.

v5->v6:
- netdev_has_upper_dev() - added statement to comment that this is looking at
  the immediate upper devices only.
- renamed "RTNL semaphore" -> "RTNL lock" in all comments
- renamed __netdev_has_upper_dev() to __netdev_search_upper_dev() to emhasize
  the difference to netdev_has_upper_dev()

v4->v5:
- fixed missed typo in drivers/infiniband/hw/nes/nes_cm.c

v3->v4:
- comments in __netdev_upper_dev_link() squashed into one line
- kfree_rcu used instead of call_rcu in netdev_upper_dev_unlink()

v2->v3:
- removed recursion in __netdev_has_upper_dev()
- refreshed bits to be applicable on current net-next

v1->v2:
- s/unique/master/ better naming + stays closer to the past
- fixed vlan err goto
- original patch 15 (WARN_ON change) is squashed into the first patch
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: kill dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:49:03 +0000 (22:49 +0000)]
net: kill dev->master

Nobody uses this now. Remove it.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: remove no longer used netdev_set_bond_master() and netdev_set_master()
Jiri Pirko [Thu, 3 Jan 2013 22:49:02 +0000 (22:49 +0000)]
net: remove no longer used netdev_set_bond_master() and netdev_set_master()

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobonding: remove usage of dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:49:01 +0000 (22:49 +0000)]
bonding: remove usage of dev->master

Benefit from new upper dev list and free bonding from dev->master usage.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agones: remove usage of dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:49:00 +0000 (22:49 +0000)]
nes: remove usage of dev->master

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agovlan: remove usage of dev->master in __vlan_find_dev_deep()
Jiri Pirko [Thu, 3 Jan 2013 22:48:59 +0000 (22:48 +0000)]
vlan: remove usage of dev->master in __vlan_find_dev_deep()

Also, since all users call __vlan_find_dev_deep() with rcu_read_lock,
make no possibility to call this with rtnl mutex held only.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock
Jiri Pirko [Thu, 3 Jan 2013 22:48:58 +0000 (22:48 +0000)]
qeth: ensure that __vlan_find_dev_deep() is called with rcu_read_lock

Also benefit from rcu_read_lock held and use __in_dev_get_rcu() in ipv4 case.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: guard __vlan_find_dev_deep() by rcu_read_lock
Jiri Pirko [Thu, 3 Jan 2013 22:48:57 +0000 (22:48 +0000)]
qlcnic: guard __vlan_find_dev_deep() by rcu_read_lock

rcu_read_lock was missing here

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agocxgb3: remove usage of dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:48:56 +0000 (22:48 +0000)]
cxgb3: remove usage of dev->master

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonetpoll: remove usage of dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:48:55 +0000 (22:48 +0000)]
netpoll: remove usage of dev->master

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agobridge: remove usage of netdev_set_master()
Jiri Pirko [Thu, 3 Jan 2013 22:48:54 +0000 (22:48 +0000)]
bridge: remove usage of netdev_set_master()

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoteam: remove usage of netdev_set_master()
Jiri Pirko [Thu, 3 Jan 2013 22:48:53 +0000 (22:48 +0000)]
team: remove usage of netdev_set_master()

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agortnetlink: remove usage of dev->master
Jiri Pirko [Thu, 3 Jan 2013 22:48:52 +0000 (22:48 +0000)]
rtnetlink: remove usage of dev->master

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agovlan: add link to upper device
Jiri Pirko [Thu, 3 Jan 2013 22:48:51 +0000 (22:48 +0000)]
vlan: add link to upper device

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agomacvlan: add link to upper device
Jiri Pirko [Thu, 3 Jan 2013 22:48:50 +0000 (22:48 +0000)]
macvlan: add link to upper device

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: introduce upper device lists
Jiri Pirko [Thu, 3 Jan 2013 22:48:49 +0000 (22:48 +0000)]
net: introduce upper device lists

This lists are supposed to serve for storing pointers to all upper devices.
Eventually it will replace dev->master pointer which is used for
bonding, bridge, team but it cannot be used for vlan, macvlan where
there might be multiple upper present. In case the upper link is
replacement for dev->master, it is marked with "master" flag.

New upper device list resolves this limitation. Also, the information
stored in lists is used for preventing looping setups like
"bond->somethingelse->samebond"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoll_temac: fix mac address setting
Jiri Pirko [Tue, 1 Jan 2013 03:30:19 +0000 (03:30 +0000)]
ll_temac: fix mac address setting

Previously, when invalid address was passed to ndo_set_mac_address,
random mac was generated and set. Fix this by returning -EADDRNOTAVAIL
in this situation.

Also polish the code around a bit.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoum: net: use eth_hw_addr_random() to generate random mac
Jiri Pirko [Tue, 1 Jan 2013 03:30:18 +0000 (03:30 +0000)]
um: net: use eth_hw_addr_random() to generate random mac

Also remove unused "mac" from uml_net struct.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: remove unnecessary NET_ADDR_RANDOM "bitclean"
Jiri Pirko [Tue, 1 Jan 2013 03:30:17 +0000 (03:30 +0000)]
net: remove unnecessary NET_ADDR_RANDOM "bitclean"

NET_ADDR_SET is set in dev_set_mac_address() no need to alter
dev->addr_assign_type value in drivers.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: add address assign type "SET"
Jiri Pirko [Tue, 1 Jan 2013 03:30:16 +0000 (03:30 +0000)]
net: add address assign type "SET"

This is the way to indicate that mac address of a device has been set by
dev_set_mac_address()

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: set dev->addr_assign_type correctly
Jiri Pirko [Tue, 1 Jan 2013 03:30:15 +0000 (03:30 +0000)]
net: set dev->addr_assign_type correctly

Not a bitfield, but a plain value.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agonet: call add_device_randomness() only after successful mac change
Jiri Pirko [Tue, 1 Jan 2013 03:30:14 +0000 (03:30 +0000)]
net: call add_device_randomness() only after successful mac change

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agortnl: use dev_set_mac_address() instead of plain ndo_
Jiri Pirko [Tue, 1 Jan 2013 03:30:13 +0000 (03:30 +0000)]
rtnl: use dev_set_mac_address() instead of plain ndo_

Benefit from existence of dev_set_mac_address() and remove duplicate
code.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoteam: update master carrier state
Flavio Leitner [Sun, 30 Dec 2012 08:27:29 +0000 (08:27 +0000)]
team: update master carrier state

Update master's carrier state when there is any
change with its ports.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: fix build error
Sony Chacko [Wed, 2 Jan 2013 23:10:15 +0000 (23:10 +0000)]
qlcnic: fix build error

Fix the following error reported by kbuild test robot.
static declaration of 'qlcnic_restore_indev_addr' follows
non-static declaration.

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: do not duplicate infrastructure functions
Stephen Rothwell [Wed, 2 Jan 2013 17:23:53 +0000 (17:23 +0000)]
qlcnic: do not duplicate infrastructure functions

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: update driver version
Signed-off-by: Sony Chacko [Tue, 1 Jan 2013 03:20:30 +0000 (03:20 +0000)]
qlcnic: update driver version

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: remove unused definitions from header file
Shahed Shaikh [Tue, 1 Jan 2013 03:20:29 +0000 (03:20 +0000)]
qlcnic: remove unused definitions from header file

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: 83xx ethtool interface routines
Sony Chacko [Tue, 1 Jan 2013 03:20:28 +0000 (03:20 +0000)]
qlcnic: 83xx ethtool interface routines

83xx ethtool interface routines

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11 years agoqlcnic: 83xx register dump routines
Sony Chacko [Tue, 1 Jan 2013 03:20:27 +0000 (03:20 +0000)]
qlcnic: 83xx register dump routines

Add 83xx register dump routines
Update 82xx register dump routines

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>