From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5A2C611D9 for ; Thu, 11 Feb 2016 04:39:22 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 10 Feb 2016 19:39:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,429,1449561600"; d="scan'208";a="45992607" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga004.fm.intel.com with ESMTP; 10 Feb 2016 19:39:20 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u1B3dIGe015951; Thu, 11 Feb 2016 11:39:19 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u1B3dGIB021109; Thu, 11 Feb 2016 11:39:18 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u1B3dGfn021105; Thu, 11 Feb 2016 11:39:16 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 11 Feb 2016 11:39:09 +0800 Message-Id: <1455161950-21059-3-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1455161950-21059-1-git-send-email-yong.liu@intel.com> References: <1455161950-21059-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2016 03:39:22 -0000 Signed-off-by: Marvin Liu 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 +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