1
0
mirror of https://github.com/systemd/systemd.git synced 2025-07-13 12:59:09 +03:00

networkctl: add support to display Transmit/Recieve queue length (#12633)

```
(networkctl) % build/networkctl status veth-test
● 13: veth-test
            Link File: /usr/lib/systemd/network/99-default.link
         Network File: /usr/lib/systemd/network/veth0.network
                 Type: ether
                State: routable (configured)
               Driver: veth
           HW Address: 8a:a6:1c:3f:a6:1a
                  MTU: 1500
          Minimum MTU: 68
          Maximum MTU: 65535
Transmit Queue Length: 1
 Receive Queue Length: 1
              Address: 192.168.5.31
                       fe80::88a6:1cff:fe3f:a61a
              Gateway: 192.168.5.1
                  DNS: 192.168.5.1
                  NTP: 192.168.5.1
            Time Zone: Asia/Kolkata
         Connected To: Zeus on port peer-test
```
This commit is contained in:
Susant Sahani
2019-05-22 14:23:12 +05:30
committed by Yu Watanabe
parent b2774a3ae6
commit 0307afc681

View File

@ -103,11 +103,15 @@ typedef struct LinkInfo {
uint32_t mtu;
uint32_t min_mtu;
uint32_t max_mtu;
uint32_t tx_queues;
uint32_t rx_queues;
bool has_mac_address:1;
bool has_mtu:1;
bool has_min_mtu:1;
bool has_max_mtu:1;
bool has_tx_queues:1;
bool has_rx_queues:1;
} LinkInfo;
static int link_info_compare(const LinkInfo *a, const LinkInfo *b) {
@ -169,6 +173,14 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns) {
sd_netlink_message_read_u32(m, IFLA_MAX_MTU, &info->max_mtu) >= 0 &&
info->min_mtu > 0;
info->has_rx_queues =
sd_netlink_message_read_u32(m, IFLA_NUM_RX_QUEUES, &info->rx_queues) >= 0 &&
info->rx_queues > 0;
info->has_tx_queues =
sd_netlink_message_read_u32(m, IFLA_NUM_TX_QUEUES, &info->tx_queues) >= 0 &&
info->tx_queues > 0;
return 1;
}
@ -796,6 +808,11 @@ static int link_status_one(
if (info->has_max_mtu)
printf(" Maximum MTU: %" PRIu32 "\n", info->max_mtu);
if (info->has_tx_queues)
printf("Transmit Queue Length: %" PRIu32 "\n", info->tx_queues);
if (info->has_rx_queues)
printf(" Receive Queue Length: %" PRIu32 "\n", info->rx_queues);
(void) dump_addresses(rtnl, " Address: ", info->ifindex);
(void) dump_gateways(rtnl, hwdb, " Gateway: ", info->ifindex);