]> git.hungrycats.org Git - linux/commitdiff
[netdrvr tulip] fix hashed setup frame code
authorPrasanna Meda <pmeda@akamai.com>
Sun, 16 Nov 2003 13:05:16 +0000 (08:05 -0500)
committerLinus Torvalds <torvalds@home.osdl.org>
Sun, 16 Nov 2003 13:05:16 +0000 (08:05 -0500)
It is using local variable `i' in both the inner and outer loop.

Need to bring the for loop outside the loop.  Otherwise we need to reset the
setup_frame to tp->setup_frame after every loop.  You do not need to set the
setup_frm for every mc address, we can set once after the complete has_table
is ready.

drivers/net/tulip/tulip_core.c

index 2aae8c5a09087ea469ea82b57a7fd072ab31836f..fe866a3dd99f5b481fc74f5abaff6f7a3faa5fa6 100644 (file)
@@ -998,12 +998,12 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
 
                set_bit_le(index, hash_table);
 
-               for (i = 0; i < 32; i++) {
-                       *setup_frm++ = hash_table[i];
-                       *setup_frm++ = hash_table[i];
-               }
-               setup_frm = &tp->setup_frame[13*6];
        }
+       for (i = 0; i < 32; i++) {
+               *setup_frm++ = hash_table[i];
+               *setup_frm++ = hash_table[i];
+       }
+       setup_frm = &tp->setup_frame[13*6];
 
        /* Fill the final entry with our physical address. */
        eaddrs = (u16 *)dev->dev_addr;
@@ -1103,11 +1103,13 @@ static void set_rx_mode(struct net_device *dev)
                }
        } else {
                unsigned long flags;
+               u32 tx_flags = 0x08000000 | 192;
 
                /* Note that only the low-address shortword of setup_frame is valid!
                   The values are doubled for big-endian architectures. */
                if (dev->mc_count > 14) { /* Must use a multicast hash table. */
                        build_setup_frame_hash(tp->setup_frame, dev);
+                       tx_flags = 0x08400000 | 192;
                } else {
                        build_setup_frame_perfect(tp->setup_frame, dev);
                }
@@ -1117,7 +1119,6 @@ static void set_rx_mode(struct net_device *dev)
                if (tp->cur_tx - tp->dirty_tx > TX_RING_SIZE - 2) {
                        /* Same setup recently queued, we need not add it. */
                } else {
-                       u32 tx_flags = 0x08000000 | 192;
                        unsigned int entry;
                        int dummy = -1;