From 7a9cdd23b759b5901c90513311583844d7a55be6 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 29 Jul 2019 13:38:10 +0000 Subject: [PATCH] KNI: remove the feature of monitor port's link status. And if you want to use kni, you should do one of two action: 1. `insmod rte_kni.ko carrier=on` while init dpdk running environment. 2. or run `echo 1 > /sys/class/net/veth0/carrier` after enable veth0 up. Refer #401, but this is not the real reason of #401, it is the DPDK's ENA driver can't work correctly in multi-processes. --- README.md | 3 +- ...Launch_F-Stack_on_AWS_EC2_in_one_minute.md | 1 + lib/ff_dpdk_kni.c | 46 ------------------- 3 files changed, 3 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 9092c7c1e..58b6a6c49 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Currently, besides authorized DNS server of DNSPod, there are various products i # offload NIC modprobe uio insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko - insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko carrier=on + insmod /data/f-stack/dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko carrier=on # carrier=on is necessary, otherwise need to be up `veth0` via `echo 1 > /sys/class/net/veth0/carrier` python dpdk-devbind.py --status ifconfig eth0 down python dpdk-devbind.py --bind=igb_uio eth0 # assuming that use 10GE NIC and eth0 @@ -111,6 +111,7 @@ for more details, see [nginx guide](https://github.com/F-Stack/f-stack/blob/mast sleep 10 ifconfig veth0 netmask   broadcast hw ether route add -net 0.0.0.0 gw dev veth0 + echo 1 > /sys/class/net/veth0/carrier # if `carrier=on` not set while `insmod rte_kni.ko` # route add -net ... # other route rules ## Binary Release diff --git a/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md index b2d34509b..4c95deb04 100644 --- a/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md +++ b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md @@ -79,3 +79,4 @@ sleep 10 ifconfig veth0 ${myaddr} netmask ${mymask} broadcast ${mybc} hw ether ${myhw} route add -net 0.0.0.0 gw ${mygw} dev veth0 + echo 1 > /sys/class/net/veth0/carrier # if `carrier=on` not set while `insmod rte_kni.ko`. diff --git a/lib/ff_dpdk_kni.c b/lib/ff_dpdk_kni.c index 143e936f4..7f1ba5261 100644 --- a/lib/ff_dpdk_kni.c +++ b/lib/ff_dpdk_kni.c @@ -80,7 +80,6 @@ struct kni_interface_stats { struct rte_ring **kni_rp; struct kni_interface_stats **kni_stat; -int kni_link = ETH_LINK_DOWN; static void set_bitmap(uint16_t port, unsigned char *bitmap) @@ -131,45 +130,6 @@ kni_change_mtu(uint16_t port_id, unsigned new_mtu) return 0; } -static void -log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link) -{ - if (kni == NULL || link == NULL) - return; - - if (prev == ETH_LINK_DOWN && link->link_status == ETH_LINK_UP) { - kni_link = ETH_LINK_UP; - printf("%s NIC Link is Up %d Mbps %s %s.\n", - rte_kni_get_name(kni), - link->link_speed, - link->link_autoneg ? "(AutoNeg)" : "(Fixed)", - link->link_duplex ? "Full Duplex" : "Half Duplex"); - } else if (prev == ETH_LINK_UP && link->link_status == ETH_LINK_DOWN) { - kni_link = ETH_LINK_DOWN; - printf("%s NIC Link is Down.\n", - rte_kni_get_name(kni)); - } -} - -/* - * Monitor the link status of all ports and update the - * corresponding KNI interface(s) - */ -static void * -monitor_all_ports_link_status(uint16_t port_id) -{ - struct rte_eth_link link; - unsigned int i; - int prev; - - memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(port_id, &link); - prev = rte_kni_update_link(kni_stat[port_id]->kni, link.link_status); - log_link_state(kni_stat[port_id]->kni, prev, &link); - - return NULL; -} - static int kni_config_network_interface(uint16_t port_id, uint8_t if_up) { @@ -199,9 +159,6 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } } - if (!if_up) - kni_link = ETH_LINK_DOWN; - if (ret < 0) printf("Failed to Configure network interface of %d %s\n", port_id, if_up ? "up" : "down"); @@ -597,9 +554,6 @@ void ff_kni_process(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **pkts_burst, unsigned count) { - if (unlikely(kni_link == ETH_LINK_DOWN)) { - monitor_all_ports_link_status(port_id); - } kni_process_tx(port_id, queue_id, pkts_burst, count); kni_process_rx(port_id, queue_id, pkts_burst, count); }