1. 18 Dec, 2018 16 commits
  2. 17 Dec, 2018 1 commit
  3. 16 Dec, 2018 12 commits
    • Marcin Wojtas's avatar
      net: mvneta: fix operation for 64K PAGE_SIZE · e735fd55
      Marcin Wojtas authored
      Recent changes in the mvneta driver reworked allocation
      and handling of the ingress buffers to use entire pages.
      Apart from that in SW BM scenario the HW must be informed
      via PRXDQS about the biggest possible incoming buffer
      that can be propagated by RX descriptors.
      
      The BufferSize field was filled according to the MTU-dependent
      pkt_size value. Later change to PAGE_SIZE broke RX operation
      when usin 64K pages, as the field is simply too small.
      
      This patch conditionally limits the value passed to the BufferSize
      of the PRXDQS register, depending on the PAGE_SIZE used.
      On the occasion remove now unused frag_size field of the mvneta_port
      structure.
      
      Fixes: 562e2f46 ("net: mvneta: Improve the buffer allocation method for SWBM")
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e735fd55
    • David S. Miller's avatar
      Merge branch 'hns-fixes' · 369a094d
      David S. Miller authored
      Peng Li says:
      
      ====================
      net: hns: Code improvements & fixes for HNS driver
      
      This patchset introduces some code improvements and fixes
      for the identified problems in the HNS driver.
      
      Every patch is independent.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      369a094d
    • Yonglong Liu's avatar
      net: hns: Fix ping failed when use net bridge and send multicast · 6adafc35
      Yonglong Liu authored
      Create a net bridge, add eth and vnet to the bridge. The vnet is used
      by a virtual machine. When ping the virtual machine from the outside
      host and the virtual machine send multicast at the same time, the ping
      package will lost.
      
      The multicast package send to the eth, eth will send it to the bridge too,
      and the bridge learn the mac of eth. When outside host ping the virtual
      mechine, it will match the promisc entry of the eth which is not expected,
      and the bridge send it to eth not to vnet, cause ping lost.
      
      So this patch change promisc tcam entry position to the END of 512 tcam
      entries, which indicate lower priority. And separate one promisc entry to
      two: mc & uc, to avoid package match the wrong tcam entry.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6adafc35
    • Yonglong Liu's avatar
      net: hns: Add mac pcs config when enable|disable mac · 726ae5c9
      Yonglong Liu authored
      In some case, when mac enable|disable and adjust link, may cause hard to
      link(or abnormal) between mac and phy. This patch adds the code for rx PCS
      to avoid this bug.
      
      Disable the rx PCS when driver disable the gmac, and enable the rx PCS
      when driver enable the mac.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      726ae5c9
    • Yonglong Liu's avatar
      net: hns: Fix ntuple-filters status error. · 7e74a19c
      Yonglong Liu authored
      The ntuple-filters features is forced on by chip.
      But it shows "ntuple-filters: off [fixed]" when use ethtool.
      This patch make it correct with "ntuple-filters: on [fixed]".
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e74a19c
    • Yonglong Liu's avatar
      net: hns: Avoid net reset caused by pause frames storm · a57275d3
      Yonglong Liu authored
      There will be a large number of MAC pause frames on the net,
      which caused tx timeout of net device. And then the net device
      was reset to try to recover it. So that is not useful, and will
      cause some other problems.
      
      So need doubled ndev->watchdog_timeo if device watchdog occurred
      until watchdog_timeo up to 40s and then try resetting to recover
      it.
      
      When collecting dfx information such as hardware registers when tx timeout.
      Some registers for count were cleared when read. So need move this task
      before update net state which also read the count registers.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a57275d3
    • Yonglong Liu's avatar
      net: hns: Free irq when exit from abnormal branch · c82bd077
      Yonglong Liu authored
      1.In "hns_nic_init_irq", if request irq fail at index i,
        the function return directly without releasing irq resources
        that already requested.
      
      2.In "hns_nic_net_up" after "hns_nic_init_irq",
        if exceptional branch occurs, irqs that already requested
        are not release.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c82bd077
    • Yonglong Liu's avatar
      net: hns: Clean rx fbd when ae stopped. · 31f6b61d
      Yonglong Liu authored
      If there are packets in hardware when changing the speed or duplex,
      it may cause hardware hang up.
      
      This patch adds the code to wait rx fbd clean up when ae stopped.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31f6b61d
    • Yonglong Liu's avatar
      net: hns: Fixed bug that netdev was opened twice · 5778b13b
      Yonglong Liu authored
      After resetting dsaf to try to repair chip error such as ecc error,
      the net device will be open if net interface is up. But at this time
      if there is the users set the net device up with the command ifconfig,
      the net device will be opened twice consecutively.
      
      Function napi_enable was called when open device. And Kernel panic will
      be occurred if it was called twice consecutively. Such as follow:
      static inline void napi_enable(struct napi_struct *n)
      {
               BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
               smp_mb__before_clear_bit();
               clear_bit(NAPI_STATE_SCHED, &n->state);
      }
      
      [37255.571996] Kernel panic - not syncing: BUG!
      [37255.595234] Call trace:
      [37255.597694] [<ffff80000008ab48>] dump_backtrace+0x0/0x1a0
      [37255.603114] [<ffff80000008ad08>] show_stack+0x20/0x28
      [37255.608187] [<ffff8000009c4944>] dump_stack+0x98/0xb8
      [37255.613258] [<ffff8000009c149c>] panic+0x10c/0x26c
      [37255.618070] [<ffff80000070f134>] hns_nic_net_up+0x30c/0x4e0
      [37255.623664] [<ffff80000070f39c>] hns_nic_net_open+0x94/0x12c
      [37255.629346] [<ffff80000084be78>] __dev_open+0xf4/0x168
      [37255.634504] [<ffff80000084c1ac>] __dev_change_flags+0x98/0x15c
      [37255.640359] [<ffff80000084c29c>] dev_change_flags+0x2c/0x68
      [37255.769580] [<ffff8000008dc400>] devinet_ioctl+0x650/0x704
      [37255.775086] [<ffff8000008ddc38>] inet_ioctl+0x98/0xb4
      [37255.780159] [<ffff800000827b7c>] sock_do_ioctl+0x44/0x84
      [37255.785490] [<ffff800000828e04>] sock_ioctl+0x248/0x30c
      [37255.790737] [<ffff80000026dc6c>] do_vfs_ioctl+0x480/0x618
      [37255.796156] [<ffff80000026de94>] SyS_ioctl+0x90/0xa4
      [37255.801139] SMP: stopping secondary CPUs
      [37255.805079] kbox: catch panic event.
      [37255.809586] collected_len = 128928, LOG_BUF_LEN_LOCAL = 131072
      [37255.816103] flush cache 0xffff80003f000000  size 0x800000
      [37255.822192] flush cache 0xffff80003f000000  size 0x800000
      [37255.828289] flush cache 0xffff80003f000000  size 0x800000
      [37255.834378] kbox: no notify die func register. no need to notify
      [37255.840413] ---[ end Kernel panic - not syncing: BUG!
      
      This patchset fix this bug according to the flag NIC_STATE_DOWN.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5778b13b
    • Yonglong Liu's avatar
      net: hns: Some registers use wrong address according to the datasheet. · 4ad26f11
      Yonglong Liu authored
      According to the hip06 datasheet:
      1.Six registers use wrong address:
        RCB_COM_SF_CFG_INTMASK_RING
        RCB_COM_SF_CFG_RING_STS
        RCB_COM_SF_CFG_RING
        RCB_COM_SF_CFG_INTMASK_BD
        RCB_COM_SF_CFG_BD_RINT_STS
        DSAF_INODE_VC1_IN_PKT_NUM_0_REG
      2.The offset of DSAF_INODE_VC1_IN_PKT_NUM_0_REG should be
        0x103C + 0x80 * all_chn_num
      3.The offset to show the value of DSAF_INODE_IN_DATA_STP_DISC_0_REG
        is wrong, so the value of DSAF_INODE_SW_VLAN_TAG_DISC_0_REG will be
        overwrite
      
      These registers are only used in "ethtool -d", so that did not cause ndev
      to misfunction.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ad26f11
    • Yonglong Liu's avatar
      net: hns: All ports can not work when insmod hns ko after rmmod. · 308c6caf
      Yonglong Liu authored
      There are two test cases:
      1. Remove the 4 modules:hns_enet_drv/hns_dsaf/hnae/hns_mdio,
         and install them again, must use "ifconfig down/ifconfig up"
         command pair to bring port to work.
      
         This patch calls phy_stop function when init phy to fix this bug.
      
      2. Remove the 2 modules:hns_enet_drv/hns_dsaf, and install them again,
         all ports can not use anymore, because of the phy devices register
         failed(phy devices already exists).
      
         Phy devices are registered when hns_dsaf installed, this patch
         removes them when hns_dsaf removed.
      
      The two cases are sometimes related, fixing the second case also requires
      fixing the first case, so fix them together.
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      308c6caf
    • Yonglong Liu's avatar
      net: hns: Incorrect offset address used for some registers. · 4e1d4be6
      Yonglong Liu authored
      According to the hip06 Datasheet:
      1. The offset of INGRESS_SW_VLAN_TAG_DISC should be 0x1A00+4*all_chn_num
      2. The offset of INGRESS_IN_DATA_STP_DISC should be 0x1A50+4*all_chn_num
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e1d4be6
  4. 15 Dec, 2018 6 commits
  5. 14 Dec, 2018 5 commits
    • Cong Wang's avatar
      tipc: check tsk->group in tipc_wait_for_cond() · 143ece65
      Cong Wang authored
      tipc_wait_for_cond() drops socket lock before going to sleep,
      but tsk->group could be freed right after that release_sock().
      So we have to re-check and reload tsk->group after it wakes up.
      
      After this patch, tipc_wait_for_cond() returns -ERESTARTSYS when
      tsk->group is NULL, instead of continuing with the assumption of
      a non-NULL tsk->group.
      
      (It looks like 'dsts' should be re-checked and reloaded too, but
      it is a different bug.)
      
      Similar for tipc_send_group_unicast() and tipc_send_group_anycast().
      
      Reported-by: syzbot+10a9db47c3a0e13eb31c@syzkaller.appspotmail.com
      Fixes: b7d42635 ("tipc: introduce flow control for group broadcast messages")
      Fixes: ee106d7f ("tipc: introduce group anycast messaging")
      Fixes: 27bd9ec0 ("tipc: introduce group unicast messaging")
      Cc: Ying Xue <ying.xue@windriver.com>
      Cc: Jon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      143ece65
    • Dave Taht's avatar
      net: Allow class-e address assignment via ifconfig ioctl · 65cab850
      Dave Taht authored
      While most distributions long ago switched to the iproute2 suite
      of utilities, which allow class-e (240.0.0.0/4) address assignment,
      distributions relying on busybox, toybox and other forms of
      ifconfig cannot assign class-e addresses without this kernel patch.
      
      While CIDR has been obsolete for 2 decades, and a survey of all the
      open source code in the world shows the IN_whatever macros are also
      obsolete... rather than obsolete CIDR from this ioctl entirely, this
      patch merely enables class-e assignment, sanely.
      Signed-off-by: default avatarDave Taht <dave.taht@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      65cab850
    • Gustavo A. R. Silva's avatar
      ip6mr: Fix potential Spectre v1 vulnerability · 69d2c867
      Gustavo A. R. Silva authored
      vr.mifi is indirectly controlled by user-space, hence leading to
      a potential exploitation of the Spectre variant 1 vulnerability.
      
      This issue was detected with the help of Smatch:
      
      net/ipv6/ip6mr.c:1845 ip6mr_ioctl() warn: potential spectre issue 'mrt->vif_table' [r] (local cap)
      net/ipv6/ip6mr.c:1919 ip6mr_compat_ioctl() warn: potential spectre issue 'mrt->vif_table' [r] (local cap)
      
      Fix this by sanitizing vr.mifi before using it to index mrt->vif_table'
      
      Notice that given that speculation windows are large, the policy is
      to kill the speculation on the first load and not worry if it can be
      completed with a dependent load/store [1].
      
      [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      69d2c867
    • Arnd Bergmann's avatar
      w90p910_ether: remove incorrect __init annotation · 51367e42
      Arnd Bergmann authored
      The get_mac_address() function is normally inline, but when it is
      not, we get a warning that this configuration is broken:
      
      WARNING: vmlinux.o(.text+0x4aff00): Section mismatch in reference from the function w90p910_ether_setup() to the function .init.text:get_mac_address()
      The function w90p910_ether_setup() references
      the function __init get_mac_address().
      This is often because w90p910_ether_setup lacks a __init
      
      Remove the __init to make it always do the right thing.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51367e42
    • Lepton Wu's avatar
      VSOCK: bind to random port for VMADDR_PORT_ANY · 8236b08c
      Lepton Wu authored
      The old code always starts from fixed port for VMADDR_PORT_ANY. Sometimes
      when VMM crashed, there is still orphaned vsock which is waiting for
      close timer, then it could cause connection time out for new started VM
      if they are trying to connect to same port with same guest cid since the
      new packets could hit that orphaned vsock. We could also fix this by doing
      more in vhost_vsock_reset_orphans, but any way, it should be better to start
      from a random local port instead of a fixed one.
      Signed-off-by: default avatarLepton Wu <ytht.net@gmail.com>
      Reviewed-by: default avatarJorgen Hansen <jhansen@vmware.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8236b08c