Thread (196 messages) 196 messages, 4 authors, 2019-07-04

Re: [dpdk-dev] [PATCH v1 48/58] net/octeontx2: add FW version get operation

From: Ferruh Yigit <hidden>
Date: 2019-06-06 16:06:26

On 6/2/2019 4:24 PM, jerinj@marvell.com wrote:
From: Vamsi Attunuru <vattunuru@marvell.com>

Add firmware version get operation.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
<...>
quoted hunk ↗ jump to hunk
@@ -209,6 +209,28 @@ otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
 	return 0;
 }
 
+int
+otx2_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+			size_t fw_size)
+{
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	int rc = (int)fw_size;
+
+	if (fw_size > sizeof(dev->mkex_pfl_name))
+		rc = sizeof(dev->mkex_pfl_name);
+
+	rc = strlcpy(fw_version, (char *)dev->mkex_pfl_name, rc);
+
+	rc += 1; /* Add the size of '\0' */
+	if (fw_size < (uint32_t)rc)
+		goto done;
+	else
+		return 0;
+
+done:
+	return rc;
+}
Up to you but this can be done without a 'goto':

	...
	if (fw_size < (uint32_t)rc)
		return rc;

	return 0;
}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help