From: Wenjun Wu Date: Fri, 22 Apr 2022 01:43:00 +0000 (+0800) Subject: net/iavf: support quanta size configuration X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b14e8a57b9fe;hp=5779a8894d154bf0b6b1c13ce5ce5961e1dfc29d;p=dpdk.git net/iavf: support quanta size configuration This patch adds quanta size configuration support. Quanta size should between 256 and 4096, and be a product of 64. Signed-off-by: Wenjun Wu Acked-by: Qi Zhang --- diff --git a/doc/guides/nics/intel_vf.rst b/doc/guides/nics/intel_vf.rst index 648af39c22..6498135655 100644 --- a/doc/guides/nics/intel_vf.rst +++ b/doc/guides/nics/intel_vf.rst @@ -92,6 +92,10 @@ For more detail on SR-IOV, please refer to the following documents: available for IAVF PMD. The same devargs with the same parameters can be applied to IAVF PMD, for detail please reference the section ``Protocol extraction for per queue`` of ice.rst. + Quanta size configuration is also supported when IAVF is backed by an Intel® E810 device by setting ``devargs`` + parameter ``quanta_size`` like ``-a 18:00.0,quanta_size=2048``. The default value is 1024, and quanta size should be + set as the product of 64 in legacy host interface mode. + The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index dd2c69bdcb..90123bb807 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -58,6 +58,7 @@ New Features * **Updated Intel iavf driver.** * Added Tx QoS queue rate limitation support. + * Added quanta size configuration support. Removed Items diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index b948b0f5fb..249ae6ed23 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -165,6 +165,7 @@ enum virtchnl_ops { VIRTCHNL_OP_DISABLE_QUEUES_V2 = 108, VIRTCHNL_OP_MAP_QUEUE_VECTOR = 111, VIRTCHNL_OP_CONFIG_QUEUE_BW = 112, + VIRTCHNL_OP_CONFIG_QUANTA = 113, VIRTCHNL_OP_MAX, }; @@ -1996,6 +1997,12 @@ struct virtchnl_queue_vector_maps { VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_queue_vector_maps); +struct virtchnl_quanta_cfg { + u16 quanta_size; + struct virtchnl_queue_chunk queue_select; +}; + +VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_quanta_cfg); /* Since VF messages are limited by u16 size, precalculate the maximum possible * values of nested elements in virtchnl structures that virtual channel can @@ -2275,6 +2282,18 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, sizeof(q_bw->cfg[0]); } break; + case VIRTCHNL_OP_CONFIG_QUANTA: + valid_len = sizeof(struct virtchnl_quanta_cfg); + if (msglen >= valid_len) { + struct virtchnl_quanta_cfg *q_quanta = + (struct virtchnl_quanta_cfg *)msg; + if (q_quanta->quanta_size == 0 || + q_quanta->queue_select.num_queues == 0) { + err_msg_format = true; + break; + } + } + break; case VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS: break; case VIRTCHNL_OP_ADD_VLAN_V2: diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 96515a3ee9..c0a4a47b04 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -292,6 +292,7 @@ enum iavf_proto_xtr_type { struct iavf_devargs { uint8_t proto_xtr_dflt; uint8_t proto_xtr[IAVF_MAX_QUEUE_NUM]; + uint16_t quanta_size; }; struct iavf_security_ctx; @@ -467,6 +468,8 @@ int iavf_set_q_bw(struct rte_eth_dev *dev, int iavf_set_q_tc_map(struct rte_eth_dev *dev, struct virtchnl_queue_tc_mapping *q_tc_mapping, uint16_t size); +int iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, + u16 num_queues); void iavf_tm_conf_init(struct rte_eth_dev *dev); void iavf_tm_conf_uninit(struct rte_eth_dev *dev); int iavf_ipsec_crypto_request(struct iavf_adapter *adapter, diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d6190ac24a..7d093bdc24 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -34,9 +34,11 @@ /* devargs */ #define IAVF_PROTO_XTR_ARG "proto_xtr" +#define IAVF_QUANTA_SIZE_ARG "quanta_size" static const char * const iavf_valid_args[] = { IAVF_PROTO_XTR_ARG, + IAVF_QUANTA_SIZE_ARG, NULL }; @@ -950,6 +952,9 @@ iavf_dev_start(struct rte_eth_dev *dev) 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. */ @@ -2092,6 +2097,25 @@ iavf_handle_proto_xtr_arg(__rte_unused const char *key, const char *value, 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 = @@ -2118,6 +2142,20 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev) 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; diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 537369f736..f9452d14ae 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -1828,3 +1828,34 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter, return 0; } + +int +iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 num_queues) +{ + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); + struct iavf_cmd_info args; + struct virtchnl_quanta_cfg q_quanta; + int err; + + if (adapter->devargs.quanta_size == 0) + return 0; + + q_quanta.quanta_size = adapter->devargs.quanta_size; + q_quanta.queue_select.type = VIRTCHNL_QUEUE_TYPE_TX; + q_quanta.queue_select.start_queue_id = start_queue_id; + q_quanta.queue_select.num_queues = num_queues; + + args.ops = VIRTCHNL_OP_CONFIG_QUANTA; + args.in_args = (uint8_t *)&q_quanta; + args.in_args_size = sizeof(q_quanta); + args.out_buffer = vf->aq_resp; + args.out_size = IAVF_AQ_BUF_SZ; + + err = iavf_execute_vf_cmd(adapter, &args, 0); + if (err) { + PMD_DRV_LOG(ERR, "Failed to execute command VIRTCHNL_OP_CONFIG_QUANTA"); + return err; + } + + return 0; +}