[dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module

Xu, HuilongX huilongx.xu at intel.com
Mon Feb 15 02:57:45 CET 2016


Hi yong,
Some comments as below?

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Yong Liu
> Sent: Thursday, February 11, 2016 11:39 AM
> To: dts at dpdk.org
> Subject: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device
> module
> 
> Signed-off-by: Marvin Liu <yong.liu at intel.com>
> 
> diff --git a/nics/net_device.py b/nics/net_device.py
> index 9d9e1ac..73750f5 100644
> --- a/nics/net_device.py
> +++ b/nics/net_device.py
> @@ -38,10 +38,13 @@ import time
> 
>  import settings
>  from crb import Crb
> -from settings import TIMEOUT
> +from settings import TIMEOUT, HEADER_SIZE
> +from utils import RED
> 
>  NICS_LIST = []      # global list for save nic objects
> 
   All NIC min MTU is 68, maybe 1G and 10G NIC is 64?
> +MIN_MTU = 68
> +
> 
>  class NetDevice(object):
> 
> @@ -770,7 +773,22 @@ class NetDevice(object):
>          """
>          nic_pci_num = ':'.join(['0000', bus_id, devfun_id])
>          cmd = "echo %s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind"
> -        self.send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ")
> +        self.__send_expect(cmd % (nic_pci_num, bus_id, devfun_id), "# ")
> +
> +    def _cal_mtu(self, framesize):
> +        return framesize - HEADER_SIZE['eth']
> +
> +    def enable_jumbo(self, framesize=0):
> +        if self.intf_name == "N/A":
> +            print RED("Enable jumbo must based on kernel interface!!!")
> +            return
> +        if framesize < MIN_MTU:
> +            print RED("Enable jumbo must over %d !!!" % MIN_MTU)
> +            return
> +
> +        mtu = self._cal_mtu(framesize)
> +        cmd = "ifconfig %s mtu %d"
> +        self.__send_expect(cmd % (self.intf_name, mtu), "# ")
> 
> 
>  def get_pci_id(crb, bus_id, devfun_id):
> --
> 1.9.3



More information about the dts mailing list