-
-
static void pcmd_portstats_callback(__rte_unused void *ptr_params,
__rte_unused struct cmdline *ctx,
__rte_unused void *ptr_data)
@@ -799,6 +809,17 @@ cmdline_parse_inst_t pcmd_macaddr = {
NULL
},
};
+cmdline_parse_inst_t pcmd_mtu_get = {
+ .f = pcmd_mtu_callback,
+ .data = (void *)0x01,
+ .help_str = "mtu <port_id>\n"
+ " Get MTU",
+ .tokens = {
+ (void *)&pcmd_mtu_token_cmd,
+ (void *)&pcmd_intstr_token_port,
+ NULL
+ },
+};
cmdline_parse_inst_t pcmd_mtu = {
.f = pcmd_mtu_callback,
.data = NULL,
@@ -879,6 +900,7 @@ cmdline_parse_ctx_t list_prompt_commands[] = {
(cmdline_parse_inst_t *)&pcmd_link,
(cmdline_parse_inst_t *)&pcmd_macaddr_get,
(cmdline_parse_inst_t *)&pcmd_macaddr,
+ (cmdline_parse_inst_t *)&pcmd_mtu_get,
(cmdline_parse_inst_t *)&pcmd_mtu,
(cmdline_parse_inst_t *)&pcmd_open,
(cmdline_parse_inst_t *)&pcmd_pause_noopt,
diff --git a/examples/ethtool/lib/rte_ethtool.c
b/examples/ethtool/lib/rte_ethtool.c
index 73193ed..e69b2c1 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -345,6 +345,13 @@ rte_ethtool_net_validate_addr(uint16_t port_id
__rte_unused,
return rte_is_valid_assigned_ether_addr(addr);
}
+int
+rte_ethtool_net_get_mtu(uint16_t port_id, uint16_t *mtu)
+{
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ return rte_eth_dev_get_mtu(port_id, mtu);
+}
int
rte_ethtool_net_change_mtu(uint16_t port_id, uint16_t mtu)
diff --git a/examples/ethtool/lib/rte_ethtool.h
b/examples/ethtool/lib/rte_ethtool.h
index fe3250e..434ad1d 100644
--- a/examples/ethtool/lib/rte_ethtool.h
+++ b/examples/ethtool/lib/rte_ethtool.h
@@ -23,6 +23,7 @@
* rte_ethtool_net_stop: net_device_ops::ndo_stop
* rte_ethtool_net_set_mac_addr: net_device_ops::ndo_set_mac_address
* rte_ethtool_net_validate_addr: net_device_ops::ndo_validate_addr
+ * rte_ethtool_net_get_mtu: net_device_ops::ndo_get_mtu
* rte_ethtool_net_change_mtu: net_device_ops::ndo_change_mtu
* rte_ethtool_net_get_stats64: net_device_ops::ndo_get_stats64
* rte_ethtool_net_vlan_rx_add_vid net_device_ops::ndo_vlan_rx_add_vid
@@ -296,6 +297,19 @@ int rte_ethtool_net_validate_addr(uint16_t port_id,
struct rte_ether_addr *addr);
/**
+ * Retrieve the MTU of an Ethernet device.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param mtu
+ * A pointer to a uint16_t where the retrieved MTU is to be stored.
+ * @return
+ * - (0) if successful.
+ * - (-ENODEV) if *port_id* invalid.
+ */
+int rte_ethtool_net_get_mtu(uint16_t port_id, uint16_t *mtu);
+
+/**
* Setting the Ethernet device maximum Tx unit.
*
* @param port_id
--
2.8.1