Message ID | 20240712192405.505553-2-nnac123@linux.ibm.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | bonding: Return TX congested if no active slave | expand |
diff --git a/include/net/bonding.h b/include/net/bonding.h index b61fb1aa3a56..22da0916d4a6 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -805,8 +805,15 @@ extern const u8 lacpdu_mcast_addr[]; static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb) { + struct bonding *bond = netdev_priv(dev); + dev_core_stats_tx_dropped_inc(dev); dev_kfree_skb_any(skb); + + /* monitoring will trigger dev_deactivate soon, imitate noop until then */ + if (bond_has_slaves(bond)) + return NET_XMIT_CN; + return NET_XMIT_DROP; }
When the bonding device cannot find an active slave, it is safe to assume that monitoring will eventually call carrier_off on the bonding device. This means that eventually the bonding devices qdisc will become noop and return congested. But, there is an indefinite amount of time between no active slaves and the bonding devices qdisc becoming noop. Previously, during this period, NET_XMIT_DROP was returned. Upper level networking functions react differently to a drop vs congested. Therefore, return NET_XMIT_CN instead of NET_XMIT_DROP because it accurately predicts the impending noop_enqueue return code and helps to keep sockets alive until then. Signed-off-by: Nick Child <nnac123@linux.ibm.com> --- include/net/bonding.h | 7 +++++++ 1 file changed, 7 insertions(+)