Lines Matching refs:fsp
11 int gve_fill_ethtool_flow_spec(struct ethtool_rx_flow_spec *fsp, in gve_fill_ethtool_flow_spec() argument
31 fsp->flow_type = flow_type_lut[be16_to_cpu(flow_rule->flow_type)]; in gve_fill_ethtool_flow_spec()
33 memset(&fsp->h_u, 0, sizeof(fsp->h_u)); in gve_fill_ethtool_flow_spec()
34 memset(&fsp->h_ext, 0, sizeof(fsp->h_ext)); in gve_fill_ethtool_flow_spec()
35 memset(&fsp->m_u, 0, sizeof(fsp->m_u)); in gve_fill_ethtool_flow_spec()
36 memset(&fsp->m_ext, 0, sizeof(fsp->m_ext)); in gve_fill_ethtool_flow_spec()
38 switch (fsp->flow_type) { in gve_fill_ethtool_flow_spec()
42 fsp->h_u.tcp_ip4_spec.ip4src = flow_rule->key.src_ip[0]; in gve_fill_ethtool_flow_spec()
43 fsp->h_u.tcp_ip4_spec.ip4dst = flow_rule->key.dst_ip[0]; in gve_fill_ethtool_flow_spec()
44 fsp->h_u.tcp_ip4_spec.psrc = flow_rule->key.src_port; in gve_fill_ethtool_flow_spec()
45 fsp->h_u.tcp_ip4_spec.pdst = flow_rule->key.dst_port; in gve_fill_ethtool_flow_spec()
46 fsp->h_u.tcp_ip4_spec.tos = flow_rule->key.tos; in gve_fill_ethtool_flow_spec()
47 fsp->m_u.tcp_ip4_spec.ip4src = flow_rule->mask.src_ip[0]; in gve_fill_ethtool_flow_spec()
48 fsp->m_u.tcp_ip4_spec.ip4dst = flow_rule->mask.dst_ip[0]; in gve_fill_ethtool_flow_spec()
49 fsp->m_u.tcp_ip4_spec.psrc = flow_rule->mask.src_port; in gve_fill_ethtool_flow_spec()
50 fsp->m_u.tcp_ip4_spec.pdst = flow_rule->mask.dst_port; in gve_fill_ethtool_flow_spec()
51 fsp->m_u.tcp_ip4_spec.tos = flow_rule->mask.tos; in gve_fill_ethtool_flow_spec()
55 fsp->h_u.ah_ip4_spec.ip4src = flow_rule->key.src_ip[0]; in gve_fill_ethtool_flow_spec()
56 fsp->h_u.ah_ip4_spec.ip4dst = flow_rule->key.dst_ip[0]; in gve_fill_ethtool_flow_spec()
57 fsp->h_u.ah_ip4_spec.spi = flow_rule->key.spi; in gve_fill_ethtool_flow_spec()
58 fsp->h_u.ah_ip4_spec.tos = flow_rule->key.tos; in gve_fill_ethtool_flow_spec()
59 fsp->m_u.ah_ip4_spec.ip4src = flow_rule->mask.src_ip[0]; in gve_fill_ethtool_flow_spec()
60 fsp->m_u.ah_ip4_spec.ip4dst = flow_rule->mask.dst_ip[0]; in gve_fill_ethtool_flow_spec()
61 fsp->m_u.ah_ip4_spec.spi = flow_rule->mask.spi; in gve_fill_ethtool_flow_spec()
62 fsp->m_u.ah_ip4_spec.tos = flow_rule->mask.tos; in gve_fill_ethtool_flow_spec()
67 memcpy(fsp->h_u.tcp_ip6_spec.ip6src, &flow_rule->key.src_ip, in gve_fill_ethtool_flow_spec()
69 memcpy(fsp->h_u.tcp_ip6_spec.ip6dst, &flow_rule->key.dst_ip, in gve_fill_ethtool_flow_spec()
71 fsp->h_u.tcp_ip6_spec.psrc = flow_rule->key.src_port; in gve_fill_ethtool_flow_spec()
72 fsp->h_u.tcp_ip6_spec.pdst = flow_rule->key.dst_port; in gve_fill_ethtool_flow_spec()
73 fsp->h_u.tcp_ip6_spec.tclass = flow_rule->key.tclass; in gve_fill_ethtool_flow_spec()
74 memcpy(fsp->m_u.tcp_ip6_spec.ip6src, &flow_rule->mask.src_ip, in gve_fill_ethtool_flow_spec()
76 memcpy(fsp->m_u.tcp_ip6_spec.ip6dst, &flow_rule->mask.dst_ip, in gve_fill_ethtool_flow_spec()
78 fsp->m_u.tcp_ip6_spec.psrc = flow_rule->mask.src_port; in gve_fill_ethtool_flow_spec()
79 fsp->m_u.tcp_ip6_spec.pdst = flow_rule->mask.dst_port; in gve_fill_ethtool_flow_spec()
80 fsp->m_u.tcp_ip6_spec.tclass = flow_rule->mask.tclass; in gve_fill_ethtool_flow_spec()
84 memcpy(fsp->h_u.ah_ip6_spec.ip6src, &flow_rule->key.src_ip, in gve_fill_ethtool_flow_spec()
86 memcpy(fsp->h_u.ah_ip6_spec.ip6dst, &flow_rule->key.dst_ip, in gve_fill_ethtool_flow_spec()
88 fsp->h_u.ah_ip6_spec.spi = flow_rule->key.spi; in gve_fill_ethtool_flow_spec()
89 fsp->h_u.ah_ip6_spec.tclass = flow_rule->key.tclass; in gve_fill_ethtool_flow_spec()
90 memcpy(fsp->m_u.ah_ip6_spec.ip6src, &flow_rule->mask.src_ip, in gve_fill_ethtool_flow_spec()
92 memcpy(fsp->m_u.ah_ip6_spec.ip6dst, &flow_rule->mask.dst_ip, in gve_fill_ethtool_flow_spec()
94 fsp->m_u.ah_ip6_spec.spi = flow_rule->mask.spi; in gve_fill_ethtool_flow_spec()
95 fsp->m_u.ah_ip6_spec.tclass = flow_rule->mask.tclass; in gve_fill_ethtool_flow_spec()
101 fsp->ring_cookie = be16_to_cpu(flow_rule->action); in gve_fill_ethtool_flow_spec()
106 static int gve_generate_flow_rule(struct gve_priv *priv, struct ethtool_rx_flow_spec *fsp, in gve_generate_flow_rule() argument
123 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in gve_generate_flow_rule()
126 if (fsp->ring_cookie >= priv->rx_cfg.num_queues) in gve_generate_flow_rule()
129 rule->action = cpu_to_be16(fsp->ring_cookie); in gve_generate_flow_rule()
131 flow_type = fsp->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT | FLOW_RSS); in gve_generate_flow_rule()
141 rule->key.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in gve_generate_flow_rule()
142 rule->key.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in gve_generate_flow_rule()
143 rule->key.src_port = fsp->h_u.tcp_ip4_spec.psrc; in gve_generate_flow_rule()
144 rule->key.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in gve_generate_flow_rule()
145 rule->mask.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in gve_generate_flow_rule()
146 rule->mask.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in gve_generate_flow_rule()
147 rule->mask.src_port = fsp->m_u.tcp_ip4_spec.psrc; in gve_generate_flow_rule()
148 rule->mask.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in gve_generate_flow_rule()
152 rule->key.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in gve_generate_flow_rule()
153 rule->key.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in gve_generate_flow_rule()
154 rule->key.spi = fsp->h_u.ah_ip4_spec.spi; in gve_generate_flow_rule()
155 rule->mask.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in gve_generate_flow_rule()
156 rule->mask.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in gve_generate_flow_rule()
157 rule->mask.spi = fsp->m_u.ah_ip4_spec.spi; in gve_generate_flow_rule()
162 memcpy(&rule->key.src_ip, fsp->h_u.tcp_ip6_spec.ip6src, in gve_generate_flow_rule()
164 memcpy(&rule->key.dst_ip, fsp->h_u.tcp_ip6_spec.ip6dst, in gve_generate_flow_rule()
166 rule->key.src_port = fsp->h_u.tcp_ip6_spec.psrc; in gve_generate_flow_rule()
167 rule->key.dst_port = fsp->h_u.tcp_ip6_spec.pdst; in gve_generate_flow_rule()
168 memcpy(&rule->mask.src_ip, fsp->m_u.tcp_ip6_spec.ip6src, in gve_generate_flow_rule()
170 memcpy(&rule->mask.dst_ip, fsp->m_u.tcp_ip6_spec.ip6dst, in gve_generate_flow_rule()
172 rule->mask.src_port = fsp->m_u.tcp_ip6_spec.psrc; in gve_generate_flow_rule()
173 rule->mask.dst_port = fsp->m_u.tcp_ip6_spec.pdst; in gve_generate_flow_rule()
177 memcpy(&rule->key.src_ip, fsp->h_u.usr_ip6_spec.ip6src, in gve_generate_flow_rule()
179 memcpy(&rule->key.dst_ip, fsp->h_u.usr_ip6_spec.ip6dst, in gve_generate_flow_rule()
181 rule->key.spi = fsp->h_u.ah_ip6_spec.spi; in gve_generate_flow_rule()
182 memcpy(&rule->mask.src_ip, fsp->m_u.usr_ip6_spec.ip6src, in gve_generate_flow_rule()
184 memcpy(&rule->mask.dst_ip, fsp->m_u.usr_ip6_spec.ip6dst, in gve_generate_flow_rule()
186 rule->key.spi = fsp->h_u.ah_ip6_spec.spi; in gve_generate_flow_rule()
199 struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; in gve_get_flow_rule_entry() local
209 fsp->location < be32_to_cpu(rules_cache[0].location) || in gve_get_flow_rule_entry()
210 fsp->location > be32_to_cpu(rules_cache[*cache_num - 1].location)) { in gve_get_flow_rule_entry()
211 err = gve_adminq_query_flow_rules(priv, GVE_FLOW_RULE_QUERY_RULES, fsp->location); in gve_get_flow_rule_entry()
219 if (fsp->location == be32_to_cpu(rules_cache[i].location)) { in gve_get_flow_rule_entry()
228 err = gve_fill_ethtool_flow_spec(fsp, rule); in gve_get_flow_rule_entry()
265 struct ethtool_rx_flow_spec *fsp = &cmd->fs; in gve_add_flow_rule() local
276 err = gve_generate_flow_rule(priv, fsp, rule); in gve_add_flow_rule()
280 err = gve_adminq_add_flow_rule(priv, rule, fsp->location); in gve_add_flow_rule()
285 dev_err(&priv->pdev->dev, "Failed to add the flow rule: %u", fsp->location); in gve_add_flow_rule()
292 struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs; in gve_del_flow_rule() local
297 return gve_adminq_del_flow_rule(priv, fsp->location); in gve_del_flow_rule()