Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * RNDIS	Definitions for Remote NDIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Authors:	Benedikt Spranger, Pengutronix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *		Robert Schwebel, Pengutronix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *		This software was originally developed in conformance with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *		Microsoft's Remote NDIS Specification License Agreement.
^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 _LINUX_RNDIS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define _LINUX_RNDIS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/rndis.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "u_ether.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include "ndis.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define RNDIS_MAXIMUM_FRAME_SIZE	1518
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define RNDIS_MAX_TOTAL_SIZE		1558
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) typedef struct rndis_init_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	__le32	MajorVersion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	__le32	MinorVersion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	__le32	MaxTransferSize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) } rndis_init_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) typedef struct rndis_init_cmplt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	__le32	MajorVersion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	__le32	MinorVersion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	__le32	DeviceFlags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	__le32	Medium;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	__le32	MaxPacketsPerTransfer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	__le32	MaxTransferSize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	__le32	PacketAlignmentFactor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	__le32	AFListOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	__le32	AFListSize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) } rndis_init_cmplt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) typedef struct rndis_halt_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) } rndis_halt_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) typedef struct rndis_query_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	__le32	OID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	__le32	InformationBufferLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	__le32	InformationBufferOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	__le32	DeviceVcHandle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) } rndis_query_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) typedef struct rndis_query_cmplt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	__le32	InformationBufferLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	__le32	InformationBufferOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) } rndis_query_cmplt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) typedef struct rndis_set_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	__le32	OID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	__le32	InformationBufferLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	__le32	InformationBufferOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	__le32	DeviceVcHandle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) } rndis_set_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) typedef struct rndis_set_cmplt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) } rndis_set_cmplt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) typedef struct rndis_reset_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	__le32	Reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) } rndis_reset_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) typedef struct rndis_reset_cmplt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	__le32	AddressingReset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) } rndis_reset_cmplt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) typedef struct rndis_indicate_status_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	__le32	StatusBufferLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	__le32	StatusBufferOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) } rndis_indicate_status_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) typedef struct rndis_keepalive_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) } rndis_keepalive_msg_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) typedef struct rndis_keepalive_cmplt_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	__le32	RequestID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	__le32	Status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) } rndis_keepalive_cmplt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct rndis_packet_msg_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	__le32	MessageType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	__le32	MessageLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	__le32	DataOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	__le32	DataLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	__le32	OOBDataOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	__le32	OOBDataLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	__le32	NumOOBDataElements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	__le32	PerPacketInfoOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	__le32	PerPacketInfoLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	__le32	VcHandle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	__le32	Reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) } __attribute__ ((packed));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct rndis_config_parameter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	__le32	ParameterNameOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	__le32	ParameterNameLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	__le32	ParameterType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	__le32	ParameterValueOffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	__le32	ParameterValueLength;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* implementation specific */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) enum rndis_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	RNDIS_UNINITIALIZED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	RNDIS_INITIALIZED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	RNDIS_DATA_INITIALIZED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) typedef struct rndis_resp_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct list_head	list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	u8			*buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	u32			length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	int			send;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) } rndis_resp_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) typedef struct rndis_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	int			confignr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u8			used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	u16			saved_filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	enum rndis_state	state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	u32			medium;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	u32			speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	u32			media_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	const u8		*host_mac;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	u16			*filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	struct net_device	*dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	u32			vendorID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	const char		*vendorDescr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	void			(*resp_avail)(void *v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	void			*v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct list_head	resp_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) } rndis_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* RNDIS Message parser and other useless functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int  rndis_msg_parser(struct rndis_params *params, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) void rndis_deregister(struct rndis_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) int  rndis_set_param_dev(struct rndis_params *params, struct net_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			 u16 *cdc_filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int  rndis_set_param_vendor(struct rndis_params *params, u32 vendorID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			    const char *vendorDescr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int  rndis_set_param_medium(struct rndis_params *params, u32 medium,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			     u32 speed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) void rndis_add_hdr(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) int rndis_rm_hdr(struct gether *port, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			struct sk_buff_head *list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) u8   *rndis_get_next_response(struct rndis_params *params, u32 *length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) void rndis_free_response(struct rndis_params *params, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) void rndis_uninit(struct rndis_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) int  rndis_signal_connect(struct rndis_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) int  rndis_signal_disconnect(struct rndis_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int  rndis_state(struct rndis_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #endif  /* _LINUX_RNDIS_H */