From ffe6d597d9e3d4407cf8062b5d6505a80ce08f41 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Tue, 28 Sep 2021 12:04:51 -0700 Subject: Update to internal 0.75 Signed-off-by: Jason M. Bills --- .../recipes-network/network/ncsi-monitor.bb | 4 +- ...Fix-for-updating-MAC-address-from-RedFish.patch | 33 ++- ...-logs-to-isolate-the-coredump-issue-of-RT.patch | 261 +++++++++++++++++++++ .../network/phosphor-network_%.bbappend | 9 +- .../recipes-network/network/static-mac-addr.bb | 4 +- .../network/static-mac-addr/mac-check | 50 +++- 6 files changed, 332 insertions(+), 29 deletions(-) create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch (limited to 'meta-openbmc-mods/meta-common/recipes-network') diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb index 98d053219..cdb8e2097 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb @@ -2,7 +2,7 @@ SUMMARY = "Check for host in reset to disable the NCSI iface" DESCRIPTION = "If the host is in reset, the NCSI NIC will not be \ available, so this will manually disable the NIC" -FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" PV = "1.0" @@ -16,7 +16,7 @@ SRC_URI = "\ inherit obmc-phosphor-systemd -SYSTEMD_SERVICE_${PN} += "${BPN}.service" +SYSTEMD_SERVICE:${PN} += "${BPN}.service" do_install() { install -d ${D}${bindir} diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch index e4d9d2837..fe7c45532 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch @@ -1,4 +1,4 @@ -From c139e292d43bdc9484f77ef2f75df5dc9ff14e15 Mon Sep 17 00:00:00 2001 +From f6240a81c0ed87c128d454fa9c4023b9062efe5e Mon Sep 17 00:00:00 2001 From: sunitakx Date: Tue, 13 Jul 2021 12:54:01 +0000 Subject: [PATCH] Fix for updating MAC address from RedFish @@ -27,14 +27,14 @@ Response code: {"200 OK"} received. Signed-off-by: sunitakx --- src/ethernet_interface.cpp | 19 +++++++++++++------ - src/ethernet_interface.hpp | 4 ++++ - 2 files changed, 17 insertions(+), 6 deletions(-) + src/ethernet_interface.hpp | 5 +++++ + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 9a4d95a..95cd70b 100644 +index 666173e6587e..95bc8db9cd3a 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp -@@ -139,6 +139,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, +@@ -144,6 +144,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, { this->emit_object_added(); } @@ -43,7 +43,7 @@ index 9a4d95a..95cd70b 100644 } static IP::Protocol convertFamily(int family) -@@ -1069,8 +1071,18 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) +@@ -1129,8 +1131,18 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) } } @@ -62,7 +62,7 @@ index 9a4d95a..95cd70b 100644 ether_addr newMAC; try { -@@ -1104,12 +1116,7 @@ std::string EthernetInterface::macAddress(std::string value) +@@ -1164,12 +1176,7 @@ std::string EthernetInterface::macAddress(std::string value) intf->MacAddressIntf::macAddress(validMAC); } MacAddressIntf::macAddress(validMAC); @@ -77,10 +77,10 @@ index 9a4d95a..95cd70b 100644 } diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index ebba151..ebe72a1 100644 +index 6c7bd69ef987..acf6b6792b75 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp -@@ -11,6 +11,7 @@ +@@ -11,11 +11,14 @@ #include #include #include @@ -88,23 +88,22 @@ index ebba151..ebe72a1 100644 #include #include #include -@@ -25,6 +26,7 @@ - #define nicEnabled nICEnabled - #define ntpServers nTPServers - #endif + #include + +static constexpr const uint32_t defaultTimeout = 1; - ++ namespace phosphor { -@@ -93,6 +95,8 @@ class EthernetInterface : public Ifaces + namespace network +@@ -83,6 +86,8 @@ class EthernetInterface : public Ifaces EthernetInterface& operator=(EthernetInterface&&) = delete; virtual ~EthernetInterface() = default; - + + std::unique_ptr macUpdateTimer; + void macAddressTimeoutHandler(); /** @brief Constructor to put object onto bus at a dbus path. * @param[in] bus - Bus to attach to. * @param[in] objPath - Path to attach at. --- +-- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch new file mode 100644 index 000000000..255ae4836 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch @@ -0,0 +1,261 @@ +From f898e4512e7907ba185a1178ad36cb7af6ad0811 Mon Sep 17 00:00:00 2001 +From: sureshv1 +Date: Tue, 10 Aug 2021 16:38:42 +0530 +Subject: [PATCH] Added Debug logs to isolate coredump of RTNETLink Packet + Processing Clang Format updated + +Tested: +Flashed the BMC firmware image with logs included and observed that +the logs are logged during the boot up time and not flooding serial +console.After the BMC is booted up, logs were logged in when ever a +RT Net Link Packet is received and not flooding the journalctl logs. + +Change-Id: I5e1d152b18df17e5351c498210dae5c45f551f7b +Signed-off-by: sureshv1 +--- + src/network_manager.cpp | 15 ++++++++ + src/network_manager_main.cpp | 12 +++++++ + src/rtnetlink_server.cpp | 70 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 97 insertions(+) + +diff --git a/src/network_manager.cpp b/src/network_manager.cpp +index 2f5097a..ec48f2a 100644 +--- a/src/network_manager.cpp ++++ b/src/network_manager.cpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -26,6 +27,8 @@ constexpr char SYSTEMD_PATH[] = "/org/freedesktop/systemd1"; + constexpr char SYSTEMD_INTERFACE[] = "org.freedesktop.systemd1.Manager"; + constexpr auto FirstBootFile = "/var/lib/network/firstBoot_"; + ++constexpr bool debug = true; ++ + namespace phosphor + { + namespace network +@@ -273,6 +276,12 @@ void Manager::createInterfaces() + + void Manager::createChildObjects() + { ++ if (debug) ++ { ++ std::cout ++ << "Create Child Objects called(restart system conf and DHCP conf)" ++ << "\n"; ++ } + // creates the ethernet interface dbus object. + createInterfaces(); + +@@ -289,6 +298,12 @@ void Manager::createChildObjects() + objPath /= "dhcp"; + dhcpConf = std::make_unique( + bus, objPath.string(), *this); ++ ++ if (debug) ++ { ++ std::cout << "Create Child Objects Exiting" ++ << "\n"; ++ } + } + + ObjectPath Manager::vlan(IntfName interfaceName, uint32_t id) +diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp +index 983616f..c9bdb15 100644 +--- a/src/network_manager_main.cpp ++++ b/src/network_manager_main.cpp +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + #ifdef SYNC_MAC_FROM_INVENTORY + #include +@@ -41,6 +42,8 @@ constexpr auto configFile = "/usr/share/network/config.json"; + constexpr auto invNetworkIntf = + "xyz.openbmc_project.Inventory.Item.NetworkInterface"; + ++constexpr bool debug = true; ++ + namespace phosphor + { + namespace network +@@ -255,10 +258,19 @@ void restartNetwork() + + void initializeTimers() + { ++ if (debug) ++ std::cout ++ << "Initialize Timer for Refresh Object Timer and Restart Timer" ++ << "\n"; ++ + auto event = sdeventplus::Event::get_default(); + refreshObjectTimer = + std::make_unique(event, std::bind(refreshObjects)); + restartTimer = std::make_unique(event, std::bind(restartNetwork)); ++ ++ if (debug) ++ std::cout << "Initialize Timer Exiting" ++ << "\n"; + } + + } // namespace network +diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp +index 07ca08c..74f08b3 100644 +--- a/src/rtnetlink_server.cpp ++++ b/src/rtnetlink_server.cpp +@@ -11,12 +11,15 @@ + #include + #include + ++#include + #include + #include + #include + #include + #include + ++constexpr bool debug = true; ++ + namespace phosphor + { + namespace network +@@ -29,6 +32,9 @@ namespace rtnetlink + + static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) + { ++ if (debug) ++ std::cout << "Should Refresh the Received Header with Data" ++ << "\n"; + switch (hdr.nlmsg_type) + { + case RTM_NEWADDR: +@@ -36,22 +42,43 @@ static bool shouldRefresh(const struct nlmsghdr& hdr, std::string_view data) + case RTM_NEWROUTE: + case RTM_DELROUTE: + { ++ if (debug) ++ std::cout << "Don't Copy Data as the Message Type is:" ++ << hdr.nlmsg_type << "\n"; + return true; + } + case RTM_NEWNEIGH: + case RTM_DELNEIGH: + { ++ if (debug) ++ std::cout << "Message Type is" << hdr.nlmsg_type << "\n"; + struct ndmsg ndm; + if (data.size() < sizeof(ndm)) + { ++ if (debug) ++ std::cout << "Data Size:" << data.size() ++ << " NDM Size:" << sizeof(ndm) << "\n"; + return false; + } ++ if (debug) ++ std::cout ++ << "Processing/Copying the received Data for MLMSG_TYPE:" ++ << hdr.nlmsg_type << " Data Size:" << data.size() << "\n"; + memcpy(&ndm, data.data(), sizeof(ndm)); ++ if (debug) ++ std::cout << "Copied the received Data for MLMSG_TYPE:" ++ << hdr.nlmsg_type ++ << " and NDM Message Size is:" << sizeof(ndm) << "\n"; + // We only want to refresh for static neighbors + return ndm.ndm_state & NUD_PERMANENT; + } + } + ++ if (debug) ++ std::cout << "Should Refresh Object is verified and done without any " ++ "known header type" ++ << "\n"; ++ + return false; + } + +@@ -62,25 +89,58 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, + char buffer[phosphor::network::rtnetlink::BUFSIZE]{}; + int len{}; + ++ if (debug) ++ std::cout << "\n" ++ << "RTNETLINK event Handler is called to read the RTNETLINK " ++ "Packet and Refresh it for a buffer size:" ++ << phosphor::network::rtnetlink::BUFSIZE << "\n"; + auto netLinkHeader = reinterpret_cast(buffer); + while ((len = recv(fd, netLinkHeader, phosphor::network::rtnetlink::BUFSIZE, + 0)) > 0) + { ++ if (debug) ++ { ++ std::cout << "Received the Packet with a Length:" << len << "\n"; ++ } + for (; (NLMSG_OK(netLinkHeader, len)) && + (netLinkHeader->nlmsg_type != NLMSG_DONE); + netLinkHeader = NLMSG_NEXT(netLinkHeader, len)) + { ++ if (debug) ++ std::cout << "NetLinkHeader Message Type is:" ++ << netLinkHeader->nlmsg_type ++ << " with total length(len):" << len ++ << " and block data packet " ++ "length(netLinkHeader->nlmsg_len - NLMSG_HDRLEN):" ++ << netLinkHeader->nlmsg_len - NLMSG_HDRLEN ++ << " and Message Length(netLinkHeader->nlmsg_len):" ++ << netLinkHeader->nlmsg_len << "\n"; + std::string_view data( + reinterpret_cast(NLMSG_DATA(netLinkHeader)), + netLinkHeader->nlmsg_len - NLMSG_HDRLEN); ++ if (debug) ++ { ++ if (netLinkHeader) ++ std::cout << "NetLinkHeader is valid" ++ << "\n"; ++ } + if (shouldRefresh(*netLinkHeader, data)) + { + // starting the timer here to make sure that we don't want + // create the child objects multiple times. ++ if (debug) ++ std::cout << "Check Refresh Object Timer is enabled?" ++ << "\n"; + if (!refreshObjectTimer->isEnabled()) + { + // if start timer throws exception then let the application + // crash ++ if (debug) ++ std::cout ++ << "Call Restart Once with a Timeout seconds:" ++ << std::chrono::seconds(refreshTimeout).count() ++ << "\n"; ++ + refreshObjectTimer->restartOnce(refreshTimeout); + } // end if + } // end if +@@ -89,6 +149,16 @@ static int eventHandler(sd_event_source* /*es*/, int fd, uint32_t /*revents*/, + + } // end while + ++ if (debug) ++ { ++ std::cout << "RTNETLINK Event Handler completed read of packets and " ++ "processed it" ++ << " with an length(exit):" << len << "\n"; ++ ++ if (errno) ++ std::cout << "Error Number:" << errno << "\n"; ++ } ++ + return 0; + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend index be2c2c070..f8010b283 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend @@ -1,13 +1,14 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "1ea359943afbd59168f490778a528c858903b74d" +SRCREV = "b108fd740fdde4a9f0fe63e63ccdee695f5b92e7" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ file://0004-Fix-for-updating-MAC-address-from-RedFish.patch \ + file://0005-Added-debug-logs-to-isolate-the-coredump-issue-of-RT.patch \ " -EXTRA_OECONF_append = " --enable-nic-ethtool=yes" -EXTRA_OECONF_append = " --enable-ipv6-accept-ra=yes" +EXTRA_OECONF:append = " --enable-nic-ethtool=yes" +EXTRA_OECONF:append = " --enable-ipv6-accept-ra=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb index 0dab0fc1a..ee55c5407 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb @@ -2,7 +2,7 @@ SUMMARY = "Enforce static MAC addresses" DESCRIPTION = "Set a priority on MAC addresses to run with: \ factory-specified > u-boot-specified > random" -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PV = "1.0" @@ -16,7 +16,7 @@ SRC_URI = "\ inherit obmc-phosphor-systemd -SYSTEMD_SERVICE_${PN} += "${PN}.service" +SYSTEMD_SERVICE:${PN} += "${PN}.service" do_install() { install -d ${D}${bindir} diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 68678e420..39d7dd8a7 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -59,6 +59,50 @@ fi return 0 } +# An earlier version of the mac_check utility disabled the netipmid for +# eth1. This was done to eliminate an error message being logged in the +# journal for systems that only had a single NIC. The error message is +# undesirable as it is present in Redfish session log output. + +# Systems that have both NICs have also had the eth1 netipmid disabled. +# The reason for this is failing to specify the correct kernel device +# tree during the U-Boot kernel boot process. Without the correct +# device tree, eth1 is not enumerated by the kernel. The mac-check +# script turned off the netipmid service for eth1. + +# The configure_netipmid_svc_eth1 function manages enabling and +# disabling netipmid for eth1. It is explicit, and does not rely upon +# previous state to enable or disable the service. + +# Note: Enabling the service is independent of the IPMI channel +# enable/disable command. This means "ipmitool lan set access +# off" functions correctly with the netipmid service enabled. +configure_netipmid_svc_eth1() { + if [ -h /sys/class/net/eth1 ]; then + if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.socket) == "disabled" ]; + then + /bin/systemctl enable "phosphor-ipmi-net@eth1.socket" + /bin/systemctl start "phosphor-ipmi-net@eth1.socket" + fi + if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.service) =="disabled" ]; + then + /bin/systemctl enable "phosphor-ipmi-net@eth1.service" + /bin/systemctl start "phosphor-ipmi-net@eth1.service" + fi + else + if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.socket) == "enabled" ]; + then + /bin/systemctl disable "phosphor-ipmi-net@eth1.socket" + /bin/systemctl stop "phosphor-ipmi-net@eth1.socket" + fi + if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.service) == "enabled" ]; + then + /bin/systemctl disable "phosphor-ipmi-net@eth1.service" + /bin/systemctl stop "phosphor-ipmi-net@eth1.service" + fi + fi +} + mac_check() { local iface="$1" local envname="$2" @@ -93,6 +137,8 @@ mac_check() { create_macdir +configure_netipmid_svc_eth1 + error=0 first_error_seen=0 @@ -107,10 +153,6 @@ while read IFACE UBDEV; do if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then first_error_seen=$error fi - else - # Disable netipmid if present because eth(x) is not present - /bin/systemctl disable "phosphor-ipmi-net@$IFACE.socket" - /bin/systemctl disable "phosphor-ipmi-net@$IFACE.service" fi done <<-END_CONF eth0 eth1addr -- cgit v1.2.3