20 Nov, 2020

1 commit

  • With the multi-subnet support of SMC-Dv2 the match for existing link
    groups should not include the vlanid of the network device.
    Set ini->smcd_version accordingly before the call to smc_conn_create()
    and use this value in smc_conn_create() to skip the vlanid check.

    Fixes: 5c21c4ccafe8 ("net/smc: determine accepted ISM devices")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     

27 Oct, 2020

1 commit

  • smc_listen_work() calls smc_listen_decline() on label out_decl,
    providing the ini pointer variable. But this pointer can still be null
    when the label out_decl is reached.
    Fix this by checking the ini variable in smc_listen_work() and call
    smc_listen_decline() with the result directly.

    Fixes: a7c9c5f4af7f ("net/smc: CLC accept / confirm V2")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     

10 Oct, 2020

3 commits

  • Field ini->smcd_version is set to SMC_V2 before calling
    smc_listen_ism_init(). This clears the V1 bit that may be set. When all
    matching ISM V2 devices fail to initialize then the smcd_version field
    needs to get restored to allow any possible V1 devices to initialize.
    And be consistent, always go to the not_found label when no device was
    found.

    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • coccinelle informs about
    net/smc/af_smc.c:1770:10-11: WARNING: opportunity for kzfree/kvfree_sensitive

    Its not that kzfree() would help here, the memset() is done to prepare
    the buffer for another socket receive.
    Fix that warning message by reordering the calls, while at it eliminate
    the unneeded variable cclc2 and use sizeof(*buf) as above in the same
    function. No functional changes.

    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • Static code checkers warn of inconsistent returns because the lgr mutex
    is locked in one function and unlocked in a function called by the
    locking function:
    net/smc/af_smc.c:823 smc_connect_rdma() warn: inconsistent returns 'smc_client_lgr_pending'.
    net/smc/af_smc.c:897 smc_connect_ism() warn: inconsistent returns 'smc_server_lgr_pending'.

    Make the code consistent by doing the unlock in the same function that
    fetches the lock. No functional changes.

    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     

04 Oct, 2020

1 commit

  • When building a CLC proposal message then the list of ISM devices does
    not need to contain multiple devices that have the same chid value,
    all these devices use the same function at the end.
    Improve smc_find_ism_v2_device_clnt() to collect only ISM devices that
    have unique chid values.

    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     

29 Sep, 2020

11 commits

  • This patch covers the small SMCD version 2 changes for CLC decline.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMC Version 2 defines a first contact extension for CLC accept
    and CLC confirm. This patch covers sending and receiving of the
    CLC first contact extension.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • The new format of SMCD V2 CLC accept and confirm is introduced,
    and building and checking of SMCD V2 CLC accepts / confirms is adapted
    accordingly.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMCD Version 2 allows to propose up to 8 additional ISM devices
    offered to the peer as candidates for SMCD communication.
    This patch covers the server side, i.e. selection of an ISM device
    matching one of the proposed ISM devices, that will be used for
    CLC accept

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • The new format of an SMCD V2 CLC proposal is introduced, and
    building and checking of SMCD V2 CLC proposals is adapted
    accordingly.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMCD Version 2 allows to propose up to 8 additional ISM devices
    offered to the peer as candidates for SMCD communication.
    This patch covers determination of the ISM devices to be proposed.
    ISM devices without PNETID are preferred, since ISM devices with
    PNETID are a V1 leftover and will disappear over the time.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • With SMCD version 2 the CHIDs of ISM devices are needed for the
    CLC handshake.
    This patch provides the new callback to retrieve the CHID of an
    ISM device.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMCD version 2 defines a System Enterprise ID (short SEID).
    This patch contains the SEID creation and adds the callback to
    retrieve the created SEID.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMCD Version 2 allows proposing of up to 8 ISM devices in addition
    to the native ISM device of SMCD Version 1.
    This patch prepares the struct smc_init_info to deal with these
    additional 8 ISM devices.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • This patch provides better separation of device determinations
    in function smc_listen_work(). No functional change.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMCD version 2 defines 2 more bits in the CLC header to specify
    version 2 types. This patch prepares better naming of the CLC
    header fields. No functional change.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     

18 Sep, 2020

1 commit

  • If smc_listen_rmda_finish() returns with an error, the storage
    addressed by 'buf' is freed a second time.
    Consolidate freeing under a common label and jump to that label.

    Fixes: 6bb14e48ee8d ("net/smc: dynamic allocation of CLC proposal buffer")
    Reported-by: Dan Carpenter
    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     

11 Sep, 2020

7 commits

  • There are 6 types of workers which exist per smc connection. 3 of them
    are used for listen and handshake processing, another 2 are used for
    close and abort processing and 1 is the tx worker that moves calls to
    sleeping functions into a worker.
    To prevent flooding of the system work queue when many connections are
    opened or closed at the same time (some pattern uperf implements), move
    those workers to one of 3 smc-specific work queues. Two work queues are
    module-global and used for handshake and close workers. The third work
    queue is defined per link group and used by the tx workers that may
    sleep waiting for resources of this link group.
    And in smc_llc_enqueue() queue the llc_event_work work to the system
    prio work queue because its critical that this work is started fast.

    Reviewed-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     
  • smc_listen_work() contains already an smc_listen_decline() exit.
    Use this exit for smc_listen_rdma_finish() problems as well.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • Move check whether peer can be reached into smc_pnet_find_ism_by_pnetid().
    Thus searching continues for another ism device, if check fails.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • smc_clc_send_accept() and smc_clc_send_confirm() are quite similar.
    Move common code into a separate function smc_clc_send_confirm_accept().
    And introduce separate SMCD and SMCR struct definitions for CLC accept
    resp. confirm.
    No functional change.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • Reduce stack size for smc_listen_work() and smc_clc_send_proposal()
    by dynamic allocation of the CLC buffer to be received or sent.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • Field names "srv_first_contact" and "cln_first_contact" are misleading,
    since they apply to both, server and client. Rename them to
    "first_contact_peer" and "first_contact_local".
    Rename "ism_gid" by the more precise name "ism_peer_gid".
    Rename version constant "SMC_CLC_V1" into "SMC_V1".
    No functional change.

    Signed-off-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • SMC starts a separate tcp_listen worker for every SMC socket in
    state SMC_LISTEN, and can accept an incoming connection request only,
    if this worker is really running and waiting in kernel_accept(). But
    the number of running workers is limited.
    This patch reworks the listening SMC code and starts a tcp_listen worker
    after the SYN-ACK handshake on the internal clc-socket only.

    Suggested-by: Karsten Graul
    Signed-off-by: Ursula Braun
    Reviewed-by: Guvenc Gulce
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Ursula Braun
     

28 Jul, 2020

1 commit

  • When the maximum dmb buffer limit for an ism device is reached no more
    dmb buffers can be registered. When this happens the reason code is set
    to SMC_CLC_DECL_MEM indicating out-of-memory. This is the same reason
    code that is used when no memory could be allocated for the new dmb
    buffer.
    This is confusing for users when they see this error but there is more
    memory available. To solve this set a separate new reason code when the
    maximum dmb limit exceeded.

    Reviewed-by: Ursula Braun
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     

26 Jul, 2020

1 commit

  • The UDP reuseport conflict was a little bit tricky.

    The net-next code, via bpf-next, extracted the reuseport handling
    into a helper so that the BPF sk lookup code could invoke it.

    At the same time, the logic for reuseport handling of unconnected
    sockets changed via commit efc6b6f6c3113e8b203b9debfb72d81e0f3dcace
    which changed the logic to carry on the reuseport result into the
    rest of the lookup loop if we do not return immediately.

    This requires moving the reuseport_has_conns() logic into the callers.

    While we are here, get rid of inline directives as they do not belong
    in foo.c files.

    The other changes were cases of more straightforward overlapping
    modifications.

    Signed-off-by: David S. Miller

    David S. Miller
     

25 Jul, 2020

1 commit

  • Rework the remaining setsockopt code to pass a sockptr_t instead of a
    plain user pointer. This removes the last remaining set_fs(KERNEL_DS)
    outside of architecture specific code.

    Signed-off-by: Christoph Hellwig
    Acked-by: Stefan Schmidt [ieee802154]
    Acked-by: Matthieu Baerts
    Signed-off-by: David S. Miller

    Christoph Hellwig
     

20 Jul, 2020

4 commits

  • Just check for a NULL method instead of wiring up
    sock_no_{get,set}sockopt.

    Signed-off-by: Christoph Hellwig
    Acked-by: Marc Kleine-Budde
    Signed-off-by: David S. Miller

    Christoph Hellwig
     
  • When a listen socket is closed then all non-accepted sockets in its
    accept queue are to be released. Inside __smc_release() the helper
    smc_restore_fallback_changes() restores the changes done to the socket
    without to check if the clcsocket has a file set. This can result in
    a crash. Fix this by checking the file pointer first.

    Reviewed-by: Ursula Braun
    Fixes: f536dffc0b79 ("net/smc: fix closing of fallback SMC sockets")
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     
  • The dma related ...sync_sg... functions check the link state before the
    dma function is actually called. But the check in smc_link_usable()
    allows links in ACTIVATING state which are not yet mapped to dma memory.
    Under high load it may happen that the sync_sg functions are called for
    such a link which results in an debug output like
    DMA-API: mlx5_core 0002:00:00.0: device driver tries to sync
    DMA memory it has not allocated [device address=0x0000000103370000]
    [size=65536 bytes]
    To fix that introduce a helper to check for the link state ACTIVE and
    use it where appropriate. And move the link state update to ACTIVATING
    to the end of smcr_link_init() when most initial setup is done.

    Reviewed-by: Ursula Braun
    Fixes: d854fcbfaeda ("net/smc: add new link state and related helpers")
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     
  • For new rdma connections the SMC server assigns the link and sends the
    link data in the clc accept message. To match the correct link use not
    only the qp_num but also the gid and the mac of the links. If there are
    equal qp_nums for different links the wrong link would be chosen.

    Reviewed-by: Ursula Braun
    Fixes: 0fb0b02bd6fd ("net/smc: adapt SMC client code to use the LLC flow")
    Signed-off-by: Karsten Graul
    Signed-off-by: David S. Miller

    Karsten Graul
     

06 May, 2020

1 commit

  • Print to system log when SMC links are available or go down, link group
    state changes or pnetids are applied to and removed from devices.
    The log entries are triggered by either user configuration actions or
    adapter activation/deactivation events and are not expected to happen
    often. The entries help SMC users to keep track of the SMC link group
    status and to detect when actions are needed (like to add replacements
    for failed adapters).

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     

05 May, 2020

1 commit

  • During SMC-R link establishment the peers exchange the link_uid that
    is used for debugging purposes. Save the peer link_uid in smc_link so it
    can be retrieved by the smc_diag netlink interface.

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     

04 May, 2020

2 commits

  • First set of functions to process an ADD_LINK LLC request as an SMC
    server. Find an alternate IB device, determine the new link group type
    and get the index for the new link. Then initialize the link and send
    the ADD_LINK LLC message to the peer. Save the contents of the response,
    ready the link, map all used buffers and register the buffers with the
    IB device. If any error occurs, stop the processing and clear the link.
    And call smc_llc_srv_add_link() in af_smc.c to start second link
    establishment after the initial link of a link group was created.

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     
  • This patch finalizes the ADD_LINK processing of new links. Receive the
    CONFIRM_LINK request from peer, complete the link initialization,
    register all used buffers with the IB device and finally send the
    CONFIRM_LINK response, which completes the ADD_LINK processing.
    And activate smc_llc_cli_add_link() in af_smc.c.

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     

02 May, 2020

2 commits

  • Introduce llc_conf_mutex in the link group which is used to protect the
    buffers and lgr states against parallel link reconfiguration.
    This ensures that new connections do not start to register buffers with
    the links of a link group when link creation or termination is running.

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     
  • The CONFIRM_RKEY LLC processing handles all links in one LLC message.
    Move the call to this processing out of smcr_link_reg_rmb() which does
    processing per link, into smcr_lgr_reg_rmbs() which is responsible for
    link group level processing. Move smcr_link_reg_rmb() into module
    smc_core.c.
    >From af_smc.c now call smcr_lgr_reg_rmbs() to register new rmbs on all
    available links.

    Signed-off-by: Karsten Graul
    Reviewed-by: Ursula Braun
    Signed-off-by: David S. Miller

    Karsten Graul
     

01 May, 2020

2 commits