Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp502113pxf; Wed, 31 Mar 2021 08:39:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMdNhETOJN14yJ2+qU8N0U9LIZ4vuXW90HvdqKFjJilLE/p6Mxom82VcKPmt9T95xArvrF X-Received: by 2002:a17:906:6c93:: with SMTP id s19mr4143485ejr.151.1617205161049; Wed, 31 Mar 2021 08:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617205161; cv=none; d=google.com; s=arc-20160816; b=TbAxgkRiiJwk/w58xpneSXRPqjovKLcXsh+qBfyFwi2CVAwH4Wj/hmqfot9f4i/YDq KL8d2tEriiEv1QMMwu7qcgBvmKWhsn1mzIJWkHM+5bRxUNAFqYH7dJCuSqABAs7b8lLY t1pXMnCBL4soPGXT4FTaD3/sQBDY8dOIgiGr9LY3Vu7g2T3hmoxPniNeyMEIU1qFsI7y QgxacpJRKT7XhQ4lVpa/o7Neatfm45EK2o2I8ewdMX/ZP9gAGZKQ1Q21WIV9bSruTuZG 10JvQSUkkWS84nhJr1i8R1FO5GcwiNkzjxGISF8LdYjQ+bC4cVSIYH1s/k6SkUSu6Zgl /RLw== 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 :ironport-sdr:ironport-sdr; bh=Cm3zbayf1QSza3BySI6xlbbyoa1jvl3tom6YT6+XmeY=; b=uSOvQ4OcTJ8hc1zEULts1pZD4rU7fGWPEVoRM1C5sGwtu1IbpkvrpTFZw9LI7u1DsL U1kIumS/jrI7mk1OFMhfKRUFDQ/iXrkBOKxCNi4ma0kX77RaSlh1zNPUW4DBJRgeA/j0 IJXT/XZZusBo55qDtz0fZ27/hhTLeiGs4QGk/ON/UKs3BA8Q4Vt8WZHVqBtMMJVeXSPv n8o/RvMdwvQf/702jwTKuJdNUNhV7uDMQ1XAUMs2G1AKwkSoqn6NKENy0PDR64kOBE0b BG6k80yEtzaiCIE7WMjB2KXU2hNuI2hsDRbmL9Ut276bHQ0YZ0MUoFh1T8ZS0IwifA72 IroQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx8si2091214edb.517.2021.03.31.08.38.57; Wed, 31 Mar 2021 08:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236265AbhCaPiF (ORCPT + 99 others); Wed, 31 Mar 2021 11:38:05 -0400 Received: from mga12.intel.com ([192.55.52.136]:32109 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235692AbhCaPhg (ORCPT ); Wed, 31 Mar 2021 11:37:36 -0400 IronPort-SDR: AUhv740SjjvbpHM15NaqrjAIUsiYGm1l2pfWKEH8b/sXHNl+f6SeOcQj/Fx4NsrhRhQuLr7qr7 DBvqH27u9aKg== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="171446712" X-IronPort-AV: E=Sophos;i="5.81,293,1610438400"; d="scan'208";a="171446712" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 08:37:36 -0700 IronPort-SDR: WBdn8n1IStfynk/TN/hI7IDItmaK3Oamsbx5mdmBIeB5dIFR8ZG08x1iEawmrhVmJZY7yuykf1 5vIZY8JWvg8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,293,1610438400"; d="scan'208";a="418729102" Received: from glass.png.intel.com ([10.158.65.59]) by orsmga008.jf.intel.com with ESMTP; 31 Mar 2021 08:37:31 -0700 From: Ong Boon Leong To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Cc: Maxime Coquelin , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Ong Boon Leong Subject: [PATCH net-next v3 2/6] net: stmmac: make SPH enable/disable to be configurable Date: Wed, 31 Mar 2021 23:41:31 +0800 Message-Id: <20210331154135.8507-3-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210331154135.8507-1-boon.leong.ong@intel.com> References: <20210331154135.8507-1-boon.leong.ong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SPH functionality splits header and payload according to split mode and offsef fields (SPLM and SPLOFST). It is beneficials for Linux network stack RX processing however it adds a lot of complexity in XDP processing. So, this patch makes the split-header (SPH) capability of the controller is stored in "priv->sph_cap" and the enabling/disabling of SPH is decided by "priv->sph". This is to prepare initial XDP enabling for stmmac to disable the use of SPH whenever XDP is enabled. Signed-off-by: Ong Boon Leong --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 9966f6f10905..e293423f98c3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -160,6 +160,7 @@ struct stmmac_priv { bool tx_path_in_lpi_mode; bool tso; int sph; + int sph_cap; u32 sarc_type; unsigned int dma_buf_sz; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9d63e8c365ae..18e34a1e2367 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2858,6 +2858,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) struct stmmac_priv *priv = netdev_priv(dev); u32 rx_cnt = priv->plat->rx_queues_to_use; u32 tx_cnt = priv->plat->tx_queues_to_use; + bool sph_en; u32 chan; int ret; @@ -2952,10 +2953,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) } /* Enable Split Header */ - if (priv->sph && priv->hw->rx_csum) { - for (chan = 0; chan < rx_cnt; chan++) - stmmac_enable_sph(priv, priv->ioaddr, 1, chan); - } + sph_en = (priv->hw->rx_csum > 0) && priv->sph; + for (chan = 0; chan < rx_cnt; chan++) + stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan); + /* VLAN Tag Insertion */ if (priv->dma_cap.vlins) @@ -5708,7 +5709,8 @@ int stmmac_dvr_probe(struct device *device, if (priv->dma_cap.sphen) { ndev->hw_features |= NETIF_F_GRO; - priv->sph = true; + priv->sph_cap = true; + priv->sph = priv->sph_cap; dev_info(priv->device, "SPH feature enabled\n"); } -- 2.25.1