Commit c3d8f507 authored by Ido Schimmel's avatar Ido Schimmel Committed by Greg Kroah-Hartman

rocker: set FDB cleanup timer according to lowest ageing time

[ Upstream commit 88de1cd4 ]

In rocker, ageing time is a per-port attribute, so the next time the FDB
cleanup timer fires should be set according to the lowest ageing time.

This will later allow us to delete the BR_MIN_AGEING_TIME macro, which was
added to guarantee minimum ageing time in the bridge layer, thereby breaking
existing behavior.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7d870cff
...@@ -239,6 +239,7 @@ struct rocker { ...@@ -239,6 +239,7 @@ struct rocker {
struct { struct {
u64 id; u64 id;
} hw; } hw;
unsigned long ageing_time;
spinlock_t cmd_ring_lock; /* for cmd ring accesses */ spinlock_t cmd_ring_lock; /* for cmd ring accesses */
struct rocker_dma_ring_info cmd_ring; struct rocker_dma_ring_info cmd_ring;
struct rocker_dma_ring_info event_ring; struct rocker_dma_ring_info event_ring;
...@@ -3704,7 +3705,7 @@ static void rocker_fdb_cleanup(unsigned long data) ...@@ -3704,7 +3705,7 @@ static void rocker_fdb_cleanup(unsigned long data)
struct rocker_port *rocker_port; struct rocker_port *rocker_port;
struct rocker_fdb_tbl_entry *entry; struct rocker_fdb_tbl_entry *entry;
struct hlist_node *tmp; struct hlist_node *tmp;
unsigned long next_timer = jiffies + BR_MIN_AGEING_TIME; unsigned long next_timer = jiffies + rocker->ageing_time;
unsigned long expires; unsigned long expires;
unsigned long lock_flags; unsigned long lock_flags;
int flags = ROCKER_OP_FLAG_NOWAIT | ROCKER_OP_FLAG_REMOVE | int flags = ROCKER_OP_FLAG_NOWAIT | ROCKER_OP_FLAG_REMOVE |
...@@ -4367,8 +4368,12 @@ static int rocker_port_bridge_ageing_time(struct rocker_port *rocker_port, ...@@ -4367,8 +4368,12 @@ static int rocker_port_bridge_ageing_time(struct rocker_port *rocker_port,
struct switchdev_trans *trans, struct switchdev_trans *trans,
u32 ageing_time) u32 ageing_time)
{ {
struct rocker *rocker = rocker_port->rocker;
if (!switchdev_trans_ph_prepare(trans)) { if (!switchdev_trans_ph_prepare(trans)) {
rocker_port->ageing_time = clock_t_to_jiffies(ageing_time); rocker_port->ageing_time = clock_t_to_jiffies(ageing_time);
if (rocker_port->ageing_time < rocker->ageing_time)
rocker->ageing_time = rocker_port->ageing_time;
mod_timer(&rocker_port->rocker->fdb_cleanup_timer, jiffies); mod_timer(&rocker_port->rocker->fdb_cleanup_timer, jiffies);
} }
...@@ -5206,10 +5211,13 @@ static int rocker_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -5206,10 +5211,13 @@ static int rocker_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_init_tbls; goto err_init_tbls;
} }
rocker->ageing_time = BR_DEFAULT_AGEING_TIME;
setup_timer(&rocker->fdb_cleanup_timer, rocker_fdb_cleanup, setup_timer(&rocker->fdb_cleanup_timer, rocker_fdb_cleanup,
(unsigned long) rocker); (unsigned long) rocker);
mod_timer(&rocker->fdb_cleanup_timer, jiffies); mod_timer(&rocker->fdb_cleanup_timer, jiffies);
rocker->ageing_time = BR_DEFAULT_AGEING_TIME;
err = rocker_probe_ports(rocker); err = rocker_probe_ports(rocker);
if (err) { if (err) {
dev_err(&pdev->dev, "failed to probe ports\n"); dev_err(&pdev->dev, "failed to probe ports\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