dpdk_mp cannot be changed while the device is running. It is passed to rte_eth_rx_queue_setup() when the device is initialized.
I think the idea of only updating 'max_packet_len' when without reconfiguring when the aligned size doesn't change is ok, but we need to make 'max_packet_len' atomic. Thanks, Daniele 2016-09-05 16:42 GMT-07:00 Binbin Xu <xu.binb...@zte.com.cn>: > 1. The MTU configuration changes, but the size of aligned mempool > of new MTU doesn't change. > What we have to do is to update the netdev's MTU and max_packet_len. > > 2. The MTU configuration changes, and the size of aligned mempool > of new MTU changes too. > The mempool needed by the new MTU has already been allocated, > and the mempool used for the old MTU is referenced by other > netdev meantime. > What we have to do is to reduce the reference count of old mempool, > increase the reference count of new mempool, update the netdev's > mempool, MTU and max_packet_len. > > Signed-off-by: Binbin Xu <xu.binb...@zte.com.cn> > --- > lib/netdev-dpdk.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index 6d334db..86dd5df 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -1723,6 +1723,8 @@ netdev_dpdk_get_mtu(const struct netdev *netdev, int > *mtup) > static int > netdev_dpdk_set_mtu(struct netdev *netdev, int mtu) > { > + struct dpdk_mp *dmp = NULL; > + struct dpdk_mp *dmp_node = NULL; > struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > > if (MTU_TO_FRAME_LEN(mtu) > NETDEV_DPDK_MAX_PKT_LEN > @@ -1731,12 +1733,39 @@ netdev_dpdk_set_mtu(struct netdev *netdev, int mtu) > return EINVAL; > } > > + ovs_mutex_lock(&dpdk_mutex); > ovs_mutex_lock(&dev->mutex); > if (dev->requested_mtu != mtu) { > + VLOG_INFO("%s: cur MTU %d, req MTU %d, " > + "cur buf len %d, req buf len %d\n", > + dev->up.name, dev->mtu, mtu, > + dpdk_buf_size(dev->mtu), dpdk_buf_size(mtu)); > + > dev->requested_mtu = mtu; > - netdev_request_reconfigure(netdev); > + > + LIST_FOR_EACH (dmp_node, list_node, &dpdk_mp_list) { > + if (dmp_node->mtu == FRAME_LEN_TO_MTU(dpdk_buf_size(mtu))) { > + dmp = dmp_node; > + break; > + } > + } > + > + if ((dpdk_buf_size(dev->mtu) != dpdk_buf_size(mtu) > + && 1 == dev->dpdk_mp->refcount) > + || dmp == NULL) { > + netdev_request_reconfigure(netdev); > + } else { > + if (dpdk_buf_size(dev->mtu) != dpdk_buf_size(mtu)) { > + dev->dpdk_mp->refcount--; > + dmp->refcount++; > + dev->dpdk_mp = dmp; > + } > + dev->mtu = mtu; > + dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu); > + } > } > ovs_mutex_unlock(&dev->mutex); > + ovs_mutex_unlock(&dpdk_mutex); > > return 0; > } > -- > 2.9.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev