| 1 |
Subject: [PATCH] Added interface driver and bus_info support |
| 2 |
According to blueprint |
| 3 |
https://blueprints.launchpad.net/fuel/+spec/support-infiniband-network, driver |
| 4 |
and bus_info functions needed to be merged to the current rethtool |
| 5 |
repositories: |
| 6 |
* packages/centos6/rubygem-rethtool |
| 7 |
* packages/precise/rethtool |
| 8 |
. |
| 9 |
And to the future repositories: |
| 10 |
* packages/centos6/ruby21-rubygem-rethtool |
| 11 |
* packages/trusty/rethtool |
| 12 |
Author: Aviram Bar-Haim <[email protected]> |
| 13 |
Date: Tue, 17 Feb 2015 16:45:28 +0200 |
| 14 |
Bug-Ubuntu: https://bugs.launchpad.net/fuel/+bug/1423150 |
| 15 |
Change-Id: I04550dfe97e829e44b970772230ab014444abf46 |
| 16 |
Origin: upstream, https://review.fuel-infra.org/#/c/3633/ |
| 17 |
Last-Update: 2015-03-19 |
| 18 |
|
| 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 |
| 20 |
new file mode 100644 |
| 21 |
index 0000000..d8a87c4 |
| 22 |
--- /dev/null |
| 23 |
+++ b/debian/patches/0001-Added-interface-driver-and-bus_info-support.patch |
| 24 |
@@ -0,0 +1,92 @@ |
| 25 |
+From 17c1bdd43147d9aa0530f0780924ba6db75df2e1 Mon Sep 17 00:00:00 2001 |
| 26 |
+From: Aviram Bar-Haim <[email protected]> |
| 27 |
+Date: Tue, 17 Feb 2015 16:45:28 +0200 |
| 28 |
+Subject: [PATCH] Added interface driver and bus_info support |
| 29 |
+ |
| 30 |
+Change-Id: I04550dfe97e829e44b970772230ab014444abf46 |
| 31 |
+--- |
| 32 |
+ lib/rethtool.rb | 5 +++-- |
| 33 |
+ lib/rethtool/ethtool_cmd.rb | 14 ++++++++++++++ |
| 34 |
+ lib/rethtool/interface_settings.rb | 21 +++++++++++++++++++-- |
| 35 |
+ 3 files changed, 36 insertions(+), 4 deletions(-) |
| 36 |
+ |
| 37 |
+diff --git a/lib/rethtool.rb b/lib/rethtool.rb |
| 38 |
+index 5ff8c36..7ec85ad 100755 |
| 39 |
+--- a/lib/rethtool.rb |
| 40 |
++++ b/lib/rethtool.rb |
| 41 |
+@@ -19,8 +19,9 @@ class Rethtool |
| 42 |
+ SIOCETHTOOL = 0x8946 |
| 43 |
+ |
| 44 |
+ # From /u/i/linux/ethtool.h |
| 45 |
+- ETHTOOL_CMD_GLINK = 0x0000000a |
| 46 |
+- ETHTOOL_CMD_GSET = 0x00000001 |
| 47 |
++ ETHTOOL_CMD_GLINK = 0x0000000a |
| 48 |
++ ETHTOOL_CMD_GSET = 0x00000001 |
| 49 |
++ ETHTOOL_CMD_GDRVINFO = 0x00000003 |
| 50 |
+ |
| 51 |
+ class << self |
| 52 |
+ # Issue an SIOCETHTOOL ioctl. ecmd must respond to #data (such |
| 53 |
+diff --git a/lib/rethtool/ethtool_cmd.rb b/lib/rethtool/ethtool_cmd.rb |
| 54 |
+index e88fef1..01d28a7 100644 |
| 55 |
+--- a/lib/rethtool/ethtool_cmd.rb |
| 56 |
++++ b/lib/rethtool/ethtool_cmd.rb |
| 57 |
+@@ -21,3 +21,17 @@ class Rethtool::EthtoolCmd < CStruct |
| 58 |
+ uint32 :reserved2 |
| 59 |
+ uint32 :reserved3 |
| 60 |
+ end |
| 61 |
++ |
| 62 |
++class Rethtool::EthtoolCmdDriver < CStruct |
| 63 |
++ uint32 :cmd |
| 64 |
++ char :driver,[32] |
| 65 |
++ char :version,[32] |
| 66 |
++ char :fw_version,[32] |
| 67 |
++ char :bus_info,[32] |
| 68 |
++ char :reserved1,[32] |
| 69 |
++ char :reserved2,[16] |
| 70 |
++ uint32 :n_stats |
| 71 |
++ uint32 :testinfo_len |
| 72 |
++ uint32 :eedump_len |
| 73 |
++ uint32 :regdump_len |
| 74 |
++end |
| 75 |
+diff --git a/lib/rethtool/interface_settings.rb b/lib/rethtool/interface_settings.rb |
| 76 |
+index 43ab273..5ba5f78 100644 |
| 77 |
+--- a/lib/rethtool/interface_settings.rb |
| 78 |
++++ b/lib/rethtool/interface_settings.rb |
| 79 |
+@@ -38,10 +38,23 @@ class Rethtool::InterfaceSettings |
| 80 |
+ def initialize(interface) |
| 81 |
+ cmd = Rethtool::EthtoolCmd.new |
| 82 |
+ cmd.cmd = Rethtool::ETHTOOL_CMD_GSET |
| 83 |
+- |
| 84 |
+ @data = Rethtool.ioctl(interface, cmd) |
| 85 |
++ |
| 86 |
++ cmd_driver = Rethtool::EthtoolCmdDriver.new |
| 87 |
++ cmd_driver.cmd = Rethtool::ETHTOOL_CMD_GDRVINFO |
| 88 |
++ @driver_data = Rethtool.ioctl(interface, cmd_driver) |
| 89 |
+ end |
| 90 |
+- |
| 91 |
++ |
| 92 |
++ # Returns a string with the value of the interface driver (kernel module). |
| 93 |
++ def driver |
| 94 |
++ as_str(@driver_data.driver) |
| 95 |
++ end |
| 96 |
++ |
| 97 |
++ # Returns a string with the bus information of the interface. |
| 98 |
++ def bus_info |
| 99 |
++ as_str(@driver_data.bus_info) |
| 100 |
++ end |
| 101 |
++ |
| 102 |
+ # Return an array of the modes supported by the interface. Returns an |
| 103 |
+ # array of Mode objects. |
| 104 |
+ def supported_modes |
| 105 |
+@@ -126,4 +139,8 @@ class Rethtool::InterfaceSettings |
| 106 |
+ def modes(data) |
| 107 |
+ PossibleModes.find_all { |m| (m[0] & data) > 0 }.map { |m| m[1] } |
| 108 |
+ end |
| 109 |
++ |
| 110 |
++ def as_str(str) |
| 111 |
++ str.pack('c*').delete("\000") |
| 112 |
++ end |
| 113 |
+ end |
| 114 |
+-- |
| 115 |
+1.8.3.2 |
| 116 |
+ |
| 117 |
diff --git a/debian/patches/series b/debian/patches/series |
| 118 |
new file mode 100644 |
| 119 |
index 0000000..99613c8 |
| 120 |
--- /dev/null |
| 121 |
+++ b/debian/patches/series |
| 122 |
@@ -0,0 +1 @@ |
| 123 |
+0001-Added-interface-driver-and-bus_info-support.patch |
| 124 |
-- |
| 125 |
1.9.1 |
| 126 |
|