1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef HDF_USB_NET_MANAGE_H 10 #define HDF_USB_NET_MANAGE_H 11 12 #include "hdf_base.h" 13 #include "hdf_device_desc.h" 14 15 16 #define MAC_ADDR_SIZE 6 17 #define IFNAMSIZ 16 18 19 /* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */ 20 #define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */ 21 #define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */ 22 #define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */ 23 24 #define HDF_FLAG_NO_SETINT 0x0010 /* device can't set_interface() */ 25 #define HDF_FLAG_ETHER 0x0020 /* maybe use "eth%d" names */ 26 27 #define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ 28 #define FLAG_WLAN 0x0080 /* use "wlan%d" names */ 29 #define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ 30 #define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ 31 #define FLAG_WWAN 0x0400 /* use "wwan%d" names */ 32 33 #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 34 #define HDF_FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ 35 36 /* 37 * Indicates to usbnet, that USB driver accumulates multiple IP packets. 38 * Affects statistic (counters) and short packet handling. 39 */ 40 #define FLAG_MULTI_PACKET 0x2000 41 #define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ 42 #define FLAG_NOARP 0x8000 /* device can't do ARP */ 43 44 enum UsbnetServiceCmd { 45 USB_NET_REGISTER_NET, 46 USB_NET_CLOSE_NET, 47 USB_NET_SEND_DATA_TO_USB, 48 USB_NET_RECIVE_DATA_FROM_USB, 49 USB_NET_OPEN_USB, 50 USB_NET_CLOSE_USB, 51 USB_NET_UPDATE_FLAGS, 52 USB_NET_UPDATE_MAXQLEN 53 }; 54 55 struct UsbnetTransInfo { 56 uint8_t isBindDevice; 57 char name[IFNAMSIZ]; /**< Network device name {@link IFNAMSIZ} */ 58 uint8_t isGetmacAddr; 59 uint8_t macAddr[MAC_ADDR_SIZE]; /**< MAC address {@link MAC_ADDR_SIZE} */ 60 uint32_t flags; /**< Network port status */ 61 uint32_t mtu; /**< Maximum transmission unit */ 62 uint16_t hardHeaderLen; /**< Header length */ 63 uint8_t link; 64 uint8_t needReset; 65 uint32_t usbFlags; /**< usb device match flags */ 66 uint32_t rxUrbSize; /* size for rx urbs */ 67 uint32_t hardMtu; /* count any extra framing */ 68 uint32_t maxpacket; 69 int txQlen; 70 }; 71 72 #endif