Below is a simple PoC for setting a large MTU size on a tap device. With this we are able to improve net i/o throughput substantially (~40% improvement on TX and ~130% improvement on RX). This is just RFC because it's hardcoded to an MTU of 9000 for any tap device. Thoughts on the best way to add this kind of support? diff -up libvirt-0.4.6/src/bridge.c~tap-mtu libvirt-0.4.6/src/bridge.c --- libvirt-0.4.6/src/bridge.c~tap-mtu 2008-08-29 05:19:52.000000000 -0700 +++ libvirt-0.4.6/src/bridge.c 2008-11-17 18:37:56.000000000 -0800 @@ -276,6 +276,38 @@ brDeleteInterface(brControl *ctl ATTRIBU #endif /** + * ifSetMtu: + * @ctl: bridge control pointer + * @ifname: interface name to set MTU for + * @mtu: MTU value + * + * This function sets the @mtu for a given interface @ifname. Typically + * used on a tap device to set up for Jumbo Frames. + * + * Returns 0 in case of success or an errno code in case of failure. + */ +static int +ifSetMtu(brControl *ctl, const char *ifname, int mtu) +{ + struct ifreq ifr; + int len; + + if (!ctl || !ifname) + return EINVAL; + + if ((len = strlen(ifname)) >= BR_IFNAME_MAXLEN) + return EINVAL; + + memset(&ifr, 0, sizeof(struct ifreq)); + + strncpy(ifr.ifr_name, ifname, len); + ifr.ifr_name[len] = '\0'; + ifr.ifr_mtu = mtu; + + return ioctl(ctl->fd, SIOCSIFMTU, &ifr) == 0 ? 0 : errno; +} + +/** * brAddTap: * @ctl: bridge control pointer * @bridge: the bridge name @@ -334,6 +366,8 @@ brAddTap(brControl *ctl, } if (ioctl(fd, TUNSETIFF, &try) == 0) { + if ((errno = ifSetMtu(ctl, try.ifr_name, 9000))) + goto error; if ((errno = brAddInterface(ctl, bridge, try.ifr_name))) goto error; if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1))) -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list