aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/avf/virtchnl.h
blob: 98d6f4adf8d44772fdcc05fe7308a6638c4749b5 (plain)
1
2
3
4

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
}
# nothing
01 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
/*
 *------------------------------------------------------------------
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *------------------------------------------------------------------
 */

#ifndef _AVF_VIRTCHNL_H_
#define _AVF_VIRTCHNL_H_

#define VIRTCHNL_VERSION_MAJOR 1
#define VIRTCHNL_VERSION_MINOR 1

#define foreach_avf_promisc_flags \
  _(0, UNICAST_PROMISC, "unicast") \
  _(1, MULTICAST_PROMISC, "multicast")

enum
{
#define _(a, b, c) FLAG_VF_ ##b = (1 << a),
  foreach_avf_promisc_flags
#undef _
};

#define AVFINT_DYN_CTLN(x)  (0x00003800 + (0x4 * x))
#define AVFINT_ICR0         0x00004800
#define AVFINT_ICR0_ENA1    0x00005000
#define AVFINT_DYN_CTL0     0x00005C00
#define AVF_ARQBAH          0x00006000
#define AVF_ATQH            0x00006400
#define AVF_ATQLEN          0x00006800
#define AVF_ARQBAL          0x00006C00
#define AVF_ARQT            0x00007000
#define AVF_ARQH            0x00007400
#define AVF_ATQBAH          0x00007800
#define AVF_ATQBAL          0x00007C00
#define AVF_ARQLEN          0x00008000
#define AVF_ATQT            0x00008400
#define AVFGEN_RSTAT        0x00008800
#define AVF_QTX_TAIL(q)     (0x00000000 + (0x4 * q))
#define AVF_QRX_TAIL(q)     (0x00002000 + (0x4 * q))

#define AVF_AQ_F_DD  (1 << 0)
#define AVF_AQ_F_CMP (1 << 1)
#define AVF_AQ_F_ERR (1 << 2)
#define AVF_AQ_F_VFE (1 << 3)
#define AVF_AQ_F_LB  (1 << 9)
#define AVF_AQ_F_RD  (1 << 10)
#define AVF_AQ_F_VFC (1 << 11)
#define AVF_AQ_F_BUF (1 << 12)
#define AVF_AQ_F_SI  (1 << 13)
#define AVF_AQ_F_EI  (1 << 14)
#define AVF_AQ_F_FE  (1 << 15)

#define foreach_virtchnl_op                                                   \
  _ (0, UNKNOWN)                                                              \
  _ (1, VERSION)                                                              \
  _ (2, RESET_VF)                                                             \
  _ (3, GET_VF_RESOURCES)                                                     \
  _ (4, CONFIG_TX_QUEUE)                                                      \
  _ (5, CONFIG_RX_QUEUE)                                                      \
  _ (6, CONFIG_VSI_QUEUES)                                                    \
  _ (7, CONFIG_IRQ_MAP)                                                       \
  _ (8, ENABLE_QUEUES)                                                        \
  _ (9, DISABLE_QUEUES)                                                       \
  _ (10, ADD_ETH_ADDR)                                                        \
  _ (11, DEL_ETH_ADDR)                                                        \
  _ (12, ADD_VLAN)                                                            \
  _ (13, DEL_VLAN)                                                            \
  _ (14, CONFIG_PROMISCUOUS_MODE)                                             \
  _ (15, GET_STATS)                                                           \
  _ (16, RSVD)                                                                \
  _ (17, EVENT)                                                               \
  _ (18, UNDEF_18)                                                            \
  _ (19, UNDEF_19)                                                            \
  _ (20, IWARP)                                                               \
  _ (21, CONFIG_IWARP_IRQ_MAP)                                                \
  _ (22, RELEASE_IWARP_IRQ_MAP)                                               \
  _ (23, CONFIG_RSS_KEY)                                                      \
  _ (24, CONFIG_RSS_LUT)                                                      \
  _ (25, GET_RSS_HENA_CAPS)                                                   \
  _ (26, SET_RSS_HENA)                                                        \
  _ (27, ENABLE_VLAN_STRIPPING)                                               \
  _ (28, DISABLE_VLAN_STRIPPING)                                              \
  _ (29, REQUEST_QUEUES)                                                      \
  _ (30, ENABLE_CHANNELS)                                                     \
  _ (31, DISABLE_CHANNELS)                                                    \
  _ (32, ADD_CLOUD_FILTER)                                                    \
  _ (33, DEL_CLOUD_FILTER)                                                    \
  _ (45, ADD_RSS_CFG)                                                         \
  _ (46, DEL_RSS_CFG)                                                         \
  _ (47, ADD_FDIR_FILTER)                                                     \
  _ (48, DEL_FDIR_FILTER)                                                     \
  _ (49, QUERY_FDIR_FILTER)                                                   \
  _ (50, GET_MAX_RSS_QREGION)                                                 \
  _ (51, GET_OFFLOAD_VLAN_V2_CAPS)                                            \
  _ (52, ADD_VLAN_V2)                                                         \
  _ (53, DEL_VLAN_V2)                                                         \
  _ (54, ENABLE_VLAN_STRIPPING_V2)                                            \
  _ (55, DISABLE_VLAN_STRIPPING_V2)                                           \
  _ (56, ENABLE_VLAN_INSERTION_V2)                                            \
  _ (57, DISABLE_VLAN_INSERTION_V2)                                           \
  _ (58, ENABLE_VLAN_FILTERING_V2)                                            \
  _ (59, DISABLE_VLAN_FILTERING_V2)                                           \
  _ (107, ENABLE_QUEUES_V2)                                                   \
  _ (108, DISABLE_QUEUES_V2)                                                  \
  _ (111, MAP_QUEUE_VECTOR)

typedef enum
{
#define _(v,n) VIRTCHNL_OP_##n = v,
  foreach_virtchnl_op
#undef _
    VIRTCHNL_N_OPS,
} virtchnl_ops_t;

typedef enum
{
  VIRTCHNL_STATUS_SUCCESS = 0,
  VIRTCHNL_STATUS_ERR_PARAM = -5,
  VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
  VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
  VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
  VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
  VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
  VIRTCHNL_STATUS_NOT_SUPPORTED = -64,
} virtchnl_status_code_t;

#define foreach_avf_vf_cap_flag                                               \
  _ (0, OFFLOAD_L2, "l2")                                                     \
  _ (1, OFFLOAD_IWARP, "iwarp")                                               \
  _ (2, OFFLOAD_RSVD, "rsvd")                                                 \
  _ (3, OFFLOAD_RSS_AQ, "rss-aq")                                             \
  _ (4, OFFLOAD_RSS_REG, "rss-reg")                                           \
  _ (5, OFFLOAD_WB_ON_ITR, "wb-on-itr")                                       \
  _ (6, OFFLOAD_REQ_QUEUES, "req-queues")                                     \
  _ (7, CAP_ADV_LINK_SPEED, "adv-link-speed")                                 \
  _ (9, LARGE_NUM_QPAIRS, "large-num-qpairs")                                 \
  _ (15, OFFLOAD_VLAN_V2, "vlan-v2")                                          \
  _ (16, OFFLOAD_VLAN, "vlan")                                                \
  _ (17, OFFLOAD_RX_POLLING, "rx-polling")                                    \
  _ (18, OFFLOAD_RSS_PCTYPE_V2, "rss-pctype-v2")                              \
  _ (19, OFFLOAD_RSS_PF, "rss-pf")                                            \
  _ (20, OFFLOAD_ENCAP, "encap")                                              \
  _ (21, OFFLOAD_ENCAP_CSUM, "encap-csum")                                    \
  _ (22, OFFLOAD_RX_ENCAP_CSUM, "rx-encap-csum")                              \
  _ (23, OFFLOAD_ADQ, "offload-adq")                                          \
  _ (24, OFFLOAD_ADQ_v2, "offload-adq-v2")                                    \
  _ (25, OFFLOAD_USO, "offload-uso")                                          \
  _ (26, OFFLOAD_RX_FLEX_DESC, "offload-rx-flex-desc")                        \
  _ (27, OFFLOAD_ADV_RSS_PF, "offload-adv-rss-pf")                            \
  _ (28, OFFLOAD_FDIR_PF, "offload-fdir-pf")                                  \
  _ (30, CAP_DCF, "dcf")

typedef enum
{
#define _(a, b, c) VIRTCHNL_VF_##b = (1 << a),
  foreach_avf_vf_cap_flag
#undef _
} avf_vf_cap_flag_t;

typedef enum
{
  VIRTCHNL_VSI_TYPE_INVALID = 0,
  VIRTCHNL_VSI_SRIOV = 6,
} virtchnl_vsi_type_t;

typedef enum
{
  VIRTCHNL_VFR_INPROGRESS = 0,
  VIRTCHNL_VFR_COMPLETED,
  VIRTCHNL_VFR_VFACTIVE,
} virtchnl_vfr_states_t;

typedef struct
{
  u16 vsi_id;
  u16 num_queue_pairs;
  virtchnl_vsi_type_t vsi_type;
  u16 qset_handle;
  u8 default_mac_addr[6];
} virtchnl_vsi_resource_t;

typedef struct
{
  u16 num_vsis;
  u16 num_queue_pairs;
  u16 max_vectors;
  u16 max_mtu;
  u32 vf_cap_flags;
  u32 rss_key_size;
  u32 rss_lut_size;
  virtchnl_vsi_resource_t vsi_res[1];
} virtchnl_vf_resource_t;

#define foreach_virtchnl_event_code \
  _(0, UNKNOWN)				\
  _(1, LINK_CHANGE)			\
  _(2, RESET_IMPENDING)			\
  _(3, PF_DRIVER_CLOSE)

typedef enum
{
#define _(a,b) VIRTCHNL_EVENT_##b = (a),
  foreach_virtchnl_event_code
#undef _
} virtchnl_event_codes_t;

#define foreach_virtchnl_link_speed \
  _(0, 2_5GB, "2.5 Gbps")		\
  _(1, 100MB, "100 Mbps")		\
  _(2, 1GB, "1 Gbps")			\
  _(3, 10GB, "10 Gbps")			\
  _(4, 40GB, "40 Gbps")			\
  _(5, 20GB, "20 Gbps")			\
  _(6, 25GB, "25 Gbps")			\
  _(7, 5GB, "5 Gbps")

typedef enum
{
  VIRTCHNL_LINK_SPEED_UNKNOWN = 0,
#define _(a,b,c) VIRTCHNL_LINK_SPEED_##b = (1 << a),
  foreach_virtchnl_link_speed
#undef _
} virtchnl_link_speed_t;

typedef struct
{
  virtchnl_event_codes_t event;
  union
  {
    struct
    {
      virtchnl_link_speed_t link_speed;
      u8 link_status;
    } link_event;
    struct
    {
      u32 link_speed;
      u8 link_status;
    } link_event_adv;
  } event_data;
  int severity;
} virtchnl_pf_event_t;

STATIC_ASSERT_SIZEOF (virtchnl_pf_event_t, 16);

typedef struct
{
  u32 major;
  u32 minor;
} virtchnl_version_info_t;

typedef struct
{
  u16 flags;
  u16 opcode;
  u16 datalen;
  u16 retval;
  union
  {
    u32 cookie_hi;
    virtchnl_ops_t v_opcode;
  };
  union
  {
    u32 cookie_lo;
    virtchnl_status_code_t v_retval;
  };
  u32 param0;
  u32 param1;
  union
  {
    u32 param2;
    u32 addr_hi;
  };
  union
  {
    u32 param3;
    u32 addr_lo;
  };
} avf_aq_desc_t;

STATIC_ASSERT_SIZEOF (avf_aq_desc_t, 32);

typedef struct
{
  u16 vsi_id;
  u16 queue_id;
  u16 ring_len;
  u64 dma_ring_addr;
  u64 dma_headwb_addr;
} virtchnl_txq_info_t;

STATIC_ASSERT_SIZEOF (virtchnl_txq_info_t, 24);

typedef struct
{
  u16 vsi_id;
  u16 queue_id;
  u32 ring_len;
  u16 hdr_size;
  u16 splithdr_enabled;
  u32 databuffer_size;
  u32 max_pkt_size;
  u32 pad1;
  u64 dma_ring_addr;
  int rx_split_pos;
  u32 pad2;
} virtchnl_rxq_info_t;

STATIC_ASSERT_SIZEOF (virtchnl_rxq_info_t, 40);

typedef struct
{
  virtchnl_txq_info_t txq;
  virtchnl_rxq_info_t rxq;
} virtchnl_queue_pair_info_t;

typedef struct
{
  u16 vsi_id;
  u16 num_queue_pairs;
  u32 pad;
  virtchnl_queue_pair_info_t qpair[1];
} virtchnl_vsi_queue_config_info_t;

STATIC_ASSERT_SIZEOF (virtchnl_vsi_queue_config_info_t, 72);

typedef struct
{
  u16 vsi_id;
  u16 pad;
  u32 rx_queues;
  u32 tx_queues;
} virtchnl_queue_select_t;

STATIC_ASSERT_SIZEOF (virtchnl_queue_select_t, 12);

typedef struct
{
  u16 vsi_id;
  u16 vector_id;
  u16 rxq_map;
  u16 txq_map;
  u16 rxitr_idx;
  u16 txitr_idx;
} virtchnl_vector_map_t;

typedef struct
{
  u16 num_vectors;
  virtchnl_vector_map_t vecmap[1];
} virtchnl_irq_map_info_t;

STATIC_ASSERT_SIZEOF (virtchnl_irq_map_info_t, 14);

typedef struct
{
  u8 addr[6];
  u8 pad[2];
} virtchnl_ether_addr_t;

typedef struct
{
  u16 vsi_id;
  u16 num_elements;
  virtchnl_ether_addr_t list[1];
} virtchnl_ether_addr_list_t;

#define foreach_virtchnl_eth_stats \
  _(rx_bytes)		\
  _(rx_unicast)		\
  _(rx_multicast)	\
  _(rx_broadcast)	\
  _(rx_discards)	\
  _(rx_unknown_protocol)\
  _(tx_bytes)		\
  _(tx_unicast)		\
  _(tx_multicast)	\
  _(tx_broadcast)	\
  _(tx_discards)	\
  _(tx_errors)

typedef struct
{
#define _(s) u64 s;
  foreach_virtchnl_eth_stats
#undef _
} virtchnl_eth_stats_t;

typedef struct
{
  u16 vsi_id;
  u16 key_len;
  u8 key[1];
} virtchnl_rss_key_t;

STATIC_ASSERT_SIZEOF (virtchnl_rss_key_t, 6);

typedef struct
{
  u16 vsi_id;
  u16 lut_entries;
  u8 lut[1];
} virtchnl_rss_lut_t;

STATIC_ASSERT_SIZEOF (virtchnl_rss_lut_t, 6);

/* VIRTCHNL_OP_REQUEST_QUEUES */
typedef struct
{
  u16 num_queue_pairs;
} virtchnl_vf_res_request_t;

typedef struct
{
  u32 outer;
  u32 inner;
} virtchnl_vlan_supported_caps_t;

typedef struct
{
  virtchnl_vlan_supported_caps_t filtering_support;
  u32 ethertype_init;
  u16 max_filters;
  u8 pad[2];
} virtchnl_vlan_filtering_caps_t;

typedef struct virtchnl_vlan_offload_caps
{
  virtchnl_vlan_supported_caps_t stripping_support;
  virtchnl_vlan_supported_caps_t insertion_support;
  u32 ethertype_init;
  u8 ethertype_match;
  u8 pad[3];
} virtchnl_vlan_offload_caps_t;

typedef struct
{
  virtchnl_vlan_filtering_caps_t filtering;
  virtchnl_vlan_offload_caps_t offloads;
} virtchnl_vlan_caps_t;

#define foreach_virtchnl_vlan_support_bit                                     \
  _ (0, ETHERTYPE_8100, "dot1Q")                                              \
  _ (1, ETHERTYPE_88A8, "dot1AD")                                             \
  _ (2, ETHERTYPE_9100, "QinQ")                                               \
  _ (8, TAG_LOCATION_L2TAG1, "l2tag1")                                        \
  _ (9, TAG_LOCATION_L2TAG2, "l2tag2")                                        \
  _ (10, TAG_LOCATION_L2TAG2_2, "l2tag2_2")                                   \
  _ (24, PRIO, "prio")                                                        \
  _ (28, FILTER_MASK, "filter-mask")                                          \
  _ (29, ETHERTYPE_AND, "etype-and")                                          \
  _ (30, ETHERTYPE_XOR, "etype-xor")                                          \
  _ (31, TOGGLE, "toggle")

typedef enum
{
  VIRTCHNL_VLAN_UNSUPPORTED = 0,
#define _(a, b, c) VIRTCHNL_VLAN_##b = (1 << a),
  foreach_virtchnl_vlan_support_bit
#undef _
} virtchnl_vlan_support_t;

typedef struct
{
  u32 outer_ethertype_setting;
  u32 inner_ethertype_setting;
  u16 vport_id;
  u8 pad[6];
} virtchnl_vlan_setting_t;

#endif /* AVF_VIRTCHNL_H */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */