20 Nov, 2020

2 commits

  • Sparse complaints 3 times about:
    net/smc/smc_ib.c:203:52: warning: incorrect type in argument 1 (different address spaces)
    net/smc/smc_ib.c:203:52: expected struct net_device const *dev
    net/smc/smc_ib.c:203:52: got struct net_device [noderef] __rcu *const ndev

    Fix that by using the existing and validated ndev variable instead of
    accessing attr->ndev directly.

    Fixes: 5102eca9039b ("net/smc: Use rdma_read_gid_l2_fields to L2 fields")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • 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
     

01 Nov, 2020

1 commit

  • …linux/kernel/git/gustavoars/linux

    Pull more flexible-array member conversions from Gustavo A. R. Silva:
    "Replace zero-length arrays with flexible-array members"

    * tag 'flexible-array-conversions-5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux:
    printk: ringbuffer: Replace zero-length array with flexible-array member
    net/smc: Replace zero-length array with flexible-array member
    net/mlx5: Replace zero-length array with flexible-array member
    mei: hw: Replace zero-length array with flexible-array member
    gve: Replace zero-length array with flexible-array member
    Bluetooth: btintel: Replace zero-length array with flexible-array member
    scsi: target: tcmu: Replace zero-length array with flexible-array member
    ima: Replace zero-length array with flexible-array member
    enetc: Replace zero-length array with flexible-array member
    fs: Replace zero-length array with flexible-array member
    Bluetooth: Replace zero-length array with flexible-array member
    params: Replace zero-length array with flexible-array member
    tracepoint: Replace zero-length array with flexible-array member
    platform/chrome: cros_ec_proto: Replace zero-length array with flexible-array member
    platform/chrome: cros_ec_commands: Replace zero-length array with flexible-array member
    mailbox: zynqmp-ipi-message: Replace zero-length array with flexible-array member
    dmaengine: ti-cppi5: Replace zero-length array with flexible-array member

    Linus Torvalds
     

31 Oct, 2020

1 commit

  • There is a regular need in the kernel to provide a way to declare having a
    dynamically sized set of trailing elements in a structure. Kernel code should
    always use “flexible array members”[1] for these cases. The older style of
    one-element or zero-length arrays should no longer be used[2].

    [1] https://en.wikipedia.org/wiki/Flexible_array_member
    [2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

27 Oct, 2020

2 commits

  • The patch that repaired the invalid return code in smcd_new_buf_create()
    missed to take care of errno ENOSPC which has a special meaning that no
    more DMBEs can be registered on the device. Fix that by keeping this
    errno value during the translation of the return code.

    Fixes: 6b1bbf94ab36 ("net/smc: fix invalid return code in smcd_new_buf_create()")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • 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
     

16 Oct, 2020

4 commits

  • Minor conflicts in net/mptcp/protocol.h and
    tools/testing/selftests/net/Makefile.

    In both cases code was added on both sides in the same place
    so just keep both.

    Signed-off-by: Jakub Kicinski

    Jakub Kicinski
     
  • smc_ism_register_dmb() returns error codes set by the ISM driver which
    are not guaranteed to be negative or in the errno range. Such values
    would not be handled by ERR_PTR() and finally the return code will be
    used as a memory address.
    Fix that by using a valid negative errno value with ERR_PTR().

    Fixes: 72b7f6c48708 ("net/smc: unique reason code for exceeded max dmb count")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • The SMCD_DMBE_SIZES should include all valid DMBE buffer sizes, so the
    correct value is 6 which means 1MB. With 7 the registration of an ISM
    buffer would always fail because of the invalid size requested.
    Fix that and set the value to 6.

    Fixes: c6ba7c9ba43d ("net/smc: add base infrastructure for SMC-D and ISM")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     
  • When a delayed event is enqueued then the event worker will send this
    event the next time it is running and no other flow is currently
    active. The event handler is called for the delayed event, and the
    pointer to the event keeps set in lgr->delayed_event. This pointer is
    cleared later in the processing by smc_llc_flow_start().
    This can lead to a use-after-free condition when the processing does not
    reach smc_llc_flow_start(), but frees the event because of an error
    situation. Then the delayed_event pointer is still set but the event is
    freed.
    Fix this by always clearing the delayed event pointer when the event is
    provided to the event handler for processing, and remove the code to
    clear it in smc_llc_flow_start().

    Fixes: 555da9af827d ("net/smc: add event-based llc_flow framework")
    Signed-off-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Karsten Graul
     

11 Oct, 2020

2 commits

  • For older versions of gcc, the array = {0}; will cause warnings:

    net/smc/smc_llc.c: In function 'smc_llc_add_link_local':
    net/smc/smc_llc.c:1212:9: warning: missing braces around initializer [-Wmissing-braces]
    struct smc_llc_msg_add_link add_llc = {0};
    ^
    net/smc/smc_llc.c:1212:9: warning: (near initialization for 'add_llc.hd') [-Wmissing-braces]
    net/smc/smc_llc.c: In function 'smc_llc_srv_delete_link_local':
    net/smc/smc_llc.c:1245:9: warning: missing braces around initializer [-Wmissing-braces]
    struct smc_llc_msg_del_link del_llc = {0};
    ^
    net/smc/smc_llc.c:1245:9: warning: (near initialization for 'del_llc.hd') [-Wmissing-braces]

    2 warnings generated

    Fixes: 4dadd151b265 ("net/smc: enqueue local LLC messages")
    Signed-off-by: Pujin Shi
    Acked-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Pujin Shi
     
  • For older versions of gcc, the array = {0}; will cause warnings:

    net/smc/smc_llc.c: In function 'smc_llc_send_link_delete_all':
    net/smc/smc_llc.c:1317:9: warning: missing braces around initializer [-Wmissing-braces]
    struct smc_llc_msg_del_link delllc = {0};
    ^
    net/smc/smc_llc.c:1317:9: warning: (near initialization for 'delllc.hd') [-Wmissing-braces]

    1 warnings generated

    Fixes: f3811fd7bc97 ("net/smc: send DELETE_LINK, ALL message and wait for send to complete")
    Signed-off-by: Pujin Shi
    Acked-by: Karsten Graul
    Signed-off-by: Jakub Kicinski

    Pujin Shi
     

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

2 commits


29 Sep, 2020

14 commits


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
     

17 Sep, 2020

1 commit


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
     
  • When the netlink messages to be sent to the userspace
    are too big for a single netlink message, send them in
    chunks using the netlink_dump infrastructure. Modify the
    smc diag dump code so that it can signal to the netlink_dump
    infrastructure that it needs to send more data.

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

    Guvenc Gulce
     
  • smc_lgr_cleanup_early() schedules the free worker with delay. DMB
    unregistering occurs in this delayed worker increasing the risk
    to reach the SMCD SBA limit without need. Terminate the
    linkgroup immediately, since termination means early DMB unregistering.

    For SMCD the global smc_server_lgr_pending lock is given up early.
    A linkgroup to be given up with smc_lgr_cleanup_early() may already
    contain more than one connection. Using __smc_lgr_terminate() in
    smc_lgr_cleanup_early() covers this.

    And consolidate smc_ism_put_vlan() and smc_put_device() into smc_lgr_free()
    only.

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

    Ursula Braun
     
  • 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