summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@nvidia.com>2021-03-14 13:19:30 +0100
committerDavid S. Miller <davem@davemloft.net>2021-03-14 23:00:43 +0100
commita03e99d39f1943ec88f6fd3b0b9f34c20663d401 (patch)
tree767918907a8f75b3bc6ed6f2d6ca4159aab524fe /include/net
parentMerge branch 'skbuff-micro-optimize-flow-dissection' (diff)
downloadlinux-a03e99d39f1943ec88f6fd3b0b9f34c20663d401.tar.xz
linux-a03e99d39f1943ec88f6fd3b0b9f34c20663d401.zip
psample: Encapsulate packet metadata in a struct
Currently, callers of psample_sample_packet() pass three metadata attributes: Ingress port, egress port and truncated size. Subsequent patches are going to add more attributes (e.g., egress queue occupancy), which also need an indication whether they are valid or not. Encapsulate packet metadata in a struct in order to keep the number of arguments reasonable. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/psample.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/net/psample.h b/include/net/psample.h
index 68ae16bb0a4a..ac6dbfb3870d 100644
--- a/include/net/psample.h
+++ b/include/net/psample.h
@@ -14,6 +14,12 @@ struct psample_group {
struct rcu_head rcu;
};
+struct psample_metadata {
+ u32 trunc_size;
+ int in_ifindex;
+ int out_ifindex;
+};
+
struct psample_group *psample_group_get(struct net *net, u32 group_num);
void psample_group_take(struct psample_group *group);
void psample_group_put(struct psample_group *group);
@@ -21,15 +27,13 @@ void psample_group_put(struct psample_group *group);
#if IS_ENABLED(CONFIG_PSAMPLE)
void psample_sample_packet(struct psample_group *group, struct sk_buff *skb,
- u32 trunc_size, int in_ifindex, int out_ifindex,
- u32 sample_rate);
+ u32 sample_rate, const struct psample_metadata *md);
#else
static inline void psample_sample_packet(struct psample_group *group,
- struct sk_buff *skb, u32 trunc_size,
- int in_ifindex, int out_ifindex,
- u32 sample_rate)
+ struct sk_buff *skb, u32 sample_rate,
+ const struct psample_metadata *md)
{
}