Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3786456rdb; Sun, 10 Dec 2023 22:35:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6tGkcKtuU3szFCPJKVGUE/T5GJ7kMWCKIRiewPU9yrYQK6lwE/nBb+mxncQElSCypLl/w X-Received: by 2002:a05:6a00:2d1b:b0:6cb:bc92:c73f with SMTP id fa27-20020a056a002d1b00b006cbbc92c73fmr4227435pfb.2.1702276522837; Sun, 10 Dec 2023 22:35:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702276522; cv=none; d=google.com; s=arc-20160816; b=sPrxsk+5ofc9cL8+rWnkb+GoSrYkzJE438BPPQn1ouzU8+5+0xvDYozz2w9o2BYUso sCruK5kC1NMh6bKmN4IdLs/yzprMzSMYuvk6DvWC4JMN6nmqUz7G1a7soVU27/cfgC5X 0Hj5965K+OGNMLd+b107EBH6LRNQ0l9iLXOPyBUnD1a7YDVOJEfljhRUwagllR7VEbIQ vVmjSZ6GkUkhP9jBpGL1DxOoZTDtxO2H0g4BaaHtfm5Qq/EygogPdvqj0yV/IJdVRibN ZbQhmNHkV7SONVxYiLOXscfT2YaFLMYSEK6hRz3R+8izrTABUdU1JoZtVEFSGjdEfyr5 ofpA== 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=6aQiUUs9iHoMVKP14gL4ZyCW5OnmwM0M4zOkO1STsM8=; fh=7SseUGK9VIpM0U5I48hZPzu1gSvnt1oPt4OqFvN72gk=; b=l2jzCQfIEHQLFo68wlt91EDeEImqZjOnL88WyGlvaQ/aamzTTZD2yxnJy3sAOKU5ka KFNNCp59VAINpGU9omowFArC805lIZzgcs/vxpuN6iJvWXh+9hh+TqEPSuWduPVlZbIm lU0SwhSuN+Hf6RNL+pNBgaHlDdJ10dSyKPvpfiSLzg4O4F+0D2Ytemzqk09gkY/wfJZg /axnmw6LRJHUuh2G0NIh8HMV8Ui+Lc/FrCxxb/3yxDgb4CtR5E/4FHJWQVvWYP9vo/yt i1R6Du51rlU9pDVKRf1+1QDX8jERVjMif/MhOpcWT9uzhVB4cu8FsflsFglxnn19weWb Kpeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Nk2Mzauj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id z9-20020a656649000000b005b9602a7badsi5627507pgv.688.2023.12.10.22.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 22:35:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Nk2Mzauj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 001E2805160C; Sun, 10 Dec 2023 22:35:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233927AbjLKGfA (ORCPT + 99 others); Mon, 11 Dec 2023 01:35:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233570AbjLKGen (ORCPT ); Mon, 11 Dec 2023 01:34:43 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72DF11716; Sun, 10 Dec 2023 22:34:31 -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 3BAMtfVg008688; Sun, 10 Dec 2023 22:34: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=6aQiUUs9iHoMVKP14gL4ZyCW5OnmwM0M4zOkO1STsM8=; b=Nk2 Mzaujszfs+tuJBXC08rqIfxwVbWxT/uZ2DxqSbYoV1zIxmJacEOzKQJuNLmWUPcp 0U4L5HtTfE+ksFc6T4mnDK70ZlFF6YRiUyPm+r/RDtzTCLCJfCISZ8kdW7RHxGjw MRbjvqYzCaCRSfyyC4Y3hRRDlCkcN3BsuFettGa4q9uw5xRe6aE/bM8gVnJJ7dnk 6wmnROYu2WWezxdFL8LnRNOxqdhPa8uu5ClahzH8XqrWyaRvh6vSvDcIqU1pVSLE TjSgTMzrOeme06f4/Hv4+ENoHrnASBqgiLfgdcU1h9bOmlUXBCE8zWlp++9dRiMF jgXLgIT4ewNju4bGxjA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3uw8xqa5x4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 10 Dec 2023 22:34:09 -0800 (PST) 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; Sun, 10 Dec 2023 22:34:05 -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; Sun, 10 Dec 2023 22:34:05 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 1BD0B3F70A3; Sun, 10 Dec 2023 22:34:05 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , , Shinas Rasheed , Veerasenareddy Burru , "Sathesh Edara" , Eric Dumazet Subject: [PATCH net-next v3 3/4] octeon_ep: control net framework to support VF offloads Date: Sun, 10 Dec 2023 22:33:54 -0800 Message-ID: <20231211063355.2630028-4-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231211063355.2630028-1-srasheed@marvell.com> References: <20231211063355.2630028-1-srasheed@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: j9qTQzeYS9-A-XUBMA_4ksC5qgtIhaY5 X-Proofpoint-ORIG-GUID: j9qTQzeYS9-A-XUBMA_4ksC5qgtIhaY5 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 pete.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 (pete.vger.email [0.0.0.0]); Sun, 10 Dec 2023 22:35:20 -0800 (PST) Inquire firmware on supported offloads, as well as convey offloads enabled dynamically to firmware for the VFs. Implement control net API to support the same. Signed-off-by: Shinas Rasheed --- V3: - No changes V2: https://lore.kernel.org/all/20231209081450.2613561-4-srasheed@marvell.com/ - No changes V1: https://lore.kernel.org/all/20231208070352.2606192-4-srasheed@marvell.com/ .../marvell/octeon_ep/octep_pfvf_mbox.c | 47 +++++++++++++++++++ .../marvell/octeon_ep/octep_pfvf_mbox.h | 21 ++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) 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 baffe298a2a0..57e0184840c2 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c @@ -159,6 +159,47 @@ static void octep_pfvf_dev_remove(struct octep_device *oct, u32 vf_id, rsp->s.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; } +static void octep_pfvf_get_fw_info(struct octep_device *oct, u32 vf_id, + union octep_pfvf_mbox_word cmd, + union octep_pfvf_mbox_word *rsp) +{ + struct octep_fw_info fw_info; + int err; + + err = octep_ctrl_net_get_info(oct, vf_id, &fw_info); + if (err) { + rsp->s_fw_info.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK; + dev_err(&oct->pdev->dev, "Get VF info failed via host control Mbox\n"); + return; + } + + rsp->s_fw_info.pkind = fw_info.pkind; + rsp->s_fw_info.fsz = fw_info.fsz; + rsp->s_fw_info.rx_ol_flags = fw_info.rx_ol_flags; + rsp->s_fw_info.tx_ol_flags = fw_info.tx_ol_flags; + + rsp->s_fw_info.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; +} + +static void octep_pfvf_set_offloads(struct octep_device *oct, u32 vf_id, + union octep_pfvf_mbox_word cmd, + union octep_pfvf_mbox_word *rsp) +{ + struct octep_ctrl_net_offloads offloads = { + .rx_offloads = cmd.s_offloads.rx_ol_flags, + .tx_offloads = cmd.s_offloads.tx_ol_flags + }; + int err; + + err = octep_ctrl_net_set_offloads(oct, vf_id, &offloads, true); + if (err) { + rsp->s_offloads.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK; + dev_err(&oct->pdev->dev, "Set VF offloads failed via host control Mbox\n"); + return; + } + rsp->s_offloads.type = OCTEP_PFVF_MBOX_TYPE_RSP_ACK; +} + int octep_setup_pfvf_mbox(struct octep_device *oct) { int i = 0, num_vfs = 0, rings_per_vf = 0; @@ -335,6 +376,12 @@ void octep_pfvf_mbox_work(struct work_struct *work) case OCTEP_PFVF_MBOX_CMD_DEV_REMOVE: octep_pfvf_dev_remove(oct, vf_id, cmd, &rsp); break; + case OCTEP_PFVF_MBOX_CMD_GET_FW_INFO: + octep_pfvf_get_fw_info(oct, vf_id, cmd, &rsp); + break; + case OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS: + octep_pfvf_set_offloads(oct, vf_id, cmd, &rsp); + break; default: dev_err(&oct->pdev->dev, "PF-VF mailbox: invalid opcode %d\n", cmd.s.opcode); rsp.s.type = OCTEP_PFVF_MBOX_TYPE_RSP_NACK; 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 af4dcf5ef7f1..c18a9f26fc31 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.h @@ -18,9 +18,10 @@ enum octep_pfvf_mbox_version { OCTEP_PFVF_MBOX_VERSION_V0, OCTEP_PFVF_MBOX_VERSION_V1, + OCTEP_PFVF_MBOX_VERSION_V2, }; -#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V1 +#define OCTEP_PFVF_MBOX_VERSION_CURRENT OCTEP_PFVF_MBOX_VERSION_V2 enum octep_pfvf_mbox_opcode { OCTEP_PFVF_MBOX_CMD_VERSION, @@ -34,6 +35,8 @@ 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_GET_FW_INFO, + OCTEP_PFVF_MBOX_CMD_SET_OFFLOADS, OCTEP_PFVF_MBOX_CMD_MAX, }; @@ -138,6 +141,22 @@ union octep_pfvf_mbox_word { u64 status:1; u64 rsvd:53; } s_link_status; + struct { + u64 opcode:8; + u64 type:2; + u64 pkind:8; + u64 fsz:8; + u64 rx_ol_flags:16; + u64 tx_ol_flags:16; + u64 rsvd:6; + } s_fw_info; + struct { + u64 opcode:8; + u64 type:2; + u64 rsvd:22; + u64 rx_ol_flags:16; + u64 tx_ol_flags:16; + } s_offloads; } __packed; void octep_pfvf_mbox_work(struct work_struct *work); -- 2.25.1