Subject: [PATCH] Added interface driver and bus_info support According to blueprint https://blueprints.launchpad.net/fuel/+spec/support-infiniband-network, driver and bus_info functions needed to be merged to the current rethtool repositories: * packages/centos6/rubygem-rethtool * packages/precise/rethtool . And to the future repositories: * packages/centos6/ruby21-rubygem-rethtool * packages/trusty/rethtool Author: Aviram Bar-Haim Date: Tue, 17 Feb 2015 16:45:28 +0200 Bug-Ubuntu: https://bugs.launchpad.net/fuel/+bug/1423150 Change-Id: I04550dfe97e829e44b970772230ab014444abf46 Origin: upstream, https://review.fuel-infra.org/#/c/3633/ Last-Update: 2015-03-19 diff --git a/debian/patches/0001-Added-interface-driver-and-bus_info-support.patch b/debian/patches/0001-Added-interface-driver-and-bus_info-support.patch new file mode 100644 index 0000000..d8a87c4 --- /dev/null +++ b/debian/patches/0001-Added-interface-driver-and-bus_info-support.patch @@ -0,0 +1,92 @@ +From 17c1bdd43147d9aa0530f0780924ba6db75df2e1 Mon Sep 17 00:00:00 2001 +From: Aviram Bar-Haim +Date: Tue, 17 Feb 2015 16:45:28 +0200 +Subject: [PATCH] Added interface driver and bus_info support + +Change-Id: I04550dfe97e829e44b970772230ab014444abf46 +--- + lib/rethtool.rb | 5 +++-- + lib/rethtool/ethtool_cmd.rb | 14 ++++++++++++++ + lib/rethtool/interface_settings.rb | 21 +++++++++++++++++++-- + 3 files changed, 36 insertions(+), 4 deletions(-) + +diff --git a/lib/rethtool.rb b/lib/rethtool.rb +index 5ff8c36..7ec85ad 100755 +--- a/lib/rethtool.rb ++++ b/lib/rethtool.rb +@@ -19,8 +19,9 @@ class Rethtool + SIOCETHTOOL = 0x8946 + + # From /u/i/linux/ethtool.h +- ETHTOOL_CMD_GLINK = 0x0000000a +- ETHTOOL_CMD_GSET = 0x00000001 ++ ETHTOOL_CMD_GLINK = 0x0000000a ++ ETHTOOL_CMD_GSET = 0x00000001 ++ ETHTOOL_CMD_GDRVINFO = 0x00000003 + + class << self + # Issue an SIOCETHTOOL ioctl. ecmd must respond to #data (such +diff --git a/lib/rethtool/ethtool_cmd.rb b/lib/rethtool/ethtool_cmd.rb +index e88fef1..01d28a7 100644 +--- a/lib/rethtool/ethtool_cmd.rb ++++ b/lib/rethtool/ethtool_cmd.rb +@@ -21,3 +21,17 @@ class Rethtool::EthtoolCmd < CStruct + uint32 :reserved2 + uint32 :reserved3 + end ++ ++class Rethtool::EthtoolCmdDriver < CStruct ++ uint32 :cmd ++ char :driver,[32] ++ char :version,[32] ++ char :fw_version,[32] ++ char :bus_info,[32] ++ char :reserved1,[32] ++ char :reserved2,[16] ++ uint32 :n_stats ++ uint32 :testinfo_len ++ uint32 :eedump_len ++ uint32 :regdump_len ++end +diff --git a/lib/rethtool/interface_settings.rb b/lib/rethtool/interface_settings.rb +index 43ab273..5ba5f78 100644 +--- a/lib/rethtool/interface_settings.rb ++++ b/lib/rethtool/interface_settings.rb +@@ -38,10 +38,23 @@ class Rethtool::InterfaceSettings + def initialize(interface) + cmd = Rethtool::EthtoolCmd.new + cmd.cmd = Rethtool::ETHTOOL_CMD_GSET +- + @data = Rethtool.ioctl(interface, cmd) ++ ++ cmd_driver = Rethtool::EthtoolCmdDriver.new ++ cmd_driver.cmd = Rethtool::ETHTOOL_CMD_GDRVINFO ++ @driver_data = Rethtool.ioctl(interface, cmd_driver) + end +- ++ ++ # Returns a string with the value of the interface driver (kernel module). ++ def driver ++ as_str(@driver_data.driver) ++ end ++ ++ # Returns a string with the bus information of the interface. ++ def bus_info ++ as_str(@driver_data.bus_info) ++ end ++ + # Return an array of the modes supported by the interface. Returns an + # array of Mode objects. + def supported_modes +@@ -126,4 +139,8 @@ class Rethtool::InterfaceSettings + def modes(data) + PossibleModes.find_all { |m| (m[0] & data) > 0 }.map { |m| m[1] } + end ++ ++ def as_str(str) ++ str.pack('c*').delete("\000") ++ end + end +-- +1.8.3.2 + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..99613c8 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Added-interface-driver-and-bus_info-support.patch -- 1.9.1