virtio-net.c (5e7b204dbfae9a562fc73684986f936b97f63877) | virtio-net.c (54aa3de72ea2aaa2e903e7e879a4f3dda515a00e) |
---|---|
1/* 2 * Virtio Network Device 3 * 4 * Copyright IBM, Corp. 2007 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 423 unchanged lines hidden (view full) --- 432 433 /* disable event notification to avoid events flooding */ 434 nc->rxfilter_notify_enabled = 0; 435 } 436} 437 438static intList *get_vlan_table(VirtIONet *n) 439{ | 1/* 2 * Virtio Network Device 3 * 4 * Copyright IBM, Corp. 2007 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 423 unchanged lines hidden (view full) --- 432 433 /* disable event notification to avoid events flooding */ 434 nc->rxfilter_notify_enabled = 0; 435 } 436} 437 438static intList *get_vlan_table(VirtIONet *n) 439{ |
440 intList *list, *entry; | 440 intList *list; |
441 int i, j; 442 443 list = NULL; 444 for (i = 0; i < MAX_VLAN >> 5; i++) { 445 for (j = 0; n->vlans[i] && j <= 0x1f; j++) { 446 if (n->vlans[i] & (1U << j)) { | 441 int i, j; 442 443 list = NULL; 444 for (i = 0; i < MAX_VLAN >> 5; i++) { 445 for (j = 0; n->vlans[i] && j <= 0x1f; j++) { 446 if (n->vlans[i] & (1U << j)) { |
447 entry = g_malloc0(sizeof(*entry)); 448 entry->value = (i << 5) + j; 449 entry->next = list; 450 list = entry; | 447 QAPI_LIST_PREPEND(list, (i << 5) + j); |
451 } 452 } 453 } 454 455 return list; 456} 457 458static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) 459{ 460 VirtIONet *n = qemu_get_nic_opaque(nc); 461 VirtIODevice *vdev = VIRTIO_DEVICE(n); 462 RxFilterInfo *info; | 448 } 449 } 450 } 451 452 return list; 453} 454 455static RxFilterInfo *virtio_net_query_rxfilter(NetClientState *nc) 456{ 457 VirtIONet *n = qemu_get_nic_opaque(nc); 458 VirtIODevice *vdev = VIRTIO_DEVICE(n); 459 RxFilterInfo *info; |
463 strList *str_list, *entry; | 460 strList *str_list; |
464 int i; 465 466 info = g_malloc0(sizeof(*info)); 467 info->name = g_strdup(nc->name); 468 info->promiscuous = n->promisc; 469 470 if (n->nouni) { 471 info->unicast = RX_STATE_NONE; --- 14 unchanged lines hidden (view full) --- 486 info->broadcast_allowed = n->nobcast; 487 info->multicast_overflow = n->mac_table.multi_overflow; 488 info->unicast_overflow = n->mac_table.uni_overflow; 489 490 info->main_mac = qemu_mac_strdup_printf(n->mac); 491 492 str_list = NULL; 493 for (i = 0; i < n->mac_table.first_multi; i++) { | 461 int i; 462 463 info = g_malloc0(sizeof(*info)); 464 info->name = g_strdup(nc->name); 465 info->promiscuous = n->promisc; 466 467 if (n->nouni) { 468 info->unicast = RX_STATE_NONE; --- 14 unchanged lines hidden (view full) --- 483 info->broadcast_allowed = n->nobcast; 484 info->multicast_overflow = n->mac_table.multi_overflow; 485 info->unicast_overflow = n->mac_table.uni_overflow; 486 487 info->main_mac = qemu_mac_strdup_printf(n->mac); 488 489 str_list = NULL; 490 for (i = 0; i < n->mac_table.first_multi; i++) { |
494 entry = g_malloc0(sizeof(*entry)); 495 entry->value = qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); 496 entry->next = str_list; 497 str_list = entry; | 491 QAPI_LIST_PREPEND(str_list, 492 qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN)); |
498 } 499 info->unicast_table = str_list; 500 501 str_list = NULL; 502 for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) { | 493 } 494 info->unicast_table = str_list; 495 496 str_list = NULL; 497 for (i = n->mac_table.first_multi; i < n->mac_table.in_use; i++) { |
503 entry = g_malloc0(sizeof(*entry)); 504 entry->value = qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN); 505 entry->next = str_list; 506 str_list = entry; | 498 QAPI_LIST_PREPEND(str_list, 499 qemu_mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN)); |
507 } 508 info->multicast_table = str_list; 509 info->vlan_table = get_vlan_table(n); 510 511 if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { 512 info->vlan = RX_STATE_ALL; 513 } else if (!info->vlan_table) { 514 info->vlan = RX_STATE_NONE; --- 3036 unchanged lines hidden --- | 500 } 501 info->multicast_table = str_list; 502 info->vlan_table = get_vlan_table(n); 503 504 if (!virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VLAN)) { 505 info->vlan = RX_STATE_ALL; 506 } else if (!info->vlan_table) { 507 info->vlan = RX_STATE_NONE; --- 3036 unchanged lines hidden --- |