Hi Kevin, 

Thanks for the patch. 
LGTM in general, couple of minor comments/thoughts inline.

<snipped>

> +struct user_mempool_config {
> +    int adj_mtu;
> +    int socket_id;
> +};
> +
> +static struct user_mempool_config *user_mempools = NULL; static int
> +n_user_mempools;

Should we consider restricting n_user_mempools to some max value ?

> 
>  /* There should be one 'struct dpdk_tx_queue' created for @@ -573,4
> +582,42 @@ dpdk_buf_size(int mtu)  }
> 
> +static int
> +dpdk_get_user_adjusted_mtu(int port_adj_mtu, int port_mtu, int
> +port_socket_id) {
> +    int best_adj_user_mtu = INT_MAX;
> +
> +    for (unsigned i = 0; i < n_user_mempools; i++) {
> +        int user_adj_mtu, user_socket_id;
> +
> +        user_adj_mtu = user_mempools[i].adj_mtu;
> +        user_socket_id = user_mempools[i].socket_id;
> +        if (port_adj_mtu > user_adj_mtu
> +            || (user_socket_id != INT_MAX
> +                && user_socket_id != port_socket_id)) {
> +            continue;
> +        }
> +        if (user_adj_mtu < best_adj_user_mtu) {
> +            /* This is the is the lowest valid user MTU. */
> +            best_adj_user_mtu = user_adj_mtu;
> +            if (best_adj_user_mtu == port_adj_mtu) {
> +                /* Found an exact fit, no need to keep searching. */
> +                break;
> +            }
> +        }


I guess this is more appropriate than sorting etc to find lowest valid user MTU 
since we assume n_user_mempools will be quite small ?


> +    }
> +    if (best_adj_user_mtu == INT_MAX) {
> +        VLOG_DBG("No user configured shared mempool mbuf sizes found "
> +                 "suitable for port with MTU %d, NUMA %d.", port_mtu,
> +                 port_socket_id);
> +        best_adj_user_mtu = port_adj_mtu;
> +    } else {
> +        VLOG_DBG("Found user configured shared mempool with mbufs "
> +                 "of size %d, suitable for port with MTU %d, NUMA %d.",
> +                 MTU_TO_FRAME_LEN(best_adj_user_mtu), port_mtu,
> +                 port_socket_id);
> +    }
> +    return best_adj_user_mtu;
> +}
> +

<snipped>

Thanks and regards,
Sunil
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to