/* devargs */
#define IAVF_PROTO_XTR_ARG "proto_xtr"
+#define IAVF_QUANTA_SIZE_ARG "quanta_size"
+
+uint64_t iavf_timestamp_dynflag;
+int iavf_timestamp_dynfield_offset = -1;
static const char * const iavf_valid_args[] = {
IAVF_PROTO_XTR_ARG,
+ IAVF_QUANTA_SIZE_ARG,
NULL
};
return 0;
}
+__rte_unused
+static int
+iavf_vfr_inprogress(struct iavf_hw *hw)
+{
+ int inprogress = 0;
+
+ if ((IAVF_READ_REG(hw, IAVF_VFGEN_RSTAT) &
+ IAVF_VFGEN_RSTAT_VFR_STATE_MASK) ==
+ VIRTCHNL_VFR_INPROGRESS)
+ inprogress = 1;
+
+ if (inprogress)
+ PMD_DRV_LOG(INFO, "Watchdog detected VFR in progress");
+
+ return inprogress;
+}
+
+__rte_unused
+static void
+iavf_dev_watchdog(void *cb_arg)
+{
+ struct iavf_adapter *adapter = cb_arg;
+ struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
+ int vfr_inprogress = 0, rc = 0;
+
+ /* check if watchdog has been disabled since last call */
+ if (!adapter->vf.watchdog_enabled)
+ return;
+
+ /* If in reset then poll vfr_inprogress register for completion */
+ if (adapter->vf.vf_reset) {
+ vfr_inprogress = iavf_vfr_inprogress(hw);
+
+ if (!vfr_inprogress) {
+ PMD_DRV_LOG(INFO, "VF \"%s\" reset has completed",
+ adapter->vf.eth_dev->data->name);
+ adapter->vf.vf_reset = false;
+ }
+ /* If not in reset then poll vfr_inprogress register for VFLR event */
+ } else {
+ vfr_inprogress = iavf_vfr_inprogress(hw);
+
+ if (vfr_inprogress) {
+ PMD_DRV_LOG(INFO,
+ "VF \"%s\" reset event detected by watchdog",
+ adapter->vf.eth_dev->data->name);
+
+ /* enter reset state with VFLR event */
+ adapter->vf.vf_reset = true;
+
+ rte_eth_dev_callback_process(adapter->vf.eth_dev,
+ RTE_ETH_EVENT_INTR_RESET, NULL);
+ }
+ }
+
+ /* re-alarm watchdog */
+ rc = rte_eal_alarm_set(IAVF_DEV_WATCHDOG_PERIOD,
+ &iavf_dev_watchdog, cb_arg);
+
+ if (rc)
+ PMD_DRV_LOG(ERR, "Failed \"%s\" to reset device watchdog alarm",
+ adapter->vf.eth_dev->data->name);
+}
+
+static void
+iavf_dev_watchdog_enable(struct iavf_adapter *adapter __rte_unused)
+{
+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)
+ PMD_DRV_LOG(INFO, "Enabling device watchdog");
+ adapter->vf.watchdog_enabled = true;
+ if (rte_eal_alarm_set(IAVF_DEV_WATCHDOG_PERIOD,
+ &iavf_dev_watchdog, (void *)adapter))
+ PMD_DRV_LOG(ERR, "Failed to enabled device watchdog");
+#endif
+}
+
+static void
+iavf_dev_watchdog_disable(struct iavf_adapter *adapter __rte_unused)
+{
+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)
+ PMD_DRV_LOG(INFO, "Disabling device watchdog");
+ adapter->vf.watchdog_enabled = false;
+#endif
+}
+
static int
iavf_set_mc_addr_list(struct rte_eth_dev *dev,
struct rte_ether_addr *mc_addrs,
j = 0;
vf->rss_lut[i] = j;
}
- /* send virtchnnl ops to configure rss*/
+ /* send virtchnl ops to configure RSS */
ret = iavf_configure_rss_lut(adapter);
if (ret)
return ret;
struct rte_eth_dev_data *dev_data = dev->data;
uint16_t buf_size, max_pkt_len;
uint32_t frame_size = dev->data->mtu + IAVF_ETH_OVERHEAD;
+ enum iavf_status err;
buf_size = rte_pktmbuf_data_room_size(rxq->mp) - RTE_PKTMBUF_HEADROOM;
return -EINVAL;
}
+ if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
+ /* Register mbuf field and flag for Rx timestamp */
+ err = rte_mbuf_dyn_rx_timestamp_register(
+ &iavf_timestamp_dynfield_offset,
+ &iavf_timestamp_dynflag);
+ if (err) {
+ PMD_DRV_LOG(ERR,
+ "Cannot register mbuf field/flag for timestamp");
+ return -EINVAL;
+ }
+ }
+
rxq->max_pkt_len = max_pkt_len;
if ((dev_data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
rxq->max_pkt_len > buf_size) {
"vector %u are mapping to all Rx queues",
vf->msix_base);
} else {
- /* If Rx interrupt is reuquired, and we can use
+ /* If Rx interrupt is required, and we can use
* multi interrupts, then the vec is from 1
*/
vf->nb_msix =
return -1;
}
+ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
+ if (iavf_get_ptp_cap(adapter)) {
+ PMD_INIT_LOG(ERR, "Failed to get ptp capability");
+ return -1;
+ }
+ }
+
if (iavf_init_queues(dev) != 0) {
PMD_DRV_LOG(ERR, "failed to do Queue init");
return -1;
}
+ if (iavf_set_vf_quanta_size(adapter, index, num_queue_pairs) != 0)
+ PMD_DRV_LOG(WARNING, "configure quanta size failed");
+
/* If needed, send configure queues msg multiple times to make the
* adminq buffer length smaller than the 4K limitation.
*/
dev_info->reta_size = vf->vf_res->rss_lut_size;
dev_info->flow_type_rss_offloads = IAVF_RSS_OFFLOAD_ALL;
dev_info->max_mac_addrs = IAVF_NUM_MACADDR_MAX;
+ dev_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
dev_info->rx_offload_capa =
RTE_ETH_RX_OFFLOAD_VLAN_STRIP |
RTE_ETH_RX_OFFLOAD_QINQ_STRIP |
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_CRC)
dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP)
+ dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
+
if (iavf_ipsec_crypto_supported(adapter)) {
dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SECURITY;
dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_SECURITY;
}
rte_memcpy(vf->rss_lut, lut, reta_size);
- /* send virtchnnl ops to configure rss*/
+ /* send virtchnl ops to configure RSS */
ret = iavf_configure_rss_lut(adapter);
if (ret) /* revert back */
rte_memcpy(vf->rss_lut, lut, reta_size);
iavf_dev_xstats_reset(struct rte_eth_dev *dev)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
-
iavf_dev_stats_reset(dev);
- memset(&vf->vsi.eth_stats_offset, 0, sizeof(struct iavf_eth_xstats));
-
+ memset(&vf->vsi.eth_stats_offset.ips_stats, 0,
+ sizeof(struct iavf_ipsec_crypto_stats));
return 0;
}
return 0;
}
+static int
+parse_u16(__rte_unused const char *key, const char *value, void *args)
+{
+ u16 *num = (u16 *)args;
+ u16 tmp;
+
+ errno = 0;
+ tmp = strtoull(value, NULL, 10);
+ if (errno || !tmp) {
+ PMD_DRV_LOG(WARNING, "%s: \"%s\" is not a valid u16",
+ key, value);
+ return -1;
+ }
+
+ *num = tmp;
+
+ return 0;
+}
+
static int iavf_parse_devargs(struct rte_eth_dev *dev)
{
struct iavf_adapter *ad =
if (ret)
goto bail;
+ ret = rte_kvargs_process(kvlist, IAVF_QUANTA_SIZE_ARG,
+ &parse_u16, &ad->devargs.quanta_size);
+ if (ret)
+ goto bail;
+
+ if (ad->devargs.quanta_size == 0)
+ ad->devargs.quanta_size = 1024;
+
+ if (ad->devargs.quanta_size < 256 || ad->devargs.quanta_size > 4096 ||
+ ad->devargs.quanta_size & 0x40) {
+ PMD_INIT_LOG(ERR, "invalid quanta size\n");
+ return -EINVAL;
+ }
+
bail:
rte_kvargs_free(kvlist);
return ret;
}
}
+ if (vf->vsi_res->num_queue_pairs > IAVF_MAX_NUM_QUEUES_DFLT)
+ vf->lv_enabled = true;
+
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC) {
if (iavf_get_supported_rxdid(adapter) != 0) {
PMD_INIT_LOG(ERR, "failed to do get supported rxdid");
iavf_default_rss_disable(adapter);
+
+ /* Start device watchdog */
+ iavf_dev_watchdog_enable(adapter);
+
+
return 0;
flow_init_err:
if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true))
vf->vf_reset = false;
+ /* disable watchdog */
+ iavf_dev_watchdog_disable(adapter);
+
return ret;
}