Commit 53515a05 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-renesas-rswitch-fixes'

Yoshihiro Shimoda says:

====================
net: renesas: rswitch: Fix rx and timestamp

I got reports locally about issues on the rswitch driver.
So, fix the issues.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 90de546d 2c59e993
...@@ -702,13 +702,14 @@ static bool rswitch_rx(struct net_device *ndev, int *quota) ...@@ -702,13 +702,14 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
u16 pkt_len; u16 pkt_len;
u32 get_ts; u32 get_ts;
if (*quota <= 0)
return true;
boguscnt = min_t(int, gq->ring_size, *quota); boguscnt = min_t(int, gq->ring_size, *quota);
limit = boguscnt; limit = boguscnt;
desc = &gq->rx_ring[gq->cur]; desc = &gq->rx_ring[gq->cur];
while ((desc->desc.die_dt & DT_MASK) != DT_FEMPTY) { while ((desc->desc.die_dt & DT_MASK) != DT_FEMPTY) {
if (--boguscnt < 0)
break;
dma_rmb(); dma_rmb();
pkt_len = le16_to_cpu(desc->desc.info_ds) & RX_DS; pkt_len = le16_to_cpu(desc->desc.info_ds) & RX_DS;
skb = gq->skbs[gq->cur]; skb = gq->skbs[gq->cur];
...@@ -734,6 +735,9 @@ static bool rswitch_rx(struct net_device *ndev, int *quota) ...@@ -734,6 +735,9 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
gq->cur = rswitch_next_queue_index(gq, true, 1); gq->cur = rswitch_next_queue_index(gq, true, 1);
desc = &gq->rx_ring[gq->cur]; desc = &gq->rx_ring[gq->cur];
if (--boguscnt <= 0)
break;
} }
num = rswitch_get_num_cur_queues(gq); num = rswitch_get_num_cur_queues(gq);
...@@ -745,7 +749,7 @@ static bool rswitch_rx(struct net_device *ndev, int *quota) ...@@ -745,7 +749,7 @@ static bool rswitch_rx(struct net_device *ndev, int *quota)
goto err; goto err;
gq->dirty = rswitch_next_queue_index(gq, false, num); gq->dirty = rswitch_next_queue_index(gq, false, num);
*quota -= limit - (++boguscnt); *quota -= limit - boguscnt;
return boguscnt <= 0; return boguscnt <= 0;
...@@ -1437,8 +1441,11 @@ static int rswitch_open(struct net_device *ndev) ...@@ -1437,8 +1441,11 @@ static int rswitch_open(struct net_device *ndev)
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true); rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true);
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true); rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true);
if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE); iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
bitmap_set(rdev->priv->opened_ports, rdev->port, 1);
return 0; return 0;
}; };
...@@ -1448,7 +1455,9 @@ static int rswitch_stop(struct net_device *ndev) ...@@ -1448,7 +1455,9 @@ static int rswitch_stop(struct net_device *ndev)
struct rswitch_gwca_ts_info *ts_info, *ts_info2; struct rswitch_gwca_ts_info *ts_info, *ts_info2;
netif_tx_stop_all_queues(ndev); netif_tx_stop_all_queues(ndev);
bitmap_clear(rdev->priv->opened_ports, rdev->port, 1);
if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID); iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDID);
list_for_each_entry_safe(ts_info, ts_info2, &rdev->priv->gwca.ts_info_list, list) { list_for_each_entry_safe(ts_info, ts_info2, &rdev->priv->gwca.ts_info_list, list) {
......
...@@ -998,6 +998,7 @@ struct rswitch_private { ...@@ -998,6 +998,7 @@ struct rswitch_private {
struct rcar_gen4_ptp_private *ptp_priv; struct rcar_gen4_ptp_private *ptp_priv;
struct rswitch_device *rdev[RSWITCH_NUM_PORTS]; struct rswitch_device *rdev[RSWITCH_NUM_PORTS];
DECLARE_BITMAP(opened_ports, RSWITCH_NUM_PORTS);
struct rswitch_gwca gwca; struct rswitch_gwca gwca;
struct rswitch_etha etha[RSWITCH_NUM_PORTS]; struct rswitch_etha etha[RSWITCH_NUM_PORTS];
......
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