1. 13 Apr, 2021 28 commits
  2. 12 Apr, 2021 12 commits
    • Adam Ford's avatar
      net: ethernet: ravb: Enable optional refclk · 8ef7adc6
      Adam Ford authored
      For devices that use a programmable clock for the AVB reference clock,
      the driver may need to enable them.  Add code to find the optional clock
      and enable it when available.
      Signed-off-by: default avatarAdam Ford <aford173@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8ef7adc6
    • Adam Ford's avatar
      dt-bindings: net: renesas,etheravb: Add additional clocks · 6f43735b
      Adam Ford authored
      The AVB driver assumes there is an external crystal, but it could
      be clocked by other means.  In order to enable a programmable
      clock, it needs to be added to the clocks list and enabled in the
      driver.  Since there currently only one clock, there is no
      clock-names list either.
      
      Update bindings to add the additional optional clock, and explicitly
      name both of them.
      Signed-off-by: default avatarAdam Ford <aford173@gmail.com>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarSergei Shtylyov <sergei.shtylyov@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f43735b
    • David S. Miller's avatar
      Merge branch 'enetc-ptp' · d27139c5
      David S. Miller authored
      Yangbo Lu says:
      
      ====================
      enetc: support PTP Sync packet one-step timestamping
      
      This patch-set is to add support for PTP Sync packet one-step timestamping.
      Since ENETC single-step register has to be configured dynamically per
      packet for correctionField offeset and UDP checksum update, current
      one-step timestamping packet has to be sent only when the last one
      completes transmitting on hardware. So, on the TX, this patch handles
      one-step timestamping packet as below:
      
      - Trasmit packet immediately if no other one in transfer, or queue to
        skb queue if there is already one in transfer.
        The test_and_set_bit_lock() is used here to lock and check state.
      - Start a work when complete transfer on hardware, to release the bit
        lock and to send one skb in skb queue if has.
      
      Changes for v2:
      	- Rebased.
      	- Fixed issues from patchwork checks.
      	- netif_tx_lock for one-step timestamping packet sending.
      Changes for v3:
      	- Used system workqueue.
      	- Set bit lock when transmitted one-step packet, and scheduled
      	  work when completed. The worker cleared the bit lock, and
      	  transmitted one skb in skb queue if has, instead of a loop.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d27139c5
    • Yangbo Lu's avatar
      enetc: support PTP Sync packet one-step timestamping · 7294380c
      Yangbo Lu authored
      This patch is to add support for PTP Sync packet one-step timestamping.
      Since ENETC single-step register has to be configured dynamically per
      packet for correctionField offeset and UDP checksum update, current
      one-step timestamping packet has to be sent only when the last one
      completes transmitting on hardware. So, on the TX, this patch handles
      one-step timestamping packet as below:
      
      - Trasmit packet immediately if no other one in transfer, or queue to
        skb queue if there is already one in transfer.
        The test_and_set_bit_lock() is used here to lock and check state.
      - Start a work when complete transfer on hardware, to release the bit
        lock and to send one skb in skb queue if has.
      
      And the configuration for one-step timestamping on ENETC before
      transmitting is,
      
      - Set one-step timestamping flag in extension BD.
      - Write 30 bits current timestamp in tstamp field of extension BD.
      - Update PTP Sync packet originTimestamp field with current timestamp.
      - Configure single-step register for correctionField offeset and UDP
        checksum update.
      Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7294380c
    • Yangbo Lu's avatar
      enetc: mark TX timestamp type per skb · f768e751
      Yangbo Lu authored
      Mark TX timestamp type per skb on skb->cb[0], instead of
      global variable for all skbs. This is a preparation for
      one step timestamp support.
      
      For one-step timestamping enablement, there will be both
      one-step and two-step PTP messages to transfer. And a skb
      queue is needed for one-step PTP messages making sure
      start to send current message only after the last one
      completed on hardware. (ENETC single-step register has to
      be dynamically configured per message.) So, marking TX
      timestamp type per skb is required.
      Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f768e751
    • David S. Miller's avatar
      Merge branch 'ibmvnic-errors' · 8043edee
      David S. Miller authored
      Lijun Pan says:
      
      ====================
      ibmvnic: improve error printing
      
      Patch 1 prints reset reason as a string.
      Patch 2 prints adapter state as a string.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8043edee
    • Lijun Pan's avatar
      ibmvnic: print adapter state as a string · 0666ef7f
      Lijun Pan authored
      The adapter state can be added or deleted over different versions
      of the source code. Print a string instead of a number.
      Signed-off-by: default avatarLijun Pan <lijunp213@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0666ef7f
    • Lijun Pan's avatar
      ibmvnic: print reset reason as a string · caee7bf5
      Lijun Pan authored
      The reset reason can be added or deleted over different versions
      of the source code. Print a string instead of a number.
      Signed-off-by: default avatarLijun Pan <lijunp213@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      caee7bf5
    • Lijun Pan's avatar
      ibmvnic: clean up the remaining debugfs data structures · c82eaa40
      Lijun Pan authored
      Commit e704f043 ("ibmvnic: Remove debugfs support") did not
      clean up everything. Remove the remaining code.
      Signed-off-by: default avatarLijun Pan <lijunp213@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c82eaa40
    • David S. Miller's avatar
      Merge branch 'netns-sysctl-isolation' · 645b34a7
      David S. Miller authored
      Jonathon Reinhart says:
      
      ====================
      Ensuring net sysctl isolation
      
      This patchset is the result of an audit of /proc/sys/net to prove that
      it is safe to be mouted read-write in a container when a net namespace
      is in use. See [1].
      
      The first commit adds code to detect sysctls which are not netns-safe,
      and can "leak" changes to other net namespaces.
      
      My manual audit found, and the above feature confirmed, that there are
      two nf_conntrack sysctls which are in fact not netns-safe.
      
      I considered sending the latter to netfilter-devel, but I think it's
      better to have both together on net-next: Adding only the former causes
      undesirable warnings in the kernel log.
      
      [1]: https://github.com/opencontainers/runc/issues/2826
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      645b34a7
    • Jonathon Reinhart's avatar
      netfilter: conntrack: Make global sysctls readonly in non-init netns · 2671fa4d
      Jonathon Reinhart authored
      These sysctls point to global variables:
      - NF_SYSCTL_CT_MAX (&nf_conntrack_max)
      - NF_SYSCTL_CT_EXPECT_MAX (&nf_ct_expect_max)
      - NF_SYSCTL_CT_BUCKETS (&nf_conntrack_htable_size_user)
      
      Because their data pointers are not updated to point to per-netns
      structures, they must be marked read-only in a non-init_net ns.
      Otherwise, changes in any net namespace are reflected in (leaked into)
      all other net namespaces. This problem has existed since the
      introduction of net namespaces.
      
      The current logic marks them read-only only if the net namespace is
      owned by an unprivileged user (other than init_user_ns).
      
      Commit d0febd81 ("netfilter: conntrack: re-visit sysctls in
      unprivileged namespaces") "exposes all sysctls even if the namespace is
      unpriviliged." Since we need to mark them readonly in any case, we can
      forego the unprivileged user check altogether.
      
      Fixes: d0febd81 ("netfilter: conntrack: re-visit sysctls in unprivileged namespaces")
      Signed-off-by: default avatarJonathon Reinhart <Jonathon.Reinhart@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2671fa4d
    • Jonathon Reinhart's avatar
      net: Ensure net namespace isolation of sysctls · 31c4d2f1
      Jonathon Reinhart authored
      This adds an ensure_safe_net_sysctl() check during register_net_sysctl()
      to validate that sysctl table entries for a non-init_net netns are
      sufficiently isolated. To be netns-safe, an entry must adhere to at
      least (and usually exactly) one of these rules:
      
      1. It is marked read-only inside the netns.
      2. Its data pointer does not point to kernel/module global data.
      
      An entry which fails both of these checks is indicative of a bug,
      whereby a child netns can affect global net sysctl values.
      
      If such an entry is found, this code will issue a warning to the kernel
      log, and force the entry to be read-only to prevent a leak.
      
      To test, simply create a new netns:
      
          $ sudo ip netns add dummy
      
      As it sits now, this patch will WARN for two sysctls which will be
      addressed in a subsequent patch:
      - /proc/sys/net/netfilter/nf_conntrack_max
      - /proc/sys/net/netfilter/nf_conntrack_expect_max
      Signed-off-by: default avatarJonathon Reinhart <Jonathon.Reinhart@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31c4d2f1