diff options
author | Jose Abreu <Jose.Abreu@synopsys.com> | 2018-05-04 10:01:38 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-10 14:16:36 -0400 |
commit | 4dbbe8dde8485b89bce8bbbe7564337fd7eed69f (patch) | |
tree | 1f6113406f200cb84545fc409ab48f6db9c743dc /drivers/net/ethernet/stmicro/stmmac/hwif.c | |
parent | b2641e2ad456459a655da2433e3150d41640a6de (diff) | |
download | linux-4dbbe8dde8485b89bce8bbbe7564337fd7eed69f.tar.gz |
net: stmmac: Add support for U32 TC filter using Flexible RX Parser
This adds support for U32 filter by using an HW only feature called
Flexible RX Parser. This allow us to match any given packet field with a
pattern and accept/reject or even route the packet to a specific DMA
channel.
Right now we only support acception or rejection of frame and we only
support simple rules. Though, the Parser has the flexibility of jumping to
specific rules as an if condition so complex rules can be established.
This is only supported in GMAC5.10+.
The following commands can be used to test this code:
1) Setup an ingress qdisk:
# tc qdisc add dev eth0 handle ffff: ingress
2) Setup a filter (e.g. filter by IP):
# tc filter add dev eth0 parent ffff: protocol ip u32 match ip \
src 192.168.0.3 skip_sw action drop
In every tests performed we always used the "skip_sw" flag to make sure
only the RX Parser was involved.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Vitor Soares <soares@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/hwif.c')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/hwif.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 2b0a7e79de00..9acc8d2f1039 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -77,6 +77,7 @@ static const struct stmmac_hwif_entry { const void *mac; const void *hwtimestamp; const void *mode; + const void *tc; int (*setup)(struct stmmac_priv *priv); int (*quirks)(struct stmmac_priv *priv); } stmmac_hw[] = { @@ -90,6 +91,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac100_ops, .hwtimestamp = &stmmac_ptp, .mode = NULL, + .tc = NULL, .setup = dwmac100_setup, .quirks = stmmac_dwmac1_quirks, }, { @@ -101,6 +103,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac1000_ops, .hwtimestamp = &stmmac_ptp, .mode = NULL, + .tc = NULL, .setup = dwmac1000_setup, .quirks = stmmac_dwmac1_quirks, }, { @@ -112,6 +115,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac4_ops, .hwtimestamp = &stmmac_ptp, .mode = NULL, + .tc = NULL, .setup = dwmac4_setup, .quirks = stmmac_dwmac4_quirks, }, { @@ -123,6 +127,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac410_ops, .hwtimestamp = &stmmac_ptp, .mode = &dwmac4_ring_mode_ops, + .tc = NULL, .setup = dwmac4_setup, .quirks = NULL, }, { @@ -134,6 +139,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac410_ops, .hwtimestamp = &stmmac_ptp, .mode = &dwmac4_ring_mode_ops, + .tc = NULL, .setup = dwmac4_setup, .quirks = NULL, }, { @@ -145,6 +151,7 @@ static const struct stmmac_hwif_entry { .mac = &dwmac510_ops, .hwtimestamp = &stmmac_ptp, .mode = &dwmac4_ring_mode_ops, + .tc = &dwmac510_tc_ops, .setup = dwmac4_setup, .quirks = NULL, } @@ -196,6 +203,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->mac = entry->mac; mac->ptp = entry->hwtimestamp; mac->mode = entry->mode; + mac->tc = entry->tc; priv->hw = mac; |