41 static void iceDeviceSetRSSHashFunction(uint64_t *rss_hf)
43 #if RTE_VERSION < RTE_VERSION_NUM(20, 0, 0, 0)
44 *rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_FRAG_IPV6 |
45 RTE_ETH_RSS_NONFRAG_IPV6_OTHER;
47 *rss_hf = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
48 RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_OTHER;
60 static int iceDeviceSetRSSFlowIPv4(
61 int port_id,
const char *port_name,
struct rte_flow_action_rss rss_conf)
63 struct rte_flow_item pattern[] = { { 0 }, { 0 }, { 0 } };
65 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
66 pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
67 pattern[2].type = RTE_FLOW_ITEM_TYPE_END;
69 return DPDKCreateRSSFlow(port_id, port_name, rss_conf, RTE_ETH_RSS_IPV4, pattern);
81 static int iceDeviceSetRSSFlowIPv6(
82 int port_id,
const char *port_name,
struct rte_flow_action_rss rss_conf)
84 struct rte_flow_item pattern[] = { { 0 }, { 0 }, { 0 } };
86 pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
87 pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV6;
88 pattern[2].type = RTE_FLOW_ITEM_TYPE_END;
90 return DPDKCreateRSSFlow(port_id, port_name, rss_conf, RTE_ETH_RSS_IPV6, pattern);
93 int iceDeviceSetRSS(
int port_id,
int nb_rx_queues,
char *port_name)
95 uint16_t queues[RTE_MAX_QUEUES_PER_PORT];
96 struct rte_flow_error flush_error = { 0 };
97 struct rte_eth_rss_conf rss_conf = { 0 };
99 if (nb_rx_queues < 1) {
100 FatalError(
"The number of queues for RSS configuration must be "
101 "configured with a positive number");
104 struct rte_flow_action_rss rss_action_conf =
105 DPDKInitRSSAction(rss_conf, 0, queues, RTE_ETH_HASH_FUNCTION_TOEPLITZ,
false);
107 int retval = iceDeviceSetRSSFlowIPv4(port_id, port_name, rss_action_conf);
108 retval |= iceDeviceSetRSSFlowIPv6(port_id, port_name, rss_action_conf);
110 retval = rte_flow_flush(port_id, &flush_error);
112 SCLogError(
"%s: unable to flush rte_flow rules: %s Flush error msg: %s", port_name,
113 rte_strerror(-retval), flush_error.message);
121 void iceDeviceSetRSSConf(
struct rte_eth_rss_conf *rss_conf)
123 iceDeviceSetRSSHashFunction(&rss_conf->rss_hf);
124 rss_conf->rss_key_len = 52;