Commit d08d32d1 authored by Ong Boon Leong's avatar Ong Boon Leong Committed by David S. Miller

net: stmmac: make SPH enable/disable to be configurable

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: default avatarOng Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8deec94c
...@@ -160,6 +160,7 @@ struct stmmac_priv { ...@@ -160,6 +160,7 @@ struct stmmac_priv {
bool tx_path_in_lpi_mode; bool tx_path_in_lpi_mode;
bool tso; bool tso;
int sph; int sph;
int sph_cap;
u32 sarc_type; u32 sarc_type;
unsigned int dma_buf_sz; unsigned int dma_buf_sz;
......
...@@ -2858,6 +2858,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) ...@@ -2858,6 +2858,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
u32 rx_cnt = priv->plat->rx_queues_to_use; u32 rx_cnt = priv->plat->rx_queues_to_use;
u32 tx_cnt = priv->plat->tx_queues_to_use; u32 tx_cnt = priv->plat->tx_queues_to_use;
bool sph_en;
u32 chan; u32 chan;
int ret; int ret;
...@@ -2952,10 +2953,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) ...@@ -2952,10 +2953,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
} }
/* Enable Split Header */ /* Enable Split Header */
if (priv->sph && priv->hw->rx_csum) { sph_en = (priv->hw->rx_csum > 0) && priv->sph;
for (chan = 0; chan < rx_cnt; chan++) for (chan = 0; chan < rx_cnt; chan++)
stmmac_enable_sph(priv, priv->ioaddr, 1, chan); stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
}
/* VLAN Tag Insertion */ /* VLAN Tag Insertion */
if (priv->dma_cap.vlins) if (priv->dma_cap.vlins)
...@@ -5708,7 +5709,8 @@ int stmmac_dvr_probe(struct device *device, ...@@ -5708,7 +5709,8 @@ int stmmac_dvr_probe(struct device *device,
if (priv->dma_cap.sphen) { if (priv->dma_cap.sphen) {
ndev->hw_features |= NETIF_F_GRO; 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"); dev_info(priv->device, "SPH feature enabled\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment