Skip to content

Commit 5882d52

Browse files
committed
Merge branch 'net-dsa-bcm_sf2-Store-rules-in-lists'
Florian Fainelli says: ==================== net: dsa: bcm_sf2: Store rules in lists This patch series changes the bcm-sf2 driver to keep a copy of the inserted rules as opposed to using the HW as a storage area for a number of reasons: - this helps us with doing duplicate rule detection in a faster way, it would have required a full rule read before - this helps with Pablo's on-going work to convert ethtool_rx_flow_spec to a more generic flow rule structure by having fewer code paths to convert to the new structure/helpers - we need to cache copies to restore them during drive resumption, because depending on the low power mode the system has entered, the switch may have lost all of its context ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 95772ec + 80f8dea commit 5882d52

File tree

5 files changed

+204
-315
lines changed

5 files changed

+204
-315
lines changed

drivers/net/dsa/bcm_sf2.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,10 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
710710
return ret;
711711
}
712712

713+
ret = bcm_sf2_cfp_resume(ds);
714+
if (ret)
715+
return ret;
716+
713717
if (priv->hw_params.num_gphy == 1)
714718
bcm_sf2_gphy_enable_set(ds, true);
715719

@@ -1061,6 +1065,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
10611065
spin_lock_init(&priv->indir_lock);
10621066
mutex_init(&priv->stats_mutex);
10631067
mutex_init(&priv->cfp.lock);
1068+
INIT_LIST_HEAD(&priv->cfp.rules_list);
10641069

10651070
/* CFP rule #0 cannot be used for specific classifications, flag it as
10661071
* permanently used
@@ -1166,6 +1171,7 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
11661171

11671172
priv->wol_ports_mask = 0;
11681173
dsa_unregister_switch(priv->dev->ds);
1174+
bcm_sf2_cfp_exit(priv->dev->ds);
11691175
/* Disable all ports and interrupts */
11701176
bcm_sf2_sw_suspend(priv->dev->ds);
11711177
bcm_sf2_mdio_unregister(priv);

drivers/net/dsa/bcm_sf2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct bcm_sf2_cfp_priv {
5656
DECLARE_BITMAP(used, CFP_NUM_RULES);
5757
DECLARE_BITMAP(unique, CFP_NUM_RULES);
5858
unsigned int rules_cnt;
59+
struct list_head rules_list;
5960
};
6061

6162
struct bcm_sf2_priv {
@@ -213,5 +214,7 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
213214
int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
214215
struct ethtool_rxnfc *nfc);
215216
int bcm_sf2_cfp_rst(struct bcm_sf2_priv *priv);
217+
void bcm_sf2_cfp_exit(struct dsa_switch *ds);
218+
int bcm_sf2_cfp_resume(struct dsa_switch *ds);
216219

217220
#endif /* __BCM_SF2_H */

0 commit comments

Comments
 (0)