Commit b33210e3 authored by David S. Miller's avatar David S. Miller

Merge branch 'stmmac-fixes'

Jose Abreu says:

====================
net: stmmac: Fixes for -net

Misc fixes for -net tree. More info in commit logs.

v2 is just a rebase of v1 against -net and we added a new patch (09/09) to
fix RSS feature.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 93c2fcb0 56627336
...@@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
int numhashregs = (hw->multicast_filter_bins >> 5); int numhashregs = (hw->multicast_filter_bins >> 5);
int mcbitslog2 = hw->mcast_bits_log2; int mcbitslog2 = hw->mcast_bits_log2;
unsigned int value; unsigned int value;
u32 mc_filter[8];
int i; int i;
memset(mc_filter, 0, sizeof(mc_filter));
value = readl(ioaddr + GMAC_PACKET_FILTER); value = readl(ioaddr + GMAC_PACKET_FILTER);
value &= ~GMAC_PACKET_FILTER_HMC; value &= ~GMAC_PACKET_FILTER_HMC;
value &= ~GMAC_PACKET_FILTER_HPF; value &= ~GMAC_PACKET_FILTER_HPF;
...@@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
/* Pass all multi */ /* Pass all multi */
value |= GMAC_PACKET_FILTER_PM; value |= GMAC_PACKET_FILTER_PM;
/* Set all the bits of the HASH tab */ /* Set all the bits of the HASH tab */
for (i = 0; i < numhashregs; i++) memset(mc_filter, 0xff, sizeof(mc_filter));
writel(0xffffffff, ioaddr + GMAC_HASH_TAB(i));
} else if (!netdev_mc_empty(dev)) { } else if (!netdev_mc_empty(dev)) {
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u32 mc_filter[8];
/* Hash filter for multicast */ /* Hash filter for multicast */
value |= GMAC_PACKET_FILTER_HMC; value |= GMAC_PACKET_FILTER_HMC;
memset(mc_filter, 0, sizeof(mc_filter));
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
/* The upper n bits of the calculated CRC are used to /* The upper n bits of the calculated CRC are used to
* index the contents of the hash table. The number of * index the contents of the hash table. The number of
...@@ -440,9 +440,10 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -440,9 +440,10 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
*/ */
mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f)); mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f));
} }
}
for (i = 0; i < numhashregs; i++) for (i = 0; i < numhashregs; i++)
writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i));
}
value |= GMAC_PACKET_FILTER_HPF; value |= GMAC_PACKET_FILTER_HPF;
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
#define XGMAC_TSIE BIT(12) #define XGMAC_TSIE BIT(12)
#define XGMAC_LPIIE BIT(5) #define XGMAC_LPIIE BIT(5)
#define XGMAC_PMTIE BIT(4) #define XGMAC_PMTIE BIT(4)
#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE | XGMAC_TSIE) #define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE)
#define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4) #define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4)
#define XGMAC_PT GENMASK(31, 16) #define XGMAC_PT GENMASK(31, 16)
#define XGMAC_PT_SHIFT 16 #define XGMAC_PT_SHIFT 16
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
#define XGMAC_HWFEAT_GMIISEL BIT(1) #define XGMAC_HWFEAT_GMIISEL BIT(1)
#define XGMAC_HW_FEATURE1 0x00000120 #define XGMAC_HW_FEATURE1 0x00000120
#define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27) #define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27)
#define XGMAC_HWFEAT_HASHTBLSZ GENMASK(25, 24)
#define XGMAC_HWFEAT_RSSEN BIT(20) #define XGMAC_HWFEAT_RSSEN BIT(20)
#define XGMAC_HWFEAT_TSOEN BIT(18) #define XGMAC_HWFEAT_TSOEN BIT(18)
#define XGMAC_HWFEAT_SPHEN BIT(17) #define XGMAC_HWFEAT_SPHEN BIT(17)
......
...@@ -472,7 +472,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw, ...@@ -472,7 +472,7 @@ static void dwxgmac2_set_filter(struct mac_device_info *hw,
dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2); dwxgmac2_set_mchash(ioaddr, mc_filter, mcbitslog2);
/* Handle multiple unicast addresses */ /* Handle multiple unicast addresses */
if (netdev_uc_count(dev) > XGMAC_ADDR_MAX) { if (netdev_uc_count(dev) > hw->unicast_filter_entries) {
value |= XGMAC_FILTER_PR; value |= XGMAC_FILTER_PR;
} else { } else {
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
...@@ -523,8 +523,8 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, ...@@ -523,8 +523,8 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw,
struct stmmac_rss *cfg, u32 num_rxq) struct stmmac_rss *cfg, u32 num_rxq)
{ {
void __iomem *ioaddr = hw->pcsr; void __iomem *ioaddr = hw->pcsr;
u32 value, *key;
int i, ret; int i, ret;
u32 value;
value = readl(ioaddr + XGMAC_RSS_CTRL); value = readl(ioaddr + XGMAC_RSS_CTRL);
if (!cfg || !cfg->enable) { if (!cfg || !cfg->enable) {
...@@ -533,8 +533,9 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw, ...@@ -533,8 +533,9 @@ static int dwxgmac2_rss_configure(struct mac_device_info *hw,
return 0; return 0;
} }
for (i = 0; i < (sizeof(cfg->key) / sizeof(u32)); i++) { key = (u32 *)cfg->key;
ret = dwxgmac2_rss_write_reg(ioaddr, true, i, cfg->key[i]); for (i = 0; i < (ARRAY_SIZE(cfg->key) / sizeof(u32)); i++) {
ret = dwxgmac2_rss_write_reg(ioaddr, true, i, key[i]);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -380,6 +380,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, ...@@ -380,6 +380,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
/* MAC HW feature 1 */ /* MAC HW feature 1 */
hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1); hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);
dma_cap->l3l4fnum = (hw_cap & XGMAC_HWFEAT_L3L4FNUM) >> 27; dma_cap->l3l4fnum = (hw_cap & XGMAC_HWFEAT_L3L4FNUM) >> 27;
dma_cap->hash_tb_sz = (hw_cap & XGMAC_HWFEAT_HASHTBLSZ) >> 24;
dma_cap->rssen = (hw_cap & XGMAC_HWFEAT_RSSEN) >> 20; dma_cap->rssen = (hw_cap & XGMAC_HWFEAT_RSSEN) >> 20;
dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18; dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18;
dma_cap->sphen = (hw_cap & XGMAC_HWFEAT_SPHEN) >> 17; dma_cap->sphen = (hw_cap & XGMAC_HWFEAT_SPHEN) >> 17;
......
...@@ -629,6 +629,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) ...@@ -629,6 +629,7 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
ptp_v2 = PTP_TCR_TSVER2ENA; ptp_v2 = PTP_TCR_TSVER2ENA;
snap_type_sel = PTP_TCR_SNAPTYPSEL_1; snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
ts_event_en = PTP_TCR_TSEVNTENA;
ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
ptp_over_ethernet = PTP_TCR_TSIPENA; ptp_over_ethernet = PTP_TCR_TSIPENA;
...@@ -4717,9 +4718,7 @@ int stmmac_suspend(struct device *dev) ...@@ -4717,9 +4718,7 @@ int stmmac_suspend(struct device *dev)
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
rtnl_lock(); phylink_mac_change(priv->phylink, false);
phylink_stop(priv->phylink);
rtnl_unlock();
netif_device_detach(ndev); netif_device_detach(ndev);
stmmac_stop_all_queues(priv); stmmac_stop_all_queues(priv);
...@@ -4734,6 +4733,10 @@ int stmmac_suspend(struct device *dev) ...@@ -4734,6 +4733,10 @@ int stmmac_suspend(struct device *dev)
stmmac_pmt(priv, priv->hw, priv->wolopts); stmmac_pmt(priv, priv->hw, priv->wolopts);
priv->irq_wake = 1; priv->irq_wake = 1;
} else { } else {
rtnl_lock();
phylink_stop(priv->phylink);
rtnl_unlock();
stmmac_mac_set(priv, priv->ioaddr, false); stmmac_mac_set(priv, priv->ioaddr, false);
pinctrl_pm_select_sleep_state(priv->device); pinctrl_pm_select_sleep_state(priv->device);
/* Disable clock in case of PWM is off */ /* Disable clock in case of PWM is off */
...@@ -4824,9 +4827,13 @@ int stmmac_resume(struct device *dev) ...@@ -4824,9 +4827,13 @@ int stmmac_resume(struct device *dev)
stmmac_start_all_queues(priv); stmmac_start_all_queues(priv);
if (!device_may_wakeup(priv->device)) {
rtnl_lock(); rtnl_lock();
phylink_start(priv->phylink); phylink_start(priv->phylink);
rtnl_unlock(); rtnl_unlock();
}
phylink_mac_change(priv->phylink, true);
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
......
...@@ -1564,10 +1564,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) ...@@ -1564,10 +1564,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue)
struct stmmac_packet_attrs attr = { }; struct stmmac_packet_attrs attr = { };
int size = priv->dma_buf_sz; int size = priv->dma_buf_sz;
/* Only XGMAC has SW support for multiple RX descs in same packet */
if (priv->plat->has_xgmac)
size = priv->dev->max_mtu;
attr.dst = priv->dev->dev_addr; attr.dst = priv->dev->dev_addr;
attr.max_size = size - ETH_FCS_LEN; attr.max_size = size - ETH_FCS_LEN;
attr.queue_mapping = queue; attr.queue_mapping = queue;
......
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