From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module
Date: Thu, 11 Feb 2016 11:39:09 +0800 [thread overview]
Message-ID: <1455161950-21059-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1455161950-21059-1-git-send-email-yong.liu@intel.com>
Signed-off-by: Marvin Liu <yong.liu@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
+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
next prev parent reply other threads:[~2016-02-11 3:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 3:39 [dts] [PATCH v3 1/4] conf vf_jumbo: add config file for vf jumboframe suite Yong Liu
2016-02-11 3:39 ` [dts] [PATCH v3 2/4] test_plan: add vf jumbo frame test plan Yong Liu
2016-02-11 3:39 ` Yong Liu [this message]
2016-02-15 1:57 ` [dts] [PATCH v3 3/4] nics: support jumbo setting in net_device module Xu, HuilongX
2016-02-15 2:30 ` Liu, Yong
2016-02-11 3:39 ` [dts] [PATCH v3 4/4] tests: add vf jumbo frame suite Yong Liu
2016-02-15 2:20 ` Xu, HuilongX
2016-02-15 2:34 ` Liu, Yong
2016-02-15 3:16 ` Xu, HuilongX
2016-02-15 5:52 ` Liu, Yong
2016-02-15 6:39 ` Xu, HuilongX
2016-02-15 7:05 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455161950-21059-3-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).