Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp772875lqa; Sun, 28 Apr 2024 03:54:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFc/Xjy/MEGcqMoReKcl3bN27h4bUvJk1Tsirzp6ItSa+2YSr/BXoaXfLTaR+OYpPTNdmfJGVLtUL9LXIOIBDMLtJC2lgyj1gwwW19yg== X-Google-Smtp-Source: AGHT+IFEHa4Fx5oakg1DfYeG3rvXXuhdG1jbwpkVOFVBhXiWxg6BIXtjRixkN+b/WN52Ls9hwiUr X-Received: by 2002:a17:90b:246:b0:2aa:cadb:d290 with SMTP id fz6-20020a17090b024600b002aacadbd290mr10420102pjb.13.1714301681736; Sun, 28 Apr 2024 03:54:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714301681; cv=pass; d=google.com; s=arc-20160816; b=W5uGGP8FhzuYL27n5nr2dgmpNg0L/w6un3bBi87Z+SHLpgYV2yE01dzoGbJfr0kI9S 9oJLKRkeBm9efU+oKGHxbNKqeaa49vlR7Wk6ftYeGmqz8g0CnwNdKza/NgXQTvHOtMrS Gu9lLEn3qnGI9MPJbUgcMZVQzYmdBal1VppZpPBMBPyHTtMscY2+IBdqVOdyd2VPXQI4 pqRPDby9vK4CAeKXY8E1S8Ef3ZOnE/bc5KqBOZ7bKlBVvMUNxgaHwASgkxS76JxQCNfd nUpPdhVdROrEQL3zq4E3vWhfflJ9svYoIKYiMMsGS1dHOystHMtrJ3iApRBqSO1/Cpsf jmvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3zNZpbGpe0FeXNsby6uBO0BeDpIzBoG0HYJNUd8cpI4=; fh=wPv/fmS7iNNmCH0mdUKjkT6XsNx1nMbXFeqwvq2D6q0=; b=w51y/0MKGZ2S3APrmq+8zkepwDA9r1C98lLFq6DVR6fWr0JI4B+ZHeyGfDTQtcwuQE X5XmXSX21V3XUrkZ52UdG+phigaxLmetOURw0lhCLom0hI9FEfGqLnK3+E7vKjYawMPg ywV/leVZZguJYpFVFrVBpIrQ0CoLdn1m0XKJAJbCo4Bj98UwY7XZHEiC0kzwEMfprUlJ h6c+9a/eOdFcPLuOq+pGOqnAOpgT79dVougkrq3AqEFO1JNieY4UuXM20m5lew5nkyDe 3CTuC8tnxeEkCCtN2sxe1ffdEBtMbwE8J+iuUXnBjtmepg+W18aYISEUCH2Tv9NxOvy2 e0Lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=RQMrTVi3; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-161383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161383-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id qc5-20020a17090b288500b002adefef518esi12441342pjb.163.2024.04.28.03.54.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 03:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=RQMrTVi3; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-161383-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161383-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5DA28281A6F for ; Sun, 28 Apr 2024 10:54:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D4FA5C617; Sun, 28 Apr 2024 10:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="RQMrTVi3" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B1BC5B5A6; Sun, 28 Apr 2024 10:53:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714301619; cv=none; b=m3guuho5r/egfS3xVYLyqYulhrtsCNsDqTLcc7Xnz5vNx4I3Qkb63nf5KcJpp4oLDYQG+XaLFg4MJIDMVEtzplOIl7UugtTmBQwQ/3AWVt8VbZPDVanORWILwGmRTjL7LhKcjLjcfpolyhqQ4afR1zxe/vOr//u8t8nSrqtW54M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714301619; c=relaxed/simple; bh=k1aTHc99+NdsBpyfSOkQ7KV39ZFSEH1u8JVMbS85Bgg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yz5Mu/cw/iQjXhdkFW/NAc8smuYNRXVvVtcG4Sz/1J/Bq+rg7almOiK/PZVjDQVYnPVUvLdlheyt+LE1IaMtpFmSSNwvDknkNvERYogd4Gjvw724gSOFUhZ/krPklEpayhJF91uT/Hg/Pb/qbf7jPttyF+wF+Z/VyoXz5oBIK48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=RQMrTVi3; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43SAnBwp009576; Sun, 28 Apr 2024 03:53:32 -0700 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-type; s=pfpt0220; bh=3zNZpbGpe0FeXNsby6uBO 0BeDpIzBoG0HYJNUd8cpI4=; b=RQMrTVi3iQ4mAJBFqqziq+HHNye76mXC9ukTS TPQfG4AAcc/yg8MFRoJ8f+4IPa2QOKBy5QJlDj1lix2CNIOMVYaBaeaIcfIUit8d 3WUEiQv7yxSmY3Y66B0EDepdm4AnsO8T2UyUcp3ziyPpfIyChM3DZme6vRkWoUeq v/ji+wdhfRTtClvIFGG42LsLxfULEEn+XEW77aVe9uXY4yyWbSF5E3G7Mp515ayV pqOgI+DoyUfJ0PHDgVqYVWj2QsiiLa11P5l9PUUQjLnclVYSUN1FxLFCOSizwL1D ugTSggHPn0O/Fc2Ttdbj0LxIGww072iZrAq39LJj3B/REJPUg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3xrxqnhuy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 28 Apr 2024 03:53:32 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 28 Apr 2024 03:53:30 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sun, 28 Apr 2024 03:53:30 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 9AB1F5B6949; Sun, 28 Apr 2024 03:53:27 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [net-next PATCH v3 4/9] octeontx2-pf: Add basic net_device_ops Date: Sun, 28 Apr 2024 16:23:07 +0530 Message-ID: <20240428105312.9731-5-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240428105312.9731-1-gakula@marvell.com> References: <20240428105312.9731-1-gakula@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: YFGtDlhPTZfK2zuWy-RvPreaJ_Nfq_E8 X-Proofpoint-ORIG-GUID: YFGtDlhPTZfK2zuWy-RvPreaJ_Nfq_E8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-28_07,2024-04-26_02,2023-05-22_02 Implements basic set of net_device_ops. Signed-off-by: Geetha sowjanya --- .../net/ethernet/marvell/octeontx2/nic/rep.c | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c index c66ae39e4e23..147a6b6ca9ae 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c @@ -28,6 +28,51 @@ MODULE_DESCRIPTION(DRV_STRING); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, rvu_rep_id_table); +static netdev_tx_t rvu_rep_xmit(struct sk_buff *skb, struct net_device *dev) +{ + struct rep_dev *rep = netdev_priv(dev); + struct otx2_nic *pf = rep->mdev; + struct otx2_snd_queue *sq; + struct netdev_queue *txq; + + sq = &pf->qset.sq[rep->rep_id]; + txq = netdev_get_tx_queue(dev, 0); + + if (!otx2_sq_append_skb(pf, txq, sq, skb, rep->rep_id)) { + netif_tx_stop_queue(txq); + + /* Check again, incase SQBs got freed up */ + smp_mb(); + if (((sq->num_sqbs - *sq->aura_fc_addr) * sq->sqe_per_sqb) + > sq->sqe_thresh) + netif_tx_wake_queue(txq); + + return NETDEV_TX_BUSY; + } + return NETDEV_TX_OK; +} + +static int rvu_rep_open(struct net_device *dev) +{ + netif_carrier_on(dev); + netif_tx_start_all_queues(dev); + return 0; +} + +static int rvu_rep_stop(struct net_device *dev) +{ + netif_carrier_off(dev); + netif_tx_disable(dev); + + return 0; +} + +static const struct net_device_ops rvu_rep_netdev_ops = { + .ndo_open = rvu_rep_open, + .ndo_stop = rvu_rep_stop, + .ndo_start_xmit = rvu_rep_xmit, +}; + static int rvu_rep_napi_init(struct otx2_nic *priv, struct netlink_ext_ack *extack) { struct otx2_cq_poll *cq_poll = NULL; @@ -151,6 +196,7 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack) ndev->min_mtu = OTX2_MIN_MTU; ndev->max_mtu = priv->hw.max_mtu; + ndev->netdev_ops = &rvu_rep_netdev_ops; pcifunc = priv->rep_pf_map[rep_id]; rep->pcifunc = pcifunc; -- 2.25.1