From: Felix Manlunas <felix.manlunas@cavium.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, raghu.vatsavayi@cavium.com,
derek.chickles@cavium.com, satananda.burla@cavium.com,
manish.awasthi@cavium.com, veerasenareddy.burru@cavium.com
Subject: [PATCH net-next] liquidio: pass date and time info to NIC firmware
Date: Fri, 22 Sep 2017 17:35:18 -0700 [thread overview]
Message-ID: <20170923003518.GA1583@felix-thinkpad.cavium.com> (raw)
From: Veerasenareddy Burru <veerasenareddy.burru@cavium.com>
Signed-off-by: Veerasenareddy Burru <veerasenareddy.burru@cavium.com>
Signed-off-by: Manish Awasthi <manish.awasthi@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
.../net/ethernet/cavium/liquidio/octeon_console.c | 28 +++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
index ec3dd69..eda799b 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
@@ -803,15 +803,19 @@ static int octeon_console_read(struct octeon_device *oct, u32 console_num,
}
#define FBUF_SIZE (4 * 1024 * 1024)
+#define MAX_DATE_SIZE 30
int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
size_t size)
{
- int ret = 0;
+ struct octeon_firmware_file_header *h;
+ char date[MAX_DATE_SIZE];
+ struct timeval time;
u32 crc32_result;
+ struct tm tm_val;
u64 load_addr;
u32 image_len;
- struct octeon_firmware_file_header *h;
+ int ret = 0;
u32 i, rem;
if (size < sizeof(struct octeon_firmware_file_header)) {
@@ -890,11 +894,29 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
load_addr += size;
}
}
+
+ /* Get time of the day */
+ do_gettimeofday(&time);
+ time_to_tm(time.tv_sec, (-sys_tz.tz_minuteswest) * 60, &tm_val);
+ ret = snprintf(date, MAX_DATE_SIZE,
+ " date=%04ld.%02d.%02d-%02d:%02d:%02d",
+ tm_val.tm_year + 1900, tm_val.tm_mon + 1, tm_val.tm_mday,
+ tm_val.tm_hour, tm_val.tm_min, tm_val.tm_sec);
+ if ((sizeof(h->bootcmd) - strnlen(h->bootcmd, sizeof(h->bootcmd))) <
+ ret) {
+ dev_err(&oct->pci_dev->dev, "Boot command buffer too small\n");
+ return -EINVAL;
+ }
+ strncat(h->bootcmd, date,
+ sizeof(h->bootcmd) - strnlen(h->bootcmd, sizeof(h->bootcmd)));
+
dev_info(&oct->pci_dev->dev, "Writing boot command: %s\n",
h->bootcmd);
/* Invoke the bootcmd */
ret = octeon_console_send_cmd(oct, h->bootcmd, 50);
+ if (ret)
+ dev_info(&oct->pci_dev->dev, "Boot command send failed\n");
- return 0;
+ return ret;
}
next reply other threads:[~2017-09-23 0:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-23 0:35 Felix Manlunas [this message]
2017-09-23 15:16 ` [PATCH net-next] liquidio: pass date and time info to NIC firmware Andrew Lunn
2017-09-26 3:27 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170923003518.GA1583@felix-thinkpad.cavium.com \
--to=felix.manlunas@cavium.com \
--cc=davem@davemloft.net \
--cc=derek.chickles@cavium.com \
--cc=manish.awasthi@cavium.com \
--cc=netdev@vger.kernel.org \
--cc=raghu.vatsavayi@cavium.com \
--cc=satananda.burla@cavium.com \
--cc=veerasenareddy.burru@cavium.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).