openwrt/staging/blogic.git
7 years agoudp: try to avoid 2 cache miss on dequeue
Paolo Abeni [Mon, 12 Jun 2017 09:23:43 +0000 (11:23 +0200)]
udp: try to avoid 2 cache miss on dequeue

when udp_recvmsg() is executed, on x86_64 and other archs, most skb
fields are on cold cachelines.
If the skb are linear and the kernel don't need to compute the udp
csum, only a handful of skb fields are required by udp_recvmsg().
Since we already use skb->dev_scratch to cache hot data, and
there are 32 bits unused on 64 bit archs, use such field to cache
as much data as we can, and try to prefetch on dequeue the relevant
fields that are left out.

This can save up to 2 cache miss per packet.

v1 -> v2:
  - changed udp_dev_scratch fields types to u{32,16} variant,
    replaced bitfiled with bool

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoudp: avoid a cache miss on dequeue
Paolo Abeni [Mon, 12 Jun 2017 09:23:42 +0000 (11:23 +0200)]
udp: avoid a cache miss on dequeue

Since UDP no more uses sk->destructor, we can clear completely
the skb head state before enqueuing. Amend and use
skb_release_head_state() for that.

All head states share a single cacheline, which is not
normally used/accesses on dequeue. We can avoid entirely accessing
such cacheline implementing and using in the UDP code a specialized
skb free helper which ignores the skb head state.

This saves a cacheline miss at skb deallocation time.

v1 -> v2:
  replaced secpath_reset() with skb_release_head_state()

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: factor out a helper to decrement the skb refcount
Paolo Abeni [Mon, 12 Jun 2017 09:23:41 +0000 (11:23 +0200)]
net: factor out a helper to decrement the skb refcount

The same code is replicated in 3 different places; move it to a
common helper.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosh_eth: add support for changing MTU
Niklas Söderlund [Mon, 12 Jun 2017 08:39:03 +0000 (10:39 +0200)]
sh_eth: add support for changing MTU

The hardware supports the MTU to be changed and the driver it self is
somewhat prepared to support this. This patch hooks up the callbacks to
be able to change the MTU from user-space.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf, arm64: take advantage of stack_depth tracking
Daniel Borkmann [Sun, 11 Jun 2017 01:55:27 +0000 (03:55 +0200)]
bpf, arm64: take advantage of stack_depth tracking

Make use of recently implemented stack_depth tracking for arm64 JIT,
so that stack usage can be reduced heavily for programs not using
tail calls at least.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge tag 'mlx5-updates-2017-06-11' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Sun, 11 Jun 2017 22:10:42 +0000 (18:10 -0400)]
Merge tag 'mlx5-updates-2017-06-11' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2017-06-11

This series provides updates to mlx5 header rewrite feature, from Or Gerlitz.
and three more small updates From maor and eran.

-------
Or says:

Packets belonging to flows which are different by matching may still need
to go through the same header re-writes (e.g set the current routing hop
MACs and issue TTL decrement).  To minimize the number of modify header
IDs, we add a cache for header re-write IDs which is keyed by the binary
chain of modify header actions.

The caching is supported for both eswitch and NIC use-cases, where the
actual conversion of the code to use caching comes in separate patches,
one per use-case.

Using a per field mask field, the TC pedit action supports modifying
partial fields. The last patch enables offloading that.
-------

From Maor, update flow table commands layout to the latest HW spec.
From Eran, ethtool connector type reporting updates.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: ti: cpdma: do not enable host error misc irq
Grygorii Strashko [Thu, 8 Jun 2017 18:51:52 +0000 (13:51 -0500)]
net: ethernet: ti: cpdma: do not enable host error misc irq

CPSW driver does not handle this interrupt, so there are no reasons to enable
it in hardware.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: ti: cpsw: enable HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter
Grygorii Strashko [Thu, 8 Jun 2017 18:51:31 +0000 (13:51 -0500)]
net: ethernet: ti: cpsw: enable HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter

CPSW driver supports PTP v1 messages, but for unknown reasons this filter
is not advertised. As result,
./tools/testing/selftests/networking/timestamping/timestamping utility
can't be used for testing of CPSW RX timestamping with option
SOF_TIMESTAMPING_RX_HARDWARE, because it uses
HWTSTAMP_FILTER_PTP_V1_L4_SYNC filter.

Hence, fix it by advertising HWTSTAMP_FILTER_PTP_V1_L4_XXX filters
in CPSW driver.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bpf-misc-updates'
David S. Miller [Sat, 10 Jun 2017 23:05:47 +0000 (19:05 -0400)]
Merge branch 'bpf-misc-updates'

Daniel Borkmann says:

====================
Misc BPF updates

This set contains a couple of misc updates: stack usage reduction
for perf_sample_data in tracing progs, reduction of stale data in
verifier on register state transitions that I still had in my queue
and few selftest improvements as well as bpf_set_hash() helper for
tc programs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: add bpf_set_hash helper for tc progs
Daniel Borkmann [Sat, 10 Jun 2017 22:50:47 +0000 (00:50 +0200)]
bpf: add bpf_set_hash helper for tc progs

Allow for tc BPF programs to set a skb->hash, apart from clearing
and triggering a recalc that we have right now. It allows for BPF
to implement a custom hashing routine for skb_get_hash().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: remove cg_skb_func_proto and use sk_filter_func_proto directly
Daniel Borkmann [Sat, 10 Jun 2017 22:50:46 +0000 (00:50 +0200)]
bpf: remove cg_skb_func_proto and use sk_filter_func_proto directly

Since cg_skb_func_proto() doesn't do anything else than just calling
into sk_filter_func_proto(), remove it and set sk_filter_func_proto()
directly for .get_func_proto callback.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf, tests: set rlimit also for test_align, so it doesn't fail
Daniel Borkmann [Sat, 10 Jun 2017 22:50:45 +0000 (00:50 +0200)]
bpf, tests: set rlimit also for test_align, so it doesn't fail

When running all the tests, through 'make run_tests', I had
test_align failing due to insufficient rlimit. Set it the same
way as all other test cases from BPF selftests do, so that
test case properly loads everything.

  [...]
  Summary: 7 PASSED, 1 FAILED
  selftests: test_progs [PASS]
  /home/foo/net-next/tools/testing/selftests/bpf
  Test   0: mov ... Failed to load program.
  FAIL
  Test   1: shift ... Failed to load program.
  FAIL
  Test   2: addsub ... Failed to load program.
  FAIL
  Test   3: mul ... Failed to load program.
  FAIL
  Test   4: unknown shift ... Failed to load program.
  FAIL
  Test   5: unknown mul ... Failed to load program.
  FAIL
  Test   6: packet const offset ... Failed to load program.
  FAIL
  Test   7: packet variable offset ... Failed to load program.
  FAIL
  Results: 0 pass 8 fail
  selftests: test_align [PASS]
  [...]

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf, tests: add a test for htab lookup + update traversal
Daniel Borkmann [Sat, 10 Jun 2017 22:50:44 +0000 (00:50 +0200)]
bpf, tests: add a test for htab lookup + update traversal

Add a test case to track behaviour when traversing and updating the
htab map. We recently used such traversal, so it's quite useful to
keep it as an example in selftests.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: reset id on spilled regs in clear_all_pkt_pointers
Daniel Borkmann [Sat, 10 Jun 2017 22:50:43 +0000 (00:50 +0200)]
bpf: reset id on spilled regs in clear_all_pkt_pointers

Right now, we don't reset the id of spilled registers in case of
clear_all_pkt_pointers(). Given pkt_pointers are highly likely to
contain an id, do so by reusing __mark_reg_unknown_value().

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: reset id on CONST_IMM transition
Daniel Borkmann [Sat, 10 Jun 2017 22:50:42 +0000 (00:50 +0200)]
bpf: reset id on CONST_IMM transition

Whenever we set the register to the type CONST_IMM, we currently don't
reset the id to 0. id member is not used in CONST_IMM case, so don't
let it become stale, where pruning won't be able to match later on.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: don't check spilled reg state for non-STACK_SPILLed type slots
Daniel Borkmann [Sat, 10 Jun 2017 22:50:41 +0000 (00:50 +0200)]
bpf: don't check spilled reg state for non-STACK_SPILLed type slots

spilled_regs[] state is only used for stack slots of type STACK_SPILL,
never for STACK_MISC. Right now, in states_equal(), even if we have
old and current stack state of type STACK_MISC, we compare spilled_regs[]
for that particular offset. Just skip these like we do everywhere else.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: avoid excessive stack usage for perf_sample_data
Daniel Borkmann [Sat, 10 Jun 2017 22:50:40 +0000 (00:50 +0200)]
bpf: avoid excessive stack usage for perf_sample_data

perf_sample_data consumes 386 bytes on stack, reduce excessive stack
usage and move it to per cpu buffer. It's allowed due to preemption
being disabled for tracing, xdp and tc programs, thus at all times
only one program can run on a specific CPU and programs cannot run
from interrupt. We similarly also handle bpf_pt_regs.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: fec: Add a fec_enet_clear_ethtool_stats() stub for CONFIG_M5272
Fabio Estevam [Sat, 10 Jun 2017 01:37:22 +0000 (22:37 -0300)]
net: fec: Add a fec_enet_clear_ethtool_stats() stub for CONFIG_M5272

Commit 2b30842b23b9 ("net: fec: Clear and enable MIB counters on imx51")
introduced fec_enet_clear_ethtool_stats(), but missed to add a stub
for the CONFIG_M5272=y case, causing build failure for the
m5272c3_defconfig.

Add the missing empty stub to fix the build failure.

Fixes: Commit 2b30842b23b9 ("net: fec: Clear and enable MIB counters on imx51")
Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoRemove the redundant skb->dev initialization in ip6_fragment
Chenbo Feng [Sat, 10 Jun 2017 19:35:38 +0000 (12:35 -0700)]
Remove the redundant skb->dev initialization in ip6_fragment

After moves the skb->dev and skb->protocol initialization into
ip6_output, setting the skb->dev inside ip6_fragment is unnecessary.

Fixes: 97a7a37a7b7b("ipv6: Initial skb->dev and skb->protocol in ip6_output")
Signed-off-by: Chenbo Feng <fengc@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: no need to check assoc id before calling sctp_assoc_set_id
Xin Long [Sat, 10 Jun 2017 07:27:12 +0000 (15:27 +0800)]
sctp: no need to check assoc id before calling sctp_assoc_set_id

sctp_assoc_set_id does the assoc id check in the beginning when
processing dupcookie, no need to do the same check before calling
it.

v1->v2:
  fix some typo errs Marcelo pointed in changelog.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: use read_lock_bh in sctp_eps_seq_show
Xin Long [Sat, 10 Jun 2017 07:13:32 +0000 (15:13 +0800)]
sctp: use read_lock_bh in sctp_eps_seq_show

This patch is to use read_lock_bh instead of local_bh_disable
and read_lock in sctp_eps_seq_show.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosctp: fix recursive locking warning in sctp_do_peeloff
Xin Long [Sat, 10 Jun 2017 06:56:56 +0000 (14:56 +0800)]
sctp: fix recursive locking warning in sctp_do_peeloff

Dmitry got the following recursive locking report while running syzkaller
fuzzer, the Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x2ee/0x3ef lib/dump_stack.c:52
 print_deadlock_bug kernel/locking/lockdep.c:1729 [inline]
 check_deadlock kernel/locking/lockdep.c:1773 [inline]
 validate_chain kernel/locking/lockdep.c:2251 [inline]
 __lock_acquire+0xef2/0x3430 kernel/locking/lockdep.c:3340
 lock_acquire+0x2a1/0x630 kernel/locking/lockdep.c:3755
 lock_sock_nested+0xcb/0x120 net/core/sock.c:2536
 lock_sock include/net/sock.h:1460 [inline]
 sctp_close+0xcd/0x9d0 net/sctp/socket.c:1497
 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:425
 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:432
 sock_release+0x8d/0x1e0 net/socket.c:597
 __sock_create+0x38b/0x870 net/socket.c:1226
 sock_create+0x7f/0xa0 net/socket.c:1237
 sctp_do_peeloff+0x1a2/0x440 net/sctp/socket.c:4879
 sctp_getsockopt_peeloff net/sctp/socket.c:4914 [inline]
 sctp_getsockopt+0x111a/0x67e0 net/sctp/socket.c:6628
 sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2690
 SYSC_getsockopt net/socket.c:1817 [inline]
 SyS_getsockopt+0x240/0x380 net/socket.c:1799
 entry_SYSCALL_64_fastpath+0x1f/0xc2

This warning is caused by the lock held by sctp_getsockopt() is on one
socket, while the other lock that sctp_close() is getting later is on
the newly created (which failed) socket during peeloff operation.

This patch is to avoid this warning by use lock_sock with subclass
SINGLE_DEPTH_NESTING as Wang Cong and Marcelo's suggestion.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/packet: remove unneeded declaraion of tpacket_snd().
Rosen, Rami [Sat, 10 Jun 2017 00:22:48 +0000 (03:22 +0300)]
net/packet: remove unneeded declaraion of tpacket_snd().

This patch removes unneeded forward declaration of tpacket_snd()
in net/packet/af_packet.c.

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Remove duplicate tcp_filter hook in ipv6
Chenbo Feng [Fri, 9 Jun 2017 19:17:37 +0000 (12:17 -0700)]
bpf: Remove duplicate tcp_filter hook in ipv6

There are two tcp_filter hooks in tcp_ipv6 ingress path currently.
One is at tcp_v6_rcv and another is in tcp_v6_do_rcv. It seems the
tcp_filter() call inside tcp_v6_do_rcv is redundent and some packet
will be filtered twice in this situation. This will cause trouble
when using eBPF filters to account traffic data.

Signed-off-by: Chenbo Feng <fengc@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobonding: warn user when 802.3ad speed is unknown
Nicolas Dichtel [Fri, 9 Jun 2017 15:58:08 +0000 (17:58 +0200)]
bonding: warn user when 802.3ad speed is unknown

Goal is to advertise the user when ethtool speeds and 802.3ad speeds are
desynchronized.
When this case happens, the kernel needs to be patched.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetns: fix error code when the nsid is already used
Nicolas Dichtel [Fri, 9 Jun 2017 12:41:57 +0000 (14:41 +0200)]
netns: fix error code when the nsid is already used

When the user tries to assign a specific nsid, idr_alloc() is called with
the range [nsid, nsid+1]. If this nsid is already used, idr_alloc() returns
ENOSPC (No space left on device). In our case, it's better to return
EEXIST to make it clear that the nsid is not available.

CC: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetns: define extack error msg for nsis cmds
Nicolas Dichtel [Fri, 9 Jun 2017 12:41:56 +0000 (14:41 +0200)]
netns: define extack error msg for nsis cmds

It helps the user to identify errors.

CC: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agocxgb4: fix memory leak in init_one()
Ganesh Goudar [Fri, 9 Jun 2017 13:56:24 +0000 (19:26 +0530)]
cxgb4: fix memory leak in init_one()

Free up mbox_log allocated for PF0 to PF3.

Fixes: 7829451c695e ("cxgb4: Add control net_device for configuring PCIe VF")
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: add qed_int_sb_init() stub function
Arnd Bergmann [Fri, 9 Jun 2017 10:37:35 +0000 (12:37 +0200)]
qed: add qed_int_sb_init() stub function

When CONFIG_QED_SRIOV is disabled, we get a build error:

drivers/net/ethernet/qlogic/qed/qed_int.c: In function 'qed_int_sb_init':
drivers/net/ethernet/qlogic/qed/qed_int.c:1499:4: error: implicit declaration of function 'qed_vf_set_sb_info'; did you mean 'qed_mcp_get_resc_info'? [-Werror=implicit-function-declaration]

All the other declarations have a 'static inline' stub as an alternative
here, so this adds one more for qed_int_sb_init.

Fixes: 50a207147fce ("qed: Hold a single array for SBs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'qed-Light-L2-updates'
David S. Miller [Fri, 9 Jun 2017 19:49:03 +0000 (15:49 -0400)]
Merge branch 'qed-Light-L2-updates'

Yuval Mintz says:

====================
qed*: Light L2 updates

This series does a major overhaul of the LL2 logic in qed.
The single biggest change done here is in #5 where we're changing
the API qed provides for LL2 [both internally in case of storage and
externally in case of RoCE] to become callback-based to allow cleaner
scalability in preperation to the future iWARP submission which would
aadd additional flavors of LL2. It's also the only patch in series
to modify !qed logic [qedr].

Patches prior to that mostly deal with refactoring LL2 code,
encapsulating varaious parameters into structure and re-ordering
of LL2 code. The latter patches add some small missing bits of LL2
ffunctionality.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: collect GSI port statistics
Mintz, Yuval [Fri, 9 Jun 2017 14:13:25 +0000 (17:13 +0300)]
qed: collect GSI port statistics

The LL2 statistics already have place holders for these, but haven't
populated them so far.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Call rx_release_cb() when flushing LL2
Mintz, Yuval [Fri, 9 Jun 2017 14:13:24 +0000 (17:13 +0300)]
qed: Call rx_release_cb() when flushing LL2

Driver to inform the connection owner that the its buffers are being
released as part of a flush.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: No need for LL2 frags indication
Mintz, Yuval [Fri, 9 Jun 2017 14:13:23 +0000 (17:13 +0300)]
qed: No need for LL2 frags indication

This is a legacy leftover; There's no current flow where 'frags_mapped'
would be set.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed*: LL2 callback operations
Michal Kalderon [Fri, 9 Jun 2017 14:13:22 +0000 (17:13 +0300)]
qed*: LL2 callback operations

LL2 today is interrupt driven - when tx/rx completion arrives [or any
other indication], qed needs to operate on the connection and pass
the information to the protocol-driver [or internal qed consumer].
Since we have several flavors of ll2 employeed by the driver,
each handler needs to do an if-else to determine the right functionality
to use based on the connection type.

In order to make things more scalable [given that we're going to add
additional types of ll2 flavors] move the infrastrucutre into using
a callback-based approach - the callbacks would be provided as part
of the connection's initialization parameters.

Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: LL2 code relocations
Mintz, Yuval [Fri, 9 Jun 2017 14:13:21 +0000 (17:13 +0300)]
qed: LL2 code relocations

Instead of having the OOO logic packetd, divide it with rest of code
according to establish/release flows.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Cleaner seperation of LL2 inputs
Mintz, Yuval [Fri, 9 Jun 2017 14:13:20 +0000 (17:13 +0300)]
qed: Cleaner seperation of LL2 inputs

A LL2 connection [qed_ll2_info] has a sub-structure of type qed_ll2_conn
that contain various inputs for ll2 acquisition, but the connection also
utilizes a couple of other inputs.

Restructure the input structure to include all the inputs and refactor
the code necessary to populate those.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: Revise ll2 Rx completion
Mintz, Yuval [Fri, 9 Jun 2017 14:13:19 +0000 (17:13 +0300)]
qed: Revise ll2 Rx completion

This introduces qed_ll2_comp_rx_data as a public struct
and moves handling of Rx packets in LL2 into using it.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoqed: LL2 to use packed information for tx
Mintz, Yuval [Fri, 9 Jun 2017 14:13:18 +0000 (17:13 +0300)]
qed: LL2 to use packed information for tx

First step in revising the LL2 interface, this declares
qed_ll2_tx_pkt_info as part of the ll2 interface, and uses it for
transmission instead of receiving lots of parameters.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'r8152-minor-adjustment'
David S. Miller [Fri, 9 Jun 2017 19:37:03 +0000 (15:37 -0400)]
Merge branch 'r8152-minor-adjustment'

Hayes Wang says:

====================
r8152: minor adjustment

Adjust some code to make it reasonable or satisfy the suggestion from
the engineers.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: replace napi_complete with napi_complete_done
hayeswang [Fri, 9 Jun 2017 09:11:48 +0000 (17:11 +0800)]
r8152: replace napi_complete with napi_complete_done

Change from using napi_complete to napi_complete_done to allow for the
use of gro_flush_timeout in tuning network processing.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: avoid rx queue more than 1000 packets
hayeswang [Fri, 9 Jun 2017 09:11:47 +0000 (17:11 +0800)]
r8152: avoid rx queue more than 1000 packets

Stop queuing rx packets if it is more than 1000.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: check if disabling ALDPS is finished
hayeswang [Fri, 9 Jun 2017 09:11:46 +0000 (17:11 +0800)]
r8152: check if disabling ALDPS is finished

Use PLA 0xe000 bit 8 to check if disabling ALDPS is finished.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: move the initialization to reset_resume function
hayeswang [Fri, 9 Jun 2017 09:11:45 +0000 (17:11 +0800)]
r8152: move the initialization to reset_resume function

Move tp->rtl_ops.init() from rtl8152_resume() to rtl8152_reset_resume().
The initialization is only necessary for reset_resume().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: move the default coalesce setting for RTL8153
hayeswang [Fri, 9 Jun 2017 09:11:44 +0000 (17:11 +0800)]
r8152: move the default coalesce setting for RTL8153

Only RTL8153 could set coalesce, so move the default setting for
rtl8152_probe() to r8153_init().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: adjust U2P3 for RTL8153
hayeswang [Fri, 9 Jun 2017 09:11:43 +0000 (17:11 +0800)]
r8152: adjust U2P3 for RTL8153

Use another way to keep disabling the U2P3 for both RTL_VER_03 and
RTL_VER_04.

Move enabling U2P3 from r8153_init() to r8153_hw_phy_cfg(). The
engineer ask the setting should be done after PHY settings.

Disable U2P3 first in rtl8153_up().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: adjust rtl8153_runtime_enable function
hayeswang [Fri, 9 Jun 2017 09:11:42 +0000 (17:11 +0800)]
r8152: adjust rtl8153_runtime_enable function

Adjust the order of rtl8153_runtime_enable() according to the
suggestion from the engineer.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: move the setting of rx aggregation
hayeswang [Fri, 9 Jun 2017 09:11:41 +0000 (17:11 +0800)]
r8152: move the setting of rx aggregation

Move the setting from r8153_first_init() to r8153_init(). It only needs to
be set once.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: adjust the settings about MAC clock speed down for RTL8153
hayeswang [Fri, 9 Jun 2017 09:11:40 +0000 (17:11 +0800)]
r8152: adjust the settings about MAC clock speed down for RTL8153

The MAC clock speed down could be enabled if the U1/U2 is disabled.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: adjust lpm settings for RTL8153
hayeswang [Fri, 9 Jun 2017 09:11:39 +0000 (17:11 +0800)]
r8152: adjust lpm settings for RTL8153

Enable lpm after r8153_init() and remove other enable/disable lpm.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agor8152: add r8153_phy_status function
hayeswang [Fri, 9 Jun 2017 09:11:38 +0000 (17:11 +0800)]
r8152: add r8153_phy_status function

Use r8153_phy_status() to check phy status of RTL8153.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Fix test_obj_id.c for llvm 5.0
Martin KaFai Lau [Fri, 9 Jun 2017 05:30:17 +0000 (22:30 -0700)]
bpf: Fix test_obj_id.c for llvm 5.0

llvm 5.0 does not like the section name and the function name
to be the same:

clang -I. -I./include/uapi -I../../../include/uapi \
-I../../../../samples/bpf/ \
-Wno-compare-distinct-pointer-types \
-O2 -target bpf -c \
linux/tools/testing/selftests/bpf/test_obj_id.c -o \
linux/tools/testing/selftests/bpf/test_obj_id.o
fatal error: error in backend: 'test_prog_id' label emitted multiple times to
assembly file
clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 5.0.0 (trunk 304326) (llvm/trunk 304329)

This patch makes changes to the section name and the function name.

Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
Reported-by: Alexei Starovoitov <ast@fb.com>
Reported-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: Fix test_bpf_obj_id() when the bpf_jit_enable sysctl is diabled
Martin KaFai Lau [Fri, 9 Jun 2017 05:30:16 +0000 (22:30 -0700)]
bpf: Fix test_bpf_obj_id() when the bpf_jit_enable sysctl is diabled

test_bpf_obj_id() should not expect a non zero jited_prog_len
to be returned by bpf_obj_get_info_by_fd() when
net.core.bpf_jit_enable is 0.

The patch checks for net.core.bpf_jit_enable and
has different expectation on jited_prog_len.

This patch also removes the pwd.h header which I forgot
to remove after making changes.

Fixes: 95b9afd3987f ("bpf: Test for bpf ID")
Reported-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoipv6: Initial skb->dev and skb->protocol in ip6_output
Chenbo Feng [Fri, 9 Jun 2017 19:06:07 +0000 (12:06 -0700)]
ipv6: Initial skb->dev and skb->protocol in ip6_output

Move the initialization of skb->dev and skb->protocol from
ip6_finish_output2 to ip6_output. This can make the skb->dev and
skb->protocol information avalaible to the CGROUP eBPF filter.

Signed-off-by: Chenbo Feng <fengc@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agocxgb4: handle interrupt raised when FW crashes
Rahul Lakkireddy [Fri, 9 Jun 2017 05:42:35 +0000 (11:12 +0530)]
cxgb4: handle interrupt raised when FW crashes

Handle TIMER0INT when FW crashes. Check for PCIE_FW[FW_EVAL]
and if it says "Device FW Crashed", then treat it as fatal.
Else, non-fatal.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'nfp-FW-app-build-name-reporting'
David S. Miller [Fri, 9 Jun 2017 16:52:09 +0000 (12:52 -0400)]
Merge branch 'nfp-FW-app-build-name-reporting'

Jakub Kicinski says:

====================
nfp: FW app build name reporting

This series adds reporting FW build name in ethtool -i.  Most
of the patches are restructuring where information caching is
done.  There is also a minor error path fix.

These are last few patches finishing the basic nfp_app support.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: report application FW build name in ethtool -i
Jakub Kicinski [Fri, 9 Jun 2017 03:56:14 +0000 (20:56 -0700)]
nfp: report application FW build name in ethtool -i

Make sure application FW build name is NULL-terminated and
print it as a part of ethtool's firmware version string.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: keep MIP object around
Jakub Kicinski [Fri, 9 Jun 2017 03:56:13 +0000 (20:56 -0700)]
nfp: keep MIP object around

Microcode Information Page contains some useful information, like
application firmware build name.  Keep it around, similar to RTSym
and HWInfo.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: remove automatic caching of HWInfo
Jakub Kicinski [Fri, 9 Jun 2017 03:56:12 +0000 (20:56 -0700)]
nfp: remove automatic caching of HWInfo

Make callers take care of managing life time of HWInfo.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: remove automatic caching of RTsym table
Jakub Kicinski [Fri, 9 Jun 2017 03:56:11 +0000 (20:56 -0700)]
nfp: remove automatic caching of RTsym table

The fact that RTsym table is cached inside nfp_cpp handle is
a relic of old times when nfpcore was a library module.  All
the nfp_cpp "caches" are awkward to deal with because of
concurrency and prone to keeping stale information.  Make
the run time symbol table be an object read out from the device
and managed by whoever requested it.  Since the driver loads
FW at ->probe() and never reloads, we can hold onto the table
for ever.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonfp: make sure to cancel port refresh on the error path
Jakub Kicinski [Fri, 9 Jun 2017 03:56:10 +0000 (20:56 -0700)]
nfp: make sure to cancel port refresh on the error path

If very last stages of netdev registering and init fail some
other netdevs and devlink ports may have been visible to user
space before we torn them back down.  In this case there is a
slight chance user may have triggered port refresh.  We need
to make sure the async work is cancelled.

We have to cancel after releasing pf->lock, so we will always
try to cancel, regardless of which part of probe has failed.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoliquidio: disallow enabling firmware debug from a VF
Derek Chickles [Fri, 9 Jun 2017 02:20:36 +0000 (19:20 -0700)]
liquidio: disallow enabling firmware debug from a VF

Disallow enabling firmware debug from a VF.  Only PF is allowed to do that.

Signed-off-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agogeneve: add missing rx stats accounting
Girish Moodalbail [Fri, 9 Jun 2017 00:07:48 +0000 (17:07 -0700)]
geneve: add missing rx stats accounting

There are few places on the receive path where packet drops and packet
errors were not accounted for. This patch fixes that issue.

Signed-off-by: Girish Moodalbail <girish.moodalbail@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoIpvlan should return an error when an address is already in use.
Krister Johansen [Thu, 8 Jun 2017 20:12:14 +0000 (13:12 -0700)]
Ipvlan should return an error when an address is already in use.

The ipvlan code already knows how to detect when a duplicate address is
about to be assigned to an ipvlan device.  However, that failure is not
propogated outward and leads to a silent failure.

Introduce a validation step at ip address creation time and allow device
drivers to register to validate the incoming ip addresses.  The ipvlan
code is the first consumer.  If it detects an address in use, we can
return an error to the user before beginning to commit the new ifa in
the networking code.

This can be especially useful if it is necessary to provision many
ipvlans in containers.  The provisioning software (or operator) can use
this to detect situations where an ip address is unexpectedly in use.

Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'netvsc-small-cleanups'
David S. Miller [Fri, 9 Jun 2017 16:15:06 +0000 (12:15 -0400)]
Merge branch 'netvsc-small-cleanups'

Stephen Hemminger says:

====================
netvsc: small cleanups

These are all small optimizations found during development of later features.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: fold in get_outbound_net_device
stephen hemminger [Thu, 8 Jun 2017 23:21:23 +0000 (16:21 -0700)]
netvsc: fold in get_outbound_net_device

No longer need common code to find get_outbound_net_device.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: pass net_device to netvsc_init_buf and netvsc_connect_vsp
stephen hemminger [Thu, 8 Jun 2017 23:21:22 +0000 (16:21 -0700)]
netvsc: pass net_device to netvsc_init_buf and netvsc_connect_vsp

Don't need to find netvsc_device structure, caller already had it.
Also rearrange declarations.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: mark error cases as unlikely
stephen hemminger [Thu, 8 Jun 2017 23:21:21 +0000 (16:21 -0700)]
netvsc: mark error cases as unlikely

Mark if() statements used for error handling only as unlikely()

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: use typed pointer for internal state
stephen hemminger [Thu, 8 Jun 2017 23:21:20 +0000 (16:21 -0700)]
netvsc: use typed pointer for internal state

The element netvsc_device:extension is always a pointer to RNDIS
information.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: use hv_get_bytes_to_read
stephen hemminger [Thu, 8 Jun 2017 23:21:19 +0000 (16:21 -0700)]
netvsc: use hv_get_bytes_to_read

Don't need need to look at write space in netvsc_close.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: optimize calculation of number of slots
stephen hemminger [Thu, 8 Jun 2017 23:21:18 +0000 (16:21 -0700)]
netvsc: optimize calculation of number of slots

Speed up transmit check for fragmented packets by using existing
macros to compute number of pages, and eliminate loop since
skb fragments each take a page. Number of slots is also unsigned.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'dsa-mv88e6xxx-ops-cosmetics'
David S. Miller [Fri, 9 Jun 2017 16:11:00 +0000 (12:11 -0400)]
Merge branch 'dsa-mv88e6xxx-ops-cosmetics'

Vivien Didelot says:

====================
net: dsa: mv88e6xxx: ops cosmetics

This patchset brings no functional changes. It is a first step in a
bigger cosmetics change to the driver. It simplifies print messages and
polishes data types and chip operations.

The next patchs will only prefix and document the port registers macros.

Changes in v2:
  - KISS and simply use dev_* since chip->ds may not be initialized
  - add reviewers tags
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: prefix PHY macros
Vivien Didelot [Thu, 8 Jun 2017 22:34:14 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: prefix PHY macros

Prefix the PHY_* macros with a Marvell specific MV88E6XXX_ prefix.
There is no functional changes.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: rework jumbo size operation
Vivien Didelot [Thu, 8 Jun 2017 22:34:13 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: rework jumbo size operation

Marvell chips have a Jumbo Mode to set the maximum frame size (MTU).

The mv88e6xxx_ops structure is meant to contain generic functionalities,
no driver logic. Change port_jumbo_config to port_set_jumbo_size setting
the mode from a given maximum size value.

There is no functional changes since we still use 10240 bytes.

At the same time, correctly clear all Jumbo Mode bits before writing.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: rework pause limit operation
Vivien Didelot [Thu, 8 Jun 2017 22:34:12 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: rework pause limit operation

All Marvell chips supporting Pause frames limiting use 1-byte value for
input and output.

Old chips have both bytes adjacent in a 16-bit register. New ones have
an indirect table using 8-bit data.

The mv88e6xxx library functions (such as in port.c) must not contain
driver logic, but only generic helpers. This patch changes the
port_pause_config operation for port_pause_limit taking two u8 arguments
for input and output limits. There is no functional changes.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: do not prefix ops with g1
Vivien Didelot [Thu, 8 Jun 2017 22:34:11 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: do not prefix ops with g1

The mv88e6xxx_ops describe functionalities, regardless their locations
(which can be Global1, Global2, or whatever register set.)

Rename the g1_set_cpu_port and g1_set_egress_port ops to set_cpu_port
and set_egress_port. No functional changes.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: use bridge state values
Vivien Didelot [Thu, 8 Jun 2017 22:34:10 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: use bridge state values

Reuse the BR_STATE_* values to abstract a port STP state value.

This provides shorter names and better control over the DSA switch
operation call.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: add egress mode enumeration
Vivien Didelot [Thu, 8 Jun 2017 22:34:09 +0000 (18:34 -0400)]
net: dsa: mv88e6xxx: add egress mode enumeration

As for the frame mode, add a mv88e6xxx_egress_mode enumeration instead
of a 16-bit register mask.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv888e6xxx: do not use netdev printing
Vivien Didelot [Thu, 8 Jun 2017 22:34:08 +0000 (18:34 -0400)]
net: dsa: mv888e6xxx: do not use netdev printing

The mv888e6xxx driver accesses a port's netdev mostly for printing.

This is bad for 2 reasons: DSA and CPU ports do not have a netdev
pointer; it doesn't give us a correct picture of why a DSA driver might
need to access a port's netdev.

Instead simply use dev_* printing functions with chip->dev (or ds->dev
depending on the scope, both guaranteed to exist), with a p%d prefix for
the target port.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoskbuff: only inherit relevant tx_flags
Willem de Bruijn [Thu, 8 Jun 2017 15:35:03 +0000 (11:35 -0400)]
skbuff: only inherit relevant tx_flags

When inheriting tx_flags from one skbuff to another, always apply a
mask to avoid overwriting unrelated other bits in the field.

The two SKBTX_SHARED_FRAG cases clears all other bits. In practice,
tx_flags are zero at this point now. But this is fragile. Timestamp
flags are set, for instance, if in tcp_gso_segment, after this clear
in skb_segment.

The SKBTX_ANY_TSTAMP mask in __skb_tstamp_tx ensures that new
skbs do not accidentally inherit flags such as SKBTX_SHARED_FRAG.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-add-const-to-mii_phy_ops-structures'
David S. Miller [Thu, 8 Jun 2017 19:32:48 +0000 (15:32 -0400)]
Merge branch 'net-add-const-to-mii_phy_ops-structures'

Bhumika Goyal says:

====================
drivers: net: add const to mii_phy_ops structures

The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agodrivers: net: emac: add const to mii_phy_ops structures
Bhumika Goyal [Thu, 8 Jun 2017 06:00:58 +0000 (11:30 +0530)]
drivers: net: emac: add const to mii_phy_ops structures

The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agodrivers/net/sungem: add const to mii_phy_ops structures
Bhumika Goyal [Thu, 8 Jun 2017 06:00:57 +0000 (11:30 +0530)]
drivers/net/sungem: add const to mii_phy_ops structures

The object references of mii_phy_ops structures are only stored
in the ops field of a mii_phy_def structure. This ops field is of type
const. So, mii_phy_ops structures having similar properties can be
declared as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Thu, 8 Jun 2017 18:41:19 +0000 (14:41 -0400)]
Merge branch '1GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2017-06-07

This series contains a fix for e1000e and igb.

Colin Ian King fixes sparse warnings in igb by making functions static.

Chris Wilson provides a fix for a previous commit which is causing an
issue during suspend "e1000e_pm_suspend()", where we need to run
e1000e_pm_thaw() if __e1000_shutdown() is unsuccessful.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agocxgb4: fix to bring link down after adapter crash
Rahul Lakkireddy [Thu, 8 Jun 2017 05:22:11 +0000 (10:52 +0530)]
cxgb4: fix to bring link down after adapter crash

Use PORT_REG for T4 and T5_PORT_REG for > T4 to write to correct
register to bring down link during shutdown after adapter crash.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ipmr: add getlink support
Nikolay Aleksandrov [Wed, 7 Jun 2017 15:02:32 +0000 (18:02 +0300)]
net: ipmr: add getlink support

Currently there's no way to dump the VIF table for an ipmr table other
than the default (via proc). This is a major issue when debugging ipmr
issues and in general it is good to know which interfaces are
configured. This patch adds support for RTM_GETLINK for the ipmr family
so we can dump the VIF table and the ipmr table's current config for
each table. We're protected by rtnl so no need to acquire RCU or
mrt_lock.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'mlxsw-Remove-compatibility-with-old-firmware'
David S. Miller [Thu, 8 Jun 2017 18:33:42 +0000 (14:33 -0400)]
Merge branch 'mlxsw-Remove-compatibility-with-old-firmware'

Jiri Pirko says:

====================
mlxsw: Remove compatibility with old firmware

Up until recently we couldn't enforce a minimal firmware version, which
forced us to be compatible with old firmware versions. This patchset
removes this code and simplifies the driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum: Pass port argument to module mapping functions
Ido Schimmel [Thu, 8 Jun 2017 06:47:45 +0000 (08:47 +0200)]
mlxsw: spectrum: Pass port argument to module mapping functions

Previous patch made it unnecessary to map ports to modules before we
allocate their struct. We can now therefore pass the port struct to
these functions, thereby making them consistent with other functions
that operate on ports.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum: Simplify port split flow
Ido Schimmel [Thu, 8 Jun 2017 06:47:44 +0000 (08:47 +0200)]
mlxsw: spectrum: Simplify port split flow

In commit be94535f9531 ("mlxsw: spectrum: Make split flow match firmware
requirements") we had to modify the port split flow to overcome quirks
in the device's firmware. This resulted in asymmetrical code with
regards to port creation and removal.

The problem in the firmware is long gone and since we can now enforce a
minimal firmware version, we can simplify the code and make it symmetric
again.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum_router: Mark only first LPM tree as reserved
Ido Schimmel [Thu, 8 Jun 2017 06:47:43 +0000 (08:47 +0200)]
mlxsw: spectrum_router: Mark only first LPM tree as reserved

In new firmware versions (that we can now enforce via
request_firmware()), only the first LPM tree is reserved and not the
first two as in older versions.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'net-Remove-support-from-bridge-bypass-for-mlxsw-rocker-drivers'
David S. Miller [Thu, 8 Jun 2017 18:16:31 +0000 (14:16 -0400)]
Merge branch 'net-Remove-support-from-bridge-bypass-for-mlxsw-rocker-drivers'

Jiri Pirko says:

===================
net: Remove support from bridge bypass for mlxsw/rocker drivers

Currently setting bridge port attributes and adding FDBs are done via
setting the SELF flag which implies unconsistent offloading model. This
patch-set fixes this behavior by making the bridge and drivers which are
using it to be totally in sync.

This implies several changes:
- Offloading bridge flags from the bridge code.
- Sending notification about FDB add/del to the software bridge in a
  similiar way it is done for the hardware externally learned FDBs.

By making the offloading model more consistent a cleanup is done in
the drivers supporting it. This is done in order to remove un-needed
logic related to dump operation which is redundant.

First add missing functionality to bridge, then clean up the mlxsw/rocker
drivers.

v1->v2
- Move bridge-switchdev related stuff to br_switchdev.c as suggested by Nik
===================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Remove support bridge bypass FDB
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:28 +0000 (08:44 +0200)]
rocker: Remove support bridge bypass FDB

The FDB add/delete are now done through the notification chain. The FDBs
are synced with the bridge and there is no need for extra dumping.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Remove support for bypass bridge port attributes/vlan set
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:27 +0000 (08:44 +0200)]
rocker: Remove support for bypass bridge port attributes/vlan set

The bridge port attributes/vlan for mlxsw devices should be set only
from bridge code. The vlans are synced totally with the bridge so
there is no need to special dump support.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Add support for learning FDB through notification
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:26 +0000 (08:44 +0200)]
rocker: Add support for learning FDB through notification

Add support for learning FDB through notification. The driver defers
the hardware update via ordered work queue.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Change world_ops API and implementation to be switchdev independant
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:25 +0000 (08:44 +0200)]
rocker: Change world_ops API and implementation to be switchdev independant

Currently the switchdev_trans struct is embedded in the world_ops API.
In order to add support for adding FDB via a notfication chain the API should
be switchdev independent.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Add support for querying supported bridge flags
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:24 +0000 (08:44 +0200)]
rocker: Add support for querying supported bridge flags

Add support for querying supported bridge flags.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agorocker: Remove support for bridge FDB learning sync
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:23 +0000 (08:44 +0200)]
rocker: Remove support for bridge FDB learning sync

Currently the rocker driver supports an option for disabling syncing
the hardware learned FDBs with the software bridge. This behavior
breaks the bridge offload model and thus it is removed.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: Remove support for bridge bypass ndos from stacked devices
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:22 +0000 (08:44 +0200)]
net: Remove support for bridge bypass ndos from stacked devices

Remove support for bridge bypass ndos from stacked devices. At this point
no driver which supports stack device behavior offload supports operation
with SELF flag. The case for upper device is already taken care of in both
of the following cases:

1. FDB add/del - driver should check at the notification cb if the
                 stacked device contains his ports.

2. Port attribute - calls switchdev code directly which checks
                    for case of stack device.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum: Remove support for bridge bypass FDB add/del
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:21 +0000 (08:44 +0200)]
mlxsw: spectrum: Remove support for bridge bypass FDB add/del

The FDB add/del are now done through the notification chain. The FDBs
are synced with the bridge and there is no need for extra dumping.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum_switchdev: Add support for learning FDB through notification
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:20 +0000 (08:44 +0200)]
mlxsw: spectrum_switchdev: Add support for learning FDB through notification

Add support for learning FDB through notification. The driver defers
the hardware update via ordered work queue. Support for stacked devices
is also provided. In case of a successful FDB add a notification is
sent back to bridge.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agomlxsw: spectrum_switchdev: Change switchdev notifier API
Arkadi Sharshevsky [Thu, 8 Jun 2017 06:44:19 +0000 (08:44 +0200)]
mlxsw: spectrum_switchdev: Change switchdev notifier API

The current API for sending switchdev notifications implies only FDB
add/del. In order to support notification about successful FDB offload
the API is changed.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>