1. 08 Jun, 2019 9 commits
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Add logic for TX timestamping · 47ed985e
      Vladimir Oltean authored
      On TX, timestamping is performed synchronously from the
      port_deferred_xmit worker thread.
      In management routes, the switch is requested to take egress timestamps
      (again partial), which are reconstructed and appended to a clone of the
      skb that was just sent.  The cloning is done by DSA and we retrieve the
      pointer from the structure that DSA keeps in skb->cb.
      Then these clones are enqueued to the socket's error queue for
      application-level processing.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47ed985e
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Add support for the PTP clock · bb77f36a
      Vladimir Oltean authored
      The design of this PHC driver is influenced by the switch's behavior
      w.r.t. timestamping.  It exposes two PTP counters, one free-running
      (PTPTSCLK) and the other offset- and frequency-corrected in hardware
      through PTPCLKVAL, PTPCLKADD and PTPCLKRATE.  The MACs can sample either
      of these for frame timestamps.
      
      However, the user manual warns that taking timestamps based on the
      corrected clock is less than useful, as the switch can deliver corrupted
      timestamps in a variety of circumstances.
      
      Therefore, this PHC uses the free-running PTPTSCLK together with a
      timecounter/cyclecounter structure that translates it into a software
      time domain.  Thus, the settime/adjtime and adjfine callbacks are
      hardware no-ops.
      
      The timestamps (introduced in a further patch) will also be translated
      to the correct time domain before being handed over to the userspace PTP
      stack.
      
      The introduction of a second set of PHC operations that operate on the
      hardware PTPCLKVAL/PTPCLKADD/PTPCLKRATE in the future is somewhat
      unavoidable, as the TTEthernet core uses the corrected PTP time domain.
      However, the free-running counter + timecounter structure combination
      will suffice for now, as the resulting timestamps yield a sub-50 ns
      synchronization offset in steady state using linuxptp.
      
      For this patch, in absence of frame timestamping, the operations of the
      switch PHC were tested by syncing it to the system time as a local slave
      clock with:
      
      phc2sys -s CLOCK_REALTIME -c swp2 -O 0 -m -S 0.01
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb77f36a
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Export symbols for upcoming PTP driver · 28e8fb3e
      Vladimir Oltean authored
      These are needed for the situation where the switch driver and the PTP
      driver are both built as modules.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28e8fb3e
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Limit use of incl_srcpt to bridge+vlan mode · 42824463
      Vladimir Oltean authored
      The incl_srcpt setting makes the switch mangle the destination MACs of
      multicast frames trapped to the CPU - a primitive tagging mechanism that
      works even when we cannot use the 802.1Q software features.
      
      The downside is that the two multicast MAC addresses that the switch
      traps for L2 PTP (01-80-C2-00-00-0E and 01-1B-19-00-00-00) quickly turn
      into a lot more, as the switch encodes the source port and switch id
      into bytes 3 and 4 of the MAC. The resulting range of MAC addresses
      would need to be installed manually into the DSA master port's multicast
      MAC filter, and even then, most devices might not have a large enough
      MAC filtering table.
      
      As a result, only limit use of incl_srcpt to when it's strictly
      necessary: when under a VLAN filtering bridge.  This fixes PTP in
      non-bridged mode (standalone ports). Otherwise, PTP frames, as well as
      metadata follow-up frames holding RX timestamps won't be received
      because they will be blocked by the master port's MAC filter.
      Linuxptp doesn't help, because it only requests the addition of the
      unmodified PTP MACs to the multicast filter.
      This issue is not seen in bridged mode because the master port is put in
      promiscuous mode when the slave ports are enslaved to a bridge.
      Therefore, there is no downside to having the incl_srcpt mechanism
      active there.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42824463
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Reverse TPID and TPID2 · f9a1a764
      Vladimir Oltean authored
      >From reading the P/Q/R/S user manual, it appears that TPID is used by
      the switch for detecting S-tags and TPID2 for C-tags.  Their meaning is
      not clear from the E/T manual.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f9a1a764
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Move sja1105_change_tpid into sja1105_vlan_filtering · 070ca3bb
      Vladimir Oltean authored
      This is a cosmetic patch, pre-cursor to making another change to the
      General Parameters Table (incl_srcpt) which does not logically pertain
      to the sja1105_change_tpid function name, but not putting it there would
      otherwise create a need of resetting the switch twice.
      
      So simply move the existing code into the .port_vlan_filtering callback,
      where the incl_srcpt change will be added as well.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      070ca3bb
    • Vladimir Oltean's avatar
      net: dsa: tag_8021q: Create helper function for removing VLAN header · d4619336
      Vladimir Oltean authored
      This removes the existing implementation from tag_sja1105, which was
      partially incorrect (it was not changing the MAC header offset, thereby
      leaving it to point 4 bytes earlier than it should have).
      
      This overwrites the VLAN tag by moving the Ethernet source and
      destination MACs 4 bytes to the right. Then skb->data (assumed to be
      pointing immediately after the EtherType) is temporarily pushed to the
      beginning of the new Ethernet header, the new Ethernet header offset and
      length are recorded, then skb->data is moved back to where it was.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4619336
    • Vladimir Oltean's avatar
      net: dsa: Add teardown callback for drivers · 5e3f847a
      Vladimir Oltean authored
      This is helpful for e.g. draining per-driver (not per-port) tagger
      queues.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5e3f847a
    • Vladimir Oltean's avatar
      net: dsa: Keep a pointer to the skb clone for TX timestamping · 146d442c
      Vladimir Oltean authored
      For drivers that use deferred_xmit for PTP frames (such as sja1105),
      there is no need to perform matching between PTP frames and their egress
      timestamps, since the sending process can be serialized.
      
      In that case, it makes sense to have the pointer to the skb clone that
      DSA made directly in the skb->cb. It will be used for pushing the egress
      timestamp back in the application socket's error queue.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      146d442c
  2. 07 Jun, 2019 4 commits
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · a6cdeeb1
      David S. Miller authored
      Some ISDN files that got removed in net-next had some changes
      done in mainline, take the removals.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6cdeeb1
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 1e1d9263
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Free AF_PACKET po->rollover properly, from Willem de Bruijn.
      
       2) Read SFP eeprom in max 16 byte increments to avoid problems with
          some SFP modules, from Russell King.
      
       3) Fix UDP socket lookup wrt. VRF, from Tim Beale.
      
       4) Handle route invalidation properly in s390 qeth driver, from Julian
          Wiedmann.
      
       5) Memory leak on unload in RDS, from Zhu Yanjun.
      
       6) sctp_process_init leak, from Neil HOrman.
      
       7) Fix fib_rules rule insertion semantic change that broke Android,
          from Hangbin Liu.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (33 commits)
        pktgen: do not sleep with the thread lock held.
        net: mvpp2: Use strscpy to handle stat strings
        net: rds: fix memory leak in rds_ib_flush_mr_pool
        ipv6: fix EFAULT on sendto with icmpv6 and hdrincl
        ipv6: use READ_ONCE() for inet->hdrincl as in ipv4
        Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"
        net: aquantia: fix wol configuration not applied sometimes
        ethtool: fix potential userspace buffer overflow
        Fix memory leak in sctp_process_init
        net: rds: fix memory leak when unload rds_rdma
        ipv6: fix the check before getting the cookie in rt6_get_cookie
        ipv4: not do cache for local delivery if bc_forwarding is enabled
        s390/qeth: handle error when updating TX queue count
        s390/qeth: fix VLAN attribute in bridge_hostnotify udev event
        s390/qeth: check dst entry before use
        s390/qeth: handle limited IPv4 broadcast in L3 TX path
        net: fix indirect calls helpers for ptype list hooks.
        net: ipvlan: Fix ipvlan device tso disabled while NETIF_F_IP_CSUM is set
        udp: only choose unbound UDP socket for multicast when not in a VRF
        net/tls: replace the sleeping lock around RX resync with a bit lock
        ...
      1e1d9263
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 6e38335d
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Things are looking pretty quiet here in RDMA, not too many bug fixes
        rolling in right now. The usual driver bug fixes and fixes for a
        couple of regressions introduced in 5.2:
      
         - Fix a race on bootup with RDMA device renaming and srp. SRP also
           needs to rename its internal sys files
      
         - Fix a memory leak in hns
      
         - Don't leak resources in efa on certain error unwinds
      
         - Don't panic in certain error unwinds in ib_register_device
      
         - Various small user visible bug fix patches for the hfi and efa
           drivers
      
         - Fix the 32 bit compilation break"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/efa: Remove MAYEXEC flag check from mmap flow
        mlx5: avoid 64-bit division
        IB/hfi1: Validate page aligned for a given virtual address
        IB/{qib, hfi1, rdmavt}: Correct ibv_devinfo max_mr value
        IB/hfi1: Insure freeze_work work_struct is canceled on shutdown
        IB/rdmavt: Fix alloc_qpn() WARN_ON()
        RDMA/core: Fix panic when port_data isn't initialized
        RDMA/uverbs: Pass udata on uverbs error unwind
        RDMA/core: Clear out the udata before error unwind
        RDMA/hns: Fix PD memory leak for internal allocation
        RDMA/srp: Rename SRP sysfs name after IB device rename trigger
      6e38335d
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · a02a532c
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Another round of mostly-benign fixes, the exception being a boot crash
        on SVE2-capable CPUs (although I don't know where you'd find such a
        thing, so maybe it's benign too).
      
        We're in the process of resolving some big-endian ptrace breakage, so
        I'll probably have some more for you next week.
      
        Summary:
      
         - Fix boot crash on platforms with SVE2 due to missing register
           encoding
      
         - Fix architected timer accessors when CONFIG_OPTIMIZE_INLINING=y
      
         - Move cpu_logical_map into smp.h for use by upcoming irqchip drivers
      
         - Trivial typo fix in comment
      
         - Disable some useless, noisy warnings from GCC 9"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: Silence gcc warnings about arch ABI drift
        ARM64: trivial: s/TIF_SECOMP/TIF_SECCOMP/ comment typo fix
        arm64: arch_timer: mark functions as __always_inline
        arm64: smp: Moved cpu_logical_map[] to smp.h
        arm64: cpufeature: Fix missing ZFR0 in __read_sysreg_by_encoding()
      a02a532c
  3. 06 Jun, 2019 27 commits