#define LINK_STATE_ELOGS 0
-#define DEFAULT_HUGE_DIR "/run/vpp/hugepages"
-#define VPP_RUN_DIR "/run/vpp"
+#define DEFAULT_HUGE_DIR (VPP_RUN_DIR "/hugepages")
/* Port configuration, mildly modified Intel app values */
if (dev_info->speed_capa & ETH_LINK_SPEED_100G)
return VNET_DPDK_PORT_TYPE_ETH_100G;
+ else if (dev_info->speed_capa & ETH_LINK_SPEED_50G)
+ return VNET_DPDK_PORT_TYPE_ETH_50G;
else if (dev_info->speed_capa & ETH_LINK_SPEED_40G)
return VNET_DPDK_PORT_TYPE_ETH_40G;
else if (dev_info->speed_capa & ETH_LINK_SPEED_25G)
rte_eth_dev_set_mtu (xd->device_index, hi->max_packet_bytes);
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
- {
- clib_error_t *error;
- error = dpdk_device_start (xd);
- clib_error_report (error);
- }
+ dpdk_device_start (xd);
}
return old;
u8 vlan_strip = 0;
int j;
struct rte_eth_dev_info dev_info;
- clib_error_t *rv;
struct rte_eth_link l;
dpdk_device_config_t *devconf = 0;
vlib_pci_addr_t pci_addr;
case VNET_DPDK_PMD_IGBVF:
case VNET_DPDK_PMD_IXGBEVF:
case VNET_DPDK_PMD_I40EVF:
+ xd->port_type = VNET_DPDK_PORT_TYPE_ETH_VF;
+ xd->port_conf.rxmode.hw_strip_crc = 1;
+ break;
+
case VNET_DPDK_PMD_THUNDERX:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_VF;
break;
/* Intel Red Rock Canyon */
case VNET_DPDK_PMD_FM10K:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_SWITCH;
+ xd->port_conf.rxmode.hw_strip_crc = 1;
break;
/* virtio */
xd->port_id = bond_ether_port_id++;
break;
+ case VNET_DPDK_PMD_VIRTIO_USER:
+ xd->port_type = VNET_DPDK_PORT_TYPE_VIRTIO_USER;
+ break;
+
default:
xd->port_type = VNET_DPDK_PORT_TYPE_UNKNOWN;
}
hi = vnet_get_hw_interface (dm->vnet_main, xd->hw_if_index);
- rv = dpdk_device_setup (xd);
+ dpdk_device_setup (xd);
- if (rv)
- return rv;
+ if (vec_len (xd->errors))
+ clib_warning ("setup failed for device %U. Errors:\n %U",
+ format_dpdk_device_name, i,
+ format_dpdk_device_errors, xd);
if (devconf->hqos_enabled)
{
+ clib_error_t *rv;
rv = dpdk_port_setup_hqos (xd, &devconf->hqos);
if (rv)
return rv;
dpdk_device_config_t *devconf;
vlib_pci_addr_t pci_addr;
unformat_input_t sub_input;
+ uword x;
u8 *s, *tmp = 0;
u8 *rte_cmd = 0, *ethname = 0;
u32 log_level;
u8 *socket_mem = 0;
conf->device_config_index_by_pci_addr = hash_create (0, sizeof (uword));
+ log_level = RTE_LOG_NOTICE;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
else if (unformat (input, "decimal-interface-names"))
conf->interface_name_format_decimal = 1;
+ else if (unformat (input, "log-level %U", unformat_dpdk_log_level, &x))
+ log_level = x;
+
else if (unformat (input, "no-multi-seg"))
conf->no_multi_seg = 1;
vec_free (mem_by_socket);
- rv = mkdir (VPP_RUN_DIR, 0755);
- if (rv && errno != EEXIST)
- {
- error = clib_error_return (0, "mkdir '%s' failed errno %d",
- VPP_RUN_DIR, errno);
- goto done;
- }
+ /* Make sure VPP_RUN_DIR exists */
+ error = unix_make_vpp_run_dir ();
+ if (error)
+ goto done;
rv = mkdir (DEFAULT_HUGE_DIR, 0755);
if (rv && errno != EEXIST)
/* Set up DPDK eal and packet mbuf pool early. */
- log_level = (CLIB_DEBUG > 0) ? RTE_LOG_DEBUG : RTE_LOG_NOTICE;
-
#if RTE_VERSION >= RTE_VERSION_NUM(17, 5, 0, 0)
rte_log_set_global_level (log_level);
#else
/*
* Extra set up for bond interfaces:
* 1. Setup MACs for bond interfaces and their slave links which was set
- * in dpdk_device_setup() but needs to be done again here to take effect.
- * 2. Set up info for bond interface related CLI support.
+ * in dpdk_device_setup() but needs to be done again here to take
+ * effect.
+ * 2. Set up info and register slave link state change callback handling.
+ * 3. Set up info for bond interface related CLI support.
*/
int nports = rte_eth_dev_count ();
if (nports > 0)
(slink[0], (struct ether_addr *) addr);
/* Set MAC of bounded interface to that of 1st slave link */
- clib_warning ("Set MAC for bond dev# %d", i);
+ clib_warning ("Set MAC for bond port %d BondEthernet%d",
+ i, xd->port_id);
rv = rte_eth_bond_mac_address_set
(i, (struct ether_addr *) addr);
if (rv)
/* Add MAC to all slave links except the first one */
if (nlink)
{
- clib_warning ("Add MAC for slave dev# %d", slave);
+ clib_warning ("Add MAC for slave port %d", slave);
rv = rte_eth_dev_mac_addr_add
(slave, (struct ether_addr *) addr, 0);
if (rv)
clib_warning ("Add MAC addr failure rv=%d", rv);
}
+ /* Setup slave link state change callback handling */
+ rte_eth_dev_callback_register
+ (slave, RTE_ETH_EVENT_INTR_LSC,
+ dpdk_port_state_callback, NULL);
+ dpdk_device_t *sxd = &dm->devices[slave];
+ sxd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE;
+ sxd->bond_port = i;
/* Set slaves bitmap for bonded interface */
bhi->bond_info = clib_bitmap_set
(bhi->bond_info, sdev->hw_if_index, 1);
- /* Set slave link flags on slave interface */
+ /* Set MACs and slave link flags on slave interface */
shi = vnet_get_hw_interface (vnm, sdev->hw_if_index);
ssi = vnet_get_sw_interface
(vnm, sdev->vlib_sw_if_index);
sei = pool_elt_at_index
(em->interfaces, shi->hw_instance);
-
shi->bond_info = VNET_HW_INTERFACE_BOND_INFO_SLAVE;
ssi->flags |= VNET_SW_INTERFACE_FLAG_BOND_SLAVE;
clib_memcpy (shi->hw_address, addr, 6);
clib_memcpy (sei->address, addr, 6);
-
/* Set l3 packet size allowed as the lowest of slave */
if (bhi->max_l3_packet_bytes[VLIB_RX] >
shi->max_l3_packet_bytes[VLIB_RX])
bhi->max_l3_packet_bytes[VLIB_RX] =
bhi->max_l3_packet_bytes[VLIB_TX] =
shi->max_l3_packet_bytes[VLIB_RX];
-
/* Set max packet size allowed as the lowest of slave */
if (bhi->max_packet_bytes > shi->max_packet_bytes)
bhi->max_packet_bytes = shi->max_packet_bytes;