From patchwork Wed Nov 29 04:53:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinas Rasheed X-Patchwork-Id: 171061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp122484vqn; Tue, 28 Nov 2023 20:54:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHanwnCOUEnXWR+QYiyHAR8Nm9kOdCvm4svniykJlKDOXVADXb1f1f3kW/p9heJne0GrFeE X-Received: by 2002:a05:6358:60cd:b0:16b:c249:9b97 with SMTP id i13-20020a05635860cd00b0016bc2499b97mr21544292rwi.18.1701233674967; Tue, 28 Nov 2023 20:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701233674; cv=none; d=google.com; s=arc-20160816; b=PzSalpgA2ViJtfvyUE5joo5oQODmcpgmsOPtGTcDcWEEoEyqlOyv4v/wJ+oCLo1evt R01rq9WtZKy8SVj3vBGJ8PMWvP4nFFMcbcLFCYGzOnI9uXK00/hYeYHbJCExKnF5TY1s UcgzdMYi5myoHccYX5Xpe6WQZ6wzJLpV/t5lclOy2v4fzg7yBSgDZ4u/S49b9WOLMgSp 3hFnj7aQDOQsGluYNc47JdGbwGl7zk9XysQqEr+hr+DpawBVOL9ru9wSKVPcqEMFgLlU 7SaxnNo8+iYy80oJM6X2F3BCULghviXdvft+cJHDEHTMW5V6Qn67ugWlmsYrSKAYVrgJ FlDw== 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=EEQhMICjy4DZQbWamyerRADQ92GAIF8ZCdHo2SGhyrw=; fh=PUbSZjf2dtyqulLdd5rISVghnntgSGxvYpWMBobeHB0=; b=USTZk/FQfni7ovLPEGYNmEgJwJjtyEyvwovYI+OTO62Rrc6K8nqu9IUVgzQEEdvo7u DK+8DYTd1udpTJySf+ECUHLQel6is+0HwoXsa0/RVKK++AHYogc1+IBfu4KttIJ2K+pN vQrPF6k30OAPhHaSLpyxztVBbswQR+sYA3s9Nufg4rLtULyNUU9Qrtsi00WW0hWrdedS 9MK1xONaR2kVtb6qZy+78C1vON+jJP8Qz0IK68A5VaFHP7ZXiFhTwh18JA8pxHPhv2bs JkQAb2cbSyFrAx3MPZhog7XMEUJtDQwEmuidu3BLVqgO3wQiZDUxnnrnecQlVKWL9j5D EJ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="BRK/IWje"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id k24-20020a635a58000000b005b92da9586bsi12953120pgm.292.2023.11.28.20.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 20:54:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="BRK/IWje"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 88D418217A53; Tue, 28 Nov 2023 20:54:30 -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 S1376927AbjK2EyW (ORCPT + 99 others); Tue, 28 Nov 2023 23:54:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376941AbjK2EyS (ORCPT ); Tue, 28 Nov 2023 23:54:18 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFDB1BC6; Tue, 28 Nov 2023 20:54:24 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASIdtw6021070; Tue, 28 Nov 2023 20:53:55 -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=EEQhMICjy4DZQbWamyerRADQ92GAIF8ZCdHo2SGhyrw=; b=BRK/IWjeEynwFLUt/UU/qCfCr3ATctIjRm2vDpqf2lv44VHzI47yhFE8nUDLSKL8pkr3 cjSjnukJTz+pP8diLhuBVcFsyk3u0V2iSksP9c5dadgR5EXmGTuIxHe1OO1/7JGYBWsG GN992H5BsQD0p7sOw/Q9wL+jzVld7PBVPYOrSRDNEFstzfDn56c55tcSkg/dGLbL/e62 K/xL0WI9pu+8diGQ2uXqi7jwqPVRqqSGen3CcxcAQOOi7o9iVXhcFwlUWHxczIEe57J1 cQ6l3UVNEKjJmLncxz2emriIXJrZ1YE1B2iGf9zFjgCqR68oaOODrmkko/SYABInyp6n XA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3unn869x1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 20:53:54 -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; Tue, 28 Nov 2023 20:53:53 -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; Tue, 28 Nov 2023 20:53:53 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 979BD3F7043; Tue, 28 Nov 2023 20:53:52 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , "Veerasenareddy Burru" , Sathesh Edara , Eric Dumazet Subject: [PATCH net-next v2 1/2] octeon_ep: implement device unload control net API Date: Tue, 28 Nov 2023 20:53:47 -0800 Message-ID: <20231129045348.2538843-2-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231129045348.2538843-1-srasheed@marvell.com> References: <20231129045348.2538843-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: M-DZoJauUIHW_8J3ww9emqAv7cpJNnld X-Proofpoint-GUID: M-DZoJauUIHW_8J3ww9emqAv7cpJNnld 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-11-29_01,2023-11-27_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]); Tue, 28 Nov 2023 20:54:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783872802044351941 X-GMAIL-MSGID: 1783872802044351941 Device unload control net function should inform firmware of driver unload to let it take necessary actions to cleanup. Signed-off-by: Shinas Rasheed --- V2: - Changed dev_info print to dev_dbg in device_remove API V1: https://lore.kernel.org/all/20231127162135.2529363-2-srasheed@marvell.com/ .../ethernet/marvell/octeon_ep/octep_ctrl_net.c | 16 +++++++++++++++- .../ethernet/marvell/octeon_ep/octep_ctrl_net.h | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c index 5fa596c674da..4c39e2fabe0a 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c @@ -26,7 +26,7 @@ static atomic_t ctrl_net_msg_id; /* Control plane version in which OCTEP_CTRL_NET_H2F_CMD was added */ static const u32 octep_ctrl_net_h2f_cmd_versions[OCTEP_CTRL_NET_H2F_CMD_MAX] = { - [OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_GET_INFO] = + [OCTEP_CTRL_NET_H2F_CMD_INVALID ... OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE] = OCTEP_CP_VERSION(1, 0, 0) }; @@ -393,10 +393,24 @@ int octep_ctrl_net_get_info(struct octep_device *oct, int vfid, return 0; } +int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid) +{ + struct octep_ctrl_net_wait_data d = {}; + struct octep_ctrl_net_h2f_req *req; + + req = &d.data.req; + dev_dbg(&oct->pdev->dev, "Sending dev_unload msg to fw\n"); + init_send_req(&d.msg, req, sizeof(int), vfid); + req->hdr.s.cmd = OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE; + + return octep_send_mbox_req(oct, &d, false); +} int octep_ctrl_net_uninit(struct octep_device *oct) { struct octep_ctrl_net_wait_data *pos, *n; + octep_ctrl_net_dev_remove(oct, OCTEP_CTRL_NET_INVALID_VFID); + list_for_each_entry_safe(pos, n, &oct->ctrl_req_wait_list, list) pos->done = 1; diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h index a2463b460ad9..0de4de2ceb8f 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h @@ -42,6 +42,7 @@ enum octep_ctrl_net_h2f_cmd { OCTEP_CTRL_NET_H2F_CMD_RX_STATE, OCTEP_CTRL_NET_H2F_CMD_LINK_INFO, OCTEP_CTRL_NET_H2F_CMD_GET_INFO, + OCTEP_CTRL_NET_H2F_CMD_DEV_REMOVE, OCTEP_CTRL_NET_H2F_CMD_MAX }; @@ -370,6 +371,16 @@ void octep_ctrl_net_recv_fw_messages(struct octep_device *oct); int octep_ctrl_net_get_info(struct octep_device *oct, int vfid, struct octep_fw_info *info); +/** + * octep_ctrl_net_dev_remove() - Indicate to firmware that a device unload has happened. + * + * @oct: non-null pointer to struct octep_device. + * @vfid: Index of virtual function. + * + * return value: 0 on success, -errno on failure. + */ +int octep_ctrl_net_dev_remove(struct octep_device *oct, int vfid); + /** * octep_ctrl_net_uninit() - Uninitialize data for ctrl net. * From patchwork Wed Nov 29 04:53: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: 171060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp122418vqn; Tue, 28 Nov 2023 20:54:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXRogeuF8Fu7P6MyQQXBHkm8vxYYNnvbSI4RFytFe3+ORBfViYq1mggWRXGxdpYON5M8FQ X-Received: by 2002:a05:6a20:8f13:b0:18c:af15:7e73 with SMTP id b19-20020a056a208f1300b0018caf157e73mr9102040pzk.48.1701233661856; Tue, 28 Nov 2023 20:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701233661; cv=none; d=google.com; s=arc-20160816; b=kUuGVKSp9/a8JlKbW8ckML7aYKhP0ul9BfWUELcinft/OvWFpmhiUxQVWArVSbM4BR Z12uiWjyQ61zpta89b/kwyLvZanoOVIxXA+Gs+FdUavg9zD8kUKlUhP9vxfDyKY47Hp3 egO5pomasG2EHkWKU42j4pj2jbtxtJ9+ZSfmXvPsfAc/xB9OGozTN+Y2wH7TwU39jOg/ Eo1DQYgHuwOm+n1xgSqGXxcR3+8SSrEJ3iWdMbwqnIZ7CeSgnv7Y5xm/P//mzHQxKxb9 ZRAJltR8tDc//pS+6OCLI8p5WG+lIZIGv5YGd64456spBE0M5X4VAR2pzpqc5OovwVkf NirQ== 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=3AYOrgKDv8lKfL5x0A77bXyChCC845fHZIPOM9At5eM=; fh=suGKDpWIFmMAjdtpk3zqWn49Qa0wgqDQqCeyR+9WeRQ=; b=esCprCONG7sOw2YgPuZWmENCN+ckDxrbf3AfcB6BGkEXXMFW/kvqZGTH0Cye/mrXAW SyOohn1DOHfY3JI+I9zFkdVE/Km+X0cQ1kOmttil8P4nvKtra9YIqrvLecEWiVu3eiPd lW0FIxF5pJnQdSVPbyKgFHLYtJ4VY1gwyD76rF5I5tZbvrNey3AqpIW8UVwuNp6Tc0PP s2QLjJFEVv3rJ9heAjcvRjGUYocupMVHkl1jxDw5unGhLreYl1tqzPtx8CCE4xkWfRbb P4B4H0Ly7A183Svztgc68GG3mW9+GAKV/jMhVINmCvX9+EH4a4qxpNP53Ie99vxYaWGn UVWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=PKvfxQKF; 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 i30-20020a63541e000000b005c2783b71cesi12745276pgb.661.2023.11.28.20.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 20:54:21 -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=PKvfxQKF; 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 3A2068217A56; Tue, 28 Nov 2023 20:54:16 -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 S1376922AbjK2EyH (ORCPT + 99 others); Tue, 28 Nov 2023 23:54:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbjK2EyF (ORCPT ); Tue, 28 Nov 2023 23:54:05 -0500 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C769A19AD; Tue, 28 Nov 2023 20:54:11 -0800 (PST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASIduaJ021095; Tue, 28 Nov 2023 20:53:59 -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=3AYOrgKDv8lKfL5x0A77bXyChCC845fHZIPOM9At5eM=; b=PKvfxQKFbZkro09Oo6NDrC+k96z9D7EB3WkvGCfu6MjQLv1kyzPvnlt+aFh5Ci4yA0u3 luiNO9SQGB6i+2BllQa4XaeKC9ombH37Cptv/pCdBLBZw0hx9F76bBqBFOe46PV0dos2 KI4vdjmliIt5MgHwtIsCFmPt1kS1RemlCO/lPTK4kAGVJWH7EdTbBXv83/qvpjrTpFl8 9MaPsOtJPtd6SxUdTSUTZllVybikaWyvoc0k4m90PTrTFS80p/yINgoWSHDD1EpGFPXO p0XHgNmr9uCgF2Gs+5JBi7ZSM9kmYYkCujEYDLoWD3wI3yJmvWIhgsIicgDoVCdDlMUI WA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3unn869x1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 20:53:59 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 28 Nov 2023 20:53:57 -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; Tue, 28 Nov 2023 20:53:57 -0800 Received: from ubuntu-PowerEdge-T110-II.sclab.marvell.com (unknown [10.106.27.86]) by maili.marvell.com (Postfix) with ESMTP id 1E4F53F7048; Tue, 28 Nov 2023 20:53:57 -0800 (PST) From: Shinas Rasheed To: , CC: , , , , , , , , , , Shinas Rasheed , Eric Dumazet , Jonathan Corbet , Veerasenareddy Burru , Sathesh Edara Subject: [PATCH net-next v2 2/2] octeon_ep: support OCTEON CN98 devices Date: Tue, 28 Nov 2023 20:53:48 -0800 Message-ID: <20231129045348.2538843-3-srasheed@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231129045348.2538843-1-srasheed@marvell.com> References: <20231129045348.2538843-1-srasheed@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Fiomo1SjeIPYNx8ElS5TPmyhYWgw4hw3 X-Proofpoint-GUID: Fiomo1SjeIPYNx8ElS5TPmyhYWgw4hw3 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-11-29_01,2023-11-27_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]); Tue, 28 Nov 2023 20:54:16 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783872788006621613 X-GMAIL-MSGID: 1783872788006621613 Add PCI Endpoint NIC support for Octeon CN98 devices. CN98 devices are part of Octeon 9 family products with similar PCI NIC characteristics to CN93, already supported driver. Add CN98 card to the device id table, as well as support differences in the register fields and certain usage scenarios such as unload. Signed-off-by: Shinas Rasheed --- V2: - No changes V1: https://lore.kernel.org/all/20231127162135.2529363-3-srasheed@marvell.com/ .../ethernet/marvell/octeon_ep.rst | 1 + .../marvell/octeon_ep/octep_cn9k_pf.c | 24 +++++++++++++++---- .../ethernet/marvell/octeon_ep/octep_main.c | 4 ++++ .../ethernet/marvell/octeon_ep/octep_main.h | 1 + .../marvell/octeon_ep/octep_regs_cn9k_pf.h | 4 ++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst b/Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst index 613a818d5db6..c96d262b30be 100644 --- a/Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst +++ b/Documentation/networking/device_drivers/ethernet/marvell/octeon_ep.rst @@ -22,6 +22,7 @@ EndPoint NIC. Supported Devices ================= Currently, this driver support following devices: + * Network controller: Cavium, Inc. Device b100 * Network controller: Cavium, Inc. Device b200 * Network controller: Cavium, Inc. Device b400 * Network controller: Cavium, Inc. Device b900 diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c index d4ee2454675b..8baabd07e91f 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c @@ -216,9 +216,15 @@ static void octep_init_config_cn93_pf(struct octep_device *oct) conf->sriov_cfg.vf_srn = CN93_SDP_EPF_RINFO_SRN(val); val = octep_read_csr64(oct, CN93_SDP_MAC_PF_RING_CTL(oct->pcie_port)); - conf->pf_ring_cfg.srn = CN93_SDP_MAC_PF_RING_CTL_SRN(val); - conf->pf_ring_cfg.max_io_rings = CN93_SDP_MAC_PF_RING_CTL_RPPF(val); - conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings; + if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) { + conf->pf_ring_cfg.srn = CN98_SDP_MAC_PF_RING_CTL_SRN(val); + conf->pf_ring_cfg.max_io_rings = CN98_SDP_MAC_PF_RING_CTL_RPPF(val); + conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings; + } else { + conf->pf_ring_cfg.srn = CN93_SDP_MAC_PF_RING_CTL_SRN(val); + conf->pf_ring_cfg.max_io_rings = CN93_SDP_MAC_PF_RING_CTL_RPPF(val); + conf->pf_ring_cfg.active_io_rings = conf->pf_ring_cfg.max_io_rings; + } dev_info(&pdev->dev, "pf_srn=%u rpvf=%u nvfs=%u rppf=%u\n", conf->pf_ring_cfg.srn, conf->sriov_cfg.active_rings_per_vf, conf->sriov_cfg.active_vfs, conf->pf_ring_cfg.active_io_rings); @@ -578,6 +584,13 @@ static irqreturn_t octep_ioq_intr_handler_cn93_pf(void *data) return IRQ_HANDLED; } +/* soft reset of 98xx */ +static int octep_soft_reset_cn98_pf(struct octep_device *oct) +{ + dev_info(&oct->pdev->dev, "CN98XX: skip soft reset\n"); + return 0; +} + /* soft reset of 93xx */ static int octep_soft_reset_cn93_pf(struct octep_device *oct) { @@ -806,7 +819,10 @@ void octep_device_setup_cn93_pf(struct octep_device *oct) oct->hw_ops.misc_intr_handler = octep_misc_intr_handler_cn93_pf; oct->hw_ops.rsvd_intr_handler = octep_rsvd_intr_handler_cn93_pf; oct->hw_ops.ioq_intr_handler = octep_ioq_intr_handler_cn93_pf; - oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf; + if (oct->chip_id == OCTEP_PCI_DEVICE_ID_CN98_PF) + oct->hw_ops.soft_reset = octep_soft_reset_cn98_pf; + else + oct->hw_ops.soft_reset = octep_soft_reset_cn93_pf; oct->hw_ops.reinit_regs = octep_reinit_regs_cn93_pf; oct->hw_ops.enable_interrupts = octep_enable_interrupts_cn93_pf; diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index 423eec5ff3ad..1a24b3d3cce6 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -22,6 +22,7 @@ struct workqueue_struct *octep_wq; /* Supported Devices */ static const struct pci_device_id octep_pci_id_tbl[] = { + {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN98_PF)}, {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN93_PF)}, {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CNF95N_PF)}, {PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, OCTEP_PCI_DEVICE_ID_CN10KA_PF)}, @@ -1147,6 +1148,8 @@ static void octep_ctrl_mbox_task(struct work_struct *work) static const char *octep_devid_to_str(struct octep_device *oct) { switch (oct->chip_id) { + case OCTEP_PCI_DEVICE_ID_CN98_PF: + return "CN98XX"; case OCTEP_PCI_DEVICE_ID_CN93_PF: return "CN93XX"; case OCTEP_PCI_DEVICE_ID_CNF95N_PF: @@ -1197,6 +1200,7 @@ int octep_device_setup(struct octep_device *oct) dev_info(&pdev->dev, "chip_id = 0x%x\n", pdev->device); switch (oct->chip_id) { + case OCTEP_PCI_DEVICE_ID_CN98_PF: case OCTEP_PCI_DEVICE_ID_CN93_PF: case OCTEP_PCI_DEVICE_ID_CNF95N_PF: dev_info(&pdev->dev, "Setting up OCTEON %s PF PASS%d.%d\n", diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h index e2fe8b28eb0e..e1b4b2af618e 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h @@ -18,6 +18,7 @@ #define OCTEP_PCIID_CN93_PF 0xB200177d #define OCTEP_PCIID_CN93_VF 0xB203177d +#define OCTEP_PCI_DEVICE_ID_CN98_PF 0xB100 #define OCTEP_PCI_DEVICE_ID_CN93_PF 0xB200 #define OCTEP_PCI_DEVICE_ID_CN93_VF 0xB203 diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h index 0a43983e9101..2e20a39d89af 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h @@ -362,6 +362,10 @@ #define CN93_SDP_MAC_PF_RING_CTL_SRN(val) (((val) >> 8) & 0xFF) #define CN93_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 16) & 0x3F) +#define CN98_SDP_MAC_PF_RING_CTL_NPFS(val) (((val) >> 48) & 0xF) +#define CN98_SDP_MAC_PF_RING_CTL_SRN(val) ((val) & 0xFF) +#define CN98_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 32) & 0x3F) + /* Number of non-queue interrupts in CN93xx */ #define CN93_NUM_NON_IOQ_INTR 16