Commit b509750f authored by David S. Miller's avatar David S. Miller

Merge branch 'stmmac-filtering-fixes'

Jose Abreu says:

====================
net: stmmac: Filtering fixes

Two single fixes for the L3 and L4 filtering in stmmac.

1) Updates the internal status of RSS when disabling it in order to keep
internal driver status consistent.

2) Do not lets user add a filter if RSS is enabled because the filter will
not work correctly as RSS bypasses this mechanism.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents db885e66 7bd754c4
...@@ -1323,16 +1323,19 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1323,16 +1323,19 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
struct stmmac_packet_attrs attr = { }; struct stmmac_packet_attrs attr = { };
struct flow_dissector *dissector; struct flow_dissector *dissector;
struct flow_cls_offload *cls; struct flow_cls_offload *cls;
int ret, old_enable = 0;
struct flow_rule *rule; struct flow_rule *rule;
int ret;
if (!tc_can_offload(priv->dev)) if (!tc_can_offload(priv->dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!priv->dma_cap.l3l4fnum) if (!priv->dma_cap.l3l4fnum)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (priv->rss.enable) if (priv->rss.enable) {
old_enable = priv->rss.enable;
priv->rss.enable = false;
stmmac_rss_configure(priv, priv->hw, NULL, stmmac_rss_configure(priv, priv->hw, NULL,
priv->plat->rx_queues_to_use); priv->plat->rx_queues_to_use);
}
dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
if (!dissector) { if (!dissector) {
...@@ -1399,7 +1402,8 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1399,7 +1402,8 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
cleanup_dissector: cleanup_dissector:
kfree(dissector); kfree(dissector);
cleanup_rss: cleanup_rss:
if (priv->rss.enable) { if (old_enable) {
priv->rss.enable = old_enable;
stmmac_rss_configure(priv, priv->hw, &priv->rss, stmmac_rss_configure(priv, priv->hw, &priv->rss,
priv->plat->rx_queues_to_use); priv->plat->rx_queues_to_use);
} }
...@@ -1444,16 +1448,19 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1444,16 +1448,19 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
struct stmmac_packet_attrs attr = { }; struct stmmac_packet_attrs attr = { };
struct flow_dissector *dissector; struct flow_dissector *dissector;
struct flow_cls_offload *cls; struct flow_cls_offload *cls;
int ret, old_enable = 0;
struct flow_rule *rule; struct flow_rule *rule;
int ret;
if (!tc_can_offload(priv->dev)) if (!tc_can_offload(priv->dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!priv->dma_cap.l3l4fnum) if (!priv->dma_cap.l3l4fnum)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (priv->rss.enable) if (priv->rss.enable) {
old_enable = priv->rss.enable;
priv->rss.enable = false;
stmmac_rss_configure(priv, priv->hw, NULL, stmmac_rss_configure(priv, priv->hw, NULL,
priv->plat->rx_queues_to_use); priv->plat->rx_queues_to_use);
}
dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); dissector = kzalloc(sizeof(*dissector), GFP_KERNEL);
if (!dissector) { if (!dissector) {
...@@ -1525,7 +1532,8 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1525,7 +1532,8 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
cleanup_dissector: cleanup_dissector:
kfree(dissector); kfree(dissector);
cleanup_rss: cleanup_rss:
if (priv->rss.enable) { if (old_enable) {
priv->rss.enable = old_enable;
stmmac_rss_configure(priv, priv->hw, &priv->rss, stmmac_rss_configure(priv, priv->hw, &priv->rss,
priv->plat->rx_queues_to_use); priv->plat->rx_queues_to_use);
} }
......
...@@ -577,6 +577,10 @@ static int tc_setup_cls(struct stmmac_priv *priv, ...@@ -577,6 +577,10 @@ static int tc_setup_cls(struct stmmac_priv *priv,
{ {
int ret = 0; int ret = 0;
/* When RSS is enabled, the filtering will be bypassed */
if (priv->rss.enable)
return -EBUSY;
switch (cls->command) { switch (cls->command) {
case FLOW_CLS_REPLACE: case FLOW_CLS_REPLACE:
ret = tc_add_flow(priv, cls); ret = tc_add_flow(priv, cls);
......
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