summaryrefslogtreecommitdiff
path: root/meta-ibs/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0003-Fix-for-clearing-outstanding-requests.patch
blob: 1b7d47b01fd04f19e95b93668681c14eb623f4cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 3a528516ea20cac006c6a892b353faa25fe64e7f Mon Sep 17 00:00:00 2001
From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Date: Mon, 20 Sep 2021 14:06:05 +0000
Subject: [PATCH 3/3] Fix for clearing outstanding requests

IPMB requests were made valid even if there was an error in opening the
mux bus. This fix makes the IPMB requests valid only we were able to
successfully open the Mux fd.

Tested:
Verified using busctl command.
Command: busctl call xyz.openbmc_project.Ipmi.Channel.Ipmb
         /xyz/openbmc_project/Ipmi/Channel/Ipmb org.openbmc.Ipmb
         sendRequest yyyyay 0 0x30 0 0x70 2 0 32
Response: (iyyyyay) 0 49 0 112 193 0

Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Signed-off-by: Andrey V.Kosteltsev <AKosteltsev@IBS.RU>
---
 ipmbbridged.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp
index 3ffc1f7..0508fcc 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -801,7 +801,6 @@ std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
                                 std::shared_ptr<IpmbRequest> request,
                                 const uint8_t pcieSlot)
 {
-    makeRequestValid(request);
     std::filesystem::path p =
         "/dev/i2c-mux/PCIE_Mux/Pcie_Slot_" + std::to_string(pcieSlot);
 
@@ -825,6 +824,7 @@ std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
         return returnStatus(ipmbResponseStatus::error);
     }
 
+    makeRequestValid(request);
     uint8_t size = buffer.size();
 
     const uint8_t slaveAddrIndex = 1;
@@ -894,6 +894,7 @@ std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
     std::vector<uint8_t> buffer(0);
     if (request->ipmbToi2cConstruct(buffer) != 0)
     {
+        makeRequestInvalid(*request);
         return returnStatus(ipmbResponseStatus::error);
     }
 
@@ -929,7 +930,8 @@ std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>
                                " To avoid log storm, not all the logs for the "
                                "issue will be shown: ";
                 }
-                if (!(requestAddLogCount % ipmbRequestAddLogInterval) && (requestAddLogCount != 0))
+                if (!(requestAddLogCount % ipmbRequestAddLogInterval) &&
+                    (requestAddLogCount != 0))
                 {
                     msgToLog = "requestAdd: There are " +
                                std::to_string(requestAddLogCount) +
-- 
2.35.1