1. 29 11月, 2016 1 次提交
    • M
      Documentation: devicetree: clarify usage of the RGMII phy-modes · e5f3a4a5
      Martin Blumenstingl 提交于
      RGMII requires special RX and/or TX delays depending on the actual
      hardware circuit/wiring. These delays can be added by the MAC, the PHY
      or the designer of the circuit (the latter means that no delay has to
      be added by PHY or MAC).
      There are 4 RGMII phy-modes used describe where a delay should be
      applied:
      - rgmii: the RX and TX delays are either added by the MAC (where the
        exact delay is typically configurable, and can be turned off when no
        extra delay is needed) or not needed at all (because the hardware
        wiring adds the delay already). The PHY should neither add the RX nor
        TX delay in this case.
      - rgmii-rxid: configures the PHY to enable the RX delay. The MAC should
        not add the RX delay in this case.
      - rgmii-txid: configures the PHY to enable the TX delay. The MAC should
        not add the TX delay in this case.
      - rgmii-id: combines rgmii-rxid and rgmii-txid and thus configures the
        PHY to enable the RX and TX delays. The MAC should neither add the RX
        nor TX delay in this case.
      
      Document these cases in the ethernet.txt documentation to make it clear
      when to use each mode.
      If applied incorrectly one might end up with MAC and PHY both enabling
      for example the TX delay, which breaks ethernet TX traffic on 1000Mbit/s
      links.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e5f3a4a5
  2. 28 11月, 2016 12 次提交
    • D
      net, sched: respect rcu grace period on cls destruction · d9363774
      Daniel Borkmann 提交于
      Roi reported a crash in flower where tp->root was NULL in ->classify()
      callbacks. Reason is that in ->destroy() tp->root is set to NULL via
      RCU_INIT_POINTER(). It's problematic for some of the classifiers, because
      this doesn't respect RCU grace period for them, and as a result, still
      outstanding readers from tc_classify() will try to blindly dereference
      a NULL tp->root.
      
      The tp->root object is strictly private to the classifier implementation
      and holds internal data the core such as tc_ctl_tfilter() doesn't know
      about. Within some classifiers, such as cls_bpf, cls_basic, etc, tp->root
      is only checked for NULL in ->get() callback, but nowhere else. This is
      misleading and seemed to be copied from old classifier code that was not
      cleaned up properly. For example, d3fa76ee ("[NET_SCHED]: cls_basic:
      fix NULL pointer dereference") moved tp->root initialization into ->init()
      routine, where before it was part of ->change(), so ->get() had to deal
      with tp->root being NULL back then, so that was indeed a valid case, after
      d3fa76ee, not really anymore. We used to set tp->root to NULL long
      ago in ->destroy(), see 47a1a1d4 ("pkt_sched: remove unnecessary xchg()
      in packet classifiers"); but the NULLifying was reintroduced with the
      RCUification, but it's not correct for every classifier implementation.
      
      In the cases that are fixed here with one exception of cls_cgroup, tp->root
      object is allocated and initialized inside ->init() callback, which is always
      performed at a point in time after we allocate a new tp, which means tp and
      thus tp->root was not globally visible in the tp chain yet (see tc_ctl_tfilter()).
      Also, on destruction tp->root is strictly kfree_rcu()'ed in ->destroy()
      handler, same for the tp which is kfree_rcu()'ed right when we return
      from ->destroy() in tcf_destroy(). This means, the head object's lifetime
      for such classifiers is always tied to the tp lifetime. The RCU callback
      invocation for the two kfree_rcu() could be out of order, but that's fine
      since both are independent.
      
      Dropping the RCU_INIT_POINTER(tp->root, NULL) for these classifiers here
      means that 1) we don't need a useless NULL check in fast-path and, 2) that
      outstanding readers of that tp in tc_classify() can still execute under
      respect with RCU grace period as it is actually expected.
      
      Things that haven't been touched here: cls_fw and cls_route. They each
      handle tp->root being NULL in ->classify() path for historic reasons, so
      their ->destroy() implementation can stay as is. If someone actually
      cares, they could get cleaned up at some point to avoid the test in fast
      path. cls_u32 doesn't set tp->root to NULL. For cls_rsvp, I just added a
      !head should anyone actually be using/testing it, so it at least aligns with
      cls_fw and cls_route. For cls_flower we additionally need to defer rhashtable
      destruction (to a sleepable context) after RCU grace period as concurrent
      readers might still access it. (Note that in this case we need to hold module
      reference to keep work callback address intact, since we only wait on module
      unload for all call_rcu()s to finish.)
      
      This fixes one race to bring RCU grace period guarantees back. Next step
      as worked on by Cong however is to fix 1e052be6 ("net_sched: destroy
      proto tp when all filters are gone") to get the order of unlinking the tp
      in tc_ctl_tfilter() for the RTM_DELTFILTER case right by moving
      RCU_INIT_POINTER() before tcf_destroy() and let the notification for
      removal be done through the prior ->delete() callback. Both are independant
      issues. Once we have that right, we can then clean tp->root up for a number
      of classifiers by not making them RCU pointers, which requires a new callback
      (->uninit) that is triggered from tp's RCU callback, where we just kfree()
      tp->root from there.
      
      Fixes: 1f947bf1 ("net: sched: rcu'ify cls_bpf")
      Fixes: 9888faef ("net: sched: cls_basic use RCU")
      Fixes: 70da9f0b ("net: sched: cls_flow use RCU")
      Fixes: 77b9900e ("tc: introduce Flower classifier")
      Fixes: bf3994d2 ("net/sched: introduce Match-all classifier")
      Fixes: 952313bd ("net: sched: cls_cgroup use RCU")
      Reported-by: NRoi Dayan <roid@mellanox.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Roi Dayan <roid@mellanox.com>
      Cc: Jiri Pirko <jiri@mellanox.com>
      Acked-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d9363774
    • J
      tipc: fix link statistics counter errors · 95901122
      Jon Paul Maloy 提交于
      In commit e4bf4f76 ("tipc: simplify packet sequence number
      handling") we changed the internal representation of the packet
      sequence number counters from u32 to u16, reflecting what is really
      sent over the wire.
      
      Since then some link statistics counters have been displaying incorrect
      values, partially because the counters meant to be used as sequence
      number snapshots are now used as direct counters, stored as u32, and
      partially because some counter updates are just missing in the code.
      
      In this commit we correct this in two ways. First, we base the
      displayed packet sent/received values on direct counters instead
      of as previously a calculated difference between current sequence
      number and a snapshot. Second, we add the missing updates of the
      counters.
      
      This change is compatible with the current netlink API, and requires
      no changes to the user space tools.
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      95901122
    • D
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · 8eb4adf6
      David S. Miller 提交于
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2016-11-25
      
      1) Fix a refcount leak in vti6.
         From Nicolas Dichtel.
      
      2) Fix a wrong if statement in xfrm_sk_policy_lookup.
         From Florian Westphal.
      
      3) The flowcache watermarks are per cpu. Take this into
         account when comparing to the threshold where we
         refusing new allocations. From Miroslav Urbanek.
      
      Please pull or let me know if there are problems.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8eb4adf6
    • G
      driver: macvtap: Unregister netdev rx_handler if macvtap_newlink fails · e824265d
      Gao Feng 提交于
      The macvtap_newlink registers the netdev rx_handler firstly, but it
      does not unregister the handler if macvlan_common_newlink failed.
      Signed-off-by: NGao Feng <fgao@ikuai8.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e824265d
    • D
      Merge branch 'more-phydev-leaks' · a1cad5ee
      David S. Miller 提交于
      Johan Hovold says:
      
      ====================
      net: fix phydev reference leaks
      
      This series fixes a number of phydev reference leaks (and one of_node
      leak) due to failure to put the reference taken by of_phy_find_device().
      
      Note that I did not try to fix drivers/net/phy/xilinx_gmii2rgmii.c which
      still leaks a reference.
      
      Against net but should apply just as fine to net-next.
      
      v2:
       - use put_device() instead of phy_dev_free() to put the references
         taken in net/dsa (patch 1/4).
       - add four new patches fixing similar leaks
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a1cad5ee
    • J
      net: qcom/emac: fix of_node and phydev leaks · 6ffe1c4c
      Johan Hovold 提交于
      Make sure to drop the reference taken by of_phy_find_device() during
      probe on probe errors and on driver unbind.
      
      Also drop the of_node reference taken by of_parse_phandle() in the same
      path.
      
      Fixes: b9b17deb ("net: emac: emac gigabit ethernet controller driver")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6ffe1c4c
    • J
      net: fsl/fman: fix fixed-link-phydev reference leak · cb1f3410
      Johan Hovold 提交于
      Make sure to drop the reference taken by of_phy_find_device() when
      looking up a fixed-link phydev during probe.
      
      Fixes: 57ba4c9b ("fsl/fman: Add FMan MAC support")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cb1f3410
    • J
      net: fsl/fman: fix phydev reference leak · 96683034
      Johan Hovold 提交于
      Make sure to drop the reference taken by of_phy_find_device() during
      initialisation when later freeing the struct fman_mac.
      
      Fixes: 57ba4c9b ("fsl/fman: Add FMan MAC support")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      96683034
    • J
      net: bcmgenet: fix phydev reference leak · 0da60541
      Johan Hovold 提交于
      Make sure to drop the reference taken by of_phy_find_device() when
      initialising MOCA PHYs.
      
      Fixes: 6ac9de5f ("net: bcmgenet: Register link_update callback for
      all MoCA PHYs")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0da60541
    • J
      net: dsa: fix fixed-link-phy device leaks · fd05d7b1
      Johan Hovold 提交于
      Make sure to drop the reference taken by of_phy_find_device() when
      registering and deregistering the fixed-link PHY-device.
      
      Fixes: 39b0c705 ("net: dsa: Allow configuration of CPU & DSA port
      speeds/duplex")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd05d7b1
    • A
      irda: fix overly long udelay() · c9bd2823
      Arnd Bergmann 提交于
      irda_get_mtt() returns a hardcoded '10000' in some cases,
      and with gcc-7, we get a build error because this triggers a
      compile-time check in udelay():
      
      drivers/net/irda/w83977af_ir.o: In function `w83977af_hard_xmit':
      w83977af_ir.c:(.text.w83977af_hard_xmit+0x14c): undefined reference to `__bad_udelay'
      
      Older compilers did not run into this because they either did not
      completely inline the irda_get_mtt() or did not consider the
      10000 value a constant expression.
      
      The code has been wrong since the start of git history.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c9bd2823
    • G
      driver: ipvlan: Fix one possible memleak in ipvlan_link_new · 147fd287
      Gao Feng 提交于
      When ipvlan_link_new fails and creates one ipvlan port, it does not
      destroy the ipvlan port created. It causes mem leak and the physical
      device contains invalid ipvlan data.
      Signed-off-by: NGao Feng <fgao@ikuai8.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      147fd287
  3. 27 11月, 2016 8 次提交
  4. 26 11月, 2016 19 次提交