^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2011, Microsoft Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Haiyang Zhang <haiyangz@microsoft.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Hank Janssen <hjanssen@microsoft.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * K. Y. Srinivasan <kys@microsoft.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef _HYPERV_NET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define _HYPERV_NET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/hyperv.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/rndis.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /* RSS related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203 /* query only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204 /* query and set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define NDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define NDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define NDIS_OBJECT_TYPE_OFFLOAD 0xa7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define NDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct ndis_obj_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u8 rev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u16 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* ndis_recv_scale_cap/cap_flag */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define NDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x01000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define NDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x02000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define NDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x04000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define NDIS_RSS_CAPS_USING_MSI_X 0x08000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define NDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x10000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define NDIS_RSS_CAPS_SUPPORTS_MSI_X 0x20000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x00000100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x00000200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x00000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct ndis_obj_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) u32 cap_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u32 num_int_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u32 num_recv_que;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) u16 num_indirect_tabent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* ndis_recv_scale_param flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define NDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define NDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define NDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define NDIS_RSS_PARAM_FLAG_DISABLE_RSS 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* Hash info bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define NDIS_HASH_FUNC_TOEPLITZ 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define NDIS_HASH_IPV4 0x00000100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define NDIS_HASH_TCP_IPV4 0x00000200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define NDIS_HASH_IPV6 0x00000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define NDIS_HASH_IPV6_EX 0x00000800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define NDIS_HASH_TCP_IPV6 0x00001000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define NDIS_HASH_TCP_IPV6_EX 0x00002000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define NDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define ITAB_NUM 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct ndis_obj_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* Qualifies the rest of the information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) u16 flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* The base CPU number to do receive processing. not used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) u16 base_cpu_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* This describes the hash function and type being enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) u32 hashinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* The size of indirection table array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) u16 indirect_tabsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* The offset of the indirection table from the beginning of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) u32 indirect_taboffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* The size of the hash secret key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) u16 hashkey_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /* The offset of the secret key from the beginning of this structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) u32 hashkey_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) u32 processor_masks_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) u32 num_processor_masks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u32 processor_masks_entry_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* Fwd declaration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct ndis_tcp_ip_checksum_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct ndis_pkt_8021q_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * within the RNDIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * The size of this structure is less than 48 bytes and we can now
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * place this structure in the skb->cb field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct hv_netvsc_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /* Bookkeeping stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u8 cp_partial; /* partial copy into send buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) u8 rmsg_size; /* RNDIS header and PPI size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) u8 rmsg_pgcnt; /* page count of RNDIS header and PPI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) u8 page_buf_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) u16 q_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) u16 total_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) u32 total_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) u32 send_buf_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) u32 total_data_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define NETVSC_HASH_KEYLEN 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct netvsc_device_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) unsigned char mac_adr[ETH_ALEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) u32 num_chn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) u32 send_sections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) u32 recv_sections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) u32 send_section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) u32 recv_section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct bpf_prog *bprog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) u8 rss_key[NETVSC_HASH_KEYLEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) enum rndis_device_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) RNDIS_DEV_UNINITIALIZED = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) RNDIS_DEV_INITIALIZING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) RNDIS_DEV_INITIALIZED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) RNDIS_DEV_DATAINITIALIZED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct rndis_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct net_device *ndev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) enum rndis_device_state state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) atomic_t new_req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) spinlock_t request_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct list_head req_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct work_struct mcast_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u32 filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) bool link_state; /* 0 - link up, 1 - link down */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) u8 hw_mac_adr[ETH_ALEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) u8 rss_key[NETVSC_HASH_KEYLEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* Interface */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct rndis_message;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct ndis_offload_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct netvsc_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct netvsc_channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct net_device_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) extern u32 netvsc_ring_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct netvsc_device *netvsc_device_add(struct hv_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) const struct netvsc_device_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int netvsc_alloc_recv_comp_ring(struct netvsc_device *net_device, u32 q_idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) void netvsc_device_remove(struct hv_device *device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) int netvsc_send(struct net_device *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct hv_netvsc_packet *packet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) struct rndis_message *rndis_msg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct hv_page_buffer *page_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) bool xdp_tx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) void netvsc_linkstatus_callback(struct net_device *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) struct rndis_message *resp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int netvsc_recv_callback(struct net_device *net,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) struct netvsc_device *nvdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct netvsc_channel *nvchan);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) void netvsc_channel_cb(void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) int netvsc_poll(struct napi_struct *napi, int budget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) u32 netvsc_run_xdp(struct net_device *ndev, struct netvsc_channel *nvchan,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) struct xdp_buff *xdp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) unsigned int netvsc_xdp_fraglen(unsigned int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) struct bpf_prog *netvsc_xdp_get(struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) int netvsc_xdp_set(struct net_device *dev, struct bpf_prog *prog,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct netlink_ext_ack *extack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) int netvsc_vf_setxdp(struct net_device *vf_netdev, struct bpf_prog *prog);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int netvsc_bpf(struct net_device *dev, struct netdev_bpf *bpf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int rndis_set_subchannel(struct net_device *ndev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct netvsc_device *nvdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) struct netvsc_device_info *dev_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int rndis_filter_open(struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) int rndis_filter_close(struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct netvsc_device_info *info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) void rndis_filter_update(struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) void rndis_filter_device_remove(struct hv_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) struct netvsc_device *nvdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int rndis_filter_set_rss_param(struct rndis_device *rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) const u8 *key);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int rndis_filter_set_offload_params(struct net_device *ndev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct netvsc_device *nvdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct ndis_offload_params *req_offloads);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int rndis_filter_receive(struct net_device *ndev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) struct netvsc_device *net_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct netvsc_channel *nvchan,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void *data, u32 buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int rndis_filter_set_device_mac(struct netvsc_device *ndev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) const char *mac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void netvsc_switch_datapath(struct net_device *nv_dev, bool vf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #define NVSP_INVALID_PROTOCOL_VERSION ((u32)0xFFFFFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #define NVSP_PROTOCOL_VERSION_1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #define NVSP_PROTOCOL_VERSION_2 0x30002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #define NVSP_PROTOCOL_VERSION_4 0x40000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #define NVSP_PROTOCOL_VERSION_5 0x50000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #define NVSP_PROTOCOL_VERSION_6 0x60000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #define NVSP_PROTOCOL_VERSION_61 0x60001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) NVSP_MSG_TYPE_NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* Init Messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) NVSP_MSG_TYPE_INIT = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) NVSP_MSG_TYPE_INIT_COMPLETE = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) NVSP_VERSION_MSG_START = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /* Version 1 Messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) NVSP_MSG1_TYPE_SEND_NDIS_VER = NVSP_VERSION_MSG_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) NVSP_MSG1_TYPE_SEND_RECV_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) NVSP_MSG1_TYPE_SEND_SEND_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) /* Version 2 messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) NVSP_MSG2_TYPE_REVOKE_CHIMNEY_DELEGATED_BUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) NVSP_MSG2_TYPE_RESUME_CHIMNEY_RX_INDICATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) NVSP_MSG2_TYPE_TERMINATE_CHIMNEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) NVSP_MSG2_TYPE_TERMINATE_CHIMNEY_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) NVSP_MSG2_TYPE_INDICATE_CHIMNEY_EVENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) NVSP_MSG2_TYPE_ALLOC_RXBUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) NVSP_MSG2_TYPE_ALLOC_RXBUF_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) NVSP_MSG2_TYPE_FREE_RXBUF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) NVSP_MSG2_TYPE_SEND_NDIS_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) NVSP_MSG2_MAX = NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) /* Version 4 messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) NVSP_MSG4_TYPE_SWITCH_DATA_PATH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) NVSP_MSG4_MAX = NVSP_MSG4_TYPE_UPLINK_CONNECT_STATE_DEPRECATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) /* Version 5 messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) NVSP_MSG5_TYPE_OID_QUERY_EX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) NVSP_MSG5_TYPE_OID_QUERY_EX_COMP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) NVSP_MSG5_TYPE_SUBCHANNEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) NVSP_MSG5_MAX = NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) /* Version 6 messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) NVSP_MSG6_TYPE_PD_API,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) NVSP_MSG6_TYPE_PD_POST_BATCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) NVSP_MSG6_MAX = NVSP_MSG6_TYPE_PD_POST_BATCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) NVSP_STAT_NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) NVSP_STAT_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) NVSP_STAT_FAIL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) NVSP_STAT_PROTOCOL_TOO_NEW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) NVSP_STAT_PROTOCOL_TOO_OLD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) NVSP_STAT_INVALID_RNDIS_PKT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) NVSP_STAT_BUSY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) NVSP_STAT_PROTOCOL_UNSUPPORTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) NVSP_STAT_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct nvsp_message_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) u32 msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) /* Init Messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * This message is used by the VSC to initialize the channel after the channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * has been opened. This message should never include anything other then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * versioning (i.e. this message will be the same for ever).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) struct nvsp_message_init {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) u32 min_protocol_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) u32 max_protocol_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * This message is used by the VSP to complete the initialization of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * channel. This message should never include anything other then versioning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * (i.e. this message will be the same for ever).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) struct nvsp_message_init_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) u32 negotiated_protocol_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) u32 max_mdl_chain_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) union nvsp_message_init_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) struct nvsp_message_init init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) struct nvsp_message_init_complete init_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /* Version 1 Messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * This message is used by the VSC to send the NDIS version to the VSP. The VSP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) * can use this information when handling OIDs sent by the VSC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) struct nvsp_1_message_send_ndis_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) u32 ndis_major_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) u32 ndis_minor_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * This message is used by the VSC to send a receive buffer to the VSP. The VSP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * can then use the receive buffer to send data to the VSC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) struct nvsp_1_message_send_receive_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) u32 gpadl_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) u16 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) struct nvsp_1_receive_buffer_section {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) u32 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) u32 sub_alloc_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) u32 num_sub_allocs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) u32 end_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) * This message is used by the VSP to acknowledge a receive buffer send by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) * VSC. This message must be sent by the VSP before the VSP uses the receive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) * buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) struct nvsp_1_message_send_receive_buffer_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) u32 num_sections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * The receive buffer is split into two parts, a large suballocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * section and a small suballocation section. These sections are then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) * suballocated by a certain size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) * For example, the following break up of the receive buffer has 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) * large suballocations and 10 small suballocations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * | Large Section | | Small Section |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) * ------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * | | | | | | | | | | | | | | | | | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * LargeOffset SmallOffset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) struct nvsp_1_receive_buffer_section sections[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * This message is sent by the VSC to revoke the receive buffer. After the VSP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * completes this transaction, the vsp should never use the receive buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) struct nvsp_1_message_revoke_receive_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) u16 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * This message is used by the VSC to send a send buffer to the VSP. The VSC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) * can then use the send buffer to send data to the VSP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) struct nvsp_1_message_send_send_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) u32 gpadl_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) u16 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) * This message is used by the VSP to acknowledge a send buffer sent by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) * VSC. This message must be sent by the VSP before the VSP uses the sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) * buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) struct nvsp_1_message_send_send_buffer_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) * The VSC gets to choose the size of the send buffer and the VSP gets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) * to choose the sections size of the buffer. This was done to enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) * dynamic reconfigurations when the cost of GPA-direct buffers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) * decreases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) u32 section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * This message is sent by the VSC to revoke the send buffer. After the VSP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) * completes this transaction, the vsp should never use the send buffer again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) struct nvsp_1_message_revoke_send_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) u16 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) * This message is used by both the VSP and the VSC to send a RNDIS message to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * the opposite channel endpoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) struct nvsp_1_message_send_rndis_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) * This field is specified by RNDIS. They assume there's two different
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) * channels of communication. However, the Network VSP only has one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) * Therefore, the channel travels with the RNDIS packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) u32 channel_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) * This field is used to send part or all of the data through a send
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) * buffer. This values specifies an index into the send buffer. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) * index is 0xFFFFFFFF, then the send buffer is not being used and all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) * of the data was sent through other VMBus mechanisms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) u32 send_buf_section_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) u32 send_buf_section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * This message is used by both the VSP and the VSC to complete a RNDIS message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * to the opposite channel endpoint. At this point, the initiator of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * message cannot use any resources associated with the original RNDIS packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) struct nvsp_1_message_send_rndis_packet_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) union nvsp_1_message_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) struct nvsp_1_message_send_ndis_version send_ndis_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) struct nvsp_1_message_send_receive_buffer send_recv_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) struct nvsp_1_message_send_receive_buffer_complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) send_recv_buf_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) struct nvsp_1_message_send_send_buffer send_send_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) struct nvsp_1_message_send_rndis_packet_complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) send_rndis_pkt_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) * Network VSP protocol version 2 messages:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) struct nvsp_2_vsc_capability {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) u64 data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) u64 vmq:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) u64 chimney:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) u64 sriov:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) u64 ieee8021q:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) u64 correlation_id:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) u64 teaming:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) u64 vsubnetid:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) u64 rsc:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) struct nvsp_2_send_ndis_config {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) u32 mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) struct nvsp_2_vsc_capability capability;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) /* Allocate receive buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) struct nvsp_2_alloc_rxbuf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) /* Allocation ID to match the allocation request and response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) u32 alloc_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) /* Length of the VM shared memory receive buffer that needs to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) * be allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) u32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) /* Allocate receive buffer complete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) struct nvsp_2_alloc_rxbuf_comp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) /* The NDIS_STATUS code for buffer allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) u32 alloc_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) /* GPADL handle for the allocated receive buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) u32 gpadl_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) /* Receive buffer ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) u64 recv_buf_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) struct nvsp_2_free_rxbuf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) u64 recv_buf_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) union nvsp_2_message_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) struct nvsp_2_send_ndis_config send_ndis_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) struct nvsp_2_alloc_rxbuf alloc_rxbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) struct nvsp_2_alloc_rxbuf_comp alloc_rxbuf_comp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) struct nvsp_2_free_rxbuf free_rxbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) struct nvsp_4_send_vf_association {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) /* 1: allocated, serial number is valid. 0: not allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) u32 allocated;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) /* Serial number of the VF to team with */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) u32 serial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) enum nvsp_vm_datapath {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) NVSP_DATAPATH_SYNTHETIC = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) NVSP_DATAPATH_VF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) NVSP_DATAPATH_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) struct nvsp_4_sw_datapath {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) u32 active_datapath; /* active data path in VM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) union nvsp_4_message_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) struct nvsp_4_send_vf_association vf_assoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) struct nvsp_4_sw_datapath active_dp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) enum nvsp_subchannel_operation {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) NVSP_SUBCHANNEL_NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) NVSP_SUBCHANNEL_ALLOCATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) NVSP_SUBCHANNEL_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) struct nvsp_5_subchannel_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) u32 op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) u32 num_subchannels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) struct nvsp_5_subchannel_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) u32 num_subchannels; /* Actual number of subchannels allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) struct nvsp_5_send_indirect_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) /* The number of entries in the send indirection table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) u32 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) /* The offset of the send indirection table from the beginning of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) * struct nvsp_message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) * The send indirection table tells which channel to put the send
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) * traffic on. Each entry is a channel number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) u32 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) union nvsp_5_message_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) struct nvsp_5_subchannel_request subchn_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) struct nvsp_5_subchannel_complete subchn_comp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) struct nvsp_5_send_indirect_table send_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) enum nvsp_6_pd_api_op {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) PD_API_OP_CONFIG = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) PD_API_OP_SW_DATAPATH, /* Switch Datapath */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) PD_API_OP_OPEN_PROVIDER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) PD_API_OP_CLOSE_PROVIDER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) PD_API_OP_CREATE_QUEUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) PD_API_OP_FLUSH_QUEUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) PD_API_OP_FREE_QUEUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) PD_API_OP_ALLOC_COM_BUF, /* Allocate Common Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) PD_API_OP_FREE_COM_BUF, /* Free Common Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) PD_API_OP_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) struct grp_affinity {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) u64 mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) u16 grp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) u16 reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) struct nvsp_6_pd_api_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) u32 op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) /* MMIO information is sent from the VM to VSP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) u64 mmio_pa; /* MMIO Physical Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) u32 mmio_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) /* Number of PD queues a VM can support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) u16 num_subchn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) } config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) /* Switch Datapath */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) /* Host Datapath Is PacketDirect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) u8 host_dpath_is_pd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) /* Guest PacketDirect Is Enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) u8 guest_pd_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) } sw_dpath;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) /* Open Provider*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) u32 prov_id; /* Provider id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) u32 flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) } open_prov;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) /* Close Provider */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) } cls_prov;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) /* Create Queue*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) u16 q_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) u16 q_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) u8 is_recv_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) u8 is_rss_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) u32 recv_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) struct grp_affinity affy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) } cr_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) /* Delete Queue*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) u16 q_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) } del_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) /* Flush Queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) u16 q_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) } flush_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) /* Allocate Common Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) u32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) u32 pf_node; /* Preferred Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) u16 region_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) } alloc_com_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) /* Free Common Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) u32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) u64 pa; /* Physical Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) u32 pf_node; /* Preferred Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) u16 region_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) u8 cache_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) } free_com_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) struct nvsp_6_pd_api_comp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) u32 op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) /* actual number of PD queues allocated to the VM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) u16 num_pd_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) /* Num Receive Rss PD Queues */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) u8 num_rss_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) u8 is_supported; /* Is supported by VSP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) u8 is_enabled; /* Is enabled by VSP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) } config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) /* Open Provider */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) } open_prov;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) /* Create Queue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) u32 prov_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) u16 q_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) u16 q_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) u32 recv_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) struct grp_affinity affy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) } cr_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) /* Allocate Common Buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) struct __packed {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) u64 pa; /* Physical Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) u32 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) u32 pf_node; /* Preferred Node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) u16 region_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) u8 cache_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) } alloc_com_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) struct nvsp_6_pd_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) u32 region_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) u16 region_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) u16 is_partial:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) u16 reserved:15;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) struct nvsp_6_pd_batch_msg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) struct nvsp_message_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) u16 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) u16 guest2host:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) u16 is_recv:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) u16 reserved:14;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) struct nvsp_6_pd_buf pd_buf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) union nvsp_6_message_uber {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) struct nvsp_6_pd_api_req pd_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) struct nvsp_6_pd_api_comp pd_comp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) union nvsp_all_messages {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) union nvsp_message_init_uber init_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) union nvsp_1_message_uber v1_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) union nvsp_2_message_uber v2_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) union nvsp_4_message_uber v4_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) union nvsp_5_message_uber v5_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) union nvsp_6_message_uber v6_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) /* ALL Messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) struct nvsp_message {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) struct nvsp_message_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) union nvsp_all_messages msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) #define NETVSC_MTU 65535
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) #define NETVSC_MTU_MIN ETH_MIN_MTU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) /* Max buffer sizes allowed by a host */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) #define NETVSC_RECEIVE_BUFFER_SIZE (1024 * 1024 * 31) /* 31MB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024 * 1024 * 15) /* 15MB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) #define NETVSC_RECEIVE_BUFFER_DEFAULT (1024 * 1024 * 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) #define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) #define NETVSC_SEND_BUFFER_DEFAULT (1024 * 1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) #define NETVSC_INVALID_INDEX -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) #define NETVSC_SEND_SECTION_SIZE 6144
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) #define NETVSC_RECV_SECTION_SIZE 1728
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) /* Default size of TX buf: 1MB, RX buf: 16MB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) #define NETVSC_MIN_TX_SECTIONS 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) #define NETVSC_DEFAULT_TX (NETVSC_SEND_BUFFER_DEFAULT \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) / NETVSC_SEND_SECTION_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) #define NETVSC_MIN_RX_SECTIONS 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) #define NETVSC_DEFAULT_RX (NETVSC_RECEIVE_BUFFER_DEFAULT \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) / NETVSC_RECV_SECTION_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) #define NETVSC_RECEIVE_BUFFER_ID 0xcafe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) #define NETVSC_SEND_BUFFER_ID 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) #define NETVSC_SUPPORTED_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) NETIF_F_TSO | NETIF_F_IPV6_CSUM | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) NETIF_F_TSO6 | NETIF_F_LRO | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) NETIF_F_SG | NETIF_F_RXHASH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) #define VRSS_SEND_TAB_SIZE 16 /* must be power of 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) #define VRSS_CHANNEL_MAX 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) #define VRSS_CHANNEL_DEFAULT 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) #define RNDIS_MAX_PKT_DEFAULT 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) #define RNDIS_PKT_ALIGN_DEFAULT 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) #define NETVSC_XDP_HDRM 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) #define NETVSC_XFER_HEADER_SIZE(rng_cnt) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) (offsetof(struct vmtransfer_page_packet_header, ranges) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) (rng_cnt) * sizeof(struct vmtransfer_page_range))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) struct multi_send_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) struct sk_buff *skb; /* skb containing the pkt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) struct hv_netvsc_packet *pkt; /* netvsc pkt pending */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) u32 count; /* counter of batched packets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) struct recv_comp_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) u64 tid; /* transaction id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) struct multi_recv_comp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) struct recv_comp_data *slots;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) u32 first; /* first data entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) u32 next; /* next entry for writing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) #define NVSP_RSC_MAX 562 /* Max #RSC frags in a vmbus xfer page pkt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) struct nvsc_rsc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) const struct ndis_pkt_8021q_info *vlan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) const struct ndis_tcp_ip_checksum_info *csum_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) const u32 *hash_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) u8 is_last; /* last RNDIS msg in a vmtransfer_page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) u32 cnt; /* #fragments in an RSC packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) u32 pktlen; /* Full packet length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) void *data[NVSP_RSC_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) u32 len[NVSP_RSC_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) struct netvsc_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) u64 packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) u64 bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) u64 broadcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) u64 multicast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) u64 xdp_drop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) struct u64_stats_sync syncp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) struct netvsc_ethtool_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) unsigned long tx_scattered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) unsigned long tx_no_memory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) unsigned long tx_no_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) unsigned long tx_too_big;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) unsigned long tx_busy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) unsigned long tx_send_full;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) unsigned long rx_comp_busy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) unsigned long rx_no_memory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) unsigned long stop_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) unsigned long wake_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) unsigned long vlan_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) struct netvsc_ethtool_pcpu_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) u64 rx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) u64 rx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) u64 tx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) u64 tx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) u64 vf_rx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) u64 vf_rx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) u64 vf_tx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) u64 vf_tx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) struct netvsc_vf_pcpu_stats {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) u64 rx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) u64 rx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) u64 tx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) u64 tx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) struct u64_stats_sync syncp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) u32 tx_dropped;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) struct netvsc_reconfig {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) u32 event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) /* L4 hash bits for different protocols */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) #define HV_TCP4_L4HASH 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) #define HV_TCP6_L4HASH 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) #define HV_UDP4_L4HASH 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) #define HV_UDP6_L4HASH 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) #define HV_DEFAULT_L4HASH (HV_TCP4_L4HASH | HV_TCP6_L4HASH | HV_UDP4_L4HASH | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) HV_UDP6_L4HASH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) /* The context of the netvsc device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) struct net_device_context {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) /* point back to our device context */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) struct hv_device *device_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) /* netvsc_device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) struct netvsc_device __rcu *nvdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) /* list of netvsc net_devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) /* reconfigure work */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) struct delayed_work dwork;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) /* last reconfig time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) unsigned long last_reconfig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) /* reconfig events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) struct list_head reconfig_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) /* list protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) u32 msg_enable; /* debug level */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) u32 tx_checksum_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) u32 tx_table[VRSS_SEND_TAB_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) u16 rx_table[ITAB_NUM];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) /* Ethtool settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) u8 duplex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) u32 speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) u32 l4_hash; /* L4 hash settings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) struct netvsc_ethtool_stats eth_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) /* State to manage the associated VF interface. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) struct net_device __rcu *vf_netdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) struct netvsc_vf_pcpu_stats __percpu *vf_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974) struct delayed_work vf_takeover;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) /* 1: allocated, serial number is valid. 0: not allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) u32 vf_alloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) /* Serial number of the VF to team with */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) u32 vf_serial;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) /* Is the current data path through the VF NIC? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982) bool data_path_is_vf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) /* Used to temporarily save the config info across hibernation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) struct netvsc_device_info *saved_netvsc_dev_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) /* Per channel data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) struct netvsc_channel {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) struct vmbus_channel *channel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991) struct netvsc_device *net_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) const struct vmpacket_descriptor *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) struct napi_struct napi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994) struct multi_send_data msd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) struct multi_recv_comp mrc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996) atomic_t queue_sends;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) struct nvsc_rsc rsc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) struct bpf_prog __rcu *bpf_prog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) struct xdp_rxq_info xdp_rxq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) struct netvsc_stats tx_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) struct netvsc_stats rx_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) /* Per netvsc device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) struct netvsc_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) u32 nvsp_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) wait_queue_head_t wait_drain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) bool destroy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) bool tx_disable; /* if true, do not wake up queue again */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) /* Receive buffer allocated by us but manages by NetVSP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) void *recv_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) u32 recv_buf_size; /* allocated bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) u32 recv_buf_gpadl_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) u32 recv_section_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) u32 recv_section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) u32 recv_completion_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) /* Send buffer allocated by us */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) void *send_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) u32 send_buf_gpadl_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) u32 send_section_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) u32 send_section_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) unsigned long *send_section_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) /* Used for NetVSP initialization protocol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) struct completion channel_init_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) struct nvsp_message channel_init_pkt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) struct nvsp_message revoke_packet;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) u32 max_chn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) u32 num_chn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) atomic_t open_chn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) struct work_struct subchan_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) wait_queue_head_t subchan_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) struct rndis_device *extension;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) u32 max_pkt; /* max number of pkt in one send, e.g. 8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) u32 pkt_align; /* alignment bytes, e.g. 8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) struct netvsc_channel chan_table[VRSS_CHANNEL_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) /* NdisInitialize message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) struct rndis_initialize_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) u32 major_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) u32 minor_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) u32 max_xfer_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) /* Response to NdisInitialize */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) struct rndis_initialize_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) u32 major_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) u32 minor_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) u32 dev_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) u32 medium;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) u32 max_pkt_per_msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) u32 max_xfer_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) u32 pkt_alignment_factor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) u32 af_list_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) u32 af_list_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) /* Call manager devices only: Information about an address family */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) /* supported by the device is appended to the response to NdisInitialize. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) struct rndis_co_address_family {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) u32 address_family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) u32 major_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) u32 minor_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) /* NdisHalt message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) struct rndis_halt_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) /* NdisQueryRequest message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) struct rndis_query_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) u32 oid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) u32 info_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) u32 info_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) /* Response to NdisQueryRequest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) struct rndis_query_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) u32 info_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) u32 info_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) /* NdisSetRequest message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) struct rndis_set_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) u32 oid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) u32 info_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) u32 info_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) /* Response to NdisSetRequest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) struct rndis_set_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) /* NdisReset message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) struct rndis_reset_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) /* Response to NdisReset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) struct rndis_reset_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) u32 addressing_reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) /* NdisMIndicateStatus message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) struct rndis_indicate_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) u32 status_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) u32 status_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) /* Diagnostic information passed as the status buffer in */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) /* struct rndis_indicate_status messages signifying error conditions. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) struct rndis_diagnostic_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) u32 diag_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) u32 error_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) /* NdisKeepAlive message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) struct rndis_keepalive_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) /* Response to NdisKeepAlive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) struct rndis_keepalive_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) * Data message. All Offset fields contain byte offsets from the beginning of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) * struct rndis_packet. All Length fields are in bytes. VcHandle is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) * to 0 for connectionless data, otherwise it contains the VC handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) struct rndis_packet {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) u32 data_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) u32 data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) u32 oob_data_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) u32 oob_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) u32 num_oob_data_elements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) u32 per_pkt_info_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) u32 per_pkt_info_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) u32 vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) /* Optional Out of Band data associated with a Data message. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) struct rndis_oobd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) u32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) u32 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) u32 class_info_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) /* Packet extension field contents associated with a Data message. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) struct rndis_per_packet_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) u32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) u32 type:31;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) u32 internal:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) u32 ppi_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) enum ndis_per_pkt_info_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) TCPIP_CHKSUM_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) IPSEC_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) TCP_LARGESEND_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) CLASSIFICATION_HANDLE_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) NDIS_RESERVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) SG_LIST_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) IEEE_8021Q_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) ORIGINAL_PKTINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) PACKET_CANCEL_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) NBL_HASH_VALUE = PACKET_CANCEL_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) ORIGINAL_NET_BUFLIST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) CACHED_NET_BUFLIST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) SHORT_PKT_PADINFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) MAX_PER_PKT_INFO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) enum rndis_per_pkt_info_interal_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) RNDIS_PKTINFO_ID = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) /* Add more members here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) RNDIS_PKTINFO_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) #define RNDIS_PKTINFO_SUBALLOC BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) #define RNDIS_PKTINFO_1ST_FRAG BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) #define RNDIS_PKTINFO_LAST_FRAG BIT(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) #define RNDIS_PKTINFO_ID_V1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) struct rndis_pktinfo_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) u8 ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) u8 flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) u16 pkt_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) struct ndis_pkt_8021q_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) u32 pri:3; /* User Priority */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) u32 cfi:1; /* Canonical Format ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) u32 vlanid:12; /* VLAN ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) u32 reserved:16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) struct ndis_object_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) u8 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) u8 revision;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) u16 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) #define NDIS_OBJECT_TYPE_DEFAULT 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) #define NDIS_OFFLOAD_PARAMETERS_REVISION_3 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) #define NDIS_OFFLOAD_PARAMETERS_REVISION_2 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) #define NDIS_OFFLOAD_PARAMETERS_REVISION_1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) #define NDIS_OFFLOAD_PARAMETERS_NO_CHANGE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) #define NDIS_OFFLOAD_PARAMETERS_LSOV2_DISABLED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) #define NDIS_OFFLOAD_PARAMETERS_LSOV2_ENABLED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) #define NDIS_OFFLOAD_PARAMETERS_LSOV1_ENABLED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) #define NDIS_OFFLOAD_PARAMETERS_RSC_DISABLED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) #define NDIS_OFFLOAD_PARAMETERS_RSC_ENABLED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) #define NDIS_OFFLOAD_PARAMETERS_TX_RX_DISABLED 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) #define NDIS_OFFLOAD_PARAMETERS_TX_ENABLED_RX_DISABLED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) #define NDIS_OFFLOAD_PARAMETERS_RX_ENABLED_TX_DISABLED 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) #define NDIS_OFFLOAD_PARAMETERS_TX_RX_ENABLED 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) #define NDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) #define NDIS_TCP_LARGE_SEND_OFFLOAD_IPV4 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) #define NDIS_TCP_LARGE_SEND_OFFLOAD_IPV6 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) #define VERSION_4_OFFLOAD_SIZE 22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) * New offload OIDs for NDIS 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) #define OID_TCP_OFFLOAD_CURRENT_CONFIG 0xFC01020B /* query only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) #define OID_TCP_OFFLOAD_PARAMETERS 0xFC01020C /* set only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) #define OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES 0xFC01020D/* query only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) #define OID_TCP_CONNECTION_OFFLOAD_CURRENT_CONFIG 0xFC01020E /* query only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) #define OID_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES 0xFC01020F /* query */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) #define OID_OFFLOAD_ENCAPSULATION 0x0101010A /* set/query */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) * ndis_type: NDIS_OBJTYPE_OFFLOAD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) #define NDIS_OFFLOAD_ENCAP_NONE 0x0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) #define NDIS_OFFLOAD_ENCAP_NULL 0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) #define NDIS_OFFLOAD_ENCAP_8023 0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) #define NDIS_OFFLOAD_ENCAP_8023PQ 0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) #define NDIS_OFFLOAD_ENCAP_8023PQ_OOB 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) #define NDIS_OFFLOAD_ENCAP_RFC1483 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) struct ndis_csum_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) u32 ip4_txenc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) u32 ip4_txcsum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) #define NDIS_TXCSUM_CAP_IP4OPT 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) #define NDIS_TXCSUM_CAP_TCP4OPT 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) #define NDIS_TXCSUM_CAP_TCP4 0x010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) #define NDIS_TXCSUM_CAP_UDP4 0x040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) #define NDIS_TXCSUM_CAP_IP4 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) #define NDIS_TXCSUM_ALL_TCP4 (NDIS_TXCSUM_CAP_TCP4 | NDIS_TXCSUM_CAP_TCP4OPT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) u32 ip4_rxenc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) u32 ip4_rxcsum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) #define NDIS_RXCSUM_CAP_IP4OPT 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) #define NDIS_RXCSUM_CAP_TCP4OPT 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) #define NDIS_RXCSUM_CAP_TCP4 0x010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) #define NDIS_RXCSUM_CAP_UDP4 0x040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) #define NDIS_RXCSUM_CAP_IP4 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) u32 ip6_txenc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) u32 ip6_txcsum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) #define NDIS_TXCSUM_CAP_IP6EXT 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) #define NDIS_TXCSUM_CAP_TCP6OPT 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) #define NDIS_TXCSUM_CAP_TCP6 0x010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) #define NDIS_TXCSUM_CAP_UDP6 0x040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) u32 ip6_rxenc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) u32 ip6_rxcsum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) #define NDIS_RXCSUM_CAP_IP6EXT 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) #define NDIS_RXCSUM_CAP_TCP6OPT 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) #define NDIS_RXCSUM_CAP_TCP6 0x010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) #define NDIS_RXCSUM_CAP_UDP6 0x040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) #define NDIS_TXCSUM_ALL_TCP6 (NDIS_TXCSUM_CAP_TCP6 | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) NDIS_TXCSUM_CAP_TCP6OPT | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) NDIS_TXCSUM_CAP_IP6EXT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) struct ndis_lsov1_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) u32 encap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) u32 maxsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) u32 minsegs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) u32 opts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) struct ndis_ipsecv1_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) u32 encap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) u32 ah_esp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) u32 xport_tun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) u32 ip4_opts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) u32 ip4_ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) u32 ip4_esp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) struct ndis_lsov2_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) u32 ip4_encap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) u32 ip4_maxsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) u32 ip4_minsg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) u32 ip6_encap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) u32 ip6_maxsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) u32 ip6_minsg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) u32 ip6_opts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) #define NDIS_LSOV2_CAP_IP6EXT 0x001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) #define NDIS_LSOV2_CAP_TCP6OPT 0x004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) #define NDIS_LSOV2_CAP_IP6 (NDIS_LSOV2_CAP_IP6EXT | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) NDIS_LSOV2_CAP_TCP6OPT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) struct ndis_ipsecv2_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) u32 encap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) u8 ip6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) u8 ip4opt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) u8 ip6ext;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) u8 ah;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) u8 esp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) u8 ah_esp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) u8 xport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) u8 tun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) u8 xport_tun;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) u8 lso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) u8 extseq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) u32 udp_esp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) u32 auth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) u32 crypto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) u32 sa_caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) struct ndis_rsc_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) u8 ip4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) u8 ip6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) struct ndis_encap_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) u32 maxhdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) struct ndis_offload {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) struct ndis_object_header header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) struct ndis_csum_offload csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) struct ndis_lsov1_offload lsov1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) struct ndis_ipsecv1_offload ipsecv1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) struct ndis_lsov2_offload lsov2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) /* NDIS >= 6.1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) struct ndis_ipsecv2_offload ipsecv2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) /* NDIS >= 6.30 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) struct ndis_rsc_offload rsc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) struct ndis_encap_offload encap_gre;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) #define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) #define NDIS_OFFLOAD_SIZE_6_0 offsetof(struct ndis_offload, ipsecv2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) #define NDIS_OFFLOAD_SIZE_6_1 offsetof(struct ndis_offload, rsc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) struct ndis_offload_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) struct ndis_object_header header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) u8 ip_v4_csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) u8 tcp_ip_v4_csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) u8 udp_ip_v4_csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) u8 tcp_ip_v6_csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) u8 udp_ip_v6_csum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) u8 lso_v1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) u8 ip_sec_v1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) u8 lso_v2_ipv4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) u8 lso_v2_ipv6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) u8 tcp_connection_ip_v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) u8 tcp_connection_ip_v6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) u8 ip_sec_v2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) u8 ip_sec_v2_ip_v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) u8 rsc_ip_v4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) u8 rsc_ip_v6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) u8 encapsulated_packet_task_offload;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) u8 encapsulation_types;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) struct ndis_tcp_ip_checksum_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) u32 is_ipv4:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) u32 is_ipv6:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) u32 tcp_checksum:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) u32 udp_checksum:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) u32 ip_header_checksum:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) u32 reserved:11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) u32 tcp_header_offset:10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) } transmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) u32 tcp_checksum_failed:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) u32 udp_checksum_failed:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) u32 ip_checksum_failed:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) u32 tcp_checksum_succeeded:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) u32 udp_checksum_succeeded:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) u32 ip_checksum_succeeded:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) u32 loopback:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) u32 tcp_checksum_value_invalid:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) u32 ip_checksum_value_invalid:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) } receive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) struct ndis_tcp_lso_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) u32 unused:30;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456) u32 type:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) u32 reserved2:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) } transmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460) u32 mss:20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) u32 tcp_header_offset:10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) u32 type:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) u32 reserved2:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464) } lso_v1_transmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) u32 tcp_payload:30;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467) u32 type:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) u32 reserved2:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) } lso_v1_transmit_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471) u32 mss:20;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) u32 tcp_header_offset:10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473) u32 type:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) u32 ip_version:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475) } lso_v2_transmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) u32 reserved:30;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478) u32 type:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479) u32 reserved2:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) } lso_v2_transmit_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1485) #define NDIS_VLAN_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1486) sizeof(struct ndis_pkt_8021q_info))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1488) #define NDIS_CSUM_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1489) sizeof(struct ndis_tcp_ip_checksum_info))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1491) #define NDIS_LSO_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1492) sizeof(struct ndis_tcp_lso_info))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1494) #define NDIS_HASH_PPI_SIZE (sizeof(struct rndis_per_packet_info) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1495) sizeof(u32))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1497) /* Total size of all PPI data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1498) #define NDIS_ALL_PPI_SIZE (NDIS_VLAN_PPI_SIZE + NDIS_CSUM_PPI_SIZE + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1499) NDIS_LSO_PPI_SIZE + NDIS_HASH_PPI_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1501) /* Format of Information buffer passed in a SetRequest for the OID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1502) /* OID_GEN_RNDIS_CONFIG_PARAMETER. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1503) struct rndis_config_parameter_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1504) u32 parameter_name_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1505) u32 parameter_name_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1506) u32 parameter_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1507) u32 parameter_value_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1508) u32 parameter_value_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1509) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1511) /* Values for ParameterType in struct rndis_config_parameter_info */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1512) #define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1513) #define RNDIS_CONFIG_PARAM_TYPE_STRING 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1515) /* CONDIS Miniport messages for connection oriented devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1516) /* that do not implement a call manager. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1518) /* CoNdisMiniportCreateVc message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1519) struct rcondis_mp_create_vc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1520) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1521) u32 ndis_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1522) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1524) /* Response to CoNdisMiniportCreateVc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1525) struct rcondis_mp_create_vc_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1526) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1527) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1528) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1529) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1530)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1531) /* CoNdisMiniportDeleteVc message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1532) struct rcondis_mp_delete_vc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1533) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1534) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1535) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1537) /* Response to CoNdisMiniportDeleteVc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1538) struct rcondis_mp_delete_vc_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1539) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1540) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1541) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1542)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1543) /* CoNdisMiniportQueryRequest message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1544) struct rcondis_mp_query_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1545) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1546) u32 request_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1547) u32 oid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1548) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1549) u32 info_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1550) u32 info_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1551) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1552)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1553) /* CoNdisMiniportSetRequest message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1554) struct rcondis_mp_set_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1555) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1556) u32 request_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1557) u32 oid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1558) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1559) u32 info_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1560) u32 info_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1561) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1562)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1563) /* CoNdisIndicateStatus message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1564) struct rcondis_indicate_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1565) u32 ndis_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1566) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1567) u32 status_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1568) u32 status_buf_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1569) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1571) /* CONDIS Call/VC parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1572) struct rcondis_specific_parameters {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1573) u32 parameter_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1574) u32 parameter_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1575) u32 parameter_lffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1576) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1578) struct rcondis_media_parameters {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1579) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1580) u32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1581) u32 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1582) struct rcondis_specific_parameters media_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1583) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1585) struct rndis_flowspec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1586) u32 token_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1587) u32 token_bucket_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1588) u32 peak_bandwidth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1589) u32 latency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1590) u32 delay_variation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1591) u32 service_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1592) u32 max_sdu_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1593) u32 minimum_policed_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1594) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1596) struct rcondis_call_manager_parameters {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1597) struct rndis_flowspec transmit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1598) struct rndis_flowspec receive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1599) struct rcondis_specific_parameters call_mgr_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1600) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1602) /* CoNdisMiniportActivateVc message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1603) struct rcondis_mp_activate_vc_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1604) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1605) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1606) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1607) u32 media_params_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1608) u32 media_params_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1609) u32 call_mgr_params_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1610) u32 call_mgr_params_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1611) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1613) /* Response to CoNdisMiniportActivateVc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1614) struct rcondis_mp_activate_vc_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1615) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1616) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1617) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1618)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1619) /* CoNdisMiniportDeactivateVc message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1620) struct rcondis_mp_deactivate_vc_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1621) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1622) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1623) u32 dev_vc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1624) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1625)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1626) /* Response to CoNdisMiniportDeactivateVc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1627) struct rcondis_mp_deactivate_vc_complete {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1628) u32 req_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1629) u32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1630) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1631)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1633) /* union with all of the RNDIS messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1634) union rndis_message_container {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1635) struct rndis_packet pkt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1636) struct rndis_initialize_request init_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1637) struct rndis_halt_request halt_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1638) struct rndis_query_request query_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1639) struct rndis_set_request set_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1640) struct rndis_reset_request reset_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1641) struct rndis_keepalive_request keep_alive_req;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1642) struct rndis_indicate_status indicate_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1643) struct rndis_initialize_complete init_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1644) struct rndis_query_complete query_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1645) struct rndis_set_complete set_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1646) struct rndis_reset_complete reset_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1647) struct rndis_keepalive_complete keep_alive_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1648) struct rcondis_mp_create_vc co_miniport_create_vc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1649) struct rcondis_mp_delete_vc co_miniport_delete_vc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1650) struct rcondis_indicate_status co_indicate_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1651) struct rcondis_mp_activate_vc_request co_miniport_activate_vc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1652) struct rcondis_mp_deactivate_vc_request co_miniport_deactivate_vc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1653) struct rcondis_mp_create_vc_complete co_miniport_create_vc_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1654) struct rcondis_mp_delete_vc_complete co_miniport_delete_vc_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1655) struct rcondis_mp_activate_vc_complete co_miniport_activate_vc_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1656) struct rcondis_mp_deactivate_vc_complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1657) co_miniport_deactivate_vc_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1658) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1660) /* Remote NDIS message format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1661) struct rndis_message {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1662) u32 ndis_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1663)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1664) /* Total length of this message, from the beginning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1665) /* of the struct rndis_message, in bytes. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1666) u32 msg_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1667)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1668) /* Actual message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1669) union rndis_message_container msg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1670) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1671)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1673) /* Handy macros */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1674)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1675) /* get the size of an RNDIS message. Pass in the message type, */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1676) /* struct rndis_set_request, struct rndis_packet for example */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1677) #define RNDIS_MESSAGE_SIZE(msg) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1678) (sizeof(msg) + (sizeof(struct rndis_message) - \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1679) sizeof(union rndis_message_container)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1681) #define RNDIS_HEADER_SIZE (sizeof(struct rndis_message) - \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1682) sizeof(union rndis_message_container))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1683)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1684) #define RNDIS_AND_PPI_SIZE (sizeof(struct rndis_message) + NDIS_ALL_PPI_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1686) #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1687) #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1688) #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1689) #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1690) #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1691) #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1692) #define NDIS_PACKET_TYPE_SMT 0x00000040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1693) #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1694) #define NDIS_PACKET_TYPE_GROUP 0x00000100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1695) #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1696) #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1697) #define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1698)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1699) #define TRANSPORT_INFO_NOT_IP 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1700) #define TRANSPORT_INFO_IPV4_TCP 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1701) #define TRANSPORT_INFO_IPV4_UDP 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1702) #define TRANSPORT_INFO_IPV6_TCP 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1703) #define TRANSPORT_INFO_IPV6_UDP 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1705) #endif /* _HYPERV_NET_H */