Thread (5 messages) flat view 5 messages, 4 authors, 2018-07-17

Re: [PATCH][net-next][v2] net: convert gro_count to bitmask

From: Eric Dumazet <hidden>
Date: 2018-07-17 00:10:35
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds


On 07/12/2018 11:41 PM, Li RongQing wrote:
gro_hash size is 192 bytes, and uses 3 cache lines, if there is few
		 */
quoted hunk ↗ jump to hunk
@@ -9264,6 +9273,9 @@ static struct hlist_head * __net_init netdev_create_hash(void)
 /* Initialize per network namespace state */
 static int __net_init netdev_init(struct net *net)
 {
+	BUILD_BUG_ON(GRO_HASH_BUCKETS >
+			FIELD_SIZEOF(struct napi_struct, gro_bitmask));
+
Sorry for the delay (patch is already merged)

This looks wrong to me. 

FIELD_SIZEOF() is in bytes not bits.

I guess we could either use BITS_PER_LONG or :
diff --git a/net/core/dev.c b/net/core/dev.c
index c883b17ee0fe2c8a7ca2f2867560ba74004790a7..4f8b92d81d107fc9acd2499297435cbd9e9b5c67 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9282,7 +9282,7 @@ static struct hlist_head * __net_init netdev_create_hash(void)
 static int __net_init netdev_init(struct net *net)
 {
        BUILD_BUG_ON(GRO_HASH_BUCKETS >
-                       FIELD_SIZEOF(struct napi_struct, gro_bitmask));
+                    8 * FIELD_SIZEOF(struct napi_struct, gro_bitmask));
 
        if (net != &init_net)
                INIT_LIST_HEAD(&net->dev_base_head);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help