Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <harshitha.ramamurthy@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Harshitha Ramamurthy and committed by
Jeff Kirsher
3872c8d4 0718e560

+59
+59
include/linux/avf/virtchnl.h
··· 138 138 VIRTCHNL_OP_REQUEST_QUEUES = 29, 139 139 VIRTCHNL_OP_ENABLE_CHANNELS = 30, 140 140 VIRTCHNL_OP_DISABLE_CHANNELS = 31, 141 + VIRTCHNL_OP_ADD_CLOUD_FILTER = 32, 142 + VIRTCHNL_OP_DEL_CLOUD_FILTER = 33, 141 143 }; 142 144 143 145 /* These macros are used to generate compilation errors if a structure/union ··· 527 525 528 526 VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info); 529 527 528 + /* VIRTCHNL_ADD_CLOUD_FILTER 529 + * VIRTCHNL_DEL_CLOUD_FILTER 530 + * VF sends these messages to add or delete a cloud filter based on the 531 + * user specified match and action filters. These structures encompass 532 + * all the information that the PF needs from the VF to add/delete a 533 + * cloud filter. 534 + */ 535 + 536 + struct virtchnl_l4_spec { 537 + u8 src_mac[ETH_ALEN]; 538 + u8 dst_mac[ETH_ALEN]; 539 + __be16 vlan_id; 540 + __be16 pad; /* reserved for future use */ 541 + __be32 src_ip[4]; 542 + __be32 dst_ip[4]; 543 + __be16 src_port; 544 + __be16 dst_port; 545 + }; 546 + 547 + VIRTCHNL_CHECK_STRUCT_LEN(52, virtchnl_l4_spec); 548 + 549 + union virtchnl_flow_spec { 550 + struct virtchnl_l4_spec tcp_spec; 551 + u8 buffer[128]; /* reserved for future use */ 552 + }; 553 + 554 + VIRTCHNL_CHECK_UNION_LEN(128, virtchnl_flow_spec); 555 + 556 + enum virtchnl_action { 557 + /* action types */ 558 + VIRTCHNL_ACTION_DROP = 0, 559 + VIRTCHNL_ACTION_TC_REDIRECT, 560 + }; 561 + 562 + enum virtchnl_flow_type { 563 + /* flow types */ 564 + VIRTCHNL_TCP_V4_FLOW = 0, 565 + VIRTCHNL_TCP_V6_FLOW, 566 + }; 567 + 568 + struct virtchnl_filter { 569 + union virtchnl_flow_spec data; 570 + union virtchnl_flow_spec mask; 571 + enum virtchnl_flow_type flow_type; 572 + enum virtchnl_action action; 573 + u32 action_meta; 574 + __u8 field_flags; 575 + }; 576 + 577 + VIRTCHNL_CHECK_STRUCT_LEN(272, virtchnl_filter); 578 + 530 579 /* VIRTCHNL_OP_EVENT 531 580 * PF sends this message to inform the VF driver of events that may affect it. 532 581 * No direct response is expected from the VF, though it may generate other ··· 805 752 } 806 753 break; 807 754 case VIRTCHNL_OP_DISABLE_CHANNELS: 755 + break; 756 + case VIRTCHNL_OP_ADD_CLOUD_FILTER: 757 + valid_len = sizeof(struct virtchnl_filter); 758 + break; 759 + case VIRTCHNL_OP_DEL_CLOUD_FILTER: 760 + valid_len = sizeof(struct virtchnl_filter); 808 761 break; 809 762 /* These are always errors coming from the VF. */ 810 763 case VIRTCHNL_OP_EVENT: