cascardo/linux.git
9 years agosock: deduplicate errqueue dequeue
Willem de Bruijn [Mon, 1 Sep 2014 01:30:27 +0000 (21:30 -0400)]
sock: deduplicate errqueue dequeue

sk->sk_error_queue is dequeued in four locations. All share the
exact same logic. Deduplicate.

Also collapse the two critical sections for dequeue (at the top of
the recv handler) and signal (at the bottom).

This moves signal generation for the next packet forward, which should
be harmless.

It also changes the behavior if the recv handler exits early with an
error. Previously, a signal for follow-up packets on the errqueue
would then not be scheduled. The new behavior, to always signal, is
arguably a bug fix.

For rxrpc, the change causes the same function to be called repeatedly
for each queued packet (because the recv handler == sk_error_report).
It is likely that all packets will fail for the same reason (e.g.,
memory exhaustion).

This code runs without sk_lock held, so it is not safe to trust that
sk->sk_err is immutable inbetween releasing q->lock and the subsequent
test. Introduce int err just to avoid this potential race.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet-timestamp: expand documentation
Willem de Bruijn [Mon, 1 Sep 2014 01:27:47 +0000 (21:27 -0400)]
net-timestamp: expand documentation

Expand Documentation/networking/timestamping.txt with new
interfaces and bytestream timestamping. Also minor
cleanup of the other text.

Import txtimestamp.c test of the new features.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'csums-next'
David S. Miller [Tue, 2 Sep 2014 04:36:35 +0000 (21:36 -0700)]
Merge branch 'csums-next'

Tom Herbert says:

====================
net: Checksum offload changes - Part VI

I am working on overhauling RX checksum offload. Goals of this effort
are:

- Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
- Preserve CHECKSUM_COMPLETE through encapsulation layers
- Don't do skb_checksum more than once per packet
- Unify GRO and non-GRO csum verification as much as possible
- Unify the checksum functions (checksum_init)
- Simplify code

What is in this seventh patch set:

- Add skb->csum. This allows a device or GRO to indicate that an
  invalid checksum was detected.
- Checksum unncessary to checksum complete conversions.

With these changes, I believe that the third goal of the overhaul is
now mostly achieved. In the case of no encapsulation or one layer of
encapsulation, there should only be at most one skb_checksum over
each packet (between GRO and normal path). In the case of two layers
of encapsulation, it is still possible with the right combination of
non-zero and zero UDP checksums to have >1 skb_checksum. For instance:
IP>GRE(with csum)>IP>UDP(zero csum)>VXLAN>IP>UDP(non-zero csum),
would likely necessiate an skb_checksum in GRO and normal path.
This doesn't seem like a common scenario at all so I'm inclined to
not address this now, if multiple layers of encapsulation becomes
popular we can reassess.

Note that checksum conversion shows a nice improvement for RX VXLAN when
outer UDP checksum is enabled (12.65% CPU compared to 20.94%). This
is not only from the fact that we don't need checksum calculation on
the host, but also allows GRO for VXLAN in this case. Checksum
conversion does not help send side (which still needs to perform
a checksum on host). For that we will implement remote checksum offload
in a later patch
(http://tools.ietf.org/html/draft-herbert-remotecsumoffload-00).

Please review carefully and test if possible, mucking with basic
checksum functions is always a little precarious :-)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agol2tp: Enable checksum unnecessary conversions for l2tp/UDP sockets
Tom Herbert [Sun, 31 Aug 2014 22:12:46 +0000 (15:12 -0700)]
l2tp: Enable checksum unnecessary conversions for l2tp/UDP sockets

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovxlan: Enable checksum unnecessary conversions for vxlan/UDP sockets
Tom Herbert [Sun, 31 Aug 2014 22:12:45 +0000 (15:12 -0700)]
vxlan: Enable checksum unnecessary conversions for vxlan/UDP sockets

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agogre: Add support for checksum unnecessary conversions
Tom Herbert [Sun, 31 Aug 2014 22:12:44 +0000 (15:12 -0700)]
gre: Add support for checksum unnecessary conversions

Call skb_checksum_try_convert and skb_gro_checksum_try_convert
after checksum is found present and validated in the GRE header
for normal and GRO paths respectively.

In GRO path, call skb_gro_checksum_try_convert

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoudp: Add support for doing checksum unnecessary conversion
Tom Herbert [Sun, 31 Aug 2014 22:12:43 +0000 (15:12 -0700)]
udp: Add support for doing checksum unnecessary conversion

Add support for doing CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE
conversion in UDP tunneling path.

In the normal UDP path, we call skb_checksum_try_convert after locating
the UDP socket. The check is that checksum conversion is enabled for
the socket (new flag in UDP socket) and that checksum field is
non-zero.

In the UDP GRO path, we call skb_gro_checksum_try_convert after
checksum is validated and checksum field is non-zero. Since this is
already in GRO we assume that checksum conversion is always wanted.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Infrastructure for checksum unnecessary conversions
Tom Herbert [Sun, 31 Aug 2014 22:12:42 +0000 (15:12 -0700)]
net: Infrastructure for checksum unnecessary conversions

For normal path, added skb_checksum_try_convert which is called
to attempt to convert CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE. The
primary condition to allow this is that ip_summed is CHECKSUM_NONE
and csum_valid is true, which will be the state after consuming
a CHECKSUM_UNNECESSARY.

For GRO path, added skb_gro_checksum_try_convert which is the GRO
analogue of skb_checksum_try_convert. The primary condition to allow
this is that NAPI_GRO_CB(skb)->csum_cnt == 0 and
NAPI_GRO_CB(skb)->csum_valid is set. This implies that we have consumed
all available CHECKSUM_UNNECESSARY checksums in the GRO path.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Support for csum_bad in skbuff
Tom Herbert [Sun, 31 Aug 2014 22:12:41 +0000 (15:12 -0700)]
net: Support for csum_bad in skbuff

This flag indicates that an invalid checksum was detected in the
packet. __skb_mark_checksum_bad helper function was added to set this.

Checksums can be marked bad from a driver or the GRO path (the latter
is implemented in this patch). csum_bad is checked in
__skb_checksum_validate_complete (i.e. calling that when ip_summed ==
CHECKSUM_NONE).

csum_bad works in conjunction with ip_summed value. In the case that
ip_summed is CHECKSUM_NONE and csum_bad is set, this implies that the
first (or next) checksum encountered in the packet is bad. When
ip_summed is CHECKSUM_UNNECESSARY, the first checksum after the last
one validated is bad. For example, if ip_summed == CHECKSUM_UNNECESSARY,
csum_level == 1, and csum_bad is set-- then the third checksum in the
packet is bad. In the normal path, the packet will be dropped when
processing the protocol layer of the bad checksum:
__skb_decr_checksum_unnecessary called twice for the good checksums
changing ip_summed to CHECKSUM_NONE so that
__skb_checksum_validate_complete is called to validate the third
checksum and that will fail since csum_bad is set.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agor8152: rename rx_buf_sz
hayeswang [Tue, 2 Sep 2014 02:27:52 +0000 (10:27 +0800)]
r8152: rename rx_buf_sz

The variable "rx_buf_sz" is used by both tx and rx buffers. Replace
it with "agg_buf_sz".

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: mdio-bcm-unimac: NULL-terminate unimac_mdio_ids
Florian Fainelli [Fri, 29 Aug 2014 19:43:56 +0000 (12:43 -0700)]
net: phy: mdio-bcm-unimac: NULL-terminate unimac_mdio_ids

drivers/net/phy/mdio-bcm-unimac.c:195:37-38: unimac_mdio_ids is not NULL
terminated at line 195

Make sure of_device_id tables are NULL terminated
Generated by: scripts/coccinelle/misc/of_table.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: make dsa_pack_type static
Florian Fainelli [Fri, 29 Aug 2014 19:42:07 +0000 (12:42 -0700)]
net: dsa: make dsa_pack_type static

net/dsa/dsa.c:624:20: sparse: symbol 'dsa_pack_type' was not declared.
Should it be static?

Fixes: 3e8a72d1dae374 ("net: dsa: reduce number of protocol hooks")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobonding: add slave_changelink support and use it for queue_id
Nikolay Aleksandrov [Wed, 27 Aug 2014 14:06:46 +0000 (16:06 +0200)]
bonding: add slave_changelink support and use it for queue_id

This patch adds support for slave_changelink to the bonding and uses it
to give the ability to change the queue_id of the enslaved devices via
netlink. It sets slave_maxtype and uses bond_changelink as a prototype for
bond_slave_changelink.
Example/test command after the iproute2 patch:
 ip link set eth0 type bond_slave queue_id 10

CC: David S. Miller <davem@davemloft.net>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Suggested-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotcp: whitespace fixes
stephen hemminger [Sat, 30 Aug 2014 06:32:05 +0000 (23:32 -0700)]
tcp: whitespace fixes

Fix places where there is space before tab, long lines, and
awkward if(){, double spacing etc. Add blank line after declaration/initialization.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: systemport: tell RXCHK if we are using Broadcom tags
Florian Fainelli [Thu, 28 Aug 2014 22:11:03 +0000 (15:11 -0700)]
net: systemport: tell RXCHK if we are using Broadcom tags

When Broadcom tags are enabled, e.g: when interfaced to an Ethernet
switch, make sure that we tell the RXCHK engine that it should be
expecting a 4-bytes Broadcom tag after the Ethernet MAC Source Address.

Use netdev_uses_dsa() to check for that condition since that will tell
us if a switch is attached to our network interface.

Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agopktgen: add flag NO_TIMESTAMP to disable timestamping
Jesper Dangaard Brouer [Thu, 28 Aug 2014 16:14:47 +0000 (18:14 +0200)]
pktgen: add flag NO_TIMESTAMP to disable timestamping

Then testing the TX limits of the stack, then it is useful to
be-able to disable the do_gettimeofday() timetamping on every packet.

This implements a pktgen flag NO_TIMESTAMP which will disable this
call to do_gettimeofday().

The performance change on (my system E5-2695) with skb_clone=0, goes
from TX 2,423,751 pps to 2,567,165 pps with flag NO_TIMESTAMP. Thus,
the cost of do_gettimeofday() or saving is approx 23 nanosec.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobnx2x: fix tunneled GSO over IPv6
Dmitry Kravkov [Thu, 28 Aug 2014 13:54:24 +0000 (16:54 +0300)]
bnx2x: fix tunneled GSO over IPv6

Set correct bit for packed description.

Introduced in e42780b66aab88d3a82b6087bcd6095b90eecde7
    bnx2x: Utilize FW 7.10.51

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobnx2x: prevent incorrect byte-swap in BE
Dmitry Kravkov [Thu, 28 Aug 2014 13:54:23 +0000 (16:54 +0300)]
bnx2x: prevent incorrect byte-swap in BE

Fixes incorrectly defined struct in FW HSI for BE platform.
Affects tunneling, tx-switching and anti-spoofing.

Introduced in e42780b66aab88d3a82b6087bcd6095b90eecde7
    bnx2x: Utilize FW 7.10.51

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Kravkov <Dmitry.Kravkov@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: add name distributor resiliency queue
Erik Hugne [Thu, 28 Aug 2014 07:08:47 +0000 (09:08 +0200)]
tipc: add name distributor resiliency queue

TIPC name table updates are distributed asynchronously in a cluster,
entailing a risk of certain race conditions. E.g., if two nodes
simultaneously issue conflicting (overlapping) publications, this may
not be detected until both publications have reached a third node, in
which case one of the publications will be silently dropped on that
node. Hence, we end up with an inconsistent name table.

In most cases this conflict is just a temporary race, e.g., one
node is issuing a publication under the assumption that a previous,
conflicting, publication has already been withdrawn by the other node.
However, because of the (rtt related) distributed update delay, this
may not yet hold true on all nodes. The symptom of this failure is a
syslog message: "tipc: Cannot publish {%u,%u,%u}, overlap error".

In this commit we add a resiliency queue at the receiving end of
the name table distributor. When insertion of an arriving publication
fails, we retain it in this queue for a short amount of time, assuming
that another update will arrive very soon and clear the conflict. If so
happens, we insert the publication, otherwise we drop it.

The (configurable) retention value defaults to 2000 ms. Knowing from
experience that the situation described above is extremely rare, there
is no risk that the queue will accumulate any large number of items.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: refactor name table updates out of named packet receive routine
Erik Hugne [Thu, 28 Aug 2014 07:08:46 +0000 (09:08 +0200)]
tipc: refactor name table updates out of named packet receive routine

We need to perform the same actions when processing deferred name
table updates, so this functionality is moved to a separate
function.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agor8152: reduce the number of Tx
hayeswang [Thu, 28 Aug 2014 02:24:18 +0000 (10:24 +0800)]
r8152: reduce the number of Tx

Because the Tx has the features of stopping queue and aggregation,
We don't need many tx buffers. Change the tx number from 10 to 4
to reduce the usage of the memory. This could save 16K * 6 bytes
memory.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'xmit_list'
David S. Miller [Tue, 2 Sep 2014 00:40:01 +0000 (17:40 -0700)]
Merge branch 'xmit_list'

David Miller says:

====================
net: Make dev_hard_start_xmit() work fundamentally on lists

After this patch set, dev_hard_start_xmit() will work fundemantally on
any and all SKB lists.

This opens the path for a clean implementation of pulling multiple
packets out during qdisc_restart(), and then passing that blob in one
shot to dev_hard_start_xmit().

There were two main architectural blockers to this:

1) The GSO handling, we kept the original GSO head SKB around simply
   because dev_hard_start_xmit() had no way to communicate to the
   caller how far into the segmented list it was able to go.  Now it
   can, so the head GSO can be liberated immediately.

   All of the special GSO head SKB destructor et al. handling goes
   away too.

2) Validate of VLAN, CSUM, and segmentation characteristics was being
   performed inside of dev_hard_start_xmit().  If want to truly batch,
   we have to let the higher levels to this.  In particular, this is
   now dequeue_skb()'s job.

And with those two issues out of the way, it should now be trivial to
build experiments on top of this patch set, all of the framework
should be there now.  You could do something as simple as:

skb = q->dequeue(q);
if (skb)
skb = validate_xmit_skb(skb, qdisc_dev(q));
if (skb) {
struct sk_buff *new, *head = skb;
int limit = 5;

do {
new = q->dequeue(q);
if (new)
new = validate_xmit_skb(new, qdisc_dev(q));
if (new) {
skb->next = new;
skb = new;
}
} while (new && --limit);
skb = head;
}

inside of the else branch of dequeue_skb().

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: xmit_list() becomes dev_hard_start_xmit().
David S. Miller [Mon, 1 Sep 2014 22:06:40 +0000 (15:06 -0700)]
net: xmit_list() becomes dev_hard_start_xmit().

Now fundamentally we can process lists of SKBs as cheaply
as single packets.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Don't keep around original SKB when we software segment GSO frames.
David S. Miller [Sun, 31 Aug 2014 02:22:20 +0000 (19:22 -0700)]
net: Don't keep around original SKB when we software segment GSO frames.

Just maintain the list properly by returning the head of the remaining
SKB list from dev_hard_start_xmit().

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Validate xmit SKBs right when we pull them out of the qdisc.
David S. Miller [Sun, 31 Aug 2014 02:13:51 +0000 (19:13 -0700)]
net: Validate xmit SKBs right when we pull them out of the qdisc.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Separate out SKB validation logic from transmit path.
David S. Miller [Sat, 30 Aug 2014 22:17:13 +0000 (15:17 -0700)]
net: Separate out SKB validation logic from transmit path.

dev_hard_start_xmit() does two things, it first validates and
canonicalizes the SKB, then it actually sends it.

Make a set of helper functions for doing the first part.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Have xmit_list() signal more==true when appropriate.
David S. Miller [Sat, 30 Aug 2014 04:57:30 +0000 (21:57 -0700)]
net: Have xmit_list() signal more==true when appropriate.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Pass a "more" indication down into netdev_start_xmit() code paths.
David S. Miller [Sat, 30 Aug 2014 04:55:22 +0000 (21:55 -0700)]
net: Pass a "more" indication down into netdev_start_xmit() code paths.

For now it will always be false.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Move main gso loop out of dev_hard_start_xmit() into helper.
David S. Miller [Sat, 30 Aug 2014 04:19:14 +0000 (21:19 -0700)]
net: Move main gso loop out of dev_hard_start_xmit() into helper.

There is a slight policy change happening here as well.

The previous code would drop the entire rest of the GSO skb if any of
them got, for example, a congestion notification.

That makes no sense, anything NET_XMIT_MASK and below is something
like congestion or policing.  And in the congestion case it doesn't
even mean the packet was actually dropped.

Just continue until dev_xmit_complete() evaluates to false.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Create xmit_one() helper for dev_hard_start_xmit()
David S. Miller [Sat, 30 Aug 2014 04:10:01 +0000 (21:10 -0700)]
net: Create xmit_one() helper for dev_hard_start_xmit()

Hopefully making the code a bit easier to read and digest.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Do txq_trans_update() in netdev_start_xmit()
David S. Miller [Sat, 30 Aug 2014 04:07:24 +0000 (21:07 -0700)]
net: Do txq_trans_update() in netdev_start_xmit()

That way we don't have to audit every call site to make sure it is
doing this properly.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: stmmac: fix warning from Sparse for socfpga
Ley Foon Tan [Thu, 28 Aug 2014 04:59:46 +0000 (12:59 +0800)]
net: stmmac: fix warning from Sparse for socfpga

Warning:
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:122:41:
sparse: cast removes address space of expression
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:122:38:
sparse: incorrect type in assignment (different address spaces)

Signed-off-by: Ley Foon Tan <lftan@altera.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'csums-next'
David S. Miller [Sat, 30 Aug 2014 03:41:17 +0000 (20:41 -0700)]
Merge branch 'csums-next'

Tom Herbert says:

====================
net: Checksum offload changes - Part VI

I am working on overhauling RX checksum offload. Goals of this effort
are:

- Specify what exactly it means when driver returns CHECKSUM_UNNECESSARY
- Preserve CHECKSUM_COMPLETE through encapsulation layers
- Don't do skb_checksum more than once per packet
- Unify GRO and non-GRO csum verification as much as possible
- Unify the checksum functions (checksum_init)
- Simplify code

What is in this sixth patch set:

- Clarify the specific requirements of devices returning
  CHECKSUM_UNNECESSARY (comments in skbuff.h).
- Add csum_level field to skbuff. This is used to express how
  many checksums are covered by CHECKSUM_UNNECESSARY (stores n - 1).
- Change __skb_checksum_validate_needed to "consume" each checksum
  as indicated by csum_level as layers of the the packet are parsed.
- Remove skb_pop_rcv_encapsulation, no longer needed in the new
  csum_level model.
- Allow GRO path to "consume" checksums provided in CHECKSUM_UNNECESSARY
  and to report new verfied checksums for use in normal path fallback.
- Add proper support to SCTP to accept CHECKSUM_UNNECESSARY to validate
  header CRC.
- Modify drivers to set skb->csum_level instead of setting
  skb->encapsulation to indicate validation of an encapsulated
  checksum on receive.

v2:

Allocate a new 16 bits for flags in skbuff.

Please review carefully and test if possible, mucking with basic
checksum functions is always a little precarious :-)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Set skb->csum_level for encapsulated checksum
Tom Herbert [Thu, 28 Aug 2014 04:28:01 +0000 (21:28 -0700)]
qlcnic: Set skb->csum_level for encapsulated checksum

Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agomlx4: Set skb->csum_level for encapsulated checksum
Tom Herbert [Thu, 28 Aug 2014 04:27:53 +0000 (21:27 -0700)]
mlx4: Set skb->csum_level for encapsulated checksum

Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoi40evf: Set skb->csum_level for encapsulated checksum
Tom Herbert [Thu, 28 Aug 2014 04:27:43 +0000 (21:27 -0700)]
i40evf: Set skb->csum_level for encapsulated checksum

Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoi40e: Set skb->csum_level for encapsulated checksum
Tom Herbert [Thu, 28 Aug 2014 04:27:32 +0000 (21:27 -0700)]
i40e: Set skb->csum_level for encapsulated checksum

Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobenet: Set skb->csum_level for encapsulated checksum
Tom Herbert [Thu, 28 Aug 2014 04:27:17 +0000 (21:27 -0700)]
benet: Set skb->csum_level for encapsulated checksum

Set skb->csum_level instead of skb->encapsulation when indicating
CHECKSUM_UNNECESSARY for an encapsulated checksum.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosctp: Change sctp to implement csum_levels
Tom Herbert [Thu, 28 Aug 2014 04:27:06 +0000 (21:27 -0700)]
sctp: Change sctp to implement csum_levels

CHECKSUM_UNNECESSARY may be applied to the SCTP CRC so we need to
appropriate account for this by decrementing csum_level. This is
done by calling __skb_dec_checksum_unnecessary.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Allow GRO to use and set levels of checksum unnecessary
Tom Herbert [Thu, 28 Aug 2014 04:26:56 +0000 (21:26 -0700)]
net: Allow GRO to use and set levels of checksum unnecessary

Allow GRO path to "consume" checksums provided in CHECKSUM_UNNECESSARY
and to report new checksums verfied for use in fallback to normal
path.

Change GRO checksum path to track csum_level using a csum_cnt field
in NAPI_GRO_CB. On GRO initialization, if ip_summed is
CHECKSUM_UNNECESSARY set NAPI_GRO_CB(skb)->csum_cnt to
skb->csum_level + 1. For each checksum verified, decrement
NAPI_GRO_CB(skb)->csum_cnt while its greater than zero. If a checksum
is verfied and NAPI_GRO_CB(skb)->csum_cnt == 0, we have verified a
deeper checksum than originally indicated in skbuf so increment
csum_level (or initialize to CHECKSUM_UNNECESSARY if ip_summed is
CHECKSUM_NONE or CHECKSUM_COMPLETE).

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Clarification of CHECKSUM_UNNECESSARY
Tom Herbert [Thu, 28 Aug 2014 04:26:46 +0000 (21:26 -0700)]
net: Clarification of CHECKSUM_UNNECESSARY

This patch:
 - Clarifies the specific requirements of devices returning
   CHECKSUM_UNNECESSARY (comments in skbuff.h).
 - Adds csum_level field to skbuff. This is used to express how
   many checksums are covered by CHECKSUM_UNNECESSARY (stores n - 1).
   This replaces the overloading of skb->encapsulation, that field is
   is now only used to indicate inner headers are valid.
 - Change __skb_checksum_validate_needed to "consume" each checksum
   as indicated by csum_level as layers of the the packet are parsed.
 - Remove skb_pop_rcv_encapsulation, no longer needed in the new
   csum_level model.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Allocate a new 16 bits for flags in skbuff
Tom Herbert [Thu, 28 Aug 2014 04:26:35 +0000 (21:26 -0700)]
net: Allocate a new 16 bits for flags in skbuff

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobe2net: Use dev_consume_skb_any() in the non-drop path
Rick Jones [Thu, 28 Aug 2014 15:53:16 +0000 (08:53 -0700)]
be2net: Use dev_consume_skb_any() in the non-drop path

The be2net driver was still using dev_kfree_skb_any() in a "normal"
skb freeing path.  This rather clutters perf top -G -e skb_kfree_skb
profiling.

Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobnx2x: Fix sparse warnings
Yuval Mintz [Thu, 28 Aug 2014 05:07:32 +0000 (08:07 +0300)]
bnx2x: Fix sparse warnings

This fixes a sprase warning introduced recently by commit
eeed018cbfa30 ("bnx2x: Add timestamping and PTP hardware clock support"),
as well as another unrelated sparse endian issue.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinclude/rxrpc/types.h: Remove unused header
Rasmus Villemoes [Thu, 28 Aug 2014 11:44:34 +0000 (13:44 +0200)]
include/rxrpc/types.h: Remove unused header

The header file include/rxrpc/types.h does not seem to be used
anywhere. It was orphaned by 63b6be55 "[AF_RXRPC]: Delete the old
RxRPC code.". Remove it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinclude/linux/phonedev.h: Remove unused header
Rasmus Villemoes [Thu, 28 Aug 2014 11:44:33 +0000 (13:44 +0200)]
include/linux/phonedev.h: Remove unused header

The header file include/linux/phonedev.h does not seem to be used
anywhere. It was orphaned by 7326446c "Staging: remove telephony
drivers". Remove it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinclude/linux/i82593.h: Remove unused header
Rasmus Villemoes [Thu, 28 Aug 2014 11:44:32 +0000 (13:44 +0200)]
include/linux/i82593.h: Remove unused header

The header file include/linux/i82593.h does not seem to be used
anywhere. It was orphaned by 8a594170 "drivers/net: delete intel
i825xx based znet notebook driver". Remove it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoinclude/linux/cycx_x25.h: Remove unused header
Rasmus Villemoes [Thu, 28 Aug 2014 11:44:31 +0000 (13:44 +0200)]
include/linux/cycx_x25.h: Remove unused header

The header file include/linux/cycx_x25.h does not seem to be used
anywhere. It was orphaned by 6fcdf4facb "wanrouter: delete now
orphaned header content, files/drivers". Remove it.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotipc: fix a potential oops
Ying Xue [Thu, 28 Aug 2014 02:02:41 +0000 (10:02 +0800)]
tipc: fix a potential oops

Commit 6c9808ce09f7 ("tipc: remove port_lock") accidentally involves
a potential bug: when tipc socket instance(tsk) is not got with given
reference number in tipc_sk_get(), tsk is set to NULL. Subsequently
we jump to exit label where to decrease socket reference counter
pointed by tsk pointer in tipc_sk_put(). However, As now tsk is NULL,
oops may happen because of touching a NULL pointer.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Erik Hugne <erik.hugne@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: properly report internal PHYs through sysfs
Florian Fainelli [Wed, 27 Aug 2014 18:44:33 +0000 (11:44 -0700)]
net: phy: properly report internal PHYs through sysfs

Internal PHYs may not have a valid PHY interface defined, which will
show up in sysfs as "". Add an explicit check of internal PHYs to report
their interface correctly.

Fixes: 3d055d8d1c24 ("net: phy: expose PHY device interface mode")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'qlcnic-next'
David S. Miller [Sat, 30 Aug 2014 03:15:42 +0000 (20:15 -0700)]
Merge branch 'qlcnic-next'

Shahed Shaikh says:

====================
qlcnic: Feature addition and enhancements

This series contains following feature addition and enhancements,
- Update Link speed and Port type information for 83xx series adapters
- Support 0x8830 device ID
- Support for Power on Self Test (POST) feature for 83xx
- Use usleep_range() instead of msleep() for values less than 20ms
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Update version to 5.3.62
Shahed Shaikh [Wed, 27 Aug 2014 16:43:22 +0000 (12:43 -0400)]
qlcnic: Update version to 5.3.62

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMAINTAINERS: Update group email alias for qlcnic driver
Shahed Shaikh [Wed, 27 Aug 2014 16:43:21 +0000 (12:43 -0400)]
MAINTAINERS: Update group email alias for qlcnic driver

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Add support to run firmware POST
Shahed Shaikh [Wed, 27 Aug 2014 16:43:20 +0000 (12:43 -0400)]
qlcnic: Add support to run firmware POST

This patch adds support to run Power On Self Test (POST) for 83xx adapters.
POST can be run in 3 different speed modes :
i)  Fast mode (takes about 690 ms)
ii) Medium mode (takes about 2930 ms)
iii) Slow mode (takes about 7500 ms)

To run POST, firmware file with name "83xx_post_fw.bin" should be present under
/lib/firmware directory. load_fw_file module parameter is used to specify
POST operation and its speed mode.
load_fw_file = 2 : Fast mode
load_fw_file = 3 : Medium mode
load_fw_file = 4 : Slow mode

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Use usleep_range() instead of msleep() for sleep less than 20ms
Jitendra Kalsaria [Wed, 27 Aug 2014 16:43:19 +0000 (12:43 -0400)]
qlcnic: Use usleep_range() instead of msleep() for sleep less than 20ms

As per recommendation, msleep() may sleep longer than intended time for
values less than 20ms. So, use usleep_range() instead of msleep()

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Add support for 0x8830 device ID
Shahed Shaikh [Wed, 27 Aug 2014 16:43:18 +0000 (12:43 -0400)]
qlcnic: Add support for 0x8830 device ID

Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoqlcnic: Update Link speed and port type info for 83xx adapter
Jitendra Kalsaria [Wed, 27 Aug 2014 16:43:17 +0000 (12:43 -0400)]
qlcnic: Update Link speed and port type info for 83xx adapter

o Update the port type information
o Advertise correct link modes and autonegotiation
o Add support to change link speed

Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: add skb_get_tx_queue() helper
Daniel Borkmann [Wed, 27 Aug 2014 09:11:27 +0000 (11:11 +0200)]
net: add skb_get_tx_queue() helper

Replace occurences of skb_get_queue_mapping() and follow-up
netdev_get_tx_queue() with an actual helper function.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agor8169: add missing MODULE_FIRMWARE.
Francois Romieu [Tue, 26 Aug 2014 20:40:38 +0000 (22:40 +0200)]
r8169: add missing MODULE_FIRMWARE.

Leftover from 6e1d0b8988188956dac091441c1492a79a342666 ("r8169:add
support for RTL8168H and RTL8107E").

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Chun-Hao Lin <hau@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net...
David S. Miller [Thu, 28 Aug 2014 21:19:38 +0000 (14:19 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-08-27

This series contains updates to i40e and i40evf.

Carolyn provides two patches, first changes the wording of the flow
director add/remove and asynchronous failure messages to include the
fd_id to try and add some way to track the operations on a given fd_id.
Second adds a check during handle_link_event for unqualified modules
when link is down and there is a module plugged in.

Anjali provides four patches to i40e/i40evf.  First update flow director
messages so that a user can tell if a filter was added or deleted.  Then
updates the ATR policy to not auto-disable ATR when we have errors in
programming.  The disabling of ATR when we got programming errors was
buggy and was still adding new rules and causing continuous errors.
With this policy change, we flush instead when we see too many errors.
In addition she adds a flow director flush counter to ethtool to help
know how many times the interface had to flush and replay the flow
director filter table.  Updates the driver to ignores a driver
perceived transmit hang if the number of descriptors pending is less
than 4, and instead log a stat when this situation happens.  This is
because the queue progresses forward and the stack never experiences
a real hang in these situations.

Shannon provides three patches for i40e/i40evf, first enables the
l2tsel bit on receive queue contexts that are assigned to VFs so that
the VF can get the stripped VLAN tag.  Then adds a max buffer size
parameter to the print helper to be sure the code knows when to stop.
Lastly, remove the complaint when removing the default MAC VLAN filter.
This was because old firmware had an incorrect MAC VLAN filter that
needed to be replaced at startup, and now newer firmware does not have
this problem.  So now we only add the new filter if the removal
succeeded and no need to complain if the removal fails.

Ashish provides a change to vsi->num_queue_pairs to equal the number
that is configured by the VF.  This limits the number of queues that
are enabled/disabled and fixes the mismatch case for when a VF
configures fewer queues than is allocated to it by the PF.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agovirtio_net: flush when in xmit_more mode and under descriptor pressure
David S. Miller [Thu, 28 Aug 2014 08:39:49 +0000 (01:39 -0700)]
virtio_net: flush when in xmit_more mode and under descriptor pressure

Mirror the changes made to ixgbe in commit 2367a17390138f68b3aa28f2f220b8d7ff8d91f4
("ixgbe: flush when in xmit_more mode and under descriptor pressure")

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoigb: flush when in xmit_more mode and under descriptor pressure
David S. Miller [Thu, 28 Aug 2014 08:39:31 +0000 (01:39 -0700)]
igb: flush when in xmit_more mode and under descriptor pressure

Mirror the changes made to ixgbe in commit 2367a17390138f68b3aa28f2f220b8d7ff8d91f4
("ixgbe: flush when in xmit_more mode and under descriptor pressure")

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoixgbe: flush when in xmit_more mode and under descriptor pressure
Daniel Borkmann [Tue, 26 Aug 2014 17:34:18 +0000 (19:34 +0200)]
ixgbe: flush when in xmit_more mode and under descriptor pressure

When xmit_more mode is being used and the ring is about to
become full or the stack has stopped the ring, enforce a tail
pointer write to the hw. Otherwise, we could risk a TX hang.

Code suggested by Alexander Duyck.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'bcm7xxx'
David S. Miller [Thu, 28 Aug 2014 06:16:19 +0000 (23:16 -0700)]
Merge branch 'bcm7xxx'

Florian Fainelli says:

====================
Broadcom BCM7xxx PHY updates for new entries

Another week, another set of updates for the Broadcom BCM7xxx PHY driver.  This
patch set cleanups the existing definitions, adds a macro to ease the addition
of future chips, and finally add two new SoCs to the list of supported chips.

Resending since the first patch did not make it to the list, sorry about that.

Changes in v2:
- rephrased commit message for patch 1 to make it pass majordomo
  capital triple X was rejected
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: bcm7xxx: add BCM7250 and BCM7364 PHY entries
Florian Fainelli [Tue, 26 Aug 2014 20:15:27 +0000 (13:15 -0700)]
net: phy: bcm7xxx: add BCM7250 and BCM7364 PHY entries

Add two new entries to the Broadcom BCM7xxx internal PHY driver for
BCM7250 and BCM7364 chips. Those chips share the usual 28nm process
Gigabit PHY sequence and require the same workarounds so far.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: broadcom: add new Broadcom OUI
Florian Fainelli [Tue, 26 Aug 2014 20:15:26 +0000 (13:15 -0700)]
net: phy: broadcom: add new Broadcom OUI

Broadcom started to use a new OUI for its 2013 and newer products:
D4-01-29 which translates into 0xae025000 for a 32-bits OUI, add its
definition.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: broadcom: fix PHY_BCM_OUI_4
Florian Fainelli [Tue, 26 Aug 2014 20:15:25 +0000 (13:15 -0700)]
net: phy: broadcom: fix PHY_BCM_OUI_4

PHY_BCM_OUI_4 is missing two significant digits that actually make it an
OUI, add those missing bits so it becomes usable again for matching.

Fixes: b560a58c45c6 ("net: phy: add Broadcom BCM7xxx internal PHY driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: bcm7xxx: introduce helper macro
Florian Fainelli [Tue, 26 Aug 2014 20:15:24 +0000 (13:15 -0700)]
net: phy: bcm7xxx: introduce helper macro

All 28nm Gigabit PHYs supported by the driver have the same
callbacks, the only differences being the 32-bits OUI and the name. Use
a macro to factor this, making it easier in the future to add new
entries.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoMerge branch 'sf2'
David S. Miller [Thu, 28 Aug 2014 06:07:18 +0000 (23:07 -0700)]
Merge branch 'sf2'

Florian Fainelli says:

====================
dsa: Broadcom Starfighter 2 switch support

This patch series adds support for the Broadcom Starfighter 2 (Roboswitch
successor) using the existing DSA infrastructure. This integrated switch
is heavily used in Set Top Box, Cable gateways and DSL gateways products
from Broadcom, and to a larger extent the new ARM-based Wi-Fi routers although
slightly differently.

Changes in v5 are the introduction of ETH_P_XDSA as suggested by Alexander to
help capture applications see this is a multiplexed DSA approach now.

Changes in v4 are the introducing of an indirection level for DSA switch tag
protocols receive and transmit functions.

I intentionnaly did not address one comment from Alexander who suggested to
move port_names and port_dn in a separate structure since that involves
touching arch/arm/ and arch/blackfin/ code which I am not yet comfortable
doing.

Notable changes in v3 is the preliminary patch that reworks the skb->protocol
override helpers for non-Ethertype switch tags, based on feedback from
Alexander Duyck.

The biggest changes from v1 of this patch series are:

- use the new fixed PHY helpers
- improved the switch driver with more complete features (interrupts,
  (RG)MII configuration, memory arrays power down/up, port disabling/enable
  VLAN separation

Future work will focus on bringing the upstream driver in feature parity with
the current downstream driver, including:

- adding Wake-on-LAN support to the switch
- adding suspend/resume callbacks for S2/S3 Power Management modes
- extending the switch register interface to cover BCM5310X SoCs
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosungem: Fix global namespace pollution of phy accessors.
David S. Miller [Thu, 28 Aug 2014 05:59:26 +0000 (22:59 -0700)]
sungem: Fix global namespace pollution of phy accessors.

The sungem driver has "phy_read()" and "phy_write()" functions, which
we need to rename because the generic phy layer is about to export
generic interfaces with the same name.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoDocumentation: devicetree: add Broadcom Starfighter 2 binding
Florian Fainelli [Thu, 28 Aug 2014 00:04:58 +0000 (17:04 -0700)]
Documentation: devicetree: add Broadcom Starfighter 2 binding

Add the binding documentation for the Broadcom Starfighter 2 integrated
switch hardware.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoDocumentation: devicetree: update dsa binding with optional properties
Florian Fainelli [Thu, 28 Aug 2014 00:04:57 +0000 (17:04 -0700)]
Documentation: devicetree: update dsa binding with optional properties

Add documentation for a bunch of new optional properties described in
ethernet.txt and fixed-link.txt, this includes: 'phy-handle', 'phy-mode'
and the 'fixed-link' subnode.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: add Broadcom SF2 switch driver
Florian Fainelli [Thu, 28 Aug 2014 00:04:56 +0000 (17:04 -0700)]
net: dsa: add Broadcom SF2 switch driver

Add support for the Broadcom Starfigther 2 switch chip using a DSA
driver. This switch driver supports the following features:

- configuration of the external switch port interface: MII, RevMII,
  RGMII and RGMII_NO_ID are supported
- support for the per-port MIB counters
- support for link interrupts for special ports (e.g: MoCA)
- powering up/down of switch memories to conserve power when ports are
  unused

Finally, update the compatible property for the DSA core code to match
our switch top-level compatible node.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: add Broadcom tag RX/TX handler
Florian Fainelli [Thu, 28 Aug 2014 00:04:55 +0000 (17:04 -0700)]
net: dsa: add Broadcom tag RX/TX handler

Add support for the 4-bytes Broadcom tag that built-in switches such as
the Starfighter 2 might insert when receiving packets, or that we need
to insert while targetting specific switch ports. We use a fake local
EtherType value for this 4-bytes switch tag: ETH_P_BRCMTAG to make sure
we can assign DSA-specific network operations within the DSA drivers.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: allow updating fixed PHY link information
Florian Fainelli [Thu, 28 Aug 2014 00:04:54 +0000 (17:04 -0700)]
net: dsa: allow updating fixed PHY link information

Allow switch drivers to hook a PHY link update callback to perform
port-specific link work.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: allow drivers to do link adjustment
Florian Fainelli [Thu, 28 Aug 2014 00:04:53 +0000 (17:04 -0700)]
net: dsa: allow drivers to do link adjustment

Whenever libphy determines that the link status of a given PHY/port has
changed, allow to call into the switch driver link adjustment callback
so proper actions can be taken care of by the switch driver upon link
notification.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: allow switches to work without tagging
Florian Fainelli [Thu, 28 Aug 2014 00:04:52 +0000 (17:04 -0700)]
net: dsa: allow switches to work without tagging

In case switch port tagging is disabled (voluntarily, or the switch just
does not support it), allow us to continue using the defined set of
dsa_device_ops in net/dsa/slave.c.

We introduce dsa_protocol_is_tagged() to check whether we need to
override skb->protocol and go through the DSA-specifif packet_type
function, or if we just go on and receive the SKB through the normal
path.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: allow for more complex PHY setups
Florian Fainelli [Thu, 28 Aug 2014 00:04:51 +0000 (17:04 -0700)]
net: dsa: allow for more complex PHY setups

Modify the DSA slave interface to be bound to an arbitray PHY, not just
the ones that are available as child PHY devices of the switch MDIO bus.

This allows us for instance to have external PHYs connected to a
separate MDIO bus, but yet also connected to a given switch port.

Under certain configurations, the physical port mask might not be a 1:1
mapping to the MII PHYs mask. This is the case, if e.g: Port 1 of the
switch is used and connects to a PHY at a MDIO address different than 1.

Introduce a phys_mii_mask variable which allows driver to implement and
divert their own MDIO read/writes operations for a subset of the MDIO
PHY addresses.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: retain a per-port device_node pointer
Florian Fainelli [Thu, 28 Aug 2014 00:04:50 +0000 (17:04 -0700)]
net: dsa: retain a per-port device_node pointer

We will later use the per-port device_node pointer to fetch a bunch of
port-specific properties.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: provide a switch device device tree node pointer
Florian Fainelli [Thu, 28 Aug 2014 00:04:49 +0000 (17:04 -0700)]
net: dsa: provide a switch device device tree node pointer

We might need to fetch additional resources from the device tree node
pointer, such as register ranges or other properties. Keep a device_node
pointer around for this.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: provide stub for fixed_phy_set_link_update
Florian Fainelli [Thu, 28 Aug 2014 00:04:48 +0000 (17:04 -0700)]
net: phy: provide stub for fixed_phy_set_link_update

In preparation for updating the DSA code and avoid using ifdefs there,
provide an empty stub for fixed_phy_set_link_update when
CONFIG_FIXED_PHY is not selected.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: phy: add generic UniMAC MDIO bus driver
Florian Fainelli [Thu, 28 Aug 2014 00:04:47 +0000 (17:04 -0700)]
net: phy: add generic UniMAC MDIO bus driver

Add a generic UniMAC MDIO bus driver and its Device Tree binding, which
can be used by the BCMGENET driver as-is, and the upcoming Starfighter 2
Ethernet switch MDIO bus controller.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: dsa: reduce number of protocol hooks
Florian Fainelli [Thu, 28 Aug 2014 00:04:46 +0000 (17:04 -0700)]
net: dsa: reduce number of protocol hooks

DSA is currently registering one packet_type function per EtherType it
needs to intercept in the receive path of a DSA-enabled Ethernet device.
Right now we have three of them: trailer, DSA and eDSA, and there might
be more in the future, this will not scale to the addition of new
protocols.

This patch proceeds with adding a new layer of abstraction and two new
functions:

dsa_switch_rcv() which will dispatch into the tag-protocol specific
receive function implemented by net/dsa/tag_*.c

dsa_slave_xmit() which will dispatch into the tag-protocol specific
transmit function implemented by net/dsa/tag_*.c

When we do create the per-port slave network devices, we iterate over
the switch protocol to assign the DSA-specific receive and transmit
operations.

A new fake ethertype value is used: ETH_P_XDSA to illustrate the fact
that this is no longer going to look like ETH_P_DSA or ETH_P_TRAILER
like it used to be.

This allows us to greatly simplify the check in eth_type_trans() and
always override the skb->protocol with ETH_P_XDSA for Ethernet switches
tagged protocol, while also reducing the number repetitive slave
netdevice_ops assignments.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agosungem: Fix global namespace pollution of phy accessors.
David S. Miller [Thu, 28 Aug 2014 05:59:26 +0000 (22:59 -0700)]
sungem: Fix global namespace pollution of phy accessors.

The sungem driver has "phy_read()" and "phy_write()" functions, which
we need to rename because the generic phy layer is about to export
generic interfaces with the same name.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotulip: dmfe: Fix global namespace pollution of phy accessors.
David S. Miller [Thu, 28 Aug 2014 01:24:16 +0000 (18:24 -0700)]
tulip: dmfe: Fix global namespace pollution of phy accessors.

The dmfe driver has "phy_read()" and "phy_write()" functions, which
we need to rename because the generic phy layer is about to export
generic interfaces with the same name.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agof_ncm: Don't use netdev_start_xmit().
David S. Miller [Thu, 28 Aug 2014 00:05:53 +0000 (17:05 -0700)]
f_ncm: Don't use netdev_start_xmit().

Unfortunately, the USB gadget layer has this weird things where NULL
skbs are passed into ops->ndo_start_xmit() in order to trigger the
dev->wrap() calls to build packets.

This is completely outside of the allowable range of sane arguments
for the ndo_start_xmit method.  All invocations of ndo_start_xmit()
should be with non-NULL SKB arguments.

Put back the direct call, but with a comment explaining how this
is not acceptable in the long term.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoethernet: arc: Add support for specific SoC layer device tree bindings
Romain Perier [Tue, 26 Aug 2014 13:14:51 +0000 (13:14 +0000)]
ethernet: arc: Add support for specific SoC layer device tree bindings

Some platforms have special bank registers which might be used to
select the correct clock or the right mode for Media Indepent Interface
controllers. Sometimes, it is also required to activate vcc regulators
in the right order to supply the ethernet controller at the right time.
This patch is an architecture refactoring of the arc-emac device driver.
It adds a new software design which allows to add specific platform
glue layer. Each platform has now its own module which performs custom
initialization and remove for the target and then calls to the
core driver.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoethernet: arc: mdio changes for future SoC glue layer devtree support
Romain Perier [Tue, 26 Aug 2014 13:14:50 +0000 (13:14 +0000)]
ethernet: arc: mdio changes for future SoC glue layer devtree support

This is an api changes for the emac_mdio.c module.
It will be required later when arc_emac_probe/arc_emac_remove
will no longer use 'struct platform_device'.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoethernet: arc: remove use of 'struct platform_device'
Romain Perier [Tue, 26 Aug 2014 13:14:49 +0000 (13:14 +0000)]
ethernet: arc: remove use of 'struct platform_device'

This is a preparation of an api changes for the emac_main.c module.
The involved functions are arc_emac_probe and arc_emac_remove.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agotcp: syncookies: mark cookie_secret read_mostly
Florian Westphal [Tue, 26 Aug 2014 10:55:53 +0000 (12:55 +0200)]
tcp: syncookies: mark cookie_secret read_mostly

only written once.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agobnx2x: Fix static checker warning regarding `txdata_ptr'
Yuval Mintz [Tue, 26 Aug 2014 07:24:41 +0000 (10:24 +0300)]
bnx2x: Fix static checker warning regarding `txdata_ptr'

Incorrect checking of array instead of array contents in panic_dump
flow - results of commit e261199872a2 ("bnx2x: Safe bnx2x_panic_dump()").

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agor8152: replace strncpy with strlcpy
hayeswang [Tue, 26 Aug 2014 02:08:23 +0000 (10:08 +0800)]
r8152: replace strncpy with strlcpy

Replace the strncpy with strlcpy, and use sizeof to determine the
length.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agonet: Update sk_buff flag bit availability comment.
David S. Miller [Wed, 27 Aug 2014 21:39:04 +0000 (14:39 -0700)]
net: Update sk_buff flag bit availability comment.

We lost one when xmit_more was added.

Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoi40e/i40evf: Bump i40e & i40evf version
Catherine Sullivan [Thu, 10 Jul 2014 07:58:26 +0000 (07:58 +0000)]
i40e/i40evf: Bump i40e & i40evf version

Bump versions for i40e to 1.0.4 and i40evf to 1.0.1.

Change-ID: I960c04da2c91bdf1d02f8e5011e68c34a634122d
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-By: Jim Young <jamesx.m.young@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: Ignore a driver perceived Tx hang if the number of desc pending < 4
Anjali Singhai Jain [Thu, 10 Jul 2014 07:58:25 +0000 (07:58 +0000)]
i40e/i40evf: Ignore a driver perceived Tx hang if the number of desc pending < 4

We are seeing situations where the driver sees a hang with less than 4
desc pending, if the driver chooses to ignore it the queue progresses
forward and the stack never experiences a real hang.
With this patch we will log a stat when this situation happens
"tx_sluggish" will increment and we can see some more details
at a higher debug level. Other than that we will ignore this
particular case of Tx hang.

Change-ID: I7d1d1666d990e2b12f4f6bed0d17d22e1b6410d5
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: quiet complaints when removing default MAC VLAN filter and make set_mac reversible
Shannon Nelson [Tue, 29 Jul 2014 04:01:50 +0000 (04:01 +0000)]
i40e: quiet complaints when removing default MAC VLAN filter and make set_mac reversible

Older firmware has an incorrect MAC VLAN filter that needs to be replaced
at startup, and now newer firmware doesn't have this problem.  With this
change we no longer complain if the remove fails, and we only add the
new filter if the remove succeeded.

Setting a new LAA worked the first time, but didn't work well in successive
operations, including returning to the HW default address.  This simplifies
the code that was trying to be too smart.

Lastly, this pulls the hardware default mac address out into separate
handling code and keeps the broadcast filtering from getting munged.

Change-ID: I1f54b002def04ffef2546febb9a4044385452f85
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e/i40evf: add max buf len to aq debug print helper
Shannon Nelson [Thu, 10 Jul 2014 07:58:20 +0000 (07:58 +0000)]
i40e/i40evf: add max buf len to aq debug print helper

There is at least one case in the Firmware API where the response to a
command changes the buffer size field in the AQ descriptor to a larger
number than what the request's buffer size started as.  This is in addition
to setting an error flag and is in order to tell the requester how much
larger a buffer is required for the answer.  We need to be sure not to
use that number when dumping the contents of the data buffer because it
can send us into the weeds and generate an invalid pointer exception.

This patch adds a max buffer size parameter to the print helper to be
sure the code knows when to stop.

Change-ID: Ib84f7ed72140fe9d600086d8f2002fc5d8753092
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Add checks and message for Qualified Module info
Carolyn Wyborny [Thu, 10 Jul 2014 07:58:19 +0000 (07:58 +0000)]
i40e: Add checks and message for Qualified Module info

This patch adds a check during handle_link_event for unqualified
module when link is down and there is a module plugged.  If found,
print a message.

Change-ID: Ibd8666d77d3044c2a3dd4d762d3ae9ac6e18e943
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: set num_queue_pairs to num configured by VF
Ashish Shah [Thu, 10 Jul 2014 07:58:15 +0000 (07:58 +0000)]
i40e: set num_queue_pairs to num configured by VF

Change vsi->num_queue_pairs to equal the number that are configured
by the VF. This, in turn, limits the number of queues that are
enable/disabled. This fixes the mismatched case for when a VF configures
fewer queues than is allocated to it by the PF.

Change other sections to use alloc_queue_pairs as warranted.

Change-ID: I0de1b55c9084e7be6acc818da8569f12128a82c2
Signed-off-by: Ashish Shah <ashish.n.shah@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
9 years agoi40e: Enable l2tsel bit for VLAN tag control
Shannon Nelson [Tue, 29 Jul 2014 04:01:03 +0000 (04:01 +0000)]
i40e: Enable l2tsel bit for VLAN tag control

Enable the l2tsel bit on Rx queue contexts that are assigned to VFs so
that the VF can get the stripped VLAN tag.

Change-ID: I7d9bc56238a9ea9baf5e8a97e69b9e27ebb9d169
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Ashish Shah <ashish.n.shah@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>