Created
June 21, 2022 13:24
-
-
Save qinghon/d30a136548b963ce29763119b256350e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: mc_v10/fsl_dpni.h | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/mc_v10/fsl_dpni.h b/mc_v10/fsl_dpni.h | |
--- a/mc_v10/fsl_dpni.h (revision c48bb2c0dabdd47e5f69fc808f380cfbd205291e) | |
+++ b/mc_v10/fsl_dpni.h (date 1655815719863) | |
@@ -264,6 +264,10 @@ | |
uint32_t cmd_flags, | |
uint16_t token, | |
struct dpni_attr_v10 *attr); | |
+int dpni_get_max_frame_len(struct fsl_mc_io *mc_io, | |
+ uint32_t cmd_flags, | |
+ uint16_t token, | |
+ uint16_t *len); | |
#define DPNI_STATISTICS_CNT 7 | |
Index: dpni_commands.c | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/dpni_commands.c b/dpni_commands.c | |
--- a/dpni_commands.c (revision c48bb2c0dabdd47e5f69fc808f380cfbd205291e) | |
+++ b/dpni_commands.c (date 1655815836786) | |
@@ -764,6 +764,7 @@ | |
union dpni_statistics_v10 dpni_stats; | |
uint16_t dpni_handle, dpni_major, dpni_minor; | |
struct dpni_link_state_v10 link_state; | |
+ uint16_t max_frame_length = 0; | |
bool dpni_opened = false; | |
uint8_t mac_addr[6]; | |
int error = 0; | |
@@ -795,6 +796,13 @@ | |
mc_status_to_string(mc_status), mc_status); | |
goto out; | |
} | |
+ error = dpni_get_max_frame_len(&restool.mc_io, 0, dpni_handle, &max_frame_length); | |
+ if (error < 0) { | |
+ mc_status = flib_error_to_mc_status(error); | |
+ ERROR_PRINTF("MC error: %s (status %#x)\n", | |
+ mc_status_to_string(mc_status), mc_status); | |
+ goto out; | |
+ } | |
error = dpni_get_api_version_v10(&restool.mc_io, 0, | |
&dpni_major, &dpni_minor); | |
@@ -851,6 +859,7 @@ | |
printf("fs_entries: %u\n", (uint32_t)dpni_attr.fs_entries); | |
printf("qos_key_size: %u\n", (uint32_t)dpni_attr.qos_key_size); | |
printf("fs_key_size: %u\n", (uint32_t)dpni_attr.fs_key_size); | |
+ printf("max_frame_length: %u\n", max_frame_length); | |
for (page = 0; page < 3; page++) { | |
error = dpni_get_statistics_v10(&restool.mc_io, 0, | |
Index: mc_v10/dpni.c | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/mc_v10/dpni.c b/mc_v10/dpni.c | |
--- a/mc_v10/dpni.c (revision c48bb2c0dabdd47e5f69fc808f380cfbd205291e) | |
+++ b/mc_v10/dpni.c (date 1655815719867) | |
@@ -244,6 +244,39 @@ | |
return 0; | |
} | |
+/** | |
+ * dpni_get_max_frame_len() - Retrieve DPNI attributes. | |
+ * @mc_io: Pointer to MC portal's I/O object | |
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
+ * @token: Token of DPNI object | |
+ * @len: Object's max frame len | |
+ * | |
+ * Return: '0' on Success; Error code otherwise. | |
+ */ | |
+int dpni_get_max_frame_len(struct fsl_mc_io *mc_io, | |
+ uint32_t cmd_flags, | |
+ uint16_t token, | |
+ uint16_t *len) | |
+{ | |
+ struct mc_command cmd = { 0 }; | |
+ | |
+ int err; | |
+ | |
+ /* prepare command */ | |
+ cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_MAX_FRAME_LENGTH, | |
+ cmd_flags, | |
+ token); | |
+ | |
+ /* send command to mc*/ | |
+ err = mc_send_command(mc_io, &cmd); | |
+ if (err) | |
+ return err; | |
+ | |
+ /* retrieve response parameters */ | |
+ *len = *(uint16_t *)cmd.params; | |
+ return 0; | |
+} | |
+ | |
/** | |
* dpni_get_api_version_v10() - Get Data Path Network Interface API version | |
* @mc_io: Pointer to MC portal's I/O object | |
Index: mc_v10/fsl_dpni_cmd.h | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
diff --git a/mc_v10/fsl_dpni_cmd.h b/mc_v10/fsl_dpni_cmd.h | |
--- a/mc_v10/fsl_dpni_cmd.h (revision c48bb2c0dabdd47e5f69fc808f380cfbd205291e) | |
+++ b/mc_v10/fsl_dpni_cmd.h (date 1655815572148) | |
@@ -51,6 +51,7 @@ | |
#define DPNI_CMDID_DESTROY DPNI_CMD(0x981) | |
#define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01) | |
#define DPNI_CMDID_GET_ATTR DPNI_CMD_V2(0x004) | |
+#define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217) | |
#define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224) | |
#define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225) | |
#define DPNI_CMDID_GET_STATISTICS DPNI_CMD_V2(0x25D) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment