rocker: set FDB cleanup timer according to lowest ageing time
authorIdo Schimmel <idosch@mellanox.com>
Tue, 8 Mar 2016 20:59:34 +0000 (12:59 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Mar 2016 19:58:58 +0000 (14:58 -0500)
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: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.h
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/rocker/rocker_ofdpa.c

index 1ab995f7146b3d1028465b7af61cfcb08f3f151a..011f1b6f91bb5b62a4f9360af31cc65dfa28f73b 100644 (file)
@@ -63,6 +63,7 @@ struct rocker {
        struct {
                u64 id;
        } hw;
+       unsigned long ageing_time;
        spinlock_t cmd_ring_lock;               /* for cmd ring accesses */
        struct rocker_dma_ring_info cmd_ring;
        struct rocker_dma_ring_info event_ring;
index 28b775e5a9ad459ccd4e1a6dc1ebe5fde4df7cd1..c8b1bf474e89a126c1dcc20275a51ddabc395ee3 100644 (file)
@@ -2733,6 +2733,8 @@ static int rocker_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        rocker->hw.id = rocker_read64(rocker, SWITCH_ID);
 
+       rocker->ageing_time = BR_DEFAULT_AGEING_TIME;
+
        err = rocker_probe_ports(rocker);
        if (err) {
                dev_err(&pdev->dev, "failed to probe ports\n");
index 07218c360d8648f593849d2428c559e2b52298bb..cfde525d9123e1f1b8f0102874d1dfd12b80d485 100644 (file)
@@ -2105,7 +2105,7 @@ static void ofdpa_fdb_cleanup(unsigned long data)
        struct ofdpa_port *ofdpa_port;
        struct ofdpa_fdb_tbl_entry *entry;
        struct hlist_node *tmp;
-       unsigned long next_timer = jiffies + BR_MIN_AGEING_TIME;
+       unsigned long next_timer = jiffies + ofdpa->rocker->ageing_time;
        unsigned long expires;
        unsigned long lock_flags;
        int flags = OFDPA_OP_FLAG_NOWAIT | OFDPA_OP_FLAG_REMOVE |
@@ -2648,9 +2648,12 @@ ofdpa_port_attr_bridge_ageing_time_set(struct rocker_port *rocker_port,
                                       struct switchdev_trans *trans)
 {
        struct ofdpa_port *ofdpa_port = rocker_port->wpriv;
+       struct rocker *rocker = rocker_port->rocker;
 
        if (!switchdev_trans_ph_prepare(trans)) {
                ofdpa_port->ageing_time = clock_t_to_jiffies(ageing_time);
+               if (ofdpa_port->ageing_time < rocker->ageing_time)
+                       rocker->ageing_time = ofdpa_port->ageing_time;
                mod_timer(&ofdpa_port->ofdpa->fdb_cleanup_timer, jiffies);
        }