From patchwork Wed Jun 28 16:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 129067 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8491642D82; Wed, 28 Jun 2023 18:32:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F405342D53; Wed, 28 Jun 2023 18:31:31 +0200 (CEST) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id BB5C042D65 for ; Wed, 28 Jun 2023 18:31:28 +0200 (CEST) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-54fb23ff7d3so3220703a12.0 for ; Wed, 28 Jun 2023 09:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1687969887; x=1690561887; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=33GLwwdi/0UpewAatYkcWAo9l4u8o8dWceDDIdJQc1c=; b=HuIm2BUqf59vCy4/a2S/DmAFMdB8lNiA10LCqVfvykPr51LG1AnqQaH4lXLOjJ8xW3 ydwCcK9jPjVgBO86abqEVnwxegzoTdX5W/IvbTyy2ieczKzN7KE9fGzQpWj949NxOdN+ ve+S2xfctFrbjyLsxQqEGhX4jY2mhlJKMbc7M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687969887; x=1690561887; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=33GLwwdi/0UpewAatYkcWAo9l4u8o8dWceDDIdJQc1c=; b=L95Bv0nO0CjPDmuk0FMUBmYP0a0v9IEBJtr8pFsd5uceCxpPC7nHC5YcWCk68WrZHI 3h/KXwRGxwiikfWaFVMREPH/qcJZx1i/kF/cQ1jhWuKdu39xfBj+0GKDQj1nLKNGwwCC GohZZmVDAKx5VLerMMN4jG05wZxS2yZO3pK65a8MUgNd+n+Qjir/+n6BgdUHcoPJVW5N ihol8hpppZ6SHMJqQwIjCviN+LGMv8aYx7G7zob2h51erMcZhrUatB4lnZPRHuVmVQ7P jDpe5YlTI7YaYvU+KFuvEBHQurgJi1UrnV9M5G7UrcoPNcY1PtKiLGOjqioKjJVh4PQC uL3w== X-Gm-Message-State: AC+VfDxZ2uO8P3+cc9YWbS3X9Xx8jO1ltXI0AsaDjxBH3028uR6LZGU+ TmZ4Zli5HxdpqnD7sn0Vh0pG/er9oKexO0AO0n1shCRsPwsuhZpC0e5TarB+Sqh1sq5XBmIUf6E X5sYFcoQa+c6t7I3snGP6ur8oJhqYakijy+z0/cmY8HO9hKDZ4BUdeu3oGna6+sxOdBiyR34= X-Google-Smtp-Source: ACHHUZ5PpwwtPo6Gobg6rPdCcgV/apO60GjRumOCv7SWQJM/cGyj86+6XaCB0+K0kRzfqYCsfxIyBQ== X-Received: by 2002:a17:902:e74e:b0:1b7:de85:84ad with SMTP id p14-20020a170902e74e00b001b7de8584admr9235406plf.25.1687969887529; Wed, 28 Jun 2023 09:31:27 -0700 (PDT) Received: from localhost.localdomain ([192.19.252.250]) by smtp.gmail.com with ESMTPSA id h12-20020a170902f7cc00b001b8229942a0sm3092403plw.34.2023.06.28.09.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 09:31:26 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, thomas@monjalon.net, Kishore Padmanabha , stable@dpdk.org, Shahaji Bhosle Subject: [PATCH v4 09/11] net/bnxt: fix multi-root card support Date: Wed, 28 Jun 2023 09:29:25 -0700 Message-Id: <20230628162927.92858-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) In-Reply-To: <20230628162927.92858-1-ajit.khaparde@broadcom.com> References: <1826961.atdPhlSkOF@thomas> <20230628162927.92858-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kishore Padmanabha Changed the logic to use device serial number to identify that different ports belong to same physical card instead of the PCI domain address. Fixes: 34a7ff5a920e ("net/bnxt: support multi root capability") Cc: stable@dpdk.org Signed-off-by: Kishore Padmanabha Reviewed-by: Shahaji Bhosle Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 3 +++ drivers/net/bnxt/bnxt_hwrm.c | 1 + drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 11 ++++++++--- drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index dadd0bd95a..08791b8a17 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -138,6 +138,7 @@ #define BNXT_NUM_CMPL_DMA_AGGR 36 #define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT 50 #define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT 12 +#define BNXT_DEVICE_SERIAL_NUM_SIZE 8 #define BNXT_DEFAULT_VNIC_STATE_MASK \ HWRM_ASYNC_EVENT_CMPL_DEFAULT_VNIC_CHANGE_EVENT_DATA1_DEF_VNIC_STATE_MASK @@ -863,6 +864,8 @@ struct bnxt { uint16_t num_reps; struct bnxt_rep_info *rep_info; uint16_t *cfa_code_map; + /* Device Serial Number */ + uint8_t dsn[BNXT_DEVICE_SERIAL_NUM_SIZE]; /* Struct to hold adapter error recovery related info */ struct bnxt_error_recovery_info *recovery_info; #define BNXT_MARK_TABLE_SZ (sizeof(struct bnxt_mark_info) * 64 * 1024) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 82679d1b32..edad84c262 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -863,6 +863,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->max_l2_ctx, bp->max_vnics); bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx); bp->max_mcast_addr = rte_le_to_cpu_32(resp->max_mcast_filters); + memcpy(bp->dsn, resp->device_serial_number, sizeof(bp->dsn)); if (BNXT_PF(bp)) bp->pf->total_vnics = rte_le_to_cpu_16(resp->max_vnics); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 3459140f18..500c177039 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -1318,9 +1318,13 @@ ulp_get_session(struct bnxt *bp, struct rte_pci_addr *pci_addr) /* if multi root capability is enabled, then ignore the pci bus id */ STAILQ_FOREACH(session, &bnxt_ulp_session_list, next) { - if (session->pci_info.domain == pci_addr->domain && - (BNXT_MULTIROOT_EN(bp) || - session->pci_info.bus == pci_addr->bus)) { + if (BNXT_MULTIROOT_EN(bp)) { + if (!memcmp(bp->dsn, session->dsn, + sizeof(session->dsn))) { + return session; + } + } else if (session->pci_info.domain == pci_addr->domain && + session->pci_info.bus == pci_addr->bus) { return session; } } @@ -1364,6 +1368,7 @@ ulp_session_init(struct bnxt *bp, /* Add it to the queue */ session->pci_info.domain = pci_addr->domain; session->pci_info.bus = pci_addr->bus; + memcpy(session->dsn, bp->dsn, sizeof(session->dsn)); rc = pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); if (rc) { BNXT_TF_DBG(ERR, "mutex create failed\n"); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index a6ad5c1eaa..92db7751fe 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -131,11 +131,13 @@ struct bnxt_ulp_pci_info { uint8_t bus; }; +#define BNXT_ULP_DEVICE_SERIAL_NUM_SIZE 8 struct bnxt_ulp_session_state { STAILQ_ENTRY(bnxt_ulp_session_state) next; bool bnxt_ulp_init; pthread_mutex_t bnxt_ulp_mutex; struct bnxt_ulp_pci_info pci_info; + uint8_t dsn[BNXT_ULP_DEVICE_SERIAL_NUM_SIZE]; struct bnxt_ulp_data *cfg_data; struct tf *g_tfp[BNXT_ULP_SESSION_MAX]; uint32_t session_opened[BNXT_ULP_SESSION_MAX];