net: group address list and its count
This patch is inspired by patch recently posted by Johannes Berg. Basically what my patch does is to group list and a count of addresses into newly introduced structure netdev_hw_addr_list. This brings us two benefits: 1) struct net_device becames a bit nicer. 2) in the future there will be a possibility to operate with lists independently on netdevices (with exporting right functions). I wanted to introduce this patch before I'll post a multicast lists conversion. Signed-off-by: Jiri Pirko <jpirko@redhat.com> drivers/net/bnx2.c | 4 +- drivers/net/e1000/e1000_main.c | 4 +- drivers/net/ixgbe/ixgbe_main.c | 6 +- drivers/net/mv643xx_eth.c | 2 +- drivers/net/niu.c | 4 +- drivers/net/virtio_net.c | 10 ++-- drivers/s390/net/qeth_l2_main.c | 2 +- include/linux/netdevice.h | 17 +++-- net/core/dev.c | 130 ++++++++++++++++++-------------------- 9 files changed, 89 insertions(+), 90 deletions(-) Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7b85576d15
commit
31278e7147
@@ -709,7 +709,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
|
||||
allmulti ? "en" : "dis");
|
||||
|
||||
/* MAC filter - use one buffer for both lists */
|
||||
mac_data = buf = kzalloc(((dev->uc_count + dev->mc_count) * ETH_ALEN) +
|
||||
mac_data = buf = kzalloc(((dev->uc.count + dev->mc_count) * ETH_ALEN) +
|
||||
(2 * sizeof(mac_data->entries)), GFP_ATOMIC);
|
||||
if (!buf) {
|
||||
dev_warn(&dev->dev, "No memory for MAC address buffer\n");
|
||||
@@ -719,16 +719,16 @@ static void virtnet_set_rx_mode(struct net_device *dev)
|
||||
sg_init_table(sg, 2);
|
||||
|
||||
/* Store the unicast list and count in the front of the buffer */
|
||||
mac_data->entries = dev->uc_count;
|
||||
mac_data->entries = dev->uc.count;
|
||||
i = 0;
|
||||
list_for_each_entry(ha, &dev->uc_list, list)
|
||||
list_for_each_entry(ha, &dev->uc.list, list)
|
||||
memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN);
|
||||
|
||||
sg_set_buf(&sg[0], mac_data,
|
||||
sizeof(mac_data->entries) + (dev->uc_count * ETH_ALEN));
|
||||
sizeof(mac_data->entries) + (dev->uc.count * ETH_ALEN));
|
||||
|
||||
/* multicast list and count fill the end */
|
||||
mac_data = (void *)&mac_data->macs[dev->uc_count][0];
|
||||
mac_data = (void *)&mac_data->macs[dev->uc.count][0];
|
||||
|
||||
mac_data->entries = dev->mc_count;
|
||||
addr = dev->mc_list;
|
||||
|
Reference in New Issue
Block a user