Merge branch 'stmmac-next'

Jose Abreu says:

====================
net: stmmac: Improvements and fixes for -next

Improvements and fixes for recently introduced features. All for -next tree.
More info in commit logs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-09-07 17:57:42 +02:00
commit 428e2d6fce
4 changed files with 78 additions and 16 deletions

View File

@ -352,7 +352,8 @@ enum power_event {
/* Default operating mode of the MAC */
#define GMAC_CORE_INIT (GMAC_CONFIG_JD | GMAC_CONFIG_PS | \
GMAC_CONFIG_BE | GMAC_CONFIG_DCRS)
GMAC_CONFIG_BE | GMAC_CONFIG_DCRS | \
GMAC_CONFIG_JE)
/* To dump the core regs excluding the Address Registers */
#define GMAC_REG_NUM 132

View File

@ -25,15 +25,9 @@ static void dwmac4_core_init(struct mac_device_info *hw,
{
void __iomem *ioaddr = hw->pcsr;
u32 value = readl(ioaddr + GMAC_CONFIG);
int mtu = dev->mtu;
value |= GMAC_CORE_INIT;
if (mtu > 1500)
value |= GMAC_CONFIG_2K;
if (mtu > 2000)
value |= GMAC_CONFIG_JE;
if (hw->ps) {
value |= GMAC_CONFIG_TE;

View File

@ -831,15 +831,22 @@ static void stmmac_validate(struct phylink_config *config,
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
} else if (priv->plat->has_xgmac) {
phylink_set(mac_supported, 2500baseT_Full);
phylink_set(mac_supported, 5000baseT_Full);
phylink_set(mac_supported, 10000baseSR_Full);
phylink_set(mac_supported, 10000baseLR_Full);
phylink_set(mac_supported, 10000baseER_Full);
phylink_set(mac_supported, 10000baseLRM_Full);
phylink_set(mac_supported, 10000baseT_Full);
phylink_set(mac_supported, 10000baseKX4_Full);
phylink_set(mac_supported, 10000baseKR_Full);
if (!max_speed || (max_speed >= 2500)) {
phylink_set(mac_supported, 2500baseT_Full);
phylink_set(mac_supported, 2500baseX_Full);
}
if (!max_speed || (max_speed >= 5000)) {
phylink_set(mac_supported, 5000baseT_Full);
}
if (!max_speed || (max_speed >= 10000)) {
phylink_set(mac_supported, 10000baseSR_Full);
phylink_set(mac_supported, 10000baseLR_Full);
phylink_set(mac_supported, 10000baseER_Full);
phylink_set(mac_supported, 10000baseLRM_Full);
phylink_set(mac_supported, 10000baseT_Full);
phylink_set(mac_supported, 10000baseKX4_Full);
phylink_set(mac_supported, 10000baseKR_Full);
}
}
/* Half-Duplex can only work with single queue */

View File

@ -722,8 +722,14 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
for (i = 0; i < rx_cnt; i++) {
struct stmmac_channel *ch = &priv->channel[i];
u32 tail;
tail = priv->rx_queue[i].dma_rx_phy +
(DMA_RX_SIZE * sizeof(struct dma_desc));
stmmac_set_rx_tail_ptr(priv, priv->ioaddr, tail, i);
stmmac_start_rx(priv, priv->ioaddr, i);
local_bh_disable();
napi_reschedule(&ch->rx_napi);
local_bh_enable();
@ -1057,6 +1063,9 @@ static int stmmac_test_desc_sai(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
if (!priv->dma_cap.vlins)
return -EOPNOTSUPP;
attr.remove_sa = true;
attr.sarc = true;
attr.src = src;
@ -1076,6 +1085,9 @@ static int stmmac_test_desc_sar(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
if (!priv->dma_cap.vlins)
return -EOPNOTSUPP;
attr.sarc = true;
attr.src = src;
attr.dst = priv->dev->dev_addr;
@ -1094,6 +1106,9 @@ static int stmmac_test_reg_sai(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
if (!priv->dma_cap.vlins)
return -EOPNOTSUPP;
attr.remove_sa = true;
attr.sarc = true;
attr.src = src;
@ -1114,6 +1129,9 @@ static int stmmac_test_reg_sar(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
if (!priv->dma_cap.vlins)
return -EOPNOTSUPP;
attr.sarc = true;
attr.src = src;
attr.dst = priv->dev->dev_addr;
@ -1585,6 +1603,44 @@ static int stmmac_test_mjumbo(struct stmmac_priv *priv)
return 0;
}
static int stmmac_test_sph(struct stmmac_priv *priv)
{
unsigned long cnt_end, cnt_start = priv->xstats.rx_split_hdr_pkt_n;
struct stmmac_packet_attrs attr = { };
int ret;
if (!priv->sph)
return -EOPNOTSUPP;
/* Check for UDP first */
attr.dst = priv->dev->dev_addr;
attr.tcp = false;
ret = __stmmac_test_loopback(priv, &attr);
if (ret)
return ret;
cnt_end = priv->xstats.rx_split_hdr_pkt_n;
if (cnt_end <= cnt_start)
return -EINVAL;
/* Check for TCP now */
cnt_start = cnt_end;
attr.dst = priv->dev->dev_addr;
attr.tcp = true;
ret = __stmmac_test_loopback(priv, &attr);
if (ret)
return ret;
cnt_end = priv->xstats.rx_split_hdr_pkt_n;
if (cnt_end <= cnt_start)
return -EINVAL;
return 0;
}
#define STMMAC_LOOPBACK_NONE 0
#define STMMAC_LOOPBACK_MAC 1
#define STMMAC_LOOPBACK_PHY 2
@ -1706,6 +1762,10 @@ static const struct stmmac_test {
.name = "Multichannel Jumbo ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_mjumbo,
}, {
.name = "Split Header ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_sph,
},
};