Skip to content

Commit

Permalink
Merge branch 'stmmac-fixes'
Browse files Browse the repository at this point in the history
Jose Abreu says:

====================
net: stmmac: Misc fixes

Some misc fixes for stmmac targeting -net.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Jan 31, 2019
2 parents d525608 + e2cd682 commit 3aa9179
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
14 changes: 10 additions & 4 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,11 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
{
unsigned long clk = clk_get_rate(priv->plat->stmmac_clk);

if (!clk)
return 0;
if (!clk) {
clk = priv->plat->clk_ref_rate;
if (!clk)
return 0;
}

return (usec * (clk / 1000000)) / 256;
}
Expand All @@ -731,8 +734,11 @@ static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv)
{
unsigned long clk = clk_get_rate(priv->plat->stmmac_clk);

if (!clk)
return 0;
if (!clk) {
clk = priv->plat->clk_ref_rate;
if (!clk)
return 0;
}

return (riwt * 256) / (clk / 1000000);
}
Expand Down
17 changes: 13 additions & 4 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3023,10 +3023,22 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)

tx_q = &priv->tx_queue[queue];

if (priv->tx_path_in_lpi_mode)
stmmac_disable_eee_mode(priv);

/* Manage oversized TCP frames for GMAC4 device */
if (skb_is_gso(skb) && priv->tso) {
if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))
if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) {
/*
* There is no way to determine the number of TSO
* capable Queues. Let's use always the Queue 0
* because if TSO is supported then at least this
* one will be capable.
*/
skb_set_queue_mapping(skb, 0);

return stmmac_tso_xmit(skb, dev);
}
}

if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) {
Expand All @@ -3041,9 +3053,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_BUSY;
}

if (priv->tx_path_in_lpi_mode)
stmmac_disable_eee_mode(priv);

entry = tx_q->cur_tx;
first_entry = entry;
WARN_ON(tx_q->tx_skbuff[first_entry]);
Expand Down
1 change: 1 addition & 0 deletions include/linux/stmmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ struct plat_stmmacenet_data {
struct clk *pclk;
struct clk *clk_ptp_ref;
unsigned int clk_ptp_rate;
unsigned int clk_ref_rate;
struct reset_control *stmmac_rst;
struct stmmac_axi *axi;
int has_gmac4;
Expand Down

0 comments on commit 3aa9179

Please sign in to comment.