Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp471657lqp; Tue, 11 Jun 2024 09:33:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMvSTXYaFDAn5q7QWZTAItVyydDVljJA2T+eANRstKq/44uV6awA2T9ljiJlhLyR/+D+bX8KUx/2YZcEZ3T56dGiUMItM2AiIRhHn/1A== X-Google-Smtp-Source: AGHT+IGYQdu0YidkbuzXda1aPc39jyjD9m1Q5VKkJxbAHpprUSbeT5Tzmj7j6Z6JBxMEKkJqJU/g X-Received: by 2002:a05:6a20:a11d:b0:1b7:cea:3070 with SMTP id adf61e73a8af0-1b70cea311emr6706189637.33.1718123607832; Tue, 11 Jun 2024 09:33:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718123607; cv=pass; d=google.com; s=arc-20160816; b=Re5ejflyesj5I6Rcw3dIc1V5NMCUCmI+CxEZZTW4xyQVS541Cu4G1nPK20ubcCPjzi b/5d0wvREDJV8Db87Lpx+4oK7I/lrlIrtXW1BFGgB5ouymrSRpUFVdj5INPGzoRGo/vI v3yfLZLKHX5wdM9tydvbxqRDhX+mCaaOGLlxiEXd7EO0TeX7lpSNxWtaaSJASzTrtIqJ qeT4A5Fi2mt8jhvwSnRkVKtd8wVzKIcK1rviWaxzmUA0zB/J+vwoozuwMGnN8wFcEtOT c/jcZw8xJJ/6fzjEh5XtFjckaNOGyp5lxQC87xPKXnvvMLwy7EqctIM5UvKGSyH+uJUc PhFQ== 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=gw1q3fY56iqcuUucMSMbsL/AX8UEWNVpX4PKvlB3e/E=; fh=wPv/fmS7iNNmCH0mdUKjkT6XsNx1nMbXFeqwvq2D6q0=; b=H6PL+nROx6ZUrMvRWXAD5Vy6hIzvqbQRfuUZEf0Uy0rsexmI/A16ndV2sSgIbJG1/1 DJ+vyFf0YtNKmOKVEaBzoyHWuYc7twxVrXCRTASxPZF6hmHrsM3BR+JU9ZMtl6sSDa7e MjH3FZGxDWeIpjNN2Ewj2k/jtQkIRySa96vNfodZu1U/mk+/hyDj5pKjzW+xB91/2zxX rDGtvZBEuexnXwitcYN4Md+g7X39zwiE+vUkwAl4C3aQVBywKIb0EO/b3pT0icewu4Un LN5hXHrdWJonCc/9WNJ26v7CO38QQS2h+rdBz9q9xg9JgswUFvur15VO5exec1/tlvEC Is7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=FKoZDZf9; 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-210235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210235-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2760acebsi5671552a12.518.2024.06.11.09.33.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 09:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=FKoZDZf9; 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-210235-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210235-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 2266C287F44 for ; Tue, 11 Jun 2024 16:24:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E60063D971; Tue, 11 Jun 2024 16:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="FKoZDZf9" 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 A471457CB5; Tue, 11 Jun 2024 16:22:47 +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=1718122969; cv=none; b=ZWFAiUaiZNxo/MjrHPufFu8sgQxW09FUtB2VYoiUSspqZGhG2todQ3cMHBlebSutayCToqiu9A//v19BzBEXW1mesQiv1RG2ynPDgHqtjkq7IbvZCpvCHtwvtN12sgGsovDL0bMUdod5dFXO3h4dUGABdwGP42JLuzVkRQlXhe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718122969; c=relaxed/simple; bh=NNmlYt0CMe+FoELVTXscqp/2pwGzb0HrWpAGV6ZT3O0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YKAhSTmJbG7R8fw6LGJBPrA4QIZxKWOO2W1ENi9U9KfMpMk6dAHfZ92Ie8OIsDxDthoQCIopguGjVR0E+BtDjg6hjoAopdGJ/iUbZ1fP2C8Vt0rliEhLJR2zDTyoZ5GT1yxqeCD7YdC+ABkfBN3TexZTMmUTKYUZuykcbHGbL5o= 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=FKoZDZf9; 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 45BGJRrJ021192; Tue, 11 Jun 2024 09:22:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=pfpt0220; bh=gw1q3fY56iqcuUucMSMbsL/AX 8UEWNVpX4PKvlB3e/E=; b=FKoZDZf9u/CAuod+6MdVupdTg03rpCxFXKA8o/QAa Bu2AV3i0m4BdBKeoXDTKRZKInxkO8MVi4tP4QFGfXPO9jOS+Gsa0abAwFddZQzm+ nsMCiuxhWqC6JnYIjwo2iCNF56ZBZdUQMq1E9kTZbU6HsnXh0HbBFEt8IGFA5x7d VOLpqxXg5rydx8nVds2CQFJz1nKr2l3fL13GT+GNgJQwImH7jhsdKbcwd0zwhNLQ 535ls7bCOG0MmAwbe6vabQ3fLDYiZlwdH1OsvCESXap359rNYJ5L7eC7UKigf1J5 S3vcQJibUB9DBtlq/fCv6nXkYu6bPn9yUMzbgR5oMz0TA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ypmq0hct8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jun 2024 09:22:33 -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; Tue, 11 Jun 2024 09:22:31 -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; Tue, 11 Jun 2024 09:22:31 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id B908C3F7059; Tue, 11 Jun 2024 09:22:28 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , Subject: [net-next PATCH v5 04/10] octeontx2-pf: Add basic net_device_ops Date: Tue, 11 Jun 2024 21:52:07 +0530 Message-ID: <20240611162213.22213-5-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240611162213.22213-1-gakula@marvell.com> References: <20240611162213.22213-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: zyZzJsw--bGkzA0xCcpQxzD3sDvQwvyL X-Proofpoint-ORIG-GUID: zyZzJsw--bGkzA0xCcpQxzD3sDvQwvyL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-11_09,2024-06-11_01,2024-05-17_01 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 16325ba23c74..3cb8dc820fdd 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, in case 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) { @@ -155,6 +200,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