1. 09 May, 2015 40 commits
    • Harini Katakam's avatar
      net: macb: Add change_mtu callback with jumbo support · a5898ea0
      Harini Katakam authored
      Add macb_change_mtu callback; if jumbo frame support is present allow
      mtu size changes upto (jumbo max length allowed - headers).
      Signed-off-by: default avatarHarini Katakam <harinik@xilinx.com>
      Reviewed-by: default avatarPunnaiah Choudary Kalluri <punnaia@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5898ea0
    • Harini Katakam's avatar
      net: macb: Add support for jumbo frames · 98b5a0f4
      Harini Katakam authored
      Enable jumbo frame support for Zynq Ultrascale+ MPSoC.
      Update the NWCFG register and descriptor length masks accordingly.
      Jumbo max length register should be set according to support in SoC; it is
      set to 10240 for Zynq Ultrascale+ MPSoC.
      Signed-off-by: default avatarHarini Katakam <harinik@xilinx.com>
      Reviewed-by: default avatarPunnaiah Choudary Kalluri <punnaia@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      98b5a0f4
    • Harini Katakam's avatar
      net: macb: Add compatible string for Zynq Ultrascale+ MPSoC · 7b61f9c1
      Harini Katakam authored
      Add compatible string and config structure for Zynq Ultrascale+ MPSoC
      Signed-off-by: default avatarHarini Katakam <harinik@xilinx.com>
      Reviewed-by: default avatarPunnaiah Choudary Kalluri <punnaia@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7b61f9c1
    • Harini Katakam's avatar
      devicetree: Add compatible string for Zynq Ultrascale+ MPSoC · 988d6f07
      Harini Katakam authored
      Add "cdns,zynqmp-gem" to be used for Zynq Ultrascale+ MPSoC.
      Signed-off-by: default avatarHarini Katakam <harinik@xilinx.com>
      Reviewed-by: default avatarPunnaiah Choudary Kalluri <punnaia@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      988d6f07
    • Jason Baron's avatar
      tcp: set SOCK_NOSPACE under memory pressure · 790ba456
      Jason Baron authored
      Under tcp memory pressure, calling epoll_wait() in edge triggered
      mode after -EAGAIN, can result in an indefinite hang in epoll_wait(),
      even when there is sufficient memory available to continue making
      progress. The problem is that when __sk_mem_schedule() returns 0
      under memory pressure, we do not set the SOCK_NOSPACE flag in the
      tcp write paths (tcp_sendmsg() or do_tcp_sendpages()). Then, since
      SOCK_NOSPACE is used to trigger wakeups when incoming acks create
      sufficient new space in the write queue, all outstanding packets
      are acked, but we never wake up with the the EPOLLOUT that we are
      expecting from epoll_wait().
      
      This issue is currently limited to epoll() when used in edge trigger
      mode, since 'tcp_poll()', does in fact currently set SOCK_NOSPACE.
      This is sufficient for poll()/select() and epoll() in level trigger
      mode. However, in edge trigger mode, epoll() is relying on the write
      path to set SOCK_NOSPACE. EPOLL(7) says that in edge-trigger mode we
      can only call epoll_wait() after read/write return -EAGAIN. Thus, in
      the case of the socket write, we are relying on the fact that
      tcp_sendmsg()/network write paths are going to issue a wakeup for
      us at some point in the future when we get -EAGAIN.
      
      Normally, epoll() edge trigger works fine when we've exceeded the
      sk->sndbuf because in that case we do set SOCK_NOSPACE. However, when
      we return -EAGAIN from the write path b/c we are over the tcp memory
      limits and not b/c we are over the sndbuf, we are never going to get
      another wakeup.
      
      I can reproduce this issue, using SO_SNDBUF, since __sk_mem_schedule()
      will return 0, or failure more readily with SO_SNDBUF:
      
      1) create socket and set SO_SNDBUF to N
      2) add socket as edge trigger
      3) write to socket and block in epoll on -EAGAIN
      4) cause tcp mem pressure via: echo "<small val>" > net.ipv4.tcp_mem
      
      The fix here is simply to set SOCK_NOSPACE in sk_stream_wait_memory()
      when the socket is non-blocking. Note that SOCK_NOSPACE, in addition
      to waking up outstanding waiters is also used to expand the size of
      the sk->sndbuf. However, we will not expand it by setting it in this
      case because tcp_should_expand_sndbuf(), ensures that no expansion
      occurs when we are under tcp memory pressure.
      
      Note that we could still hang if sk->sk_wmem_queue is 0, when we get
      the -EAGAIN. In this case the SOCK_NOSPACE bit will not help, since we
      are waiting for and event that will never happen. I believe
      that this case is harder to hit (and did not hit in my testing),
      in that over the tcp 'soft' memory limits, we continue to guarantee a
      minimum write buffer size. Perhaps, we could return -ENOSPC in this
      case, or maybe we simply issue a wakeup in this case, such that we
      keep retrying the write. Note that this case is not specific to
      epoll() ET, but rather would affect blocking sockets as well. So I
      view this patch as bringing epoll() edge-trigger into sync with the
      current poll()/select()/epoll() level trigger and blocking sockets
      behavior.
      Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      790ba456
    • Claudiu Manoil's avatar
      gianfar: Enable changing mac addr when if up · 3d23a05c
      Claudiu Manoil authored
      Use device flag IFF_LIVE_ADDR_CHANGE to signal that
      the device supports changing the hardware address when
      the device is running.
      This allows eth_mac_addr() to change the mac address
      also when the network device's interface is open.
      This capability is required by certain applications,
      like bonding mode 6 (Adaptive Load Balancing).
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d23a05c
    • Claudiu Manoil's avatar
      gianfar: Move TxFIFO underrun handling to reset path · bc602280
      Claudiu Manoil authored
      Handle TxFIFO underrun exceptions outside the fast path.
      A controller reset is more reliable in this exceptional
      case, as opposed to re-enabling on-the-fly the Tx DMA.
      
      As the controller reset is handled outside the fast path
      by the reset_gfar() workqueue handler, the locking
      scheme on the Tx path is significantly simplified.
      Because the Tx processing (xmit queues and tx napi) is
      disabled during controller reset, tstat access from xmit
      does not require locking.  So the scope of the txlock on
      the processing path is now reduced to num_txbdfree, which
      is shared only between process context (xmit) and softirq
      (clean_tx_ring).  As a result, the txlock must not guard
      against interrupt context, and the spin_lock_irqsave()
      from xmit can be replaced by spin_lock_bh().  Likewise,
      the locking has been downgraded for clean_tx_ring().
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bc602280
    • David S. Miller's avatar
      Merge branch 'bpf_seccomp' · 39d726b7
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      BPF updates
      
      This set gets rid of BPF special handling in seccomp filter preparation
      and provides generic infrastructure from BPF side, which eventually also
      allows for classic BPF JITs to add support for seccomp filters.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      39d726b7
    • Daniel Borkmann's avatar
      seccomp, filter: add and use bpf_prog_create_from_user from seccomp · ac67eb2c
      Daniel Borkmann authored
      Seccomp has always been a special candidate when it comes to preparation
      of its filters in seccomp_prepare_filter(). Due to the extra checks and
      filter rewrite it partially duplicates code and has BPF internals exposed.
      
      This patch adds a generic API inside the BPF code code that seccomp can use
      and thus keep it's filter preparation code minimal and better maintainable.
      The other side-effect is that now classic JITs can add seccomp support as
      well by only providing a BPF_LDX | BPF_W | BPF_ABS translation.
      
      Tested with seccomp and BPF test suites.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Nicolas Schichan <nschichan@freebox.fr>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Kees Cook <keescook@chromium.org>
      Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ac67eb2c
    • Daniel Borkmann's avatar
      net: filter: add __GFP_NOWARN flag for larger kmem allocs · 658da937
      Daniel Borkmann authored
      When seccomp BPF was added, it was discussed to add __GFP_NOWARN
      flag for their configuration path as f.e. up to 32K allocations are
      more prone to fail under stress. As we're going to reuse BPF API,
      add __GFP_NOWARN flags where larger kmalloc() and friends allocations
      could fail.
      
      It doesn't make much sense to pass around __GFP_NOWARN everywhere as
      an extra argument only for seccomp while we just as well could run
      into similar issues for socket filters, where it's not desired to
      have a user application throw a WARN() due to allocation failure.
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Nicolas Schichan <nschichan@freebox.fr>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Kees Cook <keescook@chromium.org>
      Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      658da937
    • Nicolas Schichan's avatar
      seccomp: simplify seccomp_prepare_filter and reuse bpf_prepare_filter · d9e12f42
      Nicolas Schichan authored
      Remove the calls to bpf_check_classic(), bpf_convert_filter() and
      bpf_migrate_runtime() and let bpf_prepare_filter() take care of that
      instead.
      
      seccomp_check_filter() is passed to bpf_prepare_filter() so that it
      gets called from there, after bpf_check_classic().
      
      We can now remove exposure of two internal classic BPF functions
      previously used by seccomp. The export of bpf_check_classic() symbol,
      previously known as sk_chk_filter(), was there since pre git times,
      and no in-tree module was using it, therefore remove it.
      
      Joint work with Daniel Borkmann.
      Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Kees Cook <keescook@chromium.org>
      Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9e12f42
    • Nicolas Schichan's avatar
      net: filter: add a callback to allow classic post-verifier transformations · 4ae92bc7
      Nicolas Schichan authored
      This is in preparation for use by the seccomp code, the rationale is
      not to duplicate additional code within the seccomp layer, but instead,
      have it abstracted and hidden within the classic BPF API.
      
      As an interim step, this now also makes bpf_prepare_filter() visible
      (not as exported symbol though), so that seccomp can reuse that code
      path instead of reimplementing it.
      
      Joint work with Daniel Borkmann.
      Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Kees Cook <keescook@chromium.org>
      Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ae92bc7
    • David S. Miller's avatar
      Merge tag 'mac80211-next-for-davem-2015-05-06' of... · 0e00a0f7
      David S. Miller authored
      Merge tag 'mac80211-next-for-davem-2015-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
      
      Johannes Berg says:
      
      ====================
      Lots of updates for net-next for this cycle. As usual, we have
      a lot of small fixes and cleanups, the bigger items are:
       * proper mac80211 rate control locking, to fix some random crashes
         (this required changing other locking as well)
       * mac80211 "fast-xmit", a mechanism to reduce, in most cases, the
         amount of code we execute while going from ndo_start_xmit() to
         the driver
       * this also clears the way for properly supporting S/G and checksum
         and segmentation offloads
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e00a0f7
    • David S. Miller's avatar
      Merge branch 'tcp-more-reliable-window-probes' · 82ae9c60
      David S. Miller authored
      Eric Dumazet says:
      
      ====================
      tcp: more reliable window probes
      
      This series address a problem caused by small rto_min timers in DC,
      leading to either timer storms or early flow terminations.
      
      We also add two new SNMP counters for proper monitoring :
      TCPWinProbe and TCPKeepAlive
      
      v2: added TCPKeepAlive counter, as suggested by Yuchung & Neal
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82ae9c60
    • Eric Dumazet's avatar
      tcp: add TCPWinProbe and TCPKeepAlive SNMP counters · e520af48
      Eric Dumazet authored
      Diagnosing problems related to Window Probes has been hard because
      we lack a counter.
      
      TCPWinProbe counts the number of ACK packets a sender has to send
      at regular intervals to make sure a reverse ACK packet opening back
      a window had not been lost.
      
      TCPKeepAlive counts the number of ACK packets sent to keep TCP
      flows alive (SO_KEEPALIVE)
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Acked-by: default avatarNandita Dukkipati <nanditad@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e520af48
    • Eric Dumazet's avatar
      tcp: adjust window probe timers to safer values · 21c8fe99
      Eric Dumazet authored
      With the advent of small rto timers in datacenter TCP,
      (ip route ... rto_min x), the following can happen :
      
      1) Qdisc is full, transmit fails.
      
         TCP sets a timer based on icsk_rto to retry the transmit, without
         exponential backoff.
         With low icsk_rto, and lot of sockets, all cpus are servicing timer
         interrupts like crazy.
         Intent of the code was to retry with a timer between 200 (TCP_RTO_MIN)
         and 500ms (TCP_RESOURCE_PROBE_INTERVAL)
      
      2) Receivers can send zero windows if they don't drain their receive queue.
      
         TCP sends zero window probes, based on icsk_rto current value, with
         exponential backoff.
         With /proc/sys/net/ipv4/tcp_retries2 being 15 (or even smaller in
         some cases), sender can abort in less than one or two minutes !
         If receiver stops the sender, it obviously doesn't care of very tight
         rto. Probability of dropping the ACK reopening the window is not
         worth the risk.
      
      Lets change the base timer to be at least 200ms (TCP_RTO_MIN) for these
      events (but not normal RTO based retransmits)
      
      A followup patch adds a new SNMP counter, as it would have helped a lot
      diagnosing this issue.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      21c8fe99
    • Richard Alpe's avatar
      tipc: send explicit not supported error in nl compat · b063bc5e
      Richard Alpe authored
      The legacy netlink API treated EPERM (permission denied) as
      "operation not supported".
      Reported-by: default avatarTomi Ollila <tomi.ollila@iki.fi>
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b063bc5e
    • Richard Alpe's avatar
      tipc: add broadcast link window set/get to nl api · 670f4f88
      Richard Alpe authored
      Add the ability to get or set the broadcast link window through the
      new netlink API. The functionality was unintentionally missing from
      the new netlink API. Adding this means that we also fix the breakage
      in the old API when coming through the compat layer.
      
      Fixes: 37e2d484 (tipc: convert legacy nl link prop set to nl compat)
      Reported-by: default avatarTomi Ollila <tomi.ollila@iki.fi>
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      670f4f88
    • Richard Alpe's avatar
      tipc: fix default link prop regression in nl compat · c3d6fb85
      Richard Alpe authored
      Default link properties can be set for media or bearer. This
      functionality was missed when introducing the NL compatibility layer.
      
      This patch implements this functionality in the compat netlink
      layer. It works the same way as it did in the old API. We search for
      media and bearers matching the "link name". If we find a matching
      media or bearer the link tolerance, priority or window is used as
      default for new links on that media or bearer.
      
      Fixes: 37e2d484 (tipc: convert legacy nl link prop set to nl compat)
      Reported-by: default avatarTomi Ollila <tomi.ollila@iki.fi>
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c3d6fb85
    • Hariprasad Shenai's avatar
      cxgb4: Initialize RSS mode for all Ports · c035e183
      Hariprasad Shenai authored
      Implements t4_init_rss_mode() to initialize the rss_mode for all the ports. If
      Tunnel All Lookup isn't specified in the global RSS Configuration, then we need
      to specify a default Ingress Queue for any ingress packets which aren't hashed.
      We'll use our first ingress queue.
      Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c035e183
    • David S. Miller's avatar
      Merge branch 'be2net' · b2a6c326
      David S. Miller authored
      Sathya Perla says:
      
      ====================
      be2net: patch-set
      
      The following patch-set has two new feature additions, and a few
      minor fixes and cleanups.
      Pls consider applying to the net-next tree. Thanks.
      
      v2 changes:
              a) dropped the "don't enable pause by default" patch
              b) described how the "spoof check" works in patch 1's commit log
      	c) I had to update our email addresses from "@emulex" to
      	   "@avagotech". I'll send a separate patch updating the
      	   maintainers
      
      Patch 1 adds support for the "spoofchk" knob for VFs.
      When it is enabled, "spoof checking" is done for both MAC-address
      and VLAN. For each VF, the HW ensures that the source MAC address
      (or vlan) of every outgoing packet of the VF exists in the MAC-list
      (or vlan-list) configured for RX filtering for that VF.
      If not, the packet is dropped and an error is reported to the driver
      in the TX completion.
      
      Patch 2 improves interrupt moderation on Skyhawk-R chip by using
      the EQ-DB mechanism to set a "re-arm to interrupt" delay. Currently
      interrupt moderation is adjusted by calculating and configuring an
      EQ-delay every second. This is done via a FW-cmd. This patch uses
      the EQ_DB facility to calculate and set the interrupt delay every 1ms.
      This helps moderating interrupts better when the traffic is bursty.
      
      Patch 3 adds L3/L4 error accounting to BE3 VFs, by passing L3/4 error
      packets to the network stack.
      
      Patch 4 adds an extra FW-cmd error value check in the driver to identify
      an "out of vlan filters" scenario.
      
      Patch 5 stops enabling pause by default as this setting fails in
      some HW-configs where priority pause is enabled in FW. If the user
      tries to do the same, an appropriate error is returned via ethtool.
      
      Patch 5 posts the full RXQ in be_open() to prevent packet drops due to
      bursty traffic when the interface is enabled.
      
      Patch 6 refactors the be_check_ufi_compatibility() routine, that checks
      to see if a UFI file meant for a lower rev of a chip is being flashed
      on a higher rev, to make it simpler.
      
      Patch 7 replaces the usage of !be_physfn() macro with be_virtfn()
      that is already avialble in the driver.
      
      Patch 8 updates the year in the copyright text to 2015.
      
      Path 9 bumps up the driver version to 10.6.02.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b2a6c326
    • Sathya Perla's avatar
    • Vasundhara Volam's avatar
    • Kalesh AP's avatar
      be2net: use be_virtfn() instead of !be_physfn() · 18c57c74
      Kalesh AP authored
      Use be_virtfn() to determine a VF instead of !be_physfn() for better
      readability.
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18c57c74
    • Vasundhara Volam's avatar
      be2net: simplify UFI compatibility checking · a6e6ff6e
      Vasundhara Volam authored
      The code in be_check_ufi_compatibility() checks to see if a UFI file meant
      for a lower rev of a chip is being flashed on a higher rev, which is
      disallowed. This patch re-writes the code needed for this check in a much
      simpler manner.
      Signed-off-by: default avatarVasundhara Volam <vasundhara.volam@avagotech.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6e6ff6e
    • Suresh Reddy's avatar
      be2net: post full RXQ on interface enable · b02e60c8
      Suresh Reddy authored
      When an RXQ is created in be_open(), the driver currently posts only
      64 buffers. This sometimes results in packet drops when there is a traffic
      burst as soon as the interface is enabled.
      This patch fixes this problem by posting the full RXQ on interface enable.
      Signed-off-by: default avatarSuresh Reddy <Suresh.Reddy@avagotech.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b02e60c8
    • Kalesh AP's avatar
      be2net: check for INSUFFICIENT_VLANS error · 77be8c1c
      Kalesh AP authored
      When the FW runs out of vlan filters it can either return an
      INSUFFICIENT_RESOURCES error or an INSUFFICIENT_VLANS error.
      The driver currently checks only for the former error value.
      This patch adds a check for the latter value too.
      Signed-off-by: default avatarKalesh AP <kalesh.purayil@emulex.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      77be8c1c
    • Somnath Kotur's avatar
      be2net: receive pkts with L3, L4 errors on VFs · 0ed7d749
      Somnath Kotur authored
      Currently pkts with L3 or L4 errors received on PFs are not dropped
      by the adapter, but instead sent to the stack. This helps the network stack
      to better reflect error statistics. This was not being done on BE3 VFs.
      This patch fixes this for BE3 VFs.
      Signed-off-by: default avatarSomnath Kotur <somnath.kotur@avagotech.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ed7d749
    • Padmanabh Ratnakar's avatar
      be2net: set interrupt moderation for Skyhawk-R using EQ-DB · 20947770
      Padmanabh Ratnakar authored
      Currently adaptive interrupt moderation is set by calculating
      and configuring an EQ-delay every second. This is done via
      a FW-cmd. But, on Skyhawk-R a "re-arm to interrupt" delay
      can be set while ringing the EQ-DB. This patch uses this
      facility to calculate and set the interrupt delay every 1ms.
      This helps moderating interrupts better when the traffic
      is bursty.
      Signed-off-by: default avatarPadmanabh Ratnakar <padmanabh.ratnakar@avagotech.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      20947770
    • Kalesh AP's avatar
      be2net: add support for spoofchk setting · e7bcbd7b
      Kalesh AP authored
      This patch adds support for spoofchk configuration for VFs.
      When it is enabled, "spoof checking" is done for both MAC-address and VLAN.
      For each VF, the HW ensures that the source MAC address (or vlan) of
      every outgoing packet exists in the MAC-list (or vlan-list) configured
      for RX filtering for that VF. If not, the packet is dropped and an error
      is reported to the driver in the TX completion; this is reflected in the
      "tx_spoof_check_err" ethtool counter.
      This feature is supported in Skyhawk FW version 10.6.31.0 and above.
      Signed-off-by: default avatarKalesh AP <kalesh.purayil@emulex.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@avagotech.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7bcbd7b
    • David S. Miller's avatar
      Merge branch 'sfc-next' · 1a676d2b
      David S. Miller authored
      Shradha Shah says:
      
      ====================
      sfc: Enabling EF10 Vf's, set up vswitching and bind the SFC driver to the VF's
      
      This set of patches makes way for the implementation of EF10
      SR-IOV driver starting with some cleanup code.
      NIC specific SR-IOV functions are moved to their own header
      and netdev_ops are made generic instead of being NIC specific
      
      Next in line comes the patch to enable VF's using sriov_configure.
      VEB vswitching hierarchy is set up next followed by patches to
      prepare sfc driver to bind to enabled VF's
      
      This is followed by patch to support use of shared RSS contexts
      which makes VF's use shared RSS contexts in all cases.
      
      Patch series ends with a patch to bind the sfc driver to the
      enabled VF's which creates network interfaces corresponding to
      the VF's.
      
      Coming up soon are the patches to set_vf_mac, set_vf_config,
      set_vf_vlan, vf_spoofcheck, etc.
      
      These patches have been tested with and without CONFIG_SFC_SRIOV.
      In the case of CONFIG_SFC_SRIOV=y enabling of VF's using
      sriov_configure is also tested. The enabled VF's bind to the
      installed sfc driver succesfully to create network interfaces.
      In the case of CONFIG_SFC_SRIOV=n enabling of VF's using
      sriov_configure returns the correct error message:
      "Function not implemented".
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a676d2b
    • Shradha Shah's avatar
      sfc: Bind the sfc driver to any available VF's · 6f7f8aa6
      Shradha Shah authored
      Add the device ID of the VF to the PCI device ID table.
      
      Added a boolean flag is_vf in efx_nic_type to differentiate
      between a VF and PF at probe time. This flag is useful in later
      patches while setting MAC address specially in the
      PCI-passthrough case.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f7f8aa6
    • Jon Cooper's avatar
      sfc: Add use of shared RSS contexts. · 267c0157
      Jon Cooper authored
      Allow PFs to allocate shared RSS contexts if we exhaust our
      exclusive RSS contexts. Make VFs use shared RSS contexts in
      all cases.
      Spruce up error handling so that the shadow copy of the RSS
      table is updated after successful update, rather than in all
      cases, so that we report the actual contents of the RSS table
      after a failure to set it, rather than what we'd like it to be.
      
      Populate context_size parameter when vacuously allocating RSS
      context of size 1.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      267c0157
    • Edward Cree's avatar
      sfc: Cope with permissions enforcement added to firmware for SR-IOV · 267d9d73
      Edward Cree authored
      * Accept EPERM in some simple cases, the following cases are handled:
      1) efx_mcdi_read_assertion()
      Unprivileged PCI functions aren't allowed to GET_ASSERTS.
      We return success as it's up to the primary PF to deal with asserts.
      2) efx_mcdi_mon_probe() in efx_ef10_probe()
      Unprivileged PCI functions aren't allowed to read sensor info, and
      worrying about sensor data is the primary PF's job.
      3) phy_op->reconfigure() in efx_init_port() and efx_reset_up()
      Unprivileged functions aren't allowed to MC_CMD_SET_LINK, they just have
      to accept the settings (including flow-control, which is what
      efx_init_port() is worried about) they've been given.
      4) Fallback to GET_WORKAROUNDS in efx_ef10_probe()
      Unprivileged PCI functions aren't allowed to set workarounds. So if
      efx_mcdi_set_workaround() fails EPERM, use efx_mcdi_get_workarounds()
      to find out if workaround_35388 is enabled.
      5) If DRV_ATTACH gets EPERM, try without specifying fw-variant
      Unprivileged PCI functions have to use a FIRMWARE_ID of 0xffffffff
      (MC_CMD_FW_DONT_CARE).
      6) Don't try to exit_assertion unless one had fired
      Previously we called efx_mcdi_exit_assertion even if
      efx_mcdi_read_assertion had received MC_CMD_GET_ASSERTS_FLAGS_NO_FAILS.
      This is unnecessary, and the resulting MC_CMD_REBOOT, even if the
      AFTER_ASSERTION flag made it a no-op, would fail EPERM for unprivileged
      PCI functions.
      So make efx_mcdi_read_assertion return whether an assert happened, and only
      call efx_mcdi_exit_assertion if it has.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      267d9d73
    • Shradha Shah's avatar
      sfc: manually allocate and free vadaptors · 7b8c7b54
      Shradha Shah authored
      To be able to use MC_CMD_VADAPTOR_SET_MAC, vadaptors must be
      manually allocated and freed as automatic vadaptors will disappear
      when their reference_count reaches zero, which must happen before
      the MAC address is changed.
      
      Vadaptors are allocated and freed in the vswitching_probe/remove
      functions for PFs and VFs, and this means that vadaptors are restored
      correctly following an MC reboot or other reset when required.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7b8c7b54
    • Shradha Shah's avatar
      sfc: create vports for VFs and assign random MAC addresses · 3c5eb876
      Shradha Shah authored
      The parent PF creates vports for all its child VFs and adds MAC
      addresses to these.  When the VF driver loads, it can make an MCDI
      call to get the MAC address that the parent PF assigned it.
      
      The parent PF also assigns a mac address to its own vport because
      implicit creation of a vAdaptor will only work on evb ports with
      MAC addresses assigned.
      
      The vport MAC address needs to be stored in the PF's nic_data
      struct as it can later be changed on the vadaptor (and its net_dev
      struct). When removing a vport the original MAC address must be
      deleted.
      
      A new flag is needed in the VF data structure to identify whether
      a vport has been assigned to the VF.  This is to determine whether
      it needs to be un-assigned before freeing the vport.  Also,
      attempting to un-assign a vport which is not assigned will result
      in an EALREADY error.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c5eb876
    • Shradha Shah's avatar
      sfc: Prepare to bind the sfc driver to the VF. · 02246a7f
      Shradha Shah authored
      Added efx_nic_type structure for VF.
      Mapped a different BAR for VF as it uses BAR 0 for memory.
      Added functions sriov_init and sriov_fini.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      02246a7f
    • Daniel Pieczko's avatar
      sfc: get the PF number and record in nic_data · 1cd9ecbb
      Daniel Pieczko authored
      Use MC_CMD_GET_FUNCTION_INFO to record the PF number in nic_data.
      This will be needed when assigned vports to VFs.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1cd9ecbb
    • Daniel Pieczko's avatar
      sfc: create VEB vswitch and vport above default firmware setup · 6d8aaaf6
      Daniel Pieczko authored
      Adds functions to allocate and free vswitches and vports; vadaptors
      are automatically allocated and freed when TX/RX queues are
      initialised and finalised.  This vswitching structure is only created
      if the firmware supports it, so a check that full-featured firmware
      is running is performed first.
      
      If the MC resets, the vswitching infrastructure will need to be
      recreated, so mark the "must_probe_vswitching" flag when an MC reboot
      is detected.
      
      Don't try to create a vswitch if vf-count=0
      
      This allocation of vswitches and vports does not currently support
      configuring VLAN tags, but that can be added in a future change.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d8aaaf6
    • Daniel Pieczko's avatar
      sfc: record the PF's vport ID in nic_data · 45b2449e
      Daniel Pieczko authored
      The default port ID of EVB_PORT_ID_ASSIGNED is a "magic" number
      for the MCFW to select the physical port of the PF.  If other
      vswitches and vports are created on top of the default firmware
      configuration, the ID of the newly created vport is then required
      when passed to MCDI commands.  Currently, this doesn't happen so
      the vport_id is never changed, but a subsequent patch will change
      this behaviour so that other vswitches and vports are created.
      
      The vport_id recorded in nic_data is only relevant for PFs.
      VFs will have their vports created by their parent PF, and in
      that case the parent PF will record the vport ID of each VF.
      For a VF, nic_data->vport_id is expected to remain at the default
      value.
      Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45b2449e