app/testpmd: add offload capabilities query
[dpdk.git] / app / test-pmd / config.c
index 5834498..80491fc 100644 (file)
@@ -543,6 +543,182 @@ port_infos_display(portid_t port_id)
        printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align);
 }
 
+void
+port_offload_cap_display(portid_t port_id)
+{
+       struct rte_eth_dev *dev;
+       struct rte_eth_dev_info dev_info;
+       static const char *info_border = "************";
+
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return;
+
+       dev = &rte_eth_devices[port_id];
+       rte_eth_dev_info_get(port_id, &dev_info);
+
+       printf("\n%s Port %d supported offload features: %s\n",
+               info_border, port_id, info_border);
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
+               printf("VLAN stripped:                 ");
+               if (dev->data->dev_conf.rxmode.hw_vlan_strip)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) {
+               printf("Double VLANs stripped:         ");
+               if (dev->data->dev_conf.rxmode.hw_vlan_extend)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) {
+               printf("RX IPv4 checksum:              ");
+               if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) {
+               printf("RX UDP checksum:               ");
+               if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) {
+               printf("RX TCP checksum:               ");
+               if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
+               printf("RX Outer IPv4 checksum:        on");
+
+       if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) {
+               printf("Large receive offload:         ");
+               if (dev->data->dev_conf.rxmode.enable_lro)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) {
+               printf("VLAN insert:                   ");
+               if (ports[port_id].tx_ol_flags &
+                   TESTPMD_TX_OFFLOAD_INSERT_VLAN)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {
+               printf("Double VLANs insert:           ");
+               if (ports[port_id].tx_ol_flags &
+                   TESTPMD_TX_OFFLOAD_INSERT_QINQ)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+               printf("TX IPv4 checksum:              ");
+               if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) {
+               printf("TX UDP checksum:               ");
+               if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) {
+               printf("TX TCP checksum:               ");
+               if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {
+               printf("TX SCTP checksum:              ");
+               if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) {
+               printf("TX Outer IPv4 checksum:        ");
+               if (ports[port_id].tx_ol_flags &
+                   TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) {
+               printf("TX TCP segmentation:           ");
+               if (ports[port_id].tso_segsz != 0)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) {
+               printf("TX UDP segmentation:           ");
+               if (ports[port_id].tso_segsz != 0)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) {
+               printf("TSO for VXLAN tunnel packet:   ");
+               if (ports[port_id].tunnel_tso_segsz)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) {
+               printf("TSO for GRE tunnel packet:     ");
+               if (ports[port_id].tunnel_tso_segsz)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) {
+               printf("TSO for IPIP tunnel packet:    ");
+               if (ports[port_id].tunnel_tso_segsz)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) {
+               printf("TSO for GENEVE tunnel packet:  ");
+               if (ports[port_id].tunnel_tso_segsz)
+                       printf("on\n");
+               else
+                       printf("off\n");
+       }
+
+}
+
 int
 port_id_is_invalid(portid_t port_id, enum print_warning warning)
 {