nfp: process MTU updates from firmware flower app
authorSimon Horman <simon.horman@netronome.com>
Wed, 16 Aug 2017 07:37:44 +0000 (09:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2017 18:36:44 +0000 (11:36 -0700)
Now that control message processing occurs in a workqueue rather than a BH
handler MTU updates received from the firmware may be safely processed.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/cmsg.c

index 6c8c22491fe7e3c9c2a4a6c9f4287d8de4810cb3..806924b82adca42384d53490ff0f6851cac8da78 100644 (file)
@@ -150,10 +150,17 @@ nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb)
                return;
        }
 
-       if (link)
+       if (link) {
+               u16 mtu = be16_to_cpu(msg->mtu);
+
                netif_carrier_on(netdev);
-       else
+
+               /* An MTU of 0 from the firmware should be ignored */
+               if (mtu)
+                       dev_set_mtu(netdev, mtu);
+       } else {
                netif_carrier_off(netdev);
+       }
        rcu_read_unlock();
 }