From 2068e983dd699e199f8c920e6b0f94e7847227dc Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 27 Jan 2016 16:59:04 +0100 Subject: Enable Chelsio T5 support Change-Id: I4bb6ac36a8bc585677448f4b22bd1299630f95de Signed-off-by: Damjan Marion --- vnet/vnet/devices/dpdk/device.c | 25 ++++++++++++++++++++++++- vnet/vnet/devices/dpdk/dpdk.h | 3 ++- vnet/vnet/devices/dpdk/init.c | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) (limited to 'vnet') diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 781fff46782..72df02a4455 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -753,6 +753,7 @@ static u8 * format_dpdk_device_name (u8 * s, va_list * args) char *device_name; u32 i = va_arg (*args, u32); struct rte_eth_dev_info dev_info; + u8 * ret; if (dm->interface_name_format_decimal) devname_format = "%s%d/%d/%d"; @@ -799,9 +800,27 @@ static u8 * format_dpdk_device_name (u8 * s, va_list * args) } rte_eth_dev_info_get(i, &dev_info); - return format (s, devname_format, device_name, dev_info.pci_dev->addr.bus, + ret = format (s, devname_format, device_name, dev_info.pci_dev->addr.bus, dev_info.pci_dev->addr.devid, dev_info.pci_dev->addr.function); + + /* address Chelsio cards which share PCI address */ + if (dm->devices[i].pmd == VNET_DPDK_PMD_CXGBE) { + struct rte_eth_dev_info di; + + di.pci_dev = 0; + rte_eth_dev_info_get(i+1, &di); + if (di.pci_dev && memcmp(&dev_info.pci_dev->addr, &di.pci_dev->addr, + sizeof(struct rte_pci_addr)) == 0) + return format(ret, "/0"); + + di.pci_dev = 0; + rte_eth_dev_info_get(i-1, &di); + if (di.pci_dev && memcmp(&dev_info.pci_dev->addr, &di.pci_dev->addr, + sizeof(struct rte_pci_addr)) == 0) + return format(ret, "/1"); + } + return ret; } static u8 * format_dpdk_device_type (u8 * s, va_list * args) @@ -859,6 +878,10 @@ static u8 * format_dpdk_device_type (u8 * s, va_list * args) dev_type = "Cisco VIC"; break; + case VNET_DPDK_PMD_CXGBE: + dev_type = "Chelsio T4/T5"; + break; + case VNET_DPDK_PMD_VMXNET3: dev_type = "VMware VMXNET3"; break; diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index bb3ef4ffba8..82456a0661c 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -88,7 +88,8 @@ typedef enum { _ ("rte_enic_pmd", ENIC) \ _ ("rte_vmxnet3_pmd", VMXNET3) \ _ ("AF_PACKET PMD", AF_PACKET) \ - _ ("rte_pmd_fm10k", FM10K) + _ ("rte_pmd_fm10k", FM10K) \ + _ ("rte_cxgbe_pmd", CXGBE) typedef enum { VNET_DPDK_PMD_NONE, diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index a8e84949a52..f2ba79d4dba 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -317,6 +317,12 @@ dpdk_lib_init (dpdk_main_t * dm) xd->rx_q_used = 1; xd->dev_type = VNET_DPDK_DEV_ETH; + + /* workaround for drivers not setting driver_name */ + if (!dev_info.driver_name) + dev_info.driver_name = dev_info.pci_dev->driver->name; + ASSERT(dev_info.driver_name); + if (!xd->pmd) { @@ -392,6 +398,20 @@ dpdk_lib_init (dpdk_main_t * dm) } break; + case VNET_DPDK_PMD_CXGBE: + switch (dev_info.pci_dev->id.device_id) { + case 0x5410: /* T580-LP-cr */ + xd->nb_rx_desc = DPDK_NB_RX_DESC_40GE; + xd->nb_tx_desc = DPDK_NB_TX_DESC_40GE; + xd->port_type = VNET_DPDK_PORT_TYPE_ETH_40G; + break; + default: + xd->nb_rx_desc = DPDK_NB_RX_DESC_10GE; + xd->nb_tx_desc = DPDK_NB_TX_DESC_10GE; + xd->port_type = VNET_DPDK_PORT_TYPE_UNKNOWN; + } + break; + /* Intel Red Rock Canyon */ case VNET_DPDK_PMD_FM10K: xd->port_type = VNET_DPDK_PORT_TYPE_ETH_SWITCH; @@ -1685,6 +1705,10 @@ do { \ _(pmd_af_packet_drv) #endif +#ifdef RTE_LIBRTE_CXGBE_PMD + _(rte_cxgbe_driver) +#endif + #undef _ /* -- cgit 1.2.3-korg