1. 14 Jun, 2021 8 commits
  2. 13 Jun, 2021 17 commits
  3. 12 Jun, 2021 15 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
    • Johannes Berg's avatar
      wwan: add interface creation support · 88b71053
      Johannes Berg authored
      Add support to create (and destroy) interfaces via a new
      rtnetlink kind "wwan". The responsible driver has to use
      the new wwan_register_ops() to make this possible.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88b71053
    • Johannes Berg's avatar
      rtnetlink: add IFLA_PARENT_[DEV|DEV_BUS]_NAME · 00e77ed8
      Johannes Berg authored
      In some cases, for example in the upcoming WWAN framework changes,
      there's no natural "parent netdev", so sometimes dummy netdevs are
      created or similar. IFLA_PARENT_DEV_NAME is a new attribute intended to
      contain a device (sysfs, struct device) name that can be used instead
      when creating a new netdev, if the rtnetlink family implements it.
      
      As suggested by Parav Pandit, we also introduce IFLA_PARENT_DEV_BUS_NAME
      attribute in order to uniquely identify a device on the system (with
      bus/name pair).
      
      ip-link(8) support for the generic parent device attributes will help
      us avoid code duplication, so no other link type will require a custom
      code to handle the parent name attribute. E.g. the WWAN interface
      creation command will looks like this:
      
      $ ip link add wwan0-1 parent-dev wwan0 type wwan channel-id 1
      
      So, some future subsystem (or driver) FOO will have an interface
      creation command that looks like this:
      
      $ ip link add foo1-3 parent-dev foo1 type foo bar-id 3 baz-type Y
      
      Below is an example of dumping link info of a random device with these
      new attributes:
      
      $ ip --details link show wlp0s20f3
        4: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
           state UP mode DORMANT group default qlen 1000
           ...
           parent_bus pci parent_dev 0000:00:14.3
      Co-developed-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Co-developed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Suggested-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      00e77ed8
    • Johannes Berg's avatar
      rtnetlink: add alloc() method to rtnl_link_ops · 8c713dc9
      Johannes Berg authored
      In order to make rtnetlink ops that can create different
      kinds of devices, like what we want to add to the WWAN
      framework, the priv_size and setup parameters aren't quite
      sufficient. Make this easier to manage by allowing ops to
      allocate their own netdev via an @alloc method that gets
      the tb netlink data.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c713dc9
    • Lijun Pan's avatar
      ibmvnic: fix kernel build warnings in build_hdr_descs_arr · 73214a69
      Lijun Pan authored
      Fix the following kernel build warnings:
      drivers/net/ethernet/ibm/ibmvnic.c:1516: warning: Function parameter or member 'skb' not described in 'build_hdr_descs_arr'
      drivers/net/ethernet/ibm/ibmvnic.c:1516: warning: Function parameter or member 'indir_arr' not described in 'build_hdr_descs_arr'
      drivers/net/ethernet/ibm/ibmvnic.c:1516: warning: Excess function parameter 'txbuff' description in 'build_hdr_descs_arr'
      Signed-off-by: default avatarLijun Pan <lijunp213@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73214a69