Up to now, a batch can contain up to NETDEV_MAX_BURST packets.
The dpif-netdev output code, and the dpcls code internally rely on this
property.
See commit 63906f18d713 ("dpcls: Use 32 packet batches for lookups.").
The only gain from using a VLA in the early stage of the input code
would be to save some memory on the stack, though the maximum is known
and used in other places.
Remove misleading code that make it look like a batch could contain
more packets.
Signed-off-by: David Marchand <[email protected]>
---
lib/dpif-netdev.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 9df05c4c28..07699df729 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -8046,15 +8046,9 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
odp_port_t in_port)
{
const size_t cnt = dp_packet_batch_size(packets_);
-#if !defined(__CHECKER__) && !defined(_WIN32)
- const size_t PKT_ARRAY_SIZE = cnt;
-#else
- /* Sparse or MSVC doesn't like variable length array. */
- enum { PKT_ARRAY_SIZE = NETDEV_MAX_BURST };
-#endif
struct dp_packet *packet;
struct dpcls *cls;
- struct dpcls_rule *rules[PKT_ARRAY_SIZE];
+ struct dpcls_rule *rules[NETDEV_MAX_BURST];
struct dp_netdev *dp = pmd->dp;
int upcall_ok_cnt = 0, upcall_fail_cnt = 0;
int lookup_cnt = 0, add_lookup_cnt;
@@ -8163,19 +8157,13 @@ dp_netdev_input__(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *packets,
bool md_is_valid, odp_port_t port_no)
{
-#if !defined(__CHECKER__) && !defined(_WIN32)
- const size_t PKT_ARRAY_SIZE = dp_packet_batch_size(packets);
-#else
- /* Sparse or MSVC doesn't like variable length array. */
- enum { PKT_ARRAY_SIZE = NETDEV_MAX_BURST };
-#endif
OVS_ALIGNED_VAR(CACHE_LINE_SIZE)
- struct netdev_flow_key keys[PKT_ARRAY_SIZE];
- struct netdev_flow_key *missed_keys[PKT_ARRAY_SIZE];
- struct packet_batch_per_flow batches[PKT_ARRAY_SIZE];
+ struct netdev_flow_key keys[NETDEV_MAX_BURST];
+ struct netdev_flow_key *missed_keys[NETDEV_MAX_BURST];
+ struct packet_batch_per_flow batches[NETDEV_MAX_BURST];
size_t n_batches;
- struct dp_packet_flow_map flow_map[PKT_ARRAY_SIZE];
- uint8_t index_map[PKT_ARRAY_SIZE];
+ struct dp_packet_flow_map flow_map[NETDEV_MAX_BURST];
+ uint8_t index_map[NETDEV_MAX_BURST];
size_t n_flows, i;
odp_port_t in_port;
--
2.53.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev