n_retry = (rv == DPDK_TX_RING_SIZE - tx_tail) ? 1 : 0;
}
}
+#if DPDK_VHOST_USER
else if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
u32 offset = 0;
queue_id = 0;
while (__sync_lock_test_and_set (xd->lockp[queue_id], 1));
}
-#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0)
else {
dpdk_device_and_queue_t * dq;
vec_foreach (dq, dm->devices_by_cpu[vm->cpu_index])
assert (dq);
offset = dq->queue_id * VIRTIO_QNUM;
}
-#endif
if (PREDICT_TRUE(tx_head > tx_tail))
{
int i; u32 bytes = 0;
f64 now = vlib_time_now (vm);
if (vring->int_deadline < now ||
- vring->n_since_last_int > dm->vhost_coalesce_frames)
+ vring->n_since_last_int > dm->conf->vhost_coalesce_frames)
dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_RXQ);
}
f64 now = vlib_time_now (vm);
if (vring->int_deadline < now ||
- vring->n_since_last_int > dm->vhost_coalesce_frames)
+ vring->n_since_last_int > dm->conf->vhost_coalesce_frames)
dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_RXQ);
}
if (xd->need_txlock)
*xd->lockp[queue_id] = 0;
}
+#endif
#if RTE_LIBRTE_KNI
else if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
mb0 = rte_mbuf_from_vlib_buffer(b0);
mb1 = rte_mbuf_from_vlib_buffer(b1);
- any_clone = b0->clone_count | b1->clone_count;
+ any_clone = (b0->flags & VLIB_BUFFER_RECYCLE)
+ | (b1->flags & VLIB_BUFFER_RECYCLE);
if (PREDICT_FALSE(any_clone != 0))
{
- if (PREDICT_FALSE(b0->clone_count != 0))
+ if (PREDICT_FALSE
+ ((b0->flags & VLIB_BUFFER_RECYCLE) != 0))
{
struct rte_mbuf * mb0_new = dpdk_replicate_packet_mb (b0);
if (PREDICT_FALSE(mb0_new == 0))
mb0 = mb0_new;
vec_add1 (dm->recycle[my_cpu], bi0);
}
- if (PREDICT_FALSE(b1->clone_count != 0))
+ if (PREDICT_FALSE
+ ((b1->flags & VLIB_BUFFER_RECYCLE) != 0))
{
struct rte_mbuf * mb1_new = dpdk_replicate_packet_mb (b1);
if (PREDICT_FALSE(mb1_new == 0))
b0 = vlib_get_buffer (vm, bi0);
mb0 = rte_mbuf_from_vlib_buffer(b0);
- if (PREDICT_FALSE(b0->clone_count != 0))
+ if (PREDICT_FALSE((b0->flags & VLIB_BUFFER_RECYCLE) != 0))
{
struct rte_mbuf * mb0_new = dpdk_replicate_packet_mb (b0);
if (PREDICT_FALSE(mb0_new == 0))
static int dpdk_device_renumber (vnet_hw_interface_t * hi,
u32 new_dev_instance)
{
+#if DPDK_VHOST_USER
dpdk_main_t * dm = &dpdk_main;
dpdk_device_t * xd = vec_elt_at_index (dm->devices, hi->dev_instance);
}
xd->vu_if_id = new_dev_instance;
+#endif
return 0;
}
memset (&xd->last_stats, 0, sizeof (xd->last_stats));
}
+#if DPDK_VHOST_USER
if (PREDICT_FALSE(xd->dev_type == VNET_DPDK_DEV_VHOST_USER)) {
int i;
for (i = 0; i < xd->rx_q_used * VIRTIO_QNUM; i++) {
xd->vu_intf->vrings[i].bytes = 0;
}
}
+#endif
}
#ifdef RTE_LIBRTE_KNI
return 0;
}
#endif
+#if DPDK_VHOST_USER
if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
if (is_up)
return 0;
}
+#endif
if (is_up)
*/
if (xd->pmd != VNET_DPDK_PMD_VMXNET3)
rte_eth_dev_stop (xd->device_index);
+
+ /* For bonded interface, stop slave links */
+ if (xd->pmd == VNET_DPDK_PMD_BOND)
+ {
+ u8 slink[16];
+ int nlink = rte_eth_bond_slaves_get(xd->device_index, slink, 16);
+ while (nlink >=1)
+ {
+ u8 dpdk_port = slink[--nlink];
+ rte_eth_dev_stop (dpdk_port);
+ }
+ }
}
if (rv < 0)
dpdk_device_t * xd = vec_elt_at_index (xm->devices, hw->dev_instance);
vnet_sw_interface_t * t = (vnet_sw_interface_t *) st;
int r, vlan_offload;
+ u32 prev_subifs = xd->vlan_subifs;
+ if (is_add) xd->vlan_subifs++;
+ else if (xd->vlan_subifs) xd->vlan_subifs--;
if (xd->dev_type != VNET_DPDK_DEV_ETH)
return 0;
if (t->sub.eth.flags.no_tags == 1)
return 0;
- if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 ))
+ if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 )) {
+ xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "unsupported VLAN setup");
-
+ }
vlan_offload = rte_eth_dev_get_vlan_offload(xd->device_index);
vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
- if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload)))
+ if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload))) {
+ xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "rte_eth_dev_set_vlan_offload[%d]: err %d",
xd->device_index, r);
+ }
- if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add)))
+ if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add))) {
+ xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "rte_eth_dev_vlan_filter[%d]: err %d",
xd->device_index, r);
+ }
return 0;
}
{
dpdk_main_t * dm = &dpdk_main;
- return dm->num_mbufs;
-}
-
-/*
- * Return the io_thread_release
- */
-int dpdk_io_thread_release (void)
-{
- dpdk_main_t * dm = &dpdk_main;
-
- return dm->io_thread_release;
+ return dm->conf->num_mbufs;
}
/*