From patchwork Thu Oct 29 00:24:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 537616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 857BE1402D4 for ; Thu, 29 Oct 2015 11:25:46 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 6ABB11A0B5F for ; Thu, 29 Oct 2015 11:25:46 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 978281A0A84 for ; Thu, 29 Oct 2015 11:25:41 +1100 (AEDT) Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Oct 2015 10:25:39 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 29 Oct 2015 10:25:38 +1000 X-Helo: d23dlp01.au.ibm.com X-MailFrom: cyril.bur@au1.ibm.com X-RcptTo: skiboot@lists.ozlabs.org Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 3B7032CE8050 for ; Thu, 29 Oct 2015 11:25:38 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9T0PUT636307040 for ; Thu, 29 Oct 2015 11:25:38 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9T0P5PQ012065 for ; Thu, 29 Oct 2015 11:25:06 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t9T0P5BG011617; Thu, 29 Oct 2015 11:25:05 +1100 Received: from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id AF902A0236; Thu, 29 Oct 2015 11:24:41 +1100 (AEDT) From: Cyril Bur To: skiboot@lists.ozlabs.org Date: Thu, 29 Oct 2015 11:24:06 +1100 Message-Id: <1446078249-10336-3-git-send-email-cyril.bur@au1.ibm.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1446078249-10336-1-git-send-email-cyril.bur@au1.ibm.com> References: <1446078249-10336-1-git-send-email-cyril.bur@au1.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15102900-0025-0000-0000-000002558863 Subject: [Skiboot] [PATCH 2/5] hw/bt: Convert retry_count to send_count X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair@popple.id.au MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" It is useful to know if a message has been sent at all, the counter used to retry sending can be used for this. Signed-off-by: Cyril Bur Acked-by: Alistair Popple --- hw/bt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/bt.c b/hw/bt.c index 15e494f..7266b2f 100644 --- a/hw/bt.c +++ b/hw/bt.c @@ -67,7 +67,7 @@ /* * Maximum number of times to attempt sending a message before giving up. */ -#define BT_MAX_RETRY_COUNT 1 +#define BT_MAX_SEND_COUNT 2 #define BT_QUEUE_DEBUG 0 @@ -106,7 +106,7 @@ struct bt_msg { struct list_node link; unsigned long tb; uint8_t seq; - uint8_t retry_count; + uint8_t send_count; struct ipmi_msg ipmi_msg; }; @@ -212,6 +212,7 @@ static void bt_send_msg(struct bt_msg *bt_msg) for (i = 0; i < ipmi_msg->req_size; i++) bt_outb(ipmi_msg->data[i], BT_HOST2BMC); + bt_msg->send_count++; BT_DBG(bt_msg, "Message sent to host"); bt_outb(BT_CTRL_H2B_ATN, BT_CTRL); bt_set_state(BT_STATE_RESP_WAIT); @@ -318,13 +319,13 @@ static void bt_expire_old_msg(uint64_t tb) bt_msg = list_top(&bt.msgq, struct bt_msg, link); if (bt_msg && bt_msg->tb > 0 && (bt_msg->tb + BT_MSG_TIMEOUT) < tb) { - if (bt_msg->retry_count < BT_MAX_RETRY_COUNT) { + if (bt_msg->send_count < BT_MAX_SEND_COUNT) { /* A message timeout is usually due to the BMC clearing the H2B_ATN flag without actually doing anything. The data will still be in the FIFO so just reset the flag.*/ BT_ERR(bt_msg, "Retry sending message"); - bt_msg->retry_count++; + bt_msg->send_count++; bt_msg->tb = tb; bt_outb(BT_CTRL_H2B_ATN, BT_CTRL); } else { @@ -350,7 +351,7 @@ static void print_debug_queue_info(void) printed = false; prlog(PR_DEBUG, "-------- BT Msg Queue --------\n"); list_for_each(&bt.msgq, msg, link) { - BT_DBG(msg, "[]"); + BT_DBG(msg, "[ sent %d ]", msg->send_count); } prlog(PR_DEBUG, "-----------------------------\n"); } else if (!printed) { @@ -432,7 +433,7 @@ static void bt_add_msg(struct bt_msg *bt_msg) { bt_msg->tb = 0; bt_msg->seq = ipmi_seq++; - bt_msg->retry_count = 0; + bt_msg->send_count = 0; bt.queue_len++; if (bt.queue_len > BT_MAX_QUEUE_LEN) { /* Maximum queue length exceeded - remove the oldest message