1. 30 4月, 2018 5 次提交
    • E
      tcp: add TCP_ZEROCOPY_RECEIVE support for zerocopy receive · 05255b82
      Eric Dumazet 提交于
      When adding tcp mmap() implementation, I forgot that socket lock
      had to be taken before current->mm->mmap_sem. syzbot eventually caught
      the bug.
      
      Since we can not lock the socket in tcp mmap() handler we have to
      split the operation in two phases.
      
      1) mmap() on a tcp socket simply reserves VMA space, and nothing else.
        This operation does not involve any TCP locking.
      
      2) getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) implements
       the transfert of pages from skbs to one VMA.
        This operation only uses down_read(&current->mm->mmap_sem) after
        holding TCP lock, thus solving the lockdep issue.
      
      This new implementation was suggested by Andy Lutomirski with great details.
      
      Benefits are :
      
      - Better scalability, in case multiple threads reuse VMAS
         (without mmap()/munmap() calls) since mmap_sem wont be write locked.
      
      - Better error recovery.
         The previous mmap() model had to provide the expected size of the
         mapping. If for some reason one part could not be mapped (partial MSS),
         the whole operation had to be aborted.
         With the tcp_zerocopy_receive struct, kernel can report how
         many bytes were successfuly mapped, and how many bytes should
         be read to skip the problematic sequence.
      
      - No more memory allocation to hold an array of page pointers.
        16 MB mappings needed 32 KB for this array, potentially using vmalloc() :/
      
      - skbs are freed while mmap_sem has been released
      
      Following patch makes the change in tcp_mmap tool to demonstrate
      one possible use of mmap() and setsockopt(... TCP_ZEROCOPY_RECEIVE ...)
      
      Note that memcg might require additional changes.
      
      Fixes: 93ab6cc6 ("tcp: implement mmap() for zero copy receive")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Suggested-by: NAndy Lutomirski <luto@kernel.org>
      Cc: linux-mm@kvack.org
      Acked-by: NSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      05255b82
    • D
      Merge branch 'dsa-mv88e6xxx-remove-Global-2-setup' · 589f84fb
      David S. Miller 提交于
      Vivien Didelot says:
      
      ====================
      net: dsa: mv88e6xxx: remove Global 2 setup
      
      Parts of the mv88e6xxx driver still write arbitrary registers of
      different banks at setup time, which is misleading especially when
      supporting multiple device models.
      
      This patchset moves two features setup into the top lovel
      mv88e6xxx_setup function and kills the old Global 2 register bank setup
      function. It brings no functional changes.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      589f84fb
    • V
      net: dsa: mv88e6xxx: remove Global 2 setup · 5d49d603
      Vivien Didelot 提交于
      The remaining values written to the Switch Management Register in the
      mv88e6xxx_g2_setup function are specific to 88E6352 and older, and are
      the default values anyway.
      
      Thus remove completely this function. The mv88e6xxx driver no more
      contains setup code to access arbitrary Global 2 registers.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d49d603
    • V
      net: dsa: mv88e6xxx: move device mapping setup · c7f047b6
      Vivien Didelot 提交于
      Move the Device Mapping setup out of the specific Global 2 code,
      into the top level device setup function.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7f047b6
    • V
      net: dsa: mv88e6xxx: move trunk setup · b28f872d
      Vivien Didelot 提交于
      Move the trunking setup out of Global 2 specific setup into the top
      level mv88e6xxx_setup function.
      
      Note that the 88E6390 family calls this LAG instead of Trunk and
      supports 32 possible ID routing vectors, with LAG ID bit 4 being placed
      in Global 2 register 0x1D...
      
      We don't need Trunk (or LAG) IDs for the moment, thus keep it simple.
      Signed-off-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b28f872d
  2. 29 4月, 2018 1 次提交
    • F
      net: phy: Fix modular PHYLIB build · 9e8d438e
      Florian Fainelli 提交于
      After commit c59530d0 ("net: Move PHY statistics code into PHY
      library helpers") we made net/core/ethtool.c reference symbols which are
      part of the library which can be modular. David introduced a temporary
      fix with 1ecd6e8a ("phy: Temporary build fix after phylib changes.")
      which would prevent such modularity.
      
      This is not desireable of course, so instead, just inline the functions
      into include/linux/phy.h to keep both options available.
      
      Fixes: c59530d0 ("net: Move PHY statistics code into PHY library helpers")
      Fixes: 1ecd6e8a ("phy: Temporary build fix after phylib changes.")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9e8d438e
  3. 28 4月, 2018 34 次提交