Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3584945ybh; Mon, 5 Aug 2019 21:47:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTzORh2RN1TKNf3MpeWc8R7YQ4/w3P159JmV7wxal2KxOJz/U1+n2cAdrY+Qb1y1t8v5T5 X-Received: by 2002:a17:902:2f:: with SMTP id 44mr1258510pla.5.1565066854484; Mon, 05 Aug 2019 21:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565066854; cv=none; d=google.com; s=arc-20160816; b=Jgea32r/7osl9CMadbWNQnPFRkf06CVvuHtnInOQkXg7CySm3Vqsh17VLe4d+19GFh YBYLMWXPPC0wdtdmRpjVShL+NeLq5D7YbCK8cFhTU1oUk1egHdw0HfD5AwPadanJlGjE cqQrJ84Y7DSvCoMYCuYLcDZA1f1V0MucJCRjvo3IjbtJLYbQjbPQ591JIAN7e0esAZkb 9qzhm0GGYBsGmrSoXdT6NpDCXG2KQCSTzF6TfqEfIP5+A6pfxFhgrJD6e2r3/I7u1UY/ qAW3hwiPmEcFg6nca0eCl08dXsp8YPeKm5I9IVvmT2Omk5bcLxtH5rZbq6iiLHnBjyJO cnpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=2j7+zajW8YHjJb6vtd6GGK8PfR2IXlyooiMNjhgqda4=; b=ppWILdm+inXwlE7Tq6C4GTZMUeNA9EF/2aoSF33aMg+HxLJEs3twkdCUQNVBJCBAci wqSFj9wC4OoJVNt9g3UzPyLa/97NmvLVhk5GwBDxOZC5MJLvXHK0De20XxTkbscPiuVR YK3+Usd+11mBav/uaRd3usLl0xXt763Tsy2nSnSwIw8eM69Z7wZEpqfVSALstxjGdKwi 2+JGeuiz1m57gD2obClTt6as5zxU6NcZuO8HCjfrEj+B9nv/kipjzDr0KcfZXjh40plL RfqzxtSaBP372vBWBi8+csndGdNv6UZy5FIpA8MdERWQh1L1s0v2Ryt/mAahktsg5r1w Zl5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=0WEACkB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si32455662pgu.549.2019.08.05.21.47.16; Mon, 05 Aug 2019 21:47:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=0WEACkB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725798AbfHFEqj (ORCPT + 99 others); Tue, 6 Aug 2019 00:46:39 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36607 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbfHFEqj (ORCPT ); Tue, 6 Aug 2019 00:46:39 -0400 Received: by mail-pg1-f194.google.com with SMTP id l21so40870772pgm.3 for ; Mon, 05 Aug 2019 21:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=2j7+zajW8YHjJb6vtd6GGK8PfR2IXlyooiMNjhgqda4=; b=0WEACkB6+tkSwapaLx3mUtGXDP8tMN+Mw0CtY4oq4TY6eb6BPbFQ03Rq2JZAoM20/u FY8yhlRyoAUr2kF8VcVVR4h1UEAzDuwkzsU7nYIJ1qyZPWUMp23JmIfyrAGr3kvvZPrF Sdjlj4dm+VQbaqllPiRCeTV7Da9fWHPMaV77IFgzqVJwYBuAK/0TvHPhNfqAJveP7gSq 6umgH6JcdQoRVJeg1LsHHvrANHxAgrbqwGK/adiCXx9KDqVtIjQOy89BCabkWAd+YMco nwsihxmqdAzfW6NyggGtIhUVCR96fStCxpW/zabYpJcYfwuyq0TJWULFKJYpIURYyfDn dv0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=2j7+zajW8YHjJb6vtd6GGK8PfR2IXlyooiMNjhgqda4=; b=dNfmmd+Ilm9RWCxS9T8+b4S+nf0yBWODO4q0mJ7Ds0MfrfPH+QKMowZhqHZXVpcIAK JV0HkomkSNiDc9hHJ40RNWH3qSEn29aywRDM/3b9FVV/BlLYg1X2j8pUQlB/3qMJJ+fn 3ghdMuF+imoctGw+ob0Q2j5T43moKdDe4buF4LFtzLYTQV9oWLw5ErDTCvoARBoYyqET i+fydTftc2OlOr26N+3uYwgbohvggjYCGuK3mDNvuXdzRLEOrrNWpbFHx+rf+lA0RVRN xNfCUB5rpHNHSt9wXEon0AD3YcZX2MAfRqdky7wLBwUBJrqZSbyNtf+n8hcZKpHxcpK2 YF5A== X-Gm-Message-State: APjAAAUtzlrB/5vwQ1vUTM4wOENM6Fb4k7IcDml2+hWp6ihIDWglaquw iXEv6Gw7V706sjhHt+8C/tgPWw== X-Received: by 2002:a17:90a:a489:: with SMTP id z9mr1170396pjp.24.1565066798435; Mon, 05 Aug 2019 21:46:38 -0700 (PDT) Received: from cakuba.netronome.com (c-71-204-185-212.hsd1.ca.comcast.net. [71.204.185.212]) by smtp.gmail.com with ESMTPSA id v18sm85291165pgl.87.2019.08.05.21.46.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 21:46:38 -0700 (PDT) Date: Mon, 5 Aug 2019 21:46:14 -0700 From: Jakub Kicinski To: Jose Abreu Cc: netdev@vger.kernel.org, Joao Pinto , Giuseppe Cavallaro , Alexandre Torgue , "David S. Miller" , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 06/10] net: stmmac: Implement RSS and enable it in XGMAC core Message-ID: <20190805214600.4c84ccd7@cakuba.netronome.com> In-Reply-To: References: Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Aug 2019 20:01:19 +0200, Jose Abreu wrote: > Implement the RSS functionality and add the corresponding callbacks in > XGMAC core. > > Signed-off-by: Jose Abreu > --- > Cc: Giuseppe Cavallaro > Cc: Alexandre Torgue > Cc: Jose Abreu > Cc: "David S. Miller" > Cc: Maxime Coquelin > Cc: netdev@vger.kernel.org > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > index c4c45402b8f8..9ff9d9ac1a50 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c > @@ -254,6 +254,34 @@ static void dwxgmac2_clear(struct dma_desc *p) > p->des3 = 0; > } > > +static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash, > + enum pkt_hash_types *type) > +{ > + unsigned int rdes3 = le32_to_cpu(p->des3); > + u32 ptype; > + > + if (rdes3 & XGMAC_RDES3_RSV) { > + ptype = (rdes3 & XGMAC_RDES3_L34T) >> XGMAC_RDES3_L34T_SHIFT; > + > + switch (ptype) { > + case 0x1: > + case 0x2: > + case 0x9: > + case 0xA: nit: it'd be nice to have defines for these constants > + *type = PKT_HASH_TYPE_L4; > + break; > + default: > + *type = PKT_HASH_TYPE_L3; > + break; > + } > + > + *hash = le32_to_cpu(p->des1); > + return 0; > + } > + > + return -EINVAL; > +} > + > const struct stmmac_desc_ops dwxgmac210_desc_ops = { > .tx_status = dwxgmac2_get_tx_status, > .rx_status = dwxgmac2_get_rx_status, > @@ -4182,7 +4208,7 @@ int stmmac_dvr_probe(struct device *device, > struct net_device *ndev = NULL; > struct stmmac_priv *priv; > u32 queue, maxq; > - int ret = 0; > + int i, ret = 0; > > ndev = devm_alloc_etherdev_mqs(device, sizeof(struct stmmac_priv), > MTL_MAX_TX_QUEUES, MTL_MAX_RX_QUEUES); > @@ -4290,6 +4316,14 @@ int stmmac_dvr_probe(struct device *device, > #endif > priv->msg_enable = netif_msg_init(debug, default_msg_level); > > + /* Initialize RSS */ > + netdev_rss_key_fill(priv->rss.key, sizeof(priv->rss.key)); > + for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++) > + priv->rss.table[i] = i % priv->plat->rx_queues_to_use; ethtool_rxfh_indir_default() ? > + if (priv->dma_cap.rssen && priv->plat->rss_en) > + ndev->features |= NETIF_F_RXHASH; > + > /* MTU range: 46 - hw-specific max */ > ndev->min_mtu = ETH_ZLEN - ETH_HLEN; > if ((priv->plat->enh_desc) || (priv->synopsys_id >= DWMAC_CORE_4_00))