Skip to content

Commit 3872c8d

Browse files
hramamu1Jeff Kirsher
authored andcommitted
virtchnl: Add filter data structures
This patch adds infrastructure to send virtchnl messages to the PF to configure filters on the VF. The patch adds a struct called virtchnl_filter which contains information about the fields in the user-specified tc filter. Signed-off-by: Harshitha Ramamurthy <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 0718e56 commit 3872c8d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

include/linux/avf/virtchnl.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ enum virtchnl_ops {
138138
VIRTCHNL_OP_REQUEST_QUEUES = 29,
139139
VIRTCHNL_OP_ENABLE_CHANNELS = 30,
140140
VIRTCHNL_OP_DISABLE_CHANNELS = 31,
141+
VIRTCHNL_OP_ADD_CLOUD_FILTER = 32,
142+
VIRTCHNL_OP_DEL_CLOUD_FILTER = 33,
141143
};
142144

143145
/* These macros are used to generate compilation errors if a structure/union
@@ -525,6 +527,57 @@ struct virtchnl_tc_info {
525527

526528
VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
527529

530+
/* VIRTCHNL_ADD_CLOUD_FILTER
531+
* VIRTCHNL_DEL_CLOUD_FILTER
532+
* VF sends these messages to add or delete a cloud filter based on the
533+
* user specified match and action filters. These structures encompass
534+
* all the information that the PF needs from the VF to add/delete a
535+
* cloud filter.
536+
*/
537+
538+
struct virtchnl_l4_spec {
539+
u8 src_mac[ETH_ALEN];
540+
u8 dst_mac[ETH_ALEN];
541+
__be16 vlan_id;
542+
__be16 pad; /* reserved for future use */
543+
__be32 src_ip[4];
544+
__be32 dst_ip[4];
545+
__be16 src_port;
546+
__be16 dst_port;
547+
};
548+
549+
VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec);
550+
551+
union virtchnl_flow_spec {
552+
struct virtchnl_l4_spec tcp_spec;
553+
u8 buffer[128]; /* reserved for future use */
554+
};
555+
556+
VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec);
557+
558+
enum virtchnl_action {
559+
/* action types */
560+
VIRTCHNL_ACTION_DROP = 0,
561+
VIRTCHNL_ACTION_TC_REDIRECT,
562+
};
563+
564+
enum virtchnl_flow_type {
565+
/* flow types */
566+
VIRTCHNL_TCP_V4_FLOW = 0,
567+
VIRTCHNL_TCP_V6_FLOW,
568+
};
569+
570+
struct virtchnl_filter {
571+
union virtchnl_flow_spec data;
572+
union virtchnl_flow_spec mask;
573+
enum virtchnl_flow_type flow_type;
574+
enum virtchnl_action action;
575+
u32 action_meta;
576+
__u8 field_flags;
577+
};
578+
579+
VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter);
580+
528581
/* VIRTCHNL_OP_EVENT
529582
* PF sends this message to inform the VF driver of events that may affect it.
530583
* No direct response is expected from the VF, though it may generate other
@@ -753,6 +806,12 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
753806
break;
754807
case VIRTCHNL_OP_DISABLE_CHANNELS:
755808
break;
809+
case VIRTCHNL_OP_ADD_CLOUD_FILTER:
810+
valid_len = sizeof(struct virtchnl_filter);
811+
break;
812+
case VIRTCHNL_OP_DEL_CLOUD_FILTER:
813+
valid_len = sizeof(struct virtchnl_filter);
814+
break;
756815
/* These are always errors coming from the VF. */
757816
case VIRTCHNL_OP_EVENT:
758817
case VIRTCHNL_OP_UNKNOWN:

0 commit comments

Comments
 (0)