Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5558267pxb; Mon, 14 Feb 2022 01:53:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzQT756CvWLnlW5uLA3ONi5ifOn0n+0Zk3xE3andNTzvD66bC2kMH/nvPRwSE36PxYMEGr X-Received: by 2002:a63:91c9:: with SMTP id l192mr3310142pge.474.1644832388234; Mon, 14 Feb 2022 01:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644832388; cv=none; d=google.com; s=arc-20160816; b=Qq24YY7hQ/fg8Y7/uO9AIN7gPyLCBB7wePbx3EM3Fw3SfzQcIX5Aw6WdMECMu3jQa9 Kbd3w0loMTgiL94E+NDZOGB+0vwEnI9e6kMWdl9PcR0+n8dXG72lYD8oa/B2OnJPA0CB 8VKciG2WQINJ1jw07SKRFfzvLhwW0AxEXwe/DKwXtftyojZqAMxDu4urODKusqX/HRJ5 RqiXJC90MsdLfU/YBlmZLKhnmt0Lt/DHtZLQEGt/VPDeC5NjU9PCElVGEd7vU3NfIDnK tzzB25iOadU5umF3lrwqr71clhB7/fa8hxMOAUb1+Y0Qmf6crbIDTNknT7cy6mVh397M tAmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9x7DSTFn1VyVI3zwfNOIChDEvRgPKpDU6GbPJ7fb7dI=; b=Z5oBCRHRk7HxwBln1MUMRFsxFmjoflw5glZlMeNSGxXeOFcHVRBUOMzC1dOkFcgVMt N/TCuyY3CNyJYh9W7lS1b5P5SaCx66bBWLNIO8n4nv1gUWQPObLvglSOgCY38e5JCKO8 I0VzDtbUbosft71kYFKcQ2dYXK77szMbfX0dS4Es5maM1G7LMPNEEggUXNBQWhpTXO1s qPnGz7m/1fC9a9flS3t+g10453eggeG+vBgNx8KqZyhTHpccuFM8akgWuarH2fPNLJ0F FJETIWBsZOwSLybjhFc8Xp2kN1FvrYOnq4kcTtFVZts6J1jM8SS8Phvsx7FM84yukzEj bw4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I4aiMhyK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn17si12494819pjb.82.2022.02.14.01.52.54; Mon, 14 Feb 2022 01:53:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I4aiMhyK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236702AbiBMPQg (ORCPT + 99 others); Sun, 13 Feb 2022 10:16:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236577AbiBMPQf (ORCPT ); Sun, 13 Feb 2022 10:16:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1D25BD0B; Sun, 13 Feb 2022 07:16:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98230B80923; Sun, 13 Feb 2022 15:16:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2D14C004E1; Sun, 13 Feb 2022 15:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644765387; bh=aGp7kWkbr372vbj+uaoixxJhotpk14CM+9+g9ENcKGs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I4aiMhyKZpFno6Ge7gRgBh8qrAa89pnSx+q7agiMQg61uTjpBa26llyyXPnkhjdIt v+qp3H9IHUVlOBDgLiuBQyuWKr15D8tPXIU8xNxiOsyCRhjqnYyISDINkSq/KjVSuz zXYzsJPWDGOC3X+v5eRnBXlnezMSTRhc138/qB2mG2z2udZpygMjFAJf5hPcOqooly X3URKTnKnjjFk4A3vaKCA0N5iZFLLofrqd6KkwtqrslhxR5vuu4hW5rghtM2F8ypii 0uQZfqKrit6iNJUNAY6RnEuu4smDcQn7q52mmpw1GhOdwoWETpLoqlzMioZTlE7Li9 5qE1Por+t1DHw== Date: Sun, 13 Feb 2022 17:16:22 +0200 From: Leon Romanovsky To: Veerasenareddy Burru Cc: davem@davemloft.net, kuba@kernel.org, corbet@lwn.net, netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Abhijit Ayarekar , Satananda Burla Subject: Re: [PATCH 2/4] octeon_ep: add support for ndo ops. Message-ID: References: <20220210213306.3599-1-vburru@marvell.com> <20220210213306.3599-3-vburru@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210213306.3599-3-vburru@marvell.com> X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Thu, Feb 10, 2022 at 01:33:04PM -0800, Veerasenareddy Burru wrote: > Add support for ndo ops to set MAC address, change MTU, get stats. > Add control path support to set MAC address, change MTU, get stats, > set speed, get and set link mode. > > Signed-off-by: Veerasenareddy Burru > Signed-off-by: Abhijit Ayarekar > Signed-off-by: Satananda Burla > --- > .../marvell/octeon_ep/octep_ctrl_net.c | 105 ++++++++++++++++++ > .../ethernet/marvell/octeon_ep/octep_main.c | 67 +++++++++++ > 2 files changed, 172 insertions(+) Please don't put "." in end of patch title. > > 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 1f0d8ba3c8ee..be9b0f31c754 100644 > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c > @@ -87,3 +87,108 @@ int octep_get_mac_addr(struct octep_device *oct, u8 *addr) > > return 0; > } > + > +int octep_set_mac_addr(struct octep_device *oct, u8 *addr) > +{ > + struct octep_ctrl_mbox_msg msg = { 0 }; > + struct octep_ctrl_net_h2f_req req = { 0 }; It is enough to write {} without 0. > + > + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_MAC; > + req.mac.cmd = OCTEP_CTRL_NET_CMD_SET; > + memcpy(&req.mac.addr, addr, ETH_ALEN); > + > + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ; > + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_MAC_REQ_SZW; > + msg.msg = &req; > + return octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg); > +} > + > +int octep_set_mtu(struct octep_device *oct, int mtu) > +{ > + struct octep_ctrl_mbox_msg msg = { 0 }; > + struct octep_ctrl_net_h2f_req req = { 0 }; > + > + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_MTU; > + req.mtu.cmd = OCTEP_CTRL_NET_CMD_SET; > + req.mtu.val = mtu; > + > + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ; > + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_MTU_REQ_SZW; > + msg.msg = &req; > + return octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg); > +} > + > +int octep_get_if_stats(struct octep_device *oct) > +{ > + struct octep_ctrl_mbox_msg msg = { 0 }; > + struct octep_ctrl_net_h2f_req req = { 0 }; > + struct octep_iface_rx_stats *iface_rx_stats; > + struct octep_iface_tx_stats *iface_tx_stats; > + int err; Reversed Christmas tree, in all functions. > + > + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_GET_IF_STATS; > + req.mac.cmd = OCTEP_CTRL_NET_CMD_GET; > + req.get_stats.offset = oct->ctrl_mbox_ifstats_offset; > + > + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ; > + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_GET_STATS_REQ_SZW; > + msg.msg = &req; > + err = octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg); > + if (!err) { Please use success oriented approach, in all places. if (err) return err; .... > + iface_rx_stats = (struct octep_iface_rx_stats *)(oct->ctrl_mbox.barmem + > + oct->ctrl_mbox_ifstats_offset); > + iface_tx_stats = (struct octep_iface_tx_stats *)(oct->ctrl_mbox.barmem + > + oct->ctrl_mbox_ifstats_offset + > + sizeof(struct octep_iface_rx_stats) > + ); > + memcpy(&oct->iface_rx_stats, iface_rx_stats, sizeof(struct octep_iface_rx_stats)); > + memcpy(&oct->iface_tx_stats, iface_tx_stats, sizeof(struct octep_iface_tx_stats)); > + } > + > + return 0; > +} > + Thanks