MCPcopy Create free account
hub / github.com/F-Stack/f-stack / unlink_vmdq

Function unlink_vmdq

dpdk/examples/vhost/main.c:990–1019  ·  view source on GitHub ↗

* Removes MAC address and vlan tag from VMDQ. Ensures that nothing is adding buffers to the RX * queue before disabling RX on the device. */

Source from the content-addressed store, hash-verified

988 * queue before disabling RX on the device.
989 */
990static inline void
991unlink_vmdq(struct vhost_dev *vdev)
992{
993 unsigned i = 0;
994 unsigned rx_count;
995 struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
996
997 if (vdev->ready == DEVICE_RX) {
998 /*clear MAC and VLAN settings*/
999 rte_eth_dev_mac_addr_remove(ports[0], &vdev->mac_address);
1000 for (i = 0; i < 6; i++)
1001 vdev->mac_address.addr_bytes[i] = 0;
1002
1003 vdev->vlan_tag = 0;
1004
1005 /*Clear out the receive buffers*/
1006 rx_count = rte_eth_rx_burst(ports[0],
1007 (uint16_t)vdev->vmdq_rx_q, pkts_burst, MAX_PKT_BURST);
1008
1009 while (rx_count) {
1010 for (i = 0; i < rx_count; i++)
1011 rte_pktmbuf_free(pkts_burst[i]);
1012
1013 rx_count = rte_eth_rx_burst(ports[0],
1014 (uint16_t)vdev->vmdq_rx_q, pkts_burst, MAX_PKT_BURST);
1015 }
1016
1017 vdev->ready = DEVICE_MAC_LEARNING;
1018 }
1019}
1020
1021static inline void
1022free_pkts(struct rte_mbuf **pkts, uint16_t n)

Callers 1

switch_workerFunction · 0.85

Calls 3

rte_eth_rx_burstFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected