Skip to content

Commit eb09f1f

Browse files
hramamu1Jeff Kirsher
authored andcommitted
virtchnl: Add virtchl structures to support queue channels
This patch defines new structs in support of the virtchannel message that the VF sends to the PF to create a queue channel specified by the user via tc tool. 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>
1 parent 836ce5e commit eb09f1f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

include/linux/avf/virtchnl.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ enum virtchnl_ops {
136136
VIRTCHNL_OP_ENABLE_VLAN_STRIPPING = 27,
137137
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING = 28,
138138
VIRTCHNL_OP_REQUEST_QUEUES = 29,
139+
VIRTCHNL_OP_ENABLE_CHANNELS = 30,
140+
VIRTCHNL_OP_DISABLE_CHANNELS = 31,
139141
};
140142

141143
/* This macro is used to generate a compilation error if a structure
@@ -244,6 +246,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
244246
#define VIRTCHNL_VF_OFFLOAD_ENCAP 0X00100000
245247
#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM 0X00200000
246248
#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM 0X00400000
249+
#define VIRTCHNL_VF_OFFLOAD_ADQ 0X00800000
247250

248251
#define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
249252
VIRTCHNL_VF_OFFLOAD_VLAN | \
@@ -496,6 +499,30 @@ struct virtchnl_rss_hena {
496499

497500
VIRTCHNL_CHECK_STRUCT_LEN(8, virtchnl_rss_hena);
498501

502+
/* VIRTCHNL_OP_ENABLE_CHANNELS
503+
* VIRTCHNL_OP_DISABLE_CHANNELS
504+
* VF sends these messages to enable or disable channels based on
505+
* the user specified queue count and queue offset for each traffic class.
506+
* This struct encompasses all the information that the PF needs from
507+
* VF to create a channel.
508+
*/
509+
struct virtchnl_channel_info {
510+
u16 count; /* number of queues in a channel */
511+
u16 offset; /* queues in a channel start from 'offset' */
512+
u32 pad;
513+
u64 max_tx_rate;
514+
};
515+
516+
VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_channel_info);
517+
518+
struct virtchnl_tc_info {
519+
u32 num_tc;
520+
u32 pad;
521+
struct virtchnl_channel_info list[1];
522+
};
523+
524+
VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_tc_info);
525+
499526
/* VIRTCHNL_OP_EVENT
500527
* PF sends this message to inform the VF driver of events that may affect it.
501528
* No direct response is expected from the VF, though it may generate other
@@ -711,6 +738,19 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
711738
case VIRTCHNL_OP_REQUEST_QUEUES:
712739
valid_len = sizeof(struct virtchnl_vf_res_request);
713740
break;
741+
case VIRTCHNL_OP_ENABLE_CHANNELS:
742+
valid_len = sizeof(struct virtchnl_tc_info);
743+
if (msglen >= valid_len) {
744+
struct virtchnl_tc_info *vti =
745+
(struct virtchnl_tc_info *)msg;
746+
valid_len += vti->num_tc *
747+
sizeof(struct virtchnl_channel_info);
748+
if (vti->num_tc == 0)
749+
err_msg_format = true;
750+
}
751+
break;
752+
case VIRTCHNL_OP_DISABLE_CHANNELS:
753+
break;
714754
/* These are always errors coming from the VF. */
715755
case VIRTCHNL_OP_EVENT:
716756
case VIRTCHNL_OP_UNKNOWN:

0 commit comments

Comments
 (0)