aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9d8984a3741c..4c347a3df657 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -735,6 +735,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
735 struct dev_addr_list *addr; 735 struct dev_addr_list *addr;
736 struct netdev_hw_addr *ha; 736 struct netdev_hw_addr *ha;
737 int uc_count; 737 int uc_count;
738 int mc_count;
738 void *buf; 739 void *buf;
739 int i; 740 int i;
740 741
@@ -762,9 +763,11 @@ static void virtnet_set_rx_mode(struct net_device *dev)
762 allmulti ? "en" : "dis"); 763 allmulti ? "en" : "dis");
763 764
764 uc_count = netdev_uc_count(dev); 765 uc_count = netdev_uc_count(dev);
766 mc_count = netdev_mc_count(dev);
765 /* MAC filter - use one buffer for both lists */ 767 /* MAC filter - use one buffer for both lists */
766 mac_data = buf = kzalloc(((uc_count + dev->mc_count) * ETH_ALEN) + 768 buf = kzalloc(((uc_count + mc_count) * ETH_ALEN) +
767 (2 * sizeof(mac_data->entries)), GFP_ATOMIC); 769 (2 * sizeof(mac_data->entries)), GFP_ATOMIC);
770 mac_data = buf;
768 if (!buf) { 771 if (!buf) {
769 dev_warn(&dev->dev, "No memory for MAC address buffer\n"); 772 dev_warn(&dev->dev, "No memory for MAC address buffer\n");
770 return; 773 return;
@@ -784,13 +787,13 @@ static void virtnet_set_rx_mode(struct net_device *dev)
784 /* multicast list and count fill the end */ 787 /* multicast list and count fill the end */
785 mac_data = (void *)&mac_data->macs[uc_count][0]; 788 mac_data = (void *)&mac_data->macs[uc_count][0];
786 789
787 mac_data->entries = dev->mc_count; 790 mac_data->entries = mc_count;
788 addr = dev->mc_list; 791 addr = dev->mc_list;
789 for (i = 0; i < dev->mc_count; i++, addr = addr->next) 792 for (i = 0; i < mc_count; i++, addr = addr->next)
790 memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN); 793 memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN);
791 794
792 sg_set_buf(&sg[1], mac_data, 795 sg_set_buf(&sg[1], mac_data,
793 sizeof(mac_data->entries) + (dev->mc_count * ETH_ALEN)); 796 sizeof(mac_data->entries) + (mc_count * ETH_ALEN));
794 797
795 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, 798 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC,
796 VIRTIO_NET_CTRL_MAC_TABLE_SET, 799 VIRTIO_NET_CTRL_MAC_TABLE_SET,