net: mvneta: some small improvements
Subsystems (3)
v2 cover net: mvneta: some small improvements
patch1 removes the NETIF_F_GRO check ourself, because the net subsystem will handle it for us.
patch2 enables NETIF_F_RXCSUM by default, since the driver and HW supports the feature.
patch3 is a small optimization, to reduce smp_processor_id() calling in mvneta_tx_done_gbe.
since v1:
- based on net-next tree
- remove the fix patches, since they should be based on net branch.
- Add Gregory's Reviewed-by tag
Jisheng Zhang (3):
net: mvneta: Don't check NETIF_F_GRO ourself
net: mvneta: enable NETIF_F_RXCSUM by default
net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe
drivers/net/ethernet/marvell/mvneta.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
2.18.0
PATCH v2 1/3 net: mvneta: Don't check NETIF_F_GRO ourself
napi_gro_receive() checks NETIF_F_GRO bit as well, if the bit is not set, we will go through GRO_NORMAL in napi_skb_finish(), so fall back to netif_receive_skb_internal(), so we don't need to check NETIF_F_GRO ourself.
--- drivers/net/ethernet/marvell/mvneta.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +1 -4
@@ -2065,10 +2065,7 @@ static int mvneta_rx_swbm(struct napi_struct *napi,/* Linux processing */ rxq->skb->protocol =eth_type_trans (rxq->skb, dev); -if (dev->features &NETIF_F_GRO ) -napi_gro_receive (napi, rxq->skb); -else -netif_receive_skb (rxq->skb); +napi_gro_receive (napi, rxq->skb);/* clean uncomplete skb pointer in queue */ rxq->skb =NULL ;
Signature · 1 line
2.18.0
PATCH v2 2/3 net: mvneta: enable NETIF_F_RXCSUM by default
In reply to Jisheng ZhangThe code and HW supports NETIF_F_RXCSUM, so let's enable it by default.
--- drivers/net/ethernet/marvell/mvneta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvneta.c +2 -1
@@ -4595,7 +4595,8 @@ static int mvneta_probe(struct platform_device *pdev) } } - dev->features =NETIF_F_SG |NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM |NETIF_F_TSO ; + dev->features =NETIF_F_SG |NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM | +NETIF_F_TSO |NETIF_F_RXCSUM ; dev->hw_features |= dev->features; dev->vlan_features |= dev->features; dev->priv_flags |=IFF_LIVE_ADDR_CHANGE ;
Signature · 1 line
2.18.0
Re: [PATCH net-next v2 2/3] net: mvneta: enable NETIF_F_RXCSUM by default
Quoted 4 lines · Jisheng Zhang
The code and HW supports
NETIF_F_RXCSUM, so let's enable it by default.Signed-off-by Jisheng Zhang <[email protected]>Reviewed-by Gregory CLEMENT <[email protected]>
Hi Jisheng
I ran some quick tests on a 370RD devel board, which uses a Marvell switch connected to mvneta. I did no see any obvious regressions.
Andrew
PATCH v2 3/3 net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe
In reply to Jisheng ZhangIn the loop of mvneta_tx_done_gbe(), we call the smp_processor_id() each time, move the call out of the loop to optimize the code a bit.
Before the patch, the loop looks like(under arm64):
ldr x1, [x29,#120]
...
ldr w24, [x1,#36]
...
bl 0 <_raw_spin_lock>
str w24, [x27,#132]
...After the patch, the loop looks like(under arm64):
...
bl 0 <_raw_spin_lock>
str w23, [x28,#132]
...where w23 is loaded so be ready before the loop.
Quoted 1 line
From another side,
mvneta_tx_done_gbe()is called frommvneta_poll()
which is in non-preemptible context, so it's safe to call the smp_processor_id() function once.
--- drivers/net/ethernet/marvell/mvneta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvneta.c +2 -1
@@ -2507,12 +2507,13 @@ static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done) {struct mvneta_tx_queue *txq;struct netdev_queue *nq; +int cpu =smp_processor_id ();while (cause_tx_done) { txq =mvneta_tx_done_policy (pp, cause_tx_done); nq =netdev_get_tx_queue (pp->dev, txq->id); -__netif_tx_lock (nq,smp_processor_id ()); +__netif_tx_lock (nq, cpu);if (txq->count)mvneta_txq_done (pp, txq);
Signature · 1 line
2.18.0
David Miller
maintainerFrom: Jisheng Zhang <[email protected]>
Date: Fri, 31 Aug 2018 16:08:10 +0800
Quoted 6 lines
patch1 removes the
NETIF_F_GROcheck ourself, because the net subsystem will handle it for us.patch2 enables
NETIF_F_RXCSUMby default, since the driver and HW supports the feature.
Quoted 7 lines
patch3 is a small optimization, to reduce
smp_processor_id()calling inmvneta_tx_done_gbe.since v1:
- based on net-next tree
- remove the fix patches, since they should be based on net branch.
- Add Gregory's Reviewed-by tag
Series applied, thanks.