Skip to content
Permalink
Lorenzo-Bianco…
Switch branches/tags

Commits on Aug 13, 2021

  1. bpf: add bpf_xdp_adjust_data selftest

    Introduce kernel selftest for new bpf_xdp_adjust_data helper.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  2. net: xdp: introduce bpf_xdp_adjust_data helper

    For XDP frames split over multiple buffers, the xdp_md->data and
    xdp_md->data_end pointers will point to the start and end of the first
    fragment only. bpf_xdp_adjust_data can be used to access subsequent
    fragments by moving the data pointers. To use, an XDP program can call
    this helper with the byte offset of the packet payload that
    it wants to access; the helper will move xdp_md->data and xdp_md ->data_end
    so they point to the requested payload offset and to the end of the
    fragment containing this byte offset, and return the byte offset of the
    start of the fragment.
    To move back to the beginning of the packet, simply call the
    helper with an offset of '0'.
    Note also that the helpers that modify the packet boundaries
    (bpf_xdp_adjust_head(), bpf_xdp_adjust_tail() and
    bpf_xdp_adjust_meta()) will fail if the pointers have been
    moved; it is the responsibility of the BPF program to move them
    back before using these helpers.
    
    Suggested-by: John Fastabend <john.fastabend@gmail.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  3. bpf: update xdp_adjust_tail selftest to include multi-buffer

    This change adds test cases for the multi-buffer scenarios when shrinking
    and growing.
    
    Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    chaudron authored and intel-lab-lkp committed Aug 13, 2021
  4. bpf: test_run: add xdp_shared_info pointer in bpf_test_finish signature

    introduce xdp_shared_info pointer in bpf_test_finish signature in order
    to copy back paged data from a xdp multi-buff frame to userspace buffer
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  5. bpf: introduce multibuff support to bpf_prog_test_run_xdp()

    Introduce the capability to allocate a xdp multi-buff in
    bpf_prog_test_run_xdp routine. This is a preliminary patch to introduce
    the selftests for new xdp multi-buff ebpf helpers
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  6. bpf: move user_size out of bpf_test_init

    Rely on data_size_in in bpf_test_init routine signature. This is a
    preliminary patch to introduce xdp multi-buff selftest
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  7. bpf: add multi-buffer support to xdp copy helpers

    This patch adds support for multi-buffer for the following helpers:
      - bpf_xdp_output()
      - bpf_perf_event_output()
    
    Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    chaudron authored and intel-lab-lkp committed Aug 13, 2021
  8. bpf: introduce bpf_xdp_get_buff_len helper

    Introduce bpf_xdp_get_buff_len helper in order to return the xdp buffer
    total size (linear and paged area)
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  9. bpf: add multi-buff support to the bpf_xdp_adjust_tail() API

    This change adds support for tail growing and shrinking for XDP multi-buff.
    
    When called on a multi-buffer packet with a grow request, it will always
    work on the last fragment of the packet. So the maximum grow size is the
    last fragments tailroom, i.e. no new buffer will be allocated.
    
    When shrinking, it will work from the last fragment, all the way down to
    the base buffer depending on the shrinking size. It's important to mention
    that once you shrink down the fragment(s) are freed, so you can not grow
    again to the original size.
    
    Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
    chaudron authored and intel-lab-lkp committed Aug 13, 2021
  10. net: mvneta: enable jumbo frames for XDP

    Enable the capability to receive jumbo frames even if the interface is
    running in XDP mode
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  11. net: mvneta: add multi buffer support to XDP_TX

    Introduce the capability to map non-linear xdp buffer running
    mvneta_xdp_submit_frame() for XDP_TX and XDP_REDIRECT
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  12. xdp: add multi-buff support to xdp_return_{buff/frame}

    Take into account if the received xdp_buff/xdp_frame is non-linear
    recycling/returning the frame memory to the allocator or into
    xdp_frame_bulk.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  13. net: marvell: rely on xdp_update_skb_shared_info utility routine

    Rely on xdp_update_skb_shared_info routine in order to avoid
    resetting frags array in skb_shared_info structure building
    the skb in mvneta_swbm_build_skb(). Frags array is expected to
    be initialized by the receiving driver building the xdp_buff
    and here we just need to update memory metadata.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  14. net: xdp: add xdp_update_skb_shared_info utility routine

    Introduce xdp_update_skb_shared_info routine to update frags array
    metadata in skb_shared_info data structure converting to a skb from
    a xdp_buff or xdp_frame.
    According to the current skb_shared_info architecture in
    xdp_frame/xdp_buff and to the xdp multi-buff support, there is
    no need to run skb_add_rx_frag() and reset frags array converting the buffer
    to a skb since the frag array will be in the same position for xdp_buff/xdp_frame
    and for the skb, we just need to update memory metadata.
    Introduce XDP_FLAGS_PF_MEMALLOC flag in xdp_buff_flags in order to mark
    the xdp_buff or xdp_frame as under memory-pressure if pages of the frags array
    are under memory pressure. Doing so we can avoid looping over all fragments in
    xdp_update_skb_shared_info routine. The driver is expected to set the
    flag constructing the xdp_buffer using xdp_buff_set_frag_pfmemalloc
    utility routine.
    Rely on xdp_update_skb_shared_info in __xdp_build_skb_from_frame routine
    converting the multi-buff xdp_frame to a skb after performing a XDP_REDIRECT.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  15. net: mvneta: simplify mvneta_swbm_add_rx_fragment management

    Relying on xdp mb bit, remove skb_shared_info structure allocated on the
    stack in mvneta_rx_swbm routine and simplify mvneta_swbm_add_rx_fragment
    accessing skb_shared_info in the xdp_buff structure directly. There is no
    performance penalty in this approach since mvneta_swbm_add_rx_fragment
    is run just for multi-buff use-case.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  16. net: mvneta: update mb bit before passing the xdp buffer to eBPF layer

    Update multi-buffer bit (mb) in xdp_buff to notify XDP/eBPF layer and
    XDP remote drivers if this is a "non-linear" XDP buffer. Access
    skb_shared_info only if xdp_buff mb is set in order to avoid possible
    cache-misses.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  17. xdp: introduce flags field in xdp_buff/xdp_frame

    Introduce flags field in xdp_frame and xdp_buffer data structures
    to define additional buffer features. At the moment the only
    supported buffer feature is multi-buffer bit (mb). Multi-buffer bit
    is used to specify if this is a linear buffer (mb = 0) or a multi-buffer
    frame (mb = 1). In the latter case the driver is expected to initialize
    the skb_shared_info structure at the end of the first buffer to link
    together subsequent buffers belonging to the same frame.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021
  18. net: skbuff: add size metadata to skb_shared_info for xdp

    Introduce xdp_frags_tsize field in skb_shared_info data structure
    to store xdp_buff/xdp_frame truesize (xdp_frags_tsize will be used
    in xdp multi-buff support). In order to not increase skb_shared_info
    size we will use a hole due to skb_shared_info alignment.
    Introduce xdp_frags_size field in skb_shared_info data structure
    reusing gso_type field in order to store xdp_buff/xdp_frame paged size.
    xdp_frags_size will be used in xdp multi-buff support.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    LorenzoBianconi authored and intel-lab-lkp committed Aug 13, 2021

Commits on Aug 11, 2021

  1. selftests/bpf: Fix running of XDP bonding tests

    An "innocent" cleanup in the last version of the XDP bonding patchset moved
    the "test__start_subtest" calls to the test main function, but I forgot to
    reverse the condition, which lead to all tests being skipped. Fix it.
    
    Fixes: 6aab1c8 ("selftests/bpf: Add tests for XDP bonding")
    Signed-off-by: Jussi Maki <joamaki@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20210811123627.20223-1-joamaki@gmail.com
    joamaki authored and borkmann committed Aug 11, 2021
  2. Merge branch 'dsa-tagger-helpers'

    Vladimir Oltean says:
    
    ====================
    DSA tagger helpers
    
    The goal of this series is to minimize the use of memmove and skb->data
    in the DSA tagging protocol drivers. Unfiltered access to this level of
    information is not very friendly to drive-by contributors, and sometimes
    is also not the easiest to review.
    
    For starters, I have converted the most common form of DSA tagging
    protocols: the DSA headers which are placed where the EtherType is.
    
    The helper functions introduced by this series are:
    - dsa_alloc_etype_header
    - dsa_strip_etype_header
    - dsa_etype_header_pos_rx
    - dsa_etype_header_pos_tx
    
    This series is just a resend as non-RFC of v1.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 11, 2021
  3. net: dsa: create a helper for locating EtherType DSA headers on TX

    Create a similar helper for locating the offset to the DSA header
    relative to skb->data, and make the existing EtherType header taggers to
    use it.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 11, 2021
  4. net: dsa: create a helper for locating EtherType DSA headers on RX

    It seems that protocol tagging driver writers are always surprised about
    the formula they use to reach their EtherType header on RX, which
    becomes apparent from the fact that there are comments in multiple
    drivers that mention the same information.
    
    Create a helper that returns a void pointer to skb->data - 2, as well as
    centralize the explanation why that is the case.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 11, 2021
  5. net: dsa: create a helper which allocates space for EtherType DSA hea…

    …ders
    
    Hide away the memmove used by DSA EtherType header taggers to shift the
    MAC SA and DA to the left to make room for the header, after they've
    called skb_push(). The call to skb_push() is still left explicit in
    drivers, to be symmetric with dsa_strip_etype_header, and because not
    all callers can be refactored to do it (for example, brcm_tag_xmit_ll
    has common code for a pre-Ethernet DSA tag and an EtherType DSA tag).
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 11, 2021
  6. net: dsa: create a helper that strips EtherType DSA headers on RX

    All header taggers open-code a memmove that is fairly not all that
    obvious, and we can hide the details behind a helper function, since the
    only thing specific to the driver is the length of the header tag.
    
    Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Andrew Lunn <andrew@lunn.ch>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    vladimiroltean authored and davem330 committed Aug 11, 2021
  7. Merge branch 'devlink-aux-devices'

    Parav Pandit says:
    
    ====================
    devlink: Control auxiliary devices
    
    Currently, for mlx5 multi-function device, a user is not able to control
    which functionality to enable/disable. For example, each PCI
    PF, VF, SF function by default has netdevice, RDMA and vdpa-net
    devices always enabled.
    
    Hence, enable user to control which device functionality to enable/disable.
    
    This is achieved by using existing devlink params [1] to
    enable/disable eth, rdma and vdpa net functionality control knob.
    
    For example user interested in only vdpa device function: performs,
    
    $ devlink dev param set pci/0000:06:00.0 name enable_rdma value false \
                       cmode driverinit
    $ devlink dev param set pci/0000:06:00.0 name enable_eth value false \
                       cmode driverinit
    $ devlink dev param set pci/0000:06:00.0 name enable_vnet value true \
                       cmode driverinit
    
    $ devlink dev reload pci/0000:06:00.0
    
    Reload command honors parameters set, initializes the device that user
    has composed using devlink dev params and resources.
    Devices before reload:
    
                mlx5_core.sf.4
             (subfunction device)
                      /\
                     /| \
                    / |  \
                   /  |   \
     mlx5_core.eth.4  |  mlx5_core.rdma.4
    (SF eth aux dev)  |  (SF rdma aux dev)
        |             |        |
        |             |        |
     enp6s0f0s88      |      mlx5_0
     (SF netdev)      |  (SF rdma device)
                      |
             mlx5_core.vnet.4
             (SF vnet aux dev)
                     |
                     |
            auxiliary/mlx5_core.sf.4
            (vdpa net mgmt device)
    
    Above example reconfigures the device with only VDPA functionality.
    Devices after reload:
    
                mlx5_core.sf.4
             (subfunction device)
                      /\
                     /  \
                    /    \
                   /      \
     mlx5_core.vnet.4     no eth, no rdma aux devices
     (SF vnet aux dev)
    
    Above parameters enable user to compose the device as needed based
    on the use case.
    
    Since devlink params are done on the devlink instance, these
    knobs are uniformly usable for PCI PF, VF and SF devices.
    ====================
    
    Signed-off-by: David S. Miller <davem@davemloft.net>
    davem330 committed Aug 11, 2021
  8. net/mlx5: Support enable_vnet devlink dev param

    Enable user to disable VDPA net auxiliary device so that when it is not
    required, user can disable it.
    
    For example,
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_vnet value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create auxiliary device
    mlx5_core.vnet.2 for the VDPA net functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  9. net/mlx5: Support enable_rdma devlink dev param

    Enable user to disable RDMA auxiliary device so that when it is not
    required, user can disable it.
    
    For example,
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_rdma value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create auxiliary device
    mlx5_core.rdma.2 for the RDMA functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  10. net/mlx5: Support enable_eth devlink dev param

    Enable user to disable Ethernet auxiliary device so that when it is not
    required, user can disable it.
    
    For example,
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_eth value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create mlx5_core.eth.2 auxiliary
    device for the Ethernet functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  11. net/mlx5: Fix unpublish devlink parameters

    Cleanup routine missed to unpublish the parameters. Add it.
    
    Fixes: e890acd ("net/mlx5: Add devlink flow_steering_mode parameter")
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  12. devlink: Add APIs to publish, unpublish individual parameter

    Enable drivers to publish/unpublish individual parameter.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  13. devlink: Add API to register and unregister single parameter

    Currently device configuration parameters can be registered as an array.
    Due to this a constant array must be registered. A single driver
    supporting multiple devices each with different device capabilities end
    up registering all parameters even if it doesn't support it.
    
    One possible workaround a driver can do is, it registers multiple single
    entry arrays to overcome such limitation.
    
    Better is to provide a API that enables driver to register/unregister a
    single parameter. This also further helps in two ways.
    (1) to reduce the memory of devlink_param_entry by avoiding in registering
    parameters which are not supported by the device.
    (2) avoid generating multiple parameter add, delete, publish, unpublish,
    init value notifications for such unsupported parameters
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  14. devlink: Create a helper function for one parameter registration

    Create and use a helper function for one parameter registration.
    Subsequent patch also will reuse this for driver facing routine to
    register a single parameter.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  15. devlink: Add new "enable_vnet" generic device param

    Add new device generic parameter to enable/disable creation of
    VDPA net auxiliary device and associated device functionality
    in the devlink instance.
    
    User who prefers to disable such functionality can disable it using below
    example.
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_vnet value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create auxiliary device for the
    VDPA net functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  16. devlink: Add new "enable_rdma" generic device param

    Add new device generic parameter to enable/disable creation of
    RDMA auxiliary device and associated device functionality
    in the devlink instance.
    
    User who prefers to disable such functionality can disable it using below
    example.
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_rdma value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create auxiliary device for the
    RDMA functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
  17. devlink: Add new "enable_eth" generic device param

    Add new device generic parameter to enable/disable creation of
    Ethernet auxiliary device and associated device functionality
    in the devlink instance.
    
    User who prefers to disable such functionality can disable it using below
    example.
    
    $ devlink dev param set pci/0000:06:00.0 \
                  name enable_eth value false cmode driverinit
    $ devlink dev reload pci/0000:06:00.0
    
    At this point devlink instance do not create auxiliary device for the
    Ethernet functionality.
    
    Signed-off-by: Parav Pandit <parav@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    paravmellanox authored and davem330 committed Aug 11, 2021
Older