On Fri,  4 May 2018 10:01:38 +0100, Jose Abreu wrote:
> 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 <joab...@synopsys.com>
> Cc: David S. Miller <da...@davemloft.net>
> Cc: Joao Pinto <jpi...@synopsys.com>
> Cc: Vitor Soares <soa...@synopsys.com>
> Cc: Giuseppe Cavallaro <peppe.cavall...@st.com>
> Cc: Alexandre Torgue <alexandre.tor...@st.com>
> Cc: Jakub Kicinski <kubak...@wp.pl>
> ---
> Changes from v1:
>       - Follow Linux network coding style (David)
>       - Use tc_cls_can_offload_and_chain0() (Jakub)

Thanks!

> @@ -4223,6 +4277,11 @@ int stmmac_dvr_probe(struct device *device,
>       ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>                           NETIF_F_RXCSUM;
>  
> +     ret = stmmac_tc_init(priv, priv);
> +     if (!ret) {
> +             ndev->hw_features |= NETIF_F_HW_TC;
> +     }
> +
>       if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) {
>               ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
>               priv->tso = true;

One more comment, but perhaps not a showstopper, it's considered good
practice to disallow clearing/disabling this flag while filters are
installed.  Driver should return -EBUSY from .ndo_set_features if TC
rules are offloaded and user wants to disable HW_TC feature flag.

Reply via email to