diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 609b8da33..61bfe3499 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, 2016 Nicira, Inc. + * Copyright (c) 2014, 2015, 2016, 2017 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2213,10 +2213,12 @@ static int netdev_dpdk_get_ifindex(const struct netdev *netdev) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); - int ifindex; ovs_mutex_lock(&dev->mutex); - ifindex = dev->port_id; + /* Calculate hash from the netdev name. Ensure that ifindex is a 24-bit + * postive integer to meet RFC 2863 recommendations. + */ + int ifindex = hash_string(netdev->name, 0) % 0xfffffe + 1; ovs_mutex_unlock(&dev->mutex); return ifindex;