1. 11 Jun, 2016 7 commits
    • David Howells's avatar
      rxrpc: Limit the listening backlog · 0e119b41
      David Howells authored
      Limit the socket incoming call backlog queue size so that a remote client
      can't pump in sufficient new calls that the server runs out of memory.  Note
      that this is partially theoretical at the moment since whilst the number of
      calls is limited, the number of packets trying to set up new calls is not.
      This will be addressed in a later patch.
      
      If the caller of listen() specifies a backlog INT_MAX, then they get the
      current maximum; anything else greater than max_backlog or anything
      negative incurs EINVAL.
      
      The limit on the maximum queue size can be set by:
      
      	echo N >/proc/sys/net/rxrpc/max_backlog
      
      where 4<=N<=32.
      
      Further, set the default backlog to 0, requiring listen() to be called
      before we start actually queueing new calls.  Whilst this kind of is a
      change in the UAPI, the caller can't actually *accept* new calls anyway
      unless they've first called listen() to put the socket into the LISTENING
      state - thus the aforementioned new calls would otherwise just sit there,
      eating up kernel memory.  (Note that sockets that don't have a non-zero
      service ID bound don't get incoming calls anyway.)
      
      Given that the default backlog is now 0, make the AFS filesystem call
      kernel_listen() to set the maximum backlog for itself.
      
      Possible improvements include:
      
       (1) Trimming a too-large backlog to max_backlog when listen is called.
      
       (2) Trimming the backlog value whenever the value is used so that changes
           to max_backlog are applied to an open socket automatically.  Note that
           the AFS filesystem opens one socket and keeps it open for extended
           periods, so would miss out on changes to max_backlog.
      
       (3) Having a separate setting for the AFS filesystem.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e119b41
    • David Howells's avatar
      rxrpc: Trim line-terminal whitespace · bc6e1ea3
      David Howells authored
      Trim line-terminal whitespace in net/rxrpc/
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bc6e1ea3
    • Daniel Borkmann's avatar
      net, cls: allow for deleting all filters for given parent · ea7f8277
      Daniel Borkmann authored
      Add a possibility where the user can just specify the parent and
      all filters under that parent are then being purged. Currently,
      for example for scripting, one needs to specify pref/prio to have
      a well-defined number for 'tc filter del' command for addressing
      the previously created instance or additionally filter handle in
      case of priorities being the same. Improve usage by allowing the
      option for tc to specify the parent and removing the whole chain
      for that given parent.
      
      Example usage after patch, no tc changes required:
      
        # tc qdisc replace dev foo clsact
        # tc filter add dev foo egress bpf da obj ./bpf.o
        # tc filter add dev foo egress bpf da obj ./bpf.o
        # tc filter show dev foo egress
        filter protocol all pref 49151 bpf
        filter protocol all pref 49151 bpf handle 0x1 bpf.o:[classifier] direct-action
        filter protocol all pref 49152 bpf
        filter protocol all pref 49152 bpf handle 0x1 bpf.o:[classifier] direct-action
        # tc filter del dev foo egress
        # tc filter show dev foo egress
        #
      
      Previously, RTM_DELTFILTER requests with invalid prio of 0 were
      rejected, so only netlink requests with RTM_NEWTFILTER and NLM_F_CREATE
      flag were allowed where the kernel would auto-generate a pref/prio.
      We can piggyback on that and use prio of 0 as a wildcard for
      requests of RTM_DELTFILTER.
      
      For notifying tc netlink monitoring users (e.g. libnl uses this
      for caching), there are two options, that is, sending individual
      tfilter_notify() notifications for each tcf_proto, or sending a
      single one indicating wildcard removal. I tried both and there
      are pros and cons for each, eventually I decided for sending
      individual tfilter_notify(), so that user space can support this
      seamlessly and there won't be a mess of changing each and every
      application to make sure expectations from the kernel won't break
      when they don't understand single notification. Since linear chains
      don't really scale, I expect only a handful of classifiers to be
      attached at max for a given parent anyway.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ea7f8277
    • David S. Miller's avatar
      Merge branch 'bpf-fixes' · 92595aea
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      bpf: couple of fixes
      
      These are two fixes for BPF, one to introduce xmit recursion limiter for
      tc bpf programs and the other one to reject filters a bit earlier. For
      more details please see individual patches. I have no strong opinion
      to which tree they should go, they apply to both, but I think net-next
      seems okay to me.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      92595aea
    • Daniel Borkmann's avatar
      bpf: reject wrong sized filters earlier · f7bd9e36
      Daniel Borkmann authored
      Add a bpf_check_basics_ok() and reject filters that are of invalid
      size much earlier, so we don't do any useless work such as invoking
      bpf_prog_alloc(). Currently, rejection happens in bpf_check_classic()
      only, but it's really unnecessarily late and they should be rejected
      at earliest point. While at it, also clean up one bpf_prog_size() to
      make it consistent with the remaining invocations.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7bd9e36
    • Daniel Borkmann's avatar
      bpf: enforce recursion limit on redirects · a70b506e
      Daniel Borkmann authored
      Respect the stack's xmit_recursion limit for calls into dev_queue_xmit().
      Currently, they are not handeled by the limiter when attached to clsact's
      egress parent, for example, and a buggy program redirecting it to the
      same device again could run into stack overflow eventually. It would be
      good if we could notify an admin to give him a chance to react. We reuse
      xmit_recursion instead of having one private to eBPF, so that the stack's
      current recursion depth will be taken into account as well. Follow-up to
      commit 3896d655 ("bpf: introduce bpf_clone_redirect() helper") and
      27b29f63 ("bpf: add bpf_redirect() helper").
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a70b506e
    • William Tu's avatar
      openvswitch: Add packet truncation support. · f2a4d086
      William Tu authored
      The patch adds a new OVS action, OVS_ACTION_ATTR_TRUNC, in order to
      truncate packets. A 'max_len' is added for setting up the maximum
      packet size, and a 'cutlen' field is to record the number of bytes
      to trim the packet when the packet is outputting to a port, or when
      the packet is sent to userspace.
      Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
      Cc: Pravin Shelar <pshelar@nicira.com>
      Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f2a4d086
  2. 10 Jun, 2016 33 commits
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 1578b0a5
      David S. Miller authored
      Conflicts:
      	net/sched/act_police.c
      	net/sched/sch_drr.c
      	net/sched/sch_hfsc.c
      	net/sched/sch_prio.c
      	net/sched/sch_red.c
      	net/sched/sch_tbf.c
      
      In net-next the drop methods of the packet schedulers got removed, so
      the bug fixes to them in 'net' are irrelevant.
      
      A packet action unload crash fix conflicts with the addition of the
      new firstuse timestamp.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1578b0a5
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 698ea54d
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) nfnetlink timestamp taken from wrong skb, fix from Florian Westphal.
      
       2) Revert some msleep conversions in rtlwifi as these spots are in
          atomic context, from Larry Finger.
      
       3) Validate that NFTA_SET_TABLE attribute is actually specified when we
          call nf_tables_getset().  From Phil Turnbull.
      
       4) Don't do mdio_reset in stmmac driver with spinlock held as that can
          sleep, from Vincent Palatin.
      
       5) sk_filter() does things other than run a BPF filter, so we should
          not elide it's call just because sk->sk_filter is NULL.  Fix from
          Eric Dumazet.
      
       6) Fix missing backlog updates in several packet schedulers, from Cong
          Wang.
      
       7) bnx2x driver should allow VLAN add/remove while the interface is
          down, from Michal Schmidt.
      
       8) Several RDS/TCP race fixes from Sowmini Varadhan.
      
       9) fq_codel scheduler doesn't return correct queue length in dumps,
          from Eric Dumazet.
      
      10) Fix TCP stats for tail loss probe and early retransmit in ipv6, from
          Yuchung Cheng.
      
      11) Properly initialize udp_tunnel_socket_cfg in l2tp_tunnel_create(),
          from Guillaume Nault.
      
      12) qfq scheduler leaks SKBs if a kzalloc fails, fix from Florian
          Westphal.
      
      13) sock_fprog passed into PACKET_FANOUT_DATA needs compat handling,
          from Willem de Bruijn.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (85 commits)
        vmxnet3: segCnt can be 1 for LRO packets
        packet: compat support for sock_fprog
        stmmac: fix parameter to dwmac4_set_umac_addr()
        net/mlx5e: Fix blue flame quota logic
        net/mlx5e: Use ndo_stop explicitly at shutdown flow
        net/mlx5: E-Switch, always set mc_promisc for allmulti vports
        net/mlx5: E-Switch, Modify node guid on vf set MAC
        net/mlx5: E-Switch, Fix vport enable flow
        net/mlx5: E-Switch, Use the correct error check on returned pointers
        net/mlx5: E-Switch, Use the correct free() function
        net/mlx5: Fix E-Switch flow steering capabilities check
        net/mlx5: Fix flow steering NIC capabilities check
        net/mlx5: Fix root flow table update
        net/mlx5: Fix MLX5_CMD_OP_MAX to be defined correctly
        net/mlx5: Fix masking of reserved bits in XRCD number
        net/mlx5: Fix the size of modify QP mailbox
        mlxsw: spectrum: Don't sleep during ndo_get_phys_port_name()
        mlxsw: spectrum: Make split flow match firmware requirements
        wext: Fix 32 bit iwpriv compatibility issue with 64 bit Kernel
        cfg80211: remove get/set antenna and tx power warnings
        ...
      698ea54d
    • Linus Torvalds's avatar
      Merge tag 'sound-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 729d3784
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "We have only few, mainly HD-audio device-specific fixes.  Realtek
        codec driver got a slightly more LOC, but they are all for the new
        codec chip, and won't affect others at all"
      
      * tag 'sound-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda - Add PCI ID for Kabylake
        ALSA: hda/realtek: Add T560 docking unit fixup
        ALSA: hda - Fix headset mic detection problem for Dell machine
        ALSA: uapi: Add three missing header files to Kbuild file
        ALSA: hda/realtek - Add support for new codecs ALC700/ALC701/ALC703
        ALSA: hda/realtek - ALC256 speaker noise issue
      729d3784
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.7-rc3' of git://people.freedesktop.org/~airlied/linux · 00da9008
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "This weeks instalment of fixes:
      
        amdgpu:
           Lots of memory leak and firmware leak fixes
      
        nouveau:
           Collection of display fixes, KASAN fixes
      
        vc4:
           vblank/pageflipping fixes
      
        fsl-dcu:
           Regmap cache fix
      
        omap:
           Unused variable warning fix.
      
        Nothing too surprising so far"
      
      * tag 'drm-fixes-for-v4.7-rc3' of git://people.freedesktop.org/~airlied/linux: (46 commits)
        drm/amdgpu: fix warning with powerplay disabled.
        drm/amd/powerplay: delete useless code as pptable changed in vbios.
        drm/amd/powerplay: fix bug visit array out of bounds
        drm/amdgpu: fix smu ucode memleak (v2)
        drm/amdgpu: add release firmware for cgs
        drm/amdgpu: fix tonga smu_fini mem leak
        drm/amdgpu: fix fiji smu fini mem leak
        drm/amdgpu: fix cik sdma ucode memleak
        drm/amdgpu: fix sdma24 ucode mem leak
        drm/amdgpu: fix sdma3 ucode mem leak
        drm/amdgpu: fix uvd fini mem leak
        drm/amdgpu: fix gfx 7 ucode mem leak
        drm/amdgpu: fix gfx8 ucode mem leak
        drm/amdgpu: fix missing free wb for cond_exec
        drm/amdgpu: fix memleak in pptable_init
        drm/amdgpu: fix mem leak in atombios
        drm/amdgpu: fix mem leak in pplib/hwmgr
        drm/amdgpu: fix mem leak in smumgr
        drm/amdgpu: add pipeline sync while vmid switch in same ctx
        drm/amdgpu: vBIOS post only call when mem_size zero
        ...
      00da9008
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · f758bbd4
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "A recently introduced boot regression related to the ACPI EC
        initialization is addressed by restoring the previous behavior (Lv
        Zheng)"
      
      * tag 'acpi-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / EC: Fix a boot EC regresion by restoring boot EC support for the DSDT EC
      f758bbd4
    • Linus Torvalds's avatar
      Merge tag 'pm-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 524a3f2c
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "Stable-candidate fixes for the intel_pstate driver and the cpuidle
        core.
      
        Specifics:
      
         - Fix two intel_pstate initialization issues, one of which was
           introduced during the 4.4 cycle (Srinivas Pandruvada)
      
         - Fix kernel build with CONFIG_UBSAN set and CONFIG_CPU_IDLE unset
           (Catalin Marinas)"
      
      * tag 'pm-4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: intel_pstate: Fix ->set_policy() interface for no_turbo
        cpufreq: intel_pstate: Fix code ordering in intel_pstate_set_policy()
        cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
      524a3f2c
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 9557c3cf
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "7 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED
        mm: introduce dedicated WQ_MEM_RECLAIM workqueue to do lru_add_drain_all
        kernel/relay.c: fix potential memory leak
        mm: thp: broken page count after commit aa88b68c
        revert "mm: memcontrol: fix possible css ref leak on oom"
        kasan: change memory hot-add error messages to info messages
        mm/hugetlb: fix huge page reserve accounting for private mappings
      9557c3cf
    • Shrikrishna Khare's avatar
      vmxnet3: segCnt can be 1 for LRO packets · 50219538
      Shrikrishna Khare authored
      The device emulation may send segCnt of 1 for LRO packets.
      Signed-off-by: default avatarShrikrishna Khare <skhare@vmware.com>
      Signed-off-by: default avatarJin Heo <heoj@vmware.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      50219538
    • Bhaktipriya Shridhar's avatar
      mlxsw: core: Remove deprecated create_workqueue · 3d5479e9
      Bhaktipriya Shridhar authored
      alloc_workqueue replaces deprecated create_workqueue().
      
      A dedicated workqueue has been used since the workqueue
      mlxsw_wq is used for FDB notif. processing with workitems that are
      involved in normal device operation && because it's a network device
      which can be depended upon during memory reclaim.
      
      Workitems &trans->timeout_dw and &mlxsw_sp->fdb_notify.dw,
      map to mlxsw_sp_fdb_notify_work (processes FDB notifications from the
      underlying device and resolves the netdev to which the entry points to
      and notifies the bridge using the switchdev notifier) and
      mlxsw_emad_trans_timeout_work (provides async EMAD register access)
      respectively. They require forward progress under memory pressure and
      hence, WQ_MEM_RECLAIM has been set.
      
      Since there are only a fixed number of work items, explicit concurrency
      limit is unnecessary here.
      Signed-off-by: default avatarBhaktipriya Shridhar <bhaktipriya96@gmail.com>
      Tested-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d5479e9
    • Bhaktipriya Shridhar's avatar
      net: cavium: liquidio: Remove deprecated create_workqueue · 292b9dab
      Bhaktipriya Shridhar authored
      alloc_workqueue replaces deprecated create_workqueue().
      
      A dedicated workqueue has been used since the workitem viz
      (&lio->txq_status_wq.wk.work which maps to octnet_poll_check_txq_status)
      is involved in a brief poll routine for checking transmit queue status
      and is an intergral part of normal device operation.
      WQ_MEM_RECLAIM has been set to guarantee forward progress under memory
      pressure, which is a requirement here.
      Since there are only a fixed number of work items, explicit concurrency
      limit is unnecessary.
      
      flush_workqueue is unnecessary since destroy_workqueue() itself calls
      drain_workqueue() which flushes repeatedly till the workqueue
      becomes empty.
      Signed-off-by: default avatarBhaktipriya Shridhar <bhaktipriya96@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      292b9dab
    • Willem de Bruijn's avatar
      packet: compat support for sock_fprog · 719c44d3
      Willem de Bruijn authored
      Socket option PACKET_FANOUT_DATA takes a struct sock_fprog as argument
      if PACKET_FANOUT has mode PACKET_FANOUT_CBPF. This structure contains
      a pointer into user memory. If userland is 32-bit and kernel is 64-bit
      the two disagree about the layout of struct sock_fprog.
      
      Add compat setsockopt support to convert a 32-bit compat_sock_fprog to
      a 64-bit sock_fprog. This is analogous to compat_sock_fprog support for
      SO_REUSEPORT added in commit 19575988 ("soreuseport: add compat
      case for setsockopt SO_ATTACH_REUSEPORT_CBPF").
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      719c44d3
    • Eric Dumazet's avatar
      net/mlx4_en: fix ethtool -x · f7d3c1cb
      Eric Dumazet authored
      mlx4 RSS is limited to spread incoming packets to a power of two number
      of queues.
      
      An uniformly distibuted traffic would be split on queues 0 to N-1, N
      being a power of two, each queue having a 1/N weight.
      
      If number of RX queues is not a power of two, upper RX queues do not
      receive traffic.
      
      ethtool -x is lying, because it pretends some queues have higher weight.
      
      Before patch:
      
      lpaa24:~# ethtool -L eth1 rx 24
      lpaa24:~# ethtool -x eth1
      RX flow hash indirection table for eth1 with 24 RX ring(s):
          0:      0     1     2     3     4     5     6     7
          8:      8     9    10    11    12    13    14    15
         16:      0     1     2     3     4     5     6     7
      RSS hash key:
      e0:7c:3a:89:07:55:b6:58:69:cc:f4:e5:24:62:e3:25:88:6c:42:5b:d2:cb:9a:d2:e0:06:e1:dc:f9:09:a1:89:0f:a0:30:43:73:6f:0c:b6
      
      If this information was correct, user space tools could expect queues 0
      to 7 to receive twice more traffic than queues 8 to 15
      
      After patch :
      
      lpaa24:~# ethtool -L eth1 rx 24
      lpaa24:~# ethtool -x eth1
      RX flow hash indirection table for eth1 with 24 RX ring(s):
          0:      0     1     2     3     4     5     6     7
          8:      8     9    10    11    12    13    14    15
      RSS hash key:
      da:7b:09:60:f1:ac:67:b4:d0:72:d4:ec:a2:e5:80:0a:ad:50:22:1a:f8:f9:66:54:5f:22:45:c3:88:f4:57:82:c1:c1:90:ed:70:cb:40:ce
      lpaa24:~# ethtool -X eth1 equal 8
      lpaa24:~# ethtool -x eth1
      RX flow hash indirection table for eth1 with 24 RX ring(s):
          0:      0     1     2     3     4     5     6     7
          8:      0     1     2     3     4     5     6     7
      RSS hash key:
      da:7b:09:60:f1:ac:67:b4:d0:72:d4:ec:a2:e5:80:0a:ad:50:22:1a:f8:f9:66:54:5f:22:45:c3:88:f4:57:82:c1:c1:90:ed:70:cb:40:ce
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarMaciej Żenczykowski <maze@google.com>
      Cc: Eugenia Emantayev <eugenia@mellanox.com>
      Cc: Wei Wang <weiwan@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f7d3c1cb
    • Ben Dooks's avatar
      stmmac: fix parameter to dwmac4_set_umac_addr() · ca8bdaf1
      Ben Dooks authored
      The dwmac4_set_umac_addr() takes a struct mac_device_info as
      the first parameter, but is being passed a ioaddr instead from
      dwmac4_set_filter(). Fix the warning/bug by changing the first
      parameter.
      
      drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:159:46: warning: incorrect type in argument 1 (different address spaces)
      drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:159:46:    expected struct mac_device_info *hw
      drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:159:46:    got void [noderef] <asn:2>*ioaddr
      
      Note, only compile tested this as do not have any
      hardware with it in.
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca8bdaf1
    • hayeswang's avatar
      r8152: replace netdev_alloc_skb_ip_align with napi_alloc_skb · c8d83963
      hayeswang authored
      Replace netdev_alloc_skb_ip_align() with napi_alloc_skb() which can save
      several CPU cycles by avoiding having to disable and re-enable IRQs.
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c8d83963
    • David S. Miller's avatar
      Merge branch 'bgmac-stats' · cef8a464
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: bgmac: Misc improvements
      
      This patch series add minor changes to the bgmac driver:
      
      - properly bind net_device with its backing device structure such that
        we can locate the device using common helper functions
      
      - add support for ethtool statistics reading the HW MIB counters which
        is useful for debugging
      
      - add netdev statistics throughout the TX/RX path to know what is going on
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cef8a464
    • Florian Fainelli's avatar
      bgmac: Maintain some netdev statistics · 6d490f62
      Florian Fainelli authored
      Add a few netdev statistics to report transmitted and received bytes and
      packets and a few obvious errors.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d490f62
    • Florian Fainelli's avatar
      bgmac: Add support for ethtool statistics · f6613d4f
      Florian Fainelli authored
      Read the statistics from the BGMAC's builtin MAC and return them to
      user-space using the standard ethtool helpers.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6613d4f
    • Florian Fainelli's avatar
      bgmac: Bind net_device with backing device structure · 2022e9d5
      Florian Fainelli authored
      In preparation for allowing different helpers to be utilized against
      network devices created by the bgmac driver, make sure that we bind the
      net_device with core->dev.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2022e9d5
    • Aaron Conole's avatar
      virtio_net: Update the feature bit to comply with spec · 7d84e37e
      Aaron Conole authored
      A draft version of the MTU Advice feature bit was specified as 25.  This
      bit is not within the allowed range for network device feature bits, and
      should be changed to be feature bit 3 to fully comply with the spec.
      
      Fixes 14de9d11 ('virtio-net: Add initial MTU advice feature')
      Signed-off-by: default avatarAaron Conole <aconole@redhat.com>
      Suggested-by: default avatar"Michael S. Tsirkin" <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d84e37e
    • David Ahern's avatar
      net: vrf: Fix crash when IPv6 is disabled at boot time · e4348637
      David Ahern authored
      Frank Kellermann reported a kernel crash with 4.5.0 when IPv6 is
      disabled at boot using the kernel option ipv6.disable=1. Using
      current net-next with the boot option:
      
      $ ip link add red type vrf table 1001
      
      Generates:
      [12210.919584] BUG: unable to handle kernel NULL pointer dereference at 0000000000000748
      [12210.921341] IP: [<ffffffff814b30e3>] fib6_get_table+0x2c/0x5a
      [12210.922537] PGD b79e3067 PUD bb32b067 PMD 0
      [12210.923479] Oops: 0000 [#1] SMP
      [12210.924001] Modules linked in: ipvlan 8021q garp mrp stp llc
      [12210.925130] CPU: 3 PID: 1177 Comm: ip Not tainted 4.7.0-rc1+ #235
      [12210.926168] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
      [12210.928065] task: ffff8800b9ac4640 ti: ffff8800bacac000 task.ti: ffff8800bacac000
      [12210.929328] RIP: 0010:[<ffffffff814b30e3>]  [<ffffffff814b30e3>] fib6_get_table+0x2c/0x5a
      [12210.930697] RSP: 0018:ffff8800bacaf888  EFLAGS: 00010202
      [12210.931563] RAX: 0000000000000748 RBX: ffffffff81a9e280 RCX: ffff8800b9ac4e28
      [12210.932688] RDX: 00000000000000e9 RSI: 0000000000000002 RDI: 0000000000000286
      [12210.933820] RBP: ffff8800bacaf898 R08: ffff8800b9ac4df0 R09: 000000000052001b
      [12210.934941] R10: 00000000657c0000 R11: 000000000000c649 R12: 00000000000003e9
      [12210.936032] R13: 00000000000003e9 R14: ffff8800bace7800 R15: ffff8800bb3ec000
      [12210.937103] FS:  00007faa1766c700(0000) GS:ffff88013ac00000(0000) knlGS:0000000000000000
      [12210.938321] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [12210.939166] CR2: 0000000000000748 CR3: 00000000b79d6000 CR4: 00000000000406e0
      [12210.940278] Stack:
      [12210.940603]  ffff8800bb3ec000 ffffffff81a9e280 ffff8800bacaf8c8 ffffffff814b3135
      [12210.941818]  ffff8800bb3ec000 ffffffff81a9e280 ffffffff81a9e280 ffff8800bace7800
      [12210.943040]  ffff8800bacaf8f0 ffffffff81397c88 ffff8800bb3ec000 ffffffff81a9e280
      [12210.944288] Call Trace:
      [12210.944688]  [<ffffffff814b3135>] fib6_new_table+0x24/0x8a
      [12210.945516]  [<ffffffff81397c88>] vrf_dev_init+0xd4/0x162
      [12210.946328]  [<ffffffff814091e1>] register_netdevice+0x100/0x396
      [12210.947209]  [<ffffffff8139823d>] vrf_newlink+0x40/0xb3
      [12210.948001]  [<ffffffff814187f0>] rtnl_newlink+0x5d3/0x6d5
      ...
      
      The problem above is due to the fact that the fib hash table is not
      allocated when IPv6 is disabled at boot.
      
      As for the VRF driver it should not do any IPv6 initializations if IPv6
      is disabled, so it needs to know if IPv6 is disabled at boot. The disable
      parameter is private to the IPv6 module, so provide an accessor for
      modules to determine if IPv6 was disabled at boot time.
      
      Fixes: 35402e31 ("net: Add IPv6 support to VRF device")
      Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e4348637
    • David Howells's avatar
      rxrpc: Simplify connect() implementation and simplify sendmsg() op · 2341e077
      David Howells authored
      Simplify the RxRPC connect() implementation.  It will just note the
      destination address it is given, and if a sendmsg() comes along with no
      address, this will be assigned as the address.  No transport struct will be
      held internally, which will allow us to remove this later.
      
      Simplify sendmsg() also.  Whilst a call is active, userspace refers to it
      by a private unique user ID specified in a control message.  When sendmsg()
      sees a user ID that doesn't map to an extant call, it creates a new call
      for that user ID and attempts to add it.  If, when we try to add it, the
      user ID is now registered, we now reject the message with -EEXIST.  We
      should never see this situation unless two threads are racing, trying to
      create a call with the same ID - which would be an error.
      
      It also isn't required to provide sendmsg() with an address - provided the
      control message data holds a user ID that maps to a currently active call.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2341e077
    • Fabien Siron's avatar
    • Eric Dumazet's avatar
      net/mlx4_en: mlx4_en_netpoll() should schedule TX, not RX · 7d71e994
      Eric Dumazet authored
      I am not sure mlx4_en_netpoll() is doing anything useful right now.
      
      mlx4 has different NAPI structures for RX and TX, and netpoll only wants
      to drain TX queues.
      
      Lets schedule NAPI polls on TX, not RX.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Maciej Żenczykowski <maze@google.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d71e994
    • David S. Miller's avatar
      Merge branch 'BCM53xx-driver' · 23c731e8
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: dsa: Broadcom BCM53xx switches support
      
      This patch series adds support for the Broadcom BCM53xx series aka RoboSwitches.
      
      This driver is largely based on Jonas Gorski's b53 driver for OpenWrt which can
      be found here:
      
      https://dev.openwrt.org/browser/trunk/target/linux/generic/files/drivers/net/phy/b53
      
      a few bug fixes and DSA-ifycation later, here is what we got.
      
      This has been successfully tested in the following configurations:
      
      - Broadcom BCM53011 using the SRAB bus layer with 4 ports LAN, 1 port WAN
      
      - A Broadcom BCM7445 device with an internal Starfighter 2 switch (bcm_sf2.c)
        and a Broadcom BCM53125 hanging off one of its ports connected via MDIO, creating
        two trees hanging off each other, and this works!
      
      - A Broadcom BCM53125 MDIO connected to a Lamobo/Bananapi R1 board using the STMMAC
        MDIO driver
      
      For now, we do not enable Broadcom tags, because there are different
      generations of switches being supported which have different tag formats, but
      the plan is to enable them later on.
      
      Support for different HW features will be added later: EEE, Compact Field
      Processor (TCAM) once this initial cut gets accepted.
      
      Testing and bug reports welcome!
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      23c731e8
    • Florian Fainelli's avatar
      net: dsa: b53: Plug in VLAN support · a2482d2c
      Florian Fainelli authored
      Add support for configuration VLANs on B53 devices by implementing the
      port VLAN add/del/dump functions. We currently default to a behavior
      which is equivalent to having VLAN filtering turned on, where all VLANs
      not programmed into the VLAN port-based vector will be discarded on
      ingress.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a2482d2c
    • Florian Fainelli's avatar
      net: dsa: b53: Add bridge support · ff39c2d6
      Florian Fainelli authored
      Add support for HW bridging by tying the ports together in the same port
      VLAN mask when they belong to the same bridge, and isolating them to be
      alone with the CPU port when they are not.
      
      Propagate STP states from the bridge layer to the switch's HW mapping
      when requested.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff39c2d6
    • Florian Fainelli's avatar
      net: dsa: b53: Implement ARL add/del/dump operations · 1da6df85
      Florian Fainelli authored
      Adds support for FDB add/delete/dump using the ARL read/write logic and
      the ARL search logic for faster dumps. The code is made flexible enough
      it could support devices with a different register layout like BCM5325
      and BCM5365 which have fewer number of entries or pack values into a
      single 64 bits register.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1da6df85
    • Florian Fainelli's avatar
      net: dsa: b53: Add BCM7445 quirk · 0830c980
      Florian Fainelli authored
      The Broadcom BCM7445 STB chip has an issued in its revision D0 which was
      previously worked around in drivers/net/dsa/bcm_sf2.c where we may
      end-up double programming the integrated BCM7445 switch (bcm_sf2) and an
      external Broadcom switch such as BCM53125, since these are mostly
      register compatible.
      
      Add a small quirk which just defers probing until we are sitting on the
      slave DSA MDIO bus, which will allow us to intercept reads/writes and
      funnel them through the SF2 internal MDIO master (which happens to
      disconnect its pseudo PHY).
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0830c980
    • Florian Fainelli's avatar
      net: dsa: b53: Add support for Broadcom RoboSwitch · 967dd82f
      Florian Fainelli authored
      This patch adds support for Broadcom's BCM53xx switch family, also known
      as RoboSwitch. Some of these switches are ubiquituous, found in home
      routers, Wi-Fi routers, DSL and cable modem gateways and other
      networking related products.
      
      This drivers adds the library driver (b53_common.c) as well as a few bus
      glue drivers for MDIO, SPI, Switch Register Access Block (SRAB) and
      memory-mapped I/O into a SoC's address space (Broadcom BCM63xx/33xx).
      
      Basic operations are supported to bring the Layer 1/2 up and running,
      but not much more at this point, subsequent patches add the remaining
      features.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      967dd82f
    • David S. Miller's avatar
      Merge branch 'bcm_sf2-vlan' · 409a5f27
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: dsa: bcm_sf2: add VLAN support
      
      This is long overdue, finally add support for VLANs in the Broadcom Starfigther
      2 switch driver.
      
      There are a few things that make us differ from e.g; mv88e6xxx.c:
      
      - we keep a software cache of which VLANs are enabled and which are not to
        dramatically speed up the VLAN dump operation, we do not have any HW operation
        which would only return the list of valid VLAN entries, they would have to be
        all queried one by one, with 4K vlans, this takes a while
      
      - the default behavior is equivalent to setting VLAN filtering to 1, still working
        on implementing a proper port_vlan_filtering callback, but I figured the most
        conservative behavior is probably okay anyway
      
      - without enabling VLANs, the default behavior is to receive any 802.1q frames
        (per the DSA documentation), however, once we start enabling VLAN support, if
        an interface leaves the bridge, we still want it to receive all 802.1q frames
        so we utiliez the "Join all VLAN" feature of the switch to perform that
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      409a5f27
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Add VLAN support · 9c57a771
      Florian Fainelli authored
      Add support for configuring VLANs on the Broadcom Starfigther2 switch.
      This is all done through the bridge vlan facility just like other DSA
      drivers.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c57a771
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Add VLAN registers definitions · 064523ff
      Florian Fainelli authored
      Add the definitions for the VLAN registers that we are going to
      manipulate in subsequent patches.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      064523ff
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Move setup function at the far end · 7fbb1a92
      Florian Fainelli authored
      Re-order the bcm_sf2_sw_setup() function so that it is at the far end of
      the driver to avoid any kind of forward declarations.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7fbb1a92