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.
dev
root 2019-07-29 13:38:10 +00:00
parent 343009335f
commit 3f18f1a26a
3 changed files with 3 additions and 47 deletions

View File

@ -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 <ipaddr> netmask <netmask>  broadcast <broadcast> hw ether <mac addr>
route add -net 0.0.0.0 gw <gateway> 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

View File

@ -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`.

View File

@ -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);
}