From patchwork Sat Dec 9 08:14:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 176145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5937678vqy; Sat, 9 Dec 2023 00:16:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFws7sRvHbVW/mS2DwsWQz3l5wajBEY9Hu8JyxW+0JW9T9SmDW5eP8URg7ktq2RafUj6i7K X-Received: by 2002:a17:90b:3d89:b0:286:6cc1:8653 with SMTP id pq9-20020a17090b3d8900b002866cc18653mr852090pjb.56.1702109780003; Sat, 09 Dec 2023 00:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702109779; cv=none; d=google.com; s=arc-20160816; b=C+LQV5mpj0dmi3J1zkDdqqGezrFOmCCt/YmfJ0LNCT14pRtPwhjw4qgvaiDR+ILMs1 58+XLTXycG425qbt/7t2ZqsF7zMG92Exm4ooNsSyDrXaM+FIOxwUeK1GU8YMP1wmOel4 HX6ZDB+zeUoFi+8L3FbMJIsIJJTyPnSDX+r45Ht13+dh3TGbseXOdoDyQK3zKOsEtjIj nCZU+QMt2s48hsfqzJQnvxqRwWUBOSOG6AjElb3kXjGUuyihdd7oIB0WUY5TGednT6wH ypNN/aMD0ZX3G7k+CZHFNCXO94WqjYQr7x1MzwZXD4/tPGlu1nizldr9wBfYlQGi7oGY 3SNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qZyVE9+1f/f1jEaHlNONJ0ctBCAPSTf4bqVJj4VITR0=; fh=7SseUGK9VIpM0U5I48hZPzu1gSvnt1oPt4OqFvN72gk=; b=Kk7+u9w6h4Uv0KZ6jI/f+Mo6JcNU0C+HQrMfZzxx2+2+vr43FpEy58fOaAmmfKo5qV SMFr02MG7OLNGSAhke++p2raJ66ItS5SoFARb88lFvW544Q9CtSeyaiswZFY9nU3zpVP RxGOd7z77AbjeevZkFGIBTfLY27sij/ZVUTbYCwepCeP1z8B+80V7c7gGp9eL5uw577B thNxpfZyHpeY/PptC+0fgihumSzRcoeaLXaMFjfrC7bZo6ruOsjEdpiYByTSM3TsIBPi 9U9NphfANTJ9APRdBNWPvBkNP46sIvhc8/zOZbBAbm0fjKE3+sAgYE2nIY4LuBnCnET/ 1kUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Wbo23g16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id j16-20020a17090ae61000b002859ad34f7bsi2799535pjy.92.2023.12.09.00.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 00:16:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Wbo23g16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9C0628072A3C; Sat, 9 Dec 2023 00:15:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234536AbjLIIPM (ORCPT + 99 others); Sat, 9 Dec 2023 03:15:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234527AbjLIIPK (ORCPT ); Sat, 9 Dec 2023 03:15:10 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9344A1AD; Sat, 9 Dec 2023 00:15:16 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B984onT022969; Sat, 9 Dec 2023 00:15:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=qZyVE9+1f/f1jEaHlNONJ0ctBCAPSTf4bqVJj4VITR0=; b=Wbo23g16vOQzVDGteovlXBNQBvpb80+G7NkGPrmU87Uf5BBLWYvhLtltlk29hb36q5vK gVCeeMTs/4zovAnKgD7UAqJW6LB6QpuoPfVSi4hZoJsxVO5CfhBRUDW7GVkJ5xl1tC4Z vGYXyw7Bc6fIqWnoqavnlHGKCMN8sN2mU81ghMLfFySj/CullIg4thKaQ9BdWFSy685b c+dLwo8HfWJwb5ZDbmfztPbdVY+Qw49HBcozKzqXOeCuyHxjVL0CJGGwcbHPfK2Vglgk YgygdvzUVkDdy5H+cRnm3NFARWKlHkNBb62eaKk4uTX+CKxHgPf5vwPGYL4dYUgmWbhp bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uubddfkhp-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 09 Dec 2023 00:15:09 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 9 Dec 2023 00:14:59 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 9 Dec 2023 00:14:59 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id BEE473F708F; Sat, 9 Dec 2023 00:14:58 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , Shinas Rasheed , Veerasenareddy Burru , "Sathesh Edara" , Eric Dumazet Subject: [PATCH net-next v2 2/4] octeon_ep: PF-VF mailbox version support Date: Sat, 9 Dec 2023 00:14:48 -0800 Message-ID: <20231209081450.2613561-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231209081450.2613561-1-srasheed@marvell.com> References: <20231209081450.2613561-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: T-xtnOM_sFwJhcTCTL7v0nE-C38XrrOH X-Proofpoint-GUID: T-xtnOM_sFwJhcTCTL7v0nE-C38XrrOH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sat, 09 Dec 2023 00:15:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784791465062121175 X-GMAIL-MSGID: 1784791465062121175 Add PF-VF mailbox initial version support Signed-off-by: Shinas Rasheed --- V2: - No changes V1: https://lore.kernel.org/all/20231208070352.2606192-3-srasheed@marvell.com/ .../net/ethernet/marvell/octeon_ep/octep_main.h | 1 + .../ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 15 ++++++++++++--- .../ethernet/marvell/octeon_ep/octep_pfvf_mbox.h | 7 +++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h index 3223bb6f95ea..fee59e0e0138 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h @@ -220,6 +220,7 @@ struct octep_iface_link_info { /* The Octeon VF device specific info data structure.*/ struct octep_pfvf_info { u8 mac_addr[ETH_ALEN]; + u32 mbox_version; }; /* The Octeon device specific private data structure. diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c index 43b40e91f7bf..baffe298a2a0 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c @@ -28,10 +28,18 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id, { u32 vf_version = (u32)cmd.s_version.version; - if (vf_version <= OCTEP_PFVF_MBOX_VERSION_V1) - rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; + dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n", + vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT); + if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT) + rsp->s_version.version = vf_version; else - rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK; + rsp->s_version.version = OCTEP_PFVF_MBOX_VERSION_CURRENT; + + oct->vf_info[vf_id].mbox_version = rsp->s_version.version; + dev_dbg(&oct->pdev->dev, "VF id:%d negotiated VF version:%d\n", + vf_id, oct->vf_info[vf_id].mbox_version); + + rsp->s_version.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; } static void octep_pfvf_get_link_status(struct octep_device *oct, u32 vf_id, @@ -167,6 +175,7 @@ int octep_setup_pfvf_mbox(struct octep_device *oct) goto free_mbox; memset(oct->mbox[ring], 0, sizeof(struct octep_mbox)); + memset(&oct->vf_info[i], 0, sizeof(struct octep_pfvf_info)); mutex_init(&oct->mbox[ring]->lock); INIT_WORK(&oct->mbox[ring]->wk.work, octep_pfvf_mbox_work); oct->mbox[ring]->wk.ctxptr = oct->mbox[ring]; diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h index 34feeb559b0d..af4dcf5ef7f1 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h @@ -13,11 +13,15 @@ #define OCTEON_SDP_16K_HW_FRS 16380UL #define OCTEON_SDP_64K_HW_FRS 65531UL +/* When a new command is implemented,PF Mbox version should be bumped. + */ enum octep_pfvf_mbox_version { OCTEP_PFVF_MBOX_VERSION_V0, OCTEP_PFVF_MBOX_VERSION_V1, }; +#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1 + enum octep_pfvf_mbox_opcode { OCTEP_PFVF_MBOX_CMD_VERSION, OCTEP_PFVF_MBOX_CMD_SET_MTU, @@ -30,7 +34,7 @@ enum octep_pfvf_mbox_opcode { OCTEP_PFVF_MBOX_CMD_GET_LINK_STATUS, OCTEP_PFVF_MBOX_CMD_GET_MTU, OCTEP_PFVF_MBOX_CMD_DEV_REMOVE, - OCTEP_PFVF_MBOX_CMD_LAST, + OCTEP_PFVF_MBOX_CMD_MAX, }; enum octep_pfvf_mbox_word_type { @@ -79,7 +83,6 @@ enum octep_pfvf_link_autoneg { #define OCTEP_PFVF_MBOX_TIMEOUT_MS 500 #define OCTEP_PFVF_MBOX_MAX_RETRIES 2 -#define OCTEP_PFVF_MBOX_VERSION 0 #define OCTEP_PFVF_MBOX_MAX_DATA_SIZE 6 #define OCTEP_PFVF_MBOX_MORE_FRAG_FLAG 1 #define OCTEP_PFVF_MBOX_WRITE_WAIT_TIME msecs_to_jiffies(1)