1. 22 Sep, 2021 1 commit
  2. 21 Sep, 2021 9 commits
  3. 20 Sep, 2021 15 commits
  4. 19 Sep, 2021 8 commits
  5. 18 Sep, 2021 7 commits
    • David S. Miller's avatar
      Merge branch 'mptcp-next' · 983e59a2
      David S. Miller authored
      Mat Martineau says:
      
      ====================
      mptcp: Add SOL_MPTCP getsockopt support
      
      Here's the first new MPTCP feature for the v5.16 cycle, and I'll defer
      to Florian's helpful description of the series implementing some new
      MPTCP socket options:
      
      ========
      
      This adds the MPTCP_INFO, MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS
      mptcp getsockopt optnames.
      
      MPTCP_INFO exposes the mptcp_info struct as an alternative to the
      existing netlink diag interface.
      
      MPTCP_TCPINFO exposes the tcp_info struct.
      Unlike SOL_TCP/TCP_INFO, this returns one struct for each active
      subflow.
      
      MPTCP_SUBFLOW_ADDRS allows userspace to discover the ip addresses/ports
      used by the local and remote endpoints, one for each active tcp subflow.
      
      MPTCP_TCPINFO and MPTCP_SUBFLOW_ADDRS share the same meta-header that
      needs to be pre-filled by userspace with the size of the data structures
      it expects.  This is done to allow extension of the involved structs
      later on, without breaking backwards compatibility.
      
      The meta-structure can also be used to discover the required space
      to obtain all information, as kernel will fill in the number of
      active subflows even if there is not enough room for the requested info
      itself.
      
      More information is available in the individual patches.
      Last patch adds test cases for the three optnames.
      
      ========
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      983e59a2
    • Florian Westphal's avatar
      selftests: mptcp: add mptcp getsockopt test cases · ce997912
      Florian Westphal authored
      Add a test program that retrieves the three info types:
      1. mptcp meta information
      2. tcp info for subflow
      3. subflow endpoint addresses
      
      For all three rudimentary checks are added.
      
      1. Meta information checks that the logical mptcp
         sequence numbers advance as expected, based on the bytes read
         (init seq + bytes_received/sent) and the connection state
         (after close, we should exect 1 extra byte due to FIN).
      
      2. TCP info checks the number of bytes sent/received vs.
         sums of read/write syscall return values.
      
      3. Subflow endpoint addresses are checked vs. getsockname/getpeername
         result.
      
      Tests for forward compatibility (0-initialisation of output-only
      fields in mptcp_subflow_data structure) are added as well.
      Co-developed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce997912
    • Florian Westphal's avatar
      mptcp: add MPTCP_SUBFLOW_ADDRS getsockopt support · c11c5906
      Florian Westphal authored
      This retrieves the address pairs of all subflows currently
      active for a given mptcp connection.
      
      It re-uses the same meta-header as for MPTCP_TCPINFO.
      
      A new structure is provided to hold the subflow
      address data:
      
      struct mptcp_subflow_addrs {
      	union {
      		__kernel_sa_family_t sa_family;
      		struct sockaddr sa_local;
      		struct sockaddr_in sin_local;
      		struct sockaddr_in6 sin6_local;
      		struct sockaddr_storage ss_local;
      	};
      	union {
      		struct sockaddr sa_remote;
      		struct sockaddr_in sin_remote;
      		struct sockaddr_in6 sin6_remote;
      		struct sockaddr_storage ss_remote;
      	};
      };
      
      Usage of the new getsockopt is very similar to
      MPTCP_TCPINFO one.
      
      Userspace allocates a
      'struct mptcp_subflow_data', followed by one or
      more 'struct mptcp_subflow_addrs', then inits the
      mptcp_subflow_data structure as follows:
      
      struct mptcp_subflow_addrs *sf_addr;
      struct mptcp_subflow_data *addr;
      socklen_t olen = sizeof(*addr) + (8 * sizeof(*sf_addr));
      
      addr = malloc(olen);
      addr->size_subflow_data = sizeof(*addr);
      addr->num_subflows = 0;
      addr->size_kernel = 0;
      addr->size_user = sizeof(struct mptcp_subflow_addrs);
      
      sf_addr = (struct mptcp_subflow_addrs *)(addr + 1);
      
      and then retrieves the endpoint addresses via:
      ret = getsockopt(fd, SOL_MPTCP, MPTCP_SUBFLOW_ADDRS,
      		 addr, &olen);
      
      If the call succeeds, kernel will have added up to 8
      endpoint addresses after the 'mptcp_subflow_data' header.
      
      Userspace needs to re-check 'olen' value to detect how
      many bytes have been filled in by the kernel.
      
      Userspace can check addr->num_subflows to discover when
      there were more subflows that available data space.
      Co-developed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c11c5906
    • Florian Westphal's avatar
      mptcp: add MPTCP_TCPINFO getsockopt support · 06f15cee
      Florian Westphal authored
      Allow users to retrieve TCP_INFO data of all subflows.
      
      Users need to pre-initialize a meta header that has to be
      prepended to the data buffer that will be filled with the tcp info data.
      
      The meta header looks like this:
      
      struct mptcp_subflow_data {
       __u32 size_subflow_data;/* size of this structure in userspace */
       __u32 num_subflows;	/* must be 0, set by kernel */
       __u32 size_kernel;	/* must be 0, set by kernel */
       __u32 size_user;	/* size of one element in data[] */
      } __attribute__((aligned(8)));
      
      size_subflow_data has to be set to 'sizeof(struct mptcp_subflow_data)'.
      This allows to extend mptcp_subflow_data structure later on without
      breaking backwards compatibility.
      
      If the structure is extended later on, kernel knows where the
      userspace-provided meta header ends, even if userspace uses an older
      (smaller) version of the structure.
      
      num_subflows must be set to 0. If the getsockopt request succeeds (return
      value is 0), it will be updated to contain the number of active subflows
      for the given logical connection.
      
      size_kernel must be set to 0. If the getsockopt request is successful,
      it will contain the size of the 'struct tcp_info' as known by the kernel.
      This is informational only.
      
      size_user must be set to 'sizeof(struct tcp_info)'.
      
      This allows the kernel to only fill in the space reserved/expected by
      userspace.
      
      Example:
      
      struct my_tcp_info {
        struct mptcp_subflow_data d;
        struct tcp_info ti[2];
      };
      struct my_tcp_info ti;
      socklen_t olen;
      
      memset(&ti, 0, sizeof(ti));
      
      ti.d.size_subflow_data = sizeof(struct mptcp_subflow_data);
      ti.d.size_user = sizeof(struct tcp_info);
      olen = sizeof(ti);
      
      ret = getsockopt(fd, SOL_MPTCP, MPTCP_TCPINFO, &ti, &olen);
      if (ret < 0)
      	die_perror("getsockopt MPTCP_TCPINFO");
      
      mptcp_subflow_data.num_subflows is populated with the number of
      subflows that exist on the kernel side for the logical mptcp connection.
      
      This allows userspace to re-try with a larger tcp_info array if the number
      of subflows was larger than the available space in the ti[] array.
      
      olen has to be set to the number of bytes that userspace has allocated to
      receive the kernel data.  It will be updated to contain the real number
      bytes that have been copied to by the kernel.
      
      In the above example, if the number if subflows was 1, olen is equal to
      'sizeof(struct mptcp_subflow_data) + sizeof(struct tcp_info).
      For 2 or more subflows olen is equal to 'sizeof(struct my_tcp_info)'.
      
      If there was more data that could not be copied due to lack of space
      in the option buffer, userspace can detect this by checking
      mptcp_subflow_data->num_subflows.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06f15cee
    • Florian Westphal's avatar
      mptcp: add MPTCP_INFO getsockopt · 55c42fa7
      Florian Westphal authored
      Its not compatible with multipath-tcp.org kernel one.
      
      1. The out-of-tree implementation defines a different 'struct mptcp_info',
         with embedded __user addresses for additional data such as
         endpoint addresses.
      
      2. Mat Martineau points out that embedded __user addresses doesn't work
      with BPF_CGROUP_RUN_PROG_GETSOCKOPT() which assumes that copying in
      optsize bytes from optval provides all data that got copied to userspace.
      
      This provides mptcp_info data for the given mptcp socket.
      
      Userspace sets optlen to the size of the structure it expects.
      The kernel updates it to contain the number of bytes that it copied.
      
      This allows to append more information to the structure later.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55c42fa7
    • Florian Westphal's avatar
      mptcp: add new mptcp_fill_diag helper · 61bc6e82
      Florian Westphal authored
      Will be re-used from getsockopt path.
      Since diag can be a module, we can't export the helper from diag, it
      needs to be moved to core.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61bc6e82
    • David S. Miller's avatar
      Merge branch 'macb-MII-on-RGMII' · 95dca2d5
      David S. Miller authored
      Claudiu Beznea says:
      
      ====================
      net: macb: add support for MII on RGMII interface
      
      This series adds support for MII mode on RGMII interface (patches 3/4,
      4/4). Along with this the series also contains minor cleanups (patches 1/3,
      2/3) on macb.h.
      
      Changes in v2:
      - added patch 4/4 to enable MII on RGMII support for SAMA7G5 MAC IPs
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      95dca2d5