Skip to content

Commit

Permalink
Merge branch 'net-dsa-bcm_sf2-Store-rules-in-lists'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
davem330 committed Nov 6, 2018
2 parents 95772ec + 80f8dea commit 5882d52
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 315 deletions.
6 changes: 6 additions & 0 deletions drivers/net/dsa/bcm_sf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
return ret;
}

ret = bcm_sf2_cfp_resume(ds);
if (ret)
return ret;

if (priv->hw_params.num_gphy == 1)
bcm_sf2_gphy_enable_set(ds, true);

Expand Down Expand Up @@ -1061,6 +1065,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
spin_lock_init(&priv->indir_lock);
mutex_init(&priv->stats_mutex);
mutex_init(&priv->cfp.lock);
INIT_LIST_HEAD(&priv->cfp.rules_list);

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

priv->wol_ports_mask = 0;
dsa_unregister_switch(priv->dev->ds);
bcm_sf2_cfp_exit(priv->dev->ds);
/* Disable all ports and interrupts */
bcm_sf2_sw_suspend(priv->dev->ds);
bcm_sf2_mdio_unregister(priv);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/dsa/bcm_sf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct bcm_sf2_cfp_priv {
DECLARE_BITMAP(used, CFP_NUM_RULES);
DECLARE_BITMAP(unique, CFP_NUM_RULES);
unsigned int rules_cnt;
struct list_head rules_list;
};

struct bcm_sf2_priv {
Expand Down Expand Up @@ -213,5 +214,7 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc);
int bcm_sf2_cfp_rst(struct bcm_sf2_priv *priv);
void bcm_sf2_cfp_exit(struct dsa_switch *ds);
int bcm_sf2_cfp_resume(struct dsa_switch *ds);

#endif /* __BCM_SF2_H */
Loading

0 comments on commit 5882d52

Please sign in to comment.