[ovs-dev] [loss-report 2/4] dpif-linux: Avoid pessimal behavior when kernel-to-user buffers overflow.

Ethan Jackson ethan at nicira.com
Wed May 30 00:44:53 UTC 2012


Looks good, thanks.

Ethan

On Fri, May 25, 2012 at 2:36 PM, Ben Pfaff <blp at nicira.com> wrote:
> When a kernel-to-user Netlink buffer overflows, the kernel reports
> ENOBUFS without passing along an actual message.  When it does this,
> we should immediately try again, because we know that there is a
> message waiting, instead of reporting the error to the caller.
>
> This improves the OVS response rate to "hping3 --flood" traffic by
> a few percentage points in my testing.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/dpif-linux.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
> index 256c9d6..9d84edd 100644
> --- a/lib/dpif-linux.c
> +++ b/lib/dpif-linux.c
> @@ -150,6 +150,7 @@ struct dpif_linux {
>  };
>
>  static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
> +static struct vlog_rate_limit enobufs_rl = VLOG_RATE_LIMIT_INIT(60, 5);
>
>  /* Generic Netlink family numbers for OVS. */
>  static int ovs_datapath_family;
> @@ -1138,6 +1139,15 @@ dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall,
>
>             error = nl_sock_recv(upcall_sock, buf, false);
>             if (error) {
> +                if (error == ENOBUFS) {
> +                    /* ENOBUFS typically means that we've received so many
> +                     * packets that the buffer overflowed.  Try again
> +                     * immediately because there's almost certainly a packet
> +                     * waiting for us. */
> +                    VLOG_ERR_RL(&enobufs_rl, "%s: lost packet with hash %d",
> +                                dpif_name(dpif_), dpif->ready_mask);
> +                    continue;
> +                }
>                 if (error == EAGAIN) {
>                     break;
>                 }
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list