1. 14 Jun, 2021 12 commits
  2. 13 Jun, 2021 17 commits
  3. 12 Jun, 2021 11 commits
    • David S. Miller's avatar
      Merge branch 'rmnet-checksums-part-2' · ffbbc5e5
      David S. Miller authored
      Alex Elder says:
      
      ====================
      net: qualcomm: rmnet: MAPv4 download checksum cleanup, part 2
      
      This is part 2 of a large series that reworks some code that handles
      downloaded packets when MAPv4 checksum offload is enabled.  The
      first part, which includes an overview, is here:
        https://lore.kernel.org/netdev/20210611190529.3085813-1-elder@linaro.org/
      
      This second part of the series completes the simplification of this
      handling code, removing unnecessary byte swaps and bitwise inversions
      of checksum values, and along the way avoids the need for almost all
      of the forced type casts.  The checksum field in an RMNet download
      trailer is given __sum16_t type to accurately reflect the meaning of
      that field.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffbbc5e5
    • Alex Elder's avatar
      net: qualcomm: rmnet: IPv6 payload length is simple · 185a108f
      Alex Elder authored
      We don't support any extension headers for IPv6 packets.  Extension
      headers therefore contribute 0 bytes to the payload length.  As a
      result we can just use the IPv6 payload length as the length used to
      compute the pseudo header checksum for both UDP and TCP messages.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      185a108f
    • Alex Elder's avatar
      net: qualcomm: rmnet: drop some unary NOTs · 411a795e
      Alex Elder authored
      We compare a payload checksum with a pseudo checksum value for
      equality in rmnet_map_ipv4_dl_csum_trailer().  Both of those values
      are computed with a unary NOT (~) operation.  The result of the
      comparison is the same if we omit that NOT for both values.
      
      Remove these operations in rmnet_map_ipv6_dl_csum_trailer() also.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      411a795e
    • Alex Elder's avatar
      net: qualcomm: rmnet: trailer value is a checksum · be754f64
      Alex Elder authored
      The csum_value field in the rmnet_map_dl_csum_trailer structure is a
      "real" Internet checksum.  It is a 16 bit value, in big endian format,
      which represents an inverted ones' complement sum over pairs of bytes.
      
      Make that clear by changing its type to __sum16.
      
      This makes a typecast in rmnet_map_ipv4_dl_csum_trailer() and
      another in rmnet_map_ipv6_dl_csum_trailer() unnecessary.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      be754f64
    • Alex Elder's avatar
      net: qualcomm: rmnet: remove unneeded code · 698aa6c4
      Alex Elder authored
      The previous patch makes rmnet_map_ipv4_dl_csum_trailer() return
      early with an error if it is determined that the computed checksum
      for the IP payload does not match what was expected.
      
      If the computed checksum *does* match the expected value, the IP
      payload (i.e., the transport message), can be considered good.
      There is no need to do any further processing of the message.
      
      This means a big block of code is unnecessary for validating the
      transport checksum value, and can be removed.
      
      Make comparable changes in rmnet_map_ipv6_dl_csum_trailer().
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      698aa6c4
    • Alex Elder's avatar
      net: qualcomm: rmnet: return earlier for bad checksum · fab01a6f
      Alex Elder authored
      In rmnet_map_ipv4_dl_csum_trailer(), if the sum of the trailer
      checksum and the pseudo checksum is non-zero, checksum validation
      has failed.  We can return an error as soon as we know that.
      
      We can do the same thing in rmnet_map_ipv6_dl_csum_trailer().
      
      Add some comments that explain where we're headed.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fab01a6f
    • Alex Elder's avatar
      net: qualcomm: rmnet: show that an intermediate sum is zero · 9d0407bc
      Alex Elder authored
      This patch simply demonstrates that a checksum value computed when
      verifying an offloaded transport checksum value for both IPv4 and
      IPv6 is (normally) 0.  It can be squashed into the next patch.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d0407bc
    • Alex Elder's avatar
      net: qualcomm: rmnet: rearrange some NOTs · bbd45f10
      Alex Elder authored
      With the ones' complement arithmetic, the sum of two negated values
      is equal to the negation of the sum of the two original values [1].
      Rearrange the calculation ip6_payload_sum using this property.
      
      [1] https://tools.ietf.org/html/rfc1071Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bbd45f10
    • Alex Elder's avatar
      net: qualcomm: rmnet: remove some local variables · 0e6af897
      Alex Elder authored
      In rmnet_map_ipv4_dl_csum_trailer(), remove the "csum_temp" and
      "addend" local variables, and simplify a few lines of code.
      
      Remove the "csum_temp", "csum_value", "ip6_hdr_csum", and "addend"
      local variables in rmnet_map_ipv6_dl_csum_trailer(), and simplify a
      few lines of code there as well.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e6af897
    • David S. Miller's avatar
      Merge branch 'wwan-link-creation' · 73a37860
      David S. Miller authored
      Loic Poulain says:
      
      ====================
      net: Add WWAN link creation support
      
      Most of the modern WWAN modems are able to support multiple network
      contexts, allowing user to connect to different APNs (e.g. Internet,
      MMS, etc...). These contexts are usually dynamically configured via
      a control channel such as MBIM, QMI or AT.
      
      Each context is naturally represented as a network link/device, and
      the muxing of these links is usually vendor/bus specific (QMAP, MBIM,
      intel iosm...). Today some drivers create a static collection of
      netdevs at init time, some relies on VLAN link for associating a context
      (cdc-mbim), some exposes sysfs attribute for dynamically creating
      additional netdev (qmi_wwan add_mux attr) or relies on vendor specific
      link type (rmnet) for performing the muxing... so there is no generic
      way to handle WWAN links, making user side integration painful.
      
      This series introduces a generic WWAN link management interface to the
      WWAN framework, allowing user to dynamically create and remove WWAN
      links through rtnetlink ('wwan' type). The underlying 'muxing' vendor
      implementation is completely abstracted.
      
      The idea is to use this interface for upcoming WWAN drivers (intel
      iosm) and to progressively integrate support into existing ones
      (qmi_wwan, cdc-mbim, mhi_net, etc...).
      
      v2: - Squashed Johannes and Sergey changes
          - Added IFLA_PARENT_DEV_BUS_NAME attribute
          - reworded commit message + introduce Sergey's comment
      
      v3: - Added basic new interface user to this series (mhi_net)
          - Moved IFLA_PARENT_DEV_NAME nla_policy introduction to right patch
          - Added cover letter
          - moved kdoc to .c file
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73a37860
    • Loic Poulain's avatar
      net: mhi_net: Register wwan_ops for link creation · 13adac03
      Loic Poulain authored
      Register wwan_ops for link management via wwan rtnetlink. This is
      only basic support for now, since we only support creating one
      single link (link-0), but is useful to validate new wwan rtnetlink
      interface.
      
      For backward compatibity support, we still register a default netdev
      at probe time, except if 'create_default_iface' module parameter is
      set to false.
      
      This has been tested with iproute2 and mbimcli:
      $ ip link add dev wwan0-0 parentdev-name wwan0 type wwan linkid 0
      $ mbimcli -p -d /dev/wwan0p2MBIM --connect apn=free
      $ ip link set dev wwan0-0 up
      $ ip addr add dev wwan0 ${IP}
      $ ip route replace default via ${IP}
      $ ping 8.8.8.8
      ...
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      13adac03