我的interface在收送上本來沒有問題,但是當它和其他interface作bridge之後就發生crash了,後來才發現是head不夠大,於是參考這篇文章"关于bridge中hard_header_len值的问题",做了些修改,原因是因為我的device在預留head room時,是hard_header_len+needed_headroom。而且有些local generate的packet會使用LL_RESERVED_SPACE()這macro來保留head room,而LL_RESERVED_SPACE()也會使用到needed_headroom,所以最保險的作法就是同時設定bridge的hard_header_len和needed_headroom。
--- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -369,6 +369,10 @@ void br_features_recompute(struct net_bridge *br) { struct net_bridge_port *p; unsigned long features, mask; +#if 1 // Brook. + unsigned short max_hard_header_len = ETH_HLEN; + unsigned short max_needed_headroom = 0; +#endif features = mask = br->feature_mask; if (list_empty(&br->port_list)) @@ -379,8 +383,22 @@ void br_features_recompute(struct net_bridge *br) list_for_each_entry(p, &br->port_list, list) { features = netdev_increment_features(features, p->dev->features, mask); +#if 1 // Brook. + if (p->dev->hard_header_len > max_hard_header_len) { + max_hard_header_len = p->dev->hard_header_len; + } + + if (p->dev->needed_headroom > max_needed_headroom) { + max_needed_headroom = p->dev->needed_headroom; + } +#endif } +#if 1 // Brook. + br->dev->hard_header_len = max_hard_header_len; + br->dev->needed_headroom = max_needed_headroom; +#endif + done: br->dev->features = netdev_fix_features(features, NULL); }
沒有留言:
張貼留言