On 12/09/2016 01:47 AM, Selvin Xavier wrote:
> This patch handles the registration with bnxt_en driver. The driver registers
> with netdev notifier chain. Upon receiving NETDEV_REGISTER event, the driver
> in turn registers with bnxt_en driver.
> 1. bnxt_en's ulp_probe function returns a structure that contains
> information
> about the device and additional entry points.
> 2. bnxt_en driver returns 'struct bnxt_eth_dev' that contains set of
> operation
> vectors that RocE driver invokes later.
> 3. bnxt_request_msix() allows the RoCE driver to specify the number of
> MSI-X
> vectors that are needed.
> 4. bnxt_send_fw_msg () can be used to send messages to the FW
> 5. bnxt_register_async_events() can be used to register for async event
> callbacks.
>
> v2: Remove some sparse warning. Also, remove some unused code from unreg path.
>
> Signed-off-by: Eddie Wai <[email protected]>
> Signed-off-by: Devesh Sharma <[email protected]>
> Signed-off-by: Somnath Kotur <[email protected]>
> Signed-off-by: Sriharsha Basavapatna <[email protected]>
> Signed-off-by: Selvin Xavier <[email protected]>
> ---
> drivers/infiniband/hw/bnxtre/bnxt_re.h | 48 +++
> drivers/infiniband/hw/bnxtre/bnxt_re_main.c | 436
> ++++++++++++++++++++++++++++
> 2 files changed, 484 insertions(+)
>
[...]
> #endif
> diff --git a/drivers/infiniband/hw/bnxtre/bnxt_re_main.c
> b/drivers/infiniband/hw/bnxtre/bnxt_re_main.c
> index ebe1c69..029824a 100644
> --- a/drivers/infiniband/hw/bnxtre/bnxt_re_main.c
> +++ b/drivers/infiniband/hw/bnxtre/bnxt_re_main.c
> +
> +static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
> +{
> + int i, j, rc;
> +
> + /* Registered a new RoCE device instance to netdev */
> + rc = bnxt_re_register_netdev(rdev);
> + if (rc) {
> + pr_err("Failed to register with netedev: %#x\n", rc);
> + return -EINVAL;
> + }
> + set_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags);
> +
> + rc = bnxt_re_request_msix(rdev);
> + if (rc) {
> + pr_err("Failed to get MSI-X vectors: %#x\n", rc);
> + rc = -EINVAL;
> + goto fail;
> + }
> + set_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags);
Though this exit path looks correct (need to verify) once all patches
are applied, this looks incorrect if only considering this specific
patch. I think you need the following:
+ return 0;
> +
> +fail:
> + bnxt_re_ib_unreg(rdev, true);
> + return rc;
> +}
> +