+ for (i = 0; i < rss->queue_num; i++) {
+ PMD_DRV_LOG(DEBUG, "RSS action Queue %d\n",
+ rss->queue[i]);
+
+ if (!rss->queue[i] ||
+ rss->queue[i] >= bp->rx_nr_rings ||
+ !bp->rx_queues[rss->queue[i]]) {
+ rte_flow_error_set(error,
+ EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Invalid queue ID for RSS");
+ rc = -rte_errno;
+ goto ret;
+ }
+ rxq = bp->rx_queues[rss->queue[i]];
+
+ //if (bp->vnic_info[0].fw_grp_ids[rss->queue[i]] !=
+ //INVALID_HW_RING_ID ||
+ //!rxq->rx_deferred_start) {
+ if (bp->vnic_info[0].fw_grp_ids[rss->queue[i]] !=
+ INVALID_HW_RING_ID) {
+ PMD_DRV_LOG(ERR,
+ "queue active with other VNIC\n");
+ rte_flow_error_set(error,
+ EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ act,
+ "Invalid queue ID for RSS");
+ rc = -rte_errno;
+ goto ret;
+ }
+
+ rxq->vnic = vnic;
+ rxq->rx_started = 1;
+ vnic->rx_queue_cnt++;
+ }
+
+ vnic->start_grp_id = rss->queue[0];
+ vnic->end_grp_id = rss->queue[rss->queue_num - 1];
+ vnic->func_default = 0; //This is not a default VNIC.
+
+ rc = bnxt_vnic_prep(bp, vnic);
+ if (rc)
+ goto ret;
+
+ PMD_DRV_LOG(DEBUG,
+ "vnic[%d] = %p vnic->fw_grp_ids = %p\n",
+ vnic_id, vnic, vnic->fw_grp_ids);
+
+ vnic->ff_pool_idx = vnic_id;
+ PMD_DRV_LOG(DEBUG,
+ "Setting vnic ff_pool_idx %d\n", vnic->ff_pool_idx);
+
+ /* This can be done only after vnic_grp_alloc is done. */
+ for (i = 0; i < vnic->rx_queue_cnt; i++) {
+ vnic->fw_grp_ids[i] =
+ bp->grp_info[rss->queue[i]].fw_grp_id;
+ /* Make sure vnic0 does not use these rings. */
+ bp->vnic_info[0].fw_grp_ids[rss->queue[i]] =
+ INVALID_HW_RING_ID;
+ }
+
+ for (rss_idx = 0; rss_idx < HW_HASH_INDEX_SIZE; ) {
+ for (i = 0; i < vnic->rx_queue_cnt; i++)
+ vnic->rss_table[rss_idx++] =
+ vnic->fw_grp_ids[i];
+ }
+
+ /* Configure RSS only if the queue count is > 1 */
+ if (vnic->rx_queue_cnt > 1) {
+ vnic->hash_type =
+ bnxt_rte_to_hwrm_hash_types(rss->types);
+
+ if (!rss->key_len) {
+ /* If hash key has not been specified,
+ * use random hash key.
+ */
+ prandom_bytes(vnic->rss_hash_key,
+ HW_HASH_KEY_SIZE);
+ } else {
+ if (rss->key_len > HW_HASH_KEY_SIZE)
+ memcpy(vnic->rss_hash_key,
+ rss->key,
+ HW_HASH_KEY_SIZE);
+ else
+ memcpy(vnic->rss_hash_key,
+ rss->key,
+ rss->key_len);
+ }
+ bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+ } else {
+ PMD_DRV_LOG(DEBUG, "No RSS config required\n");
+ }
+
+vnic_found:
+ filter->dst_id = vnic->fw_vnic_id;
+ filter1 = bnxt_get_l2_filter(bp, filter, vnic);
+ if (filter1 == NULL) {
+ rc = -ENOSPC;
+ goto ret;
+ }
+
+ PMD_DRV_LOG(DEBUG, "L2 filter created\n");
+ bnxt_update_filter_flags_en(filter, filter1, use_ntuple);
+ break;