Initialize the TAP host state from the VPP state

DBGvpp# set interface state TenGigabitEthernet3/0/0 down
DBGvpp# lcpng create TenGigabitEthernet3/0/0 host-if e0
DBGvpp# set interface state TenGigabitEthernet3/0/1 up
DBGvpp# lcpng create TenGigabitEthernet3/0/1 host-if e1

Yields:

pim@hippo:~/src/lcpng$ ip link show e0
304: e0: <BROADCAST,MULTICAST> mtu 9000 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 68:05:ca:32:46:14 brd ff:ff:ff:ff:ff:ff

pim@hippo:~/src/lcpng$ ip link show e1
305: e1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 68:05:ca:32:46:15 brd ff:ff:ff:ff:ff:ff
This commit is contained in:
Pim van Pelt
2021-08-12 15:22:35 +02:00
parent de5c01280e
commit d43b583c7b

View File

@ -793,13 +793,13 @@ lcp_itf_pair_create (u32 phy_sw_if_index, u8 *host_if_name,
hw = vnet_get_sup_hw_interface (vnm, args.sw_if_index); hw = vnet_get_sup_hw_interface (vnm, args.sw_if_index);
/* /*
* Set the interface down on the host side. * Copy the link state from VPP inon the host side.
* This controls whether the host can RX/TX. * This controls whether the host can RX/TX.
*/ */
virtio_main_t *mm = &virtio_main; virtio_main_t *mm = &virtio_main;
virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance); virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
lcp_itf_set_vif_link_state (vif->ifindex, 0 /* down */, lcp_itf_set_vif_link_state (vif->ifindex, sw->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP,
args.host_namespace); args.host_namespace);
/* /*