From patchwork Thu Dec 14 16:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 178799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8683312dys; Thu, 14 Dec 2023 08:46:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpFzRyanw/dJv6IVTQX6gGMs1uKktEjbkWwsJN5yw+NQJEmXDAJkpl5+hjxVIgKJWa8+wd X-Received: by 2002:a17:90a:3908:b0:286:b272:d9a0 with SMTP id y8-20020a17090a390800b00286b272d9a0mr7510652pjb.45.1702572397938; Thu, 14 Dec 2023 08:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702572397; cv=none; d=google.com; s=arc-20160816; b=O3F3tqEeb/CCd4vPBfcfZVAXEgWRrMRfvKY9OQCr5wEpf7/UeFLnM6aLRaKv81dShB W/4l8+tYD6RvGut64LANU7aBrrGAAAS27llMyBQOZ7jZikDIBSv0NH11yoYBeybdurDw UGm+W7CVVSee6PtOqoQRzd2E+GtnMC1gAlEXQLQGlDeGKZVFuLkZ9+P1dqtjzCgTX3Q4 vzH4IsAe0HexYpSj1PppLIJCLTtLVDl1yckjdPkEWcYugFlxmKaCmlDJ1aVQixzU0YQh x+8Set7NmJWIDJ8aZ9X8qDIA3+Z4skROqv0ArKzLAR2axJMFTWNk022D8uA36F2tLoBB Qu/g== 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=RvfpBnCACTU6sC+JJ6zDpSUjvbw9f20fkg5+4vx5i0o=; fh=JmKr503mNMzrAZEKWnjDOFUBUBn3OtyLhG6qi8Ho0v0=; b=T7wqdUk6LKFpDPTLtesyhRu1/Wx5Cv97Wic1hjixVaN19f4I87onQq8Rp6Kr8m8HIb sU8NhksScBdQLDkb4nRzfb068K6PXLfga9x1BASC/kHIw3SEANxMr60VKBULJiw4B7ZF 4SJ6h983dZTwHi2enc31idQP56p9csTPCVBeScY0kJKoM+DsIEArQQd9uPmGMsKNjLsg 4Z9YZBMGEEV/ymiqLO7f+wK5djgjFAGzC7dIQ6P5E0nTWyPB07jq8+fNDvF7rTuOJeCH 4u95NcqpubnunfW+TipIexZTJ/Q19GhjPQciFZtG3L5JQLSaMhf8nz5dNbGCZF2l46ml tmlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dCrcq6Zh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l13-20020a17090a660d00b002887662139bsi11638031pjj.35.2023.12.14.08.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:46:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dCrcq6Zh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 8BC8480793CB; Thu, 14 Dec 2023 08:46:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjLNQqI (ORCPT + 99 others); Thu, 14 Dec 2023 11:46:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbjLNQqH (ORCPT ); Thu, 14 Dec 2023 11:46:07 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6FB912D; Thu, 14 Dec 2023 08:46:13 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BEFKh18001581; Thu, 14 Dec 2023 08:45:56 -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=RvfpBnCACTU6sC+JJ6zDpSUjvbw9f20fkg5+4vx5i0o=; b=dCr cq6ZhHuiQyl0UTDVFE5FoAnO1QGEN91F9SN0G7SMaMD7azJbDjI4P+NIgu38l8dJ p8s+fR0KvjXprY7zpUQp0BHfLChgPoiJbVV9GZkHjHf8Xjh8bdYrKeTYomq/UwXD 9KAHUY6e6VhaRQjdzOGAG+CZegNrbQStufK4xS0RhWQiCMfM57Pu70K1ZN6GfaEl yOVB4lNa3yBCsN3uQqiwe4Q/YAS5Pmv4Dpo/+Q8pYJ6MzEySa9YdQ/KgV/gr/rYz cHexBPLyeJExwVmDUx8ZmBJmnFjEBHNKvySY7deKmbyo/ppiNeg+gzB7GPPQs5bF iJNQWSKAdp4rvhOl9ag== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uyy0m9fy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 08:45:56 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 14 Dec 2023 08:45:55 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 14 Dec 2023 08:45:55 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id B76D13F708A; Thu, 14 Dec 2023 08:45:54 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , , "Shinas Rasheed" , Veerasenareddy Burru , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v5 2/4] octeon_ep: PF-VF mailbox version support Date: Thu, 14 Dec 2023 08:45:34 -0800 Message-ID: <20231214164536.2670006-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214164536.2670006-1-srasheed@marvell.com> References: <20231214164536.2670006-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: hwzTw8l1G7Qdky8kjixDMxS3Nor8fI-l X-Proofpoint-ORIG-GUID: hwzTw8l1G7Qdky8kjixDMxS3Nor8fI-l 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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 08:46:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785276554754371389 X-GMAIL-MSGID: 1785276554754371389 Add PF-VF mailbox initial version support Signed-off-by: Shinas Rasheed --- V5: - Refactored patch to leave out changes moved to first patch itself V4: https://lore.kernel.org/all/20231213035816.2656851-3-srasheed@marvell.com/ - No changes V3: https://lore.kernel.org/all/20231211063355.2630028-3-srasheed@marvell.com/ - No changes V2: https://lore.kernel.org/all/20231209081450.2613561-3-srasheed@marvell.com/ - 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 | 4 ++++ 3 files changed, 17 insertions(+), 3 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 0557c138060f..fb4da72e5193 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c @@ -27,10 +27,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, @@ -166,6 +174,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 83c072d97512..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,