diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-02-28 02:57:13 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2020-03-02 22:06:57 +0300 |
commit | 6c1caca70063aa707ba809a6b4695d0f0c5646f1 (patch) | |
tree | 84da2f29a60cb571686d3a4fb93f9d1f1189d989 /meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch | |
parent | 9600a7403ba2848c8751280077503a3e0f2f3481 (diff) | |
download | openbmc-6c1caca70063aa707ba809a6b4695d0f0c5646f1.tar.xz |
Update to internal 2020-02-27
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch new file mode 100644 index 000000000..c05088990 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Enable-conditional-use-of-ETHTOOL-features-in-the-NI.patch @@ -0,0 +1,120 @@ +From 6d3d50c506e2d6b4982ff6040af9fd61edaa8beb Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey <johnathanx.mantey@intel.com> +Date: Fri, 24 Jan 2020 13:30:39 -0800 +Subject: [PATCH] Enable conditional use of ETHTOOL features in the NIC driver + +The retrieval of the NIC speed, duplex, and autonegotiation +capabilities using the ETHTOOL driver extensions is not supported in +every NIC. + +Depending on the driver, the use of the ETHTOOL_GSET command may +result in undesirable messages being printed by the kernel. In order +to avoid these kernel messages a compile time switch is added. By +default the switch disables the use of the ETHTOOL features. Enable +the ETHTOOL feature by adding: + EXTRA_OECONF_append = " --enable-nic-ethtool=yes" +to the phosphor-network bbappend file. + +Tested: +Compiled the source without changing the bbappend file. The code +compiled as is, and after code was added that would cause a compile +time failure. +Loaded the code, and performed a Redfish read of the NIC. The +SpeedMbps field was confirmed to be set to 0. + +Enabled compiling the code by adding the EXTRA_OECONF entry to the +bbappend file. The code compiled as is, and failed to compile after +adding invalid code to the protected blocks. +Loaded the code, and performed a Redfish read of the NIC. The +SpeedMbps reported the correct link speed. + +Change-Id: If03e7d473d439ebb4a01b5d3f45e37ede2a5a84f +Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com> +--- + Makefile.am | 3 +++ + configure.ac | 10 ++++++++++ + ethernet_interface.cpp | 13 ++++++++----- + 3 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 2a54797..ff252fc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -99,6 +99,9 @@ phosphor_network_manager_CXXFLAGS = \ + $(PHOSPHOR_LOGGING_CFLAGS) \ + -DBOOST_ASIO_DISABLE_THREADS \ + -flto ++if FEATURE_NIC_ETHTOOL ++phosphor_network_manager_CXXFLAGS += -DNIC_SUPPORTS_ETHTOOL ++endif + + xyz/openbmc_project/Network/VLAN/Create/server.cpp: xyz/openbmc_project/Network/VLAN/Create.interface.yaml xyz/openbmc_project/Network/VLAN/Create/server.hpp + @mkdir -p `dirname $@` +diff --git a/configure.ac b/configure.ac +index 00b23bc..fed3e09 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -114,6 +114,16 @@ AC_SUBST(DEFAULT_BUSNAME, ["$DEFAULT_BUSNAME"]) + AC_ARG_VAR(SYSTEMD_TARGET, "Target for starting this service") + AS_IF([test "x$SYSTEMD_TARGET" == "x"], [SYSTEMD_TARGET="multi-user.target"]) + ++AC_ARG_ENABLE([nic_ethtool], ++ [ --enable-nic-ethtool Enable/disable the use of ETHTOOL features in the NIC driver], ++ [case "${enableval}" in ++ yes) nic_ethtool=true ;; ++ no) nic_ethtool=false ;; ++ *) AC_MSG_ERROR([bad value ${nic_ethtool} for --enable-nic-ethtool]) ;; ++ esac],[nic_ethtool=false] ++ ) ++AM_CONDITIONAL([FEATURE_NIC_ETHTOOL], [test x$nic_ethtool = xtrue]) ++ + # Create configured output. + AC_CONFIG_FILES([Makefile test/Makefile]) + AC_CONFIG_FILES([xyz.openbmc_project.Network.service]) +diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp +index 7f81003..ba6195e 100644 +--- a/ethernet_interface.cpp ++++ b/ethernet_interface.cpp +@@ -57,10 +57,12 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, + MacAddressIntf::mACAddress(getMACAddress(intfName)); + EthernetInterfaceIntf::nTPServers(getNTPServersFromConf()); + EthernetInterfaceIntf::nameservers(getNameServerFromConf()); ++#if NIC_SUPPORTS_ETHTOOL + InterfaceInfo ifInfo = EthernetInterface::getInterfaceInfo(); + + EthernetInterfaceIntf::autoNeg(std::get<2>(ifInfo)); + EthernetInterfaceIntf::speed(std::get<0>(ifInfo)); ++#endif + getChannelPrivilege(intfName); + + // Emit deferred signal. +@@ -283,13 +285,13 @@ ObjectPath EthernetInterface::neighbor(std::string iPAddress, + return objectPath; + } + ++#if NIC_SUPPORTS_ETHTOOL + /* +-Note: We don't have support for ethtool now +-will enable this code once we bring the ethtool +-in the image. +-TODO: https://github.com/openbmc/openbmc/issues/1484 ++ Enable this code if your NIC driver supports the ETHTOOL features. ++ Do this by adding the following to your phosphor-network*.bbappend file. ++ EXTRA_OECONF_append = " --enable-nic-ethtool=yes" ++ The default compile mode is to omit getInterfaceInfo() + */ +- + InterfaceInfo EthernetInterface::getInterfaceInfo() const + { + int sock{-1}; +@@ -330,6 +332,7 @@ InterfaceInfo EthernetInterface::getInterfaceInfo() const + } + return std::make_tuple(speed, duplex, autoneg); + } ++#endif + + /** @brief get the mac address of the interface. + * @return macaddress on success +-- +2.24.1 + |