示例#1
0
int
rw_piot_get_vlan_offload(rw_piot_api_handle_t api_handle)
{
  rw_piot_device_t *rw_piot_dev = RWPIOT_GET_DEVICE(api_handle);
  ASSERT(RWPIOT_VALID_DEVICE(rw_piot_dev));
  if (NULL == rw_piot_dev) {
    RW_PIOT_LOG(RTE_LOG_ERR, "PIOT Could not find device by handle\n");
    return -1;
  }
  return rte_eth_dev_get_vlan_offload(rw_piot_dev->rte_port_id);
}
示例#2
0
void
port_infos_display(struct cmdline *cl, portid_t port_id)
{
	struct ether_addr mac_addr;
	struct rte_eth_link link;
	int vlan_offload;
	static const char *info_border = "=====================";

	rte_eth_link_get_nowait(port_id, &link);
	cmdline_printf(cl, "\n%s Infos for port %-2d %s\n", info_border,
		       port_id, info_border);
	rte_eth_macaddr_get(port_id, &mac_addr);
	print_ethaddr(cl, "MAC address: ", &mac_addr);

	cmdline_printf(cl, "\nLink status: %s\n",
		       (link.link_status) ? ("up") : ("down"));
	cmdline_printf(cl, "Link speed: %u Mbps\n", (unsigned)link.link_speed);
	cmdline_printf(cl, "Link duplex: %s\n",
		       (link.link_duplex == ETH_LINK_FULL_DUPLEX)
			   ? ("full-duplex")
			   : ("half-duplex"));
	cmdline_printf(cl, "Promiscuous mode: %s\n",
		       rte_eth_promiscuous_get(port_id) ? "enabled"
							: "disabled");
	cmdline_printf(cl, "Allmulticast mode: %s\n",
		       rte_eth_allmulticast_get(port_id) ? "enabled"
							 : "disabled");

	vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
	if (vlan_offload >= 0) {
		cmdline_printf(cl, "VLAN offload: \n");
		if (vlan_offload & ETH_VLAN_STRIP_OFFLOAD)
			cmdline_printf(cl, "  strip on \n");
		else
			cmdline_printf(cl, "  strip off \n");

		if (vlan_offload & ETH_VLAN_FILTER_OFFLOAD)
			cmdline_printf(cl, "  filter on \n");
		else
			cmdline_printf(cl, "  filter off \n");

		if (vlan_offload & ETH_VLAN_EXTEND_OFFLOAD)
			cmdline_printf(cl, "  qinq(extend) on \n");
		else
			cmdline_printf(cl, "  qinq(extend) off \n");
	}
}