Reformat NCM class.
This commit is contained in:
@@ -25,58 +25,59 @@
|
|||||||
* This file is part of the TinyUSB stack.
|
* This file is part of the TinyUSB stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _TUSB_NCM_H_
|
#ifndef _TUSB_NCM_H_
|
||||||
#define _TUSB_NCM_H_
|
#define _TUSB_NCM_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
#include "lwipopts.h"
|
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_IN_NTB_MAX_SIZE
|
// NTB buffers size for reception side, must be >> MTU to avoid TCP retransmission (driver issue ?)
|
||||||
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE (2 * TCP_MSS + 100)
|
// Linux use 2048 as minimal size
|
||||||
#endif
|
|
||||||
#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE
|
#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE
|
||||||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (2 * TCP_MSS + 100)
|
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE 3200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// NTB buffers size for reception side, must be > MTU
|
||||||
|
// Linux use 2048 as minimal size
|
||||||
|
#ifndef CFG_TUD_NCM_IN_NTB_MAX_SIZE
|
||||||
|
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE 3200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Number of NTB buffers for reception side
|
||||||
|
// Depending on the configuration, this parameter could be increased with the cost of additional RAM requirements
|
||||||
|
// On Full-Speed (RP2040) :
|
||||||
|
// 1 - good performance
|
||||||
|
// 2 - up to 30% more performance with iperf with small packets
|
||||||
|
// >2 - no performance gain
|
||||||
|
// On High-Speed (STM32F7) :
|
||||||
|
// No performance gain
|
||||||
#ifndef CFG_TUD_NCM_OUT_NTB_N
|
#ifndef CFG_TUD_NCM_OUT_NTB_N
|
||||||
/// number of NTB buffers for reception side
|
|
||||||
/// 1 - good performance
|
|
||||||
/// 2 - up to 30% more performance with iperf with small packets
|
|
||||||
/// >2 - no performance gain
|
|
||||||
/// -> for performance optimizations this parameter could be increased with the cost of additional RAM requirements
|
|
||||||
#define CFG_TUD_NCM_OUT_NTB_N 1
|
#define CFG_TUD_NCM_OUT_NTB_N 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Number of NTB buffers for transmission side
|
||||||
|
// Depending on the configuration, this parameter could be increased with the cost of additional RAM requirements
|
||||||
|
// On Full-Speed (RP2040) :
|
||||||
|
// 1 - good performance but SystemView shows lost events (on load test)
|
||||||
|
// 2 - up to 50% more performance with iperf with small packets, "tud_network_can_xmit: request blocked"
|
||||||
|
// happens from time to time with SystemView
|
||||||
|
// 3 - "tud_network_can_xmit: request blocked" never happens
|
||||||
|
// >3 - no performance gain
|
||||||
|
// On High-Speed (STM32F7) :
|
||||||
|
// No performance gain
|
||||||
#ifndef CFG_TUD_NCM_IN_NTB_N
|
#ifndef CFG_TUD_NCM_IN_NTB_N
|
||||||
/// number of NTB buffers for transmission side
|
|
||||||
/// 1 - good performance but SystemView shows lost events (on load test)
|
|
||||||
/// 2 - up to 50% more performance with iperf with small packets, "tud_network_can_xmit: request blocked"
|
|
||||||
/// happens from time to time with SystemView
|
|
||||||
/// 3 - "tud_network_can_xmit: request blocked" never happens
|
|
||||||
/// >2 - no performance gain
|
|
||||||
/// -> for performance optimizations this parameter could be increased with the cost of additional RAM requirements
|
|
||||||
#define CFG_TUD_NCM_IN_NTB_N 1
|
#define CFG_TUD_NCM_IN_NTB_N 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// How many datagrams it is allowed to put into an NTB for transmission side
|
||||||
#ifndef CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB
|
#ifndef CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB
|
||||||
/// this is for the transmission side for allocation of \a ndp16_datagram_t
|
|
||||||
#define CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB 8
|
#define CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// This tells the host how many datagrams it is allowed to put into an NTB
|
||||||
#ifndef CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB
|
#ifndef CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB
|
||||||
/// this tells the host how many datagrams it is allowed to put into an NTB
|
|
||||||
#define CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB 6
|
#define CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_ALIGNMENT
|
|
||||||
#define CFG_TUD_NCM_ALIGNMENT 4
|
|
||||||
#endif
|
|
||||||
#if (CFG_TUD_NCM_ALIGNMENT != 4)
|
|
||||||
#error "CFG_TUD_NCM_ALIGNMENT must be 4, otherwise the headers and start of datagrams have to be aligned (which they are currently not)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Table 6.2 Class-Specific Request Codes for Network Control Model subclass
|
// Table 6.2 Class-Specific Request Codes for Network Control Model subclass
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -98,7 +99,6 @@ typedef enum
|
|||||||
NCM_SET_CRC_MODE = 0x8A,
|
NCM_SET_CRC_MODE = 0x8A,
|
||||||
} ncm_request_code_t;
|
} ncm_request_code_t;
|
||||||
|
|
||||||
|
|
||||||
#define NTH16_SIGNATURE 0x484D434E
|
#define NTH16_SIGNATURE 0x484D434E
|
||||||
#define NDP16_SIGNATURE_NCM0 0x304D434E
|
#define NDP16_SIGNATURE_NCM0 0x304D434E
|
||||||
#define NDP16_SIGNATURE_NCM1 0x314D434E
|
#define NDP16_SIGNATURE_NCM1 0x314D434E
|
||||||
@@ -160,5 +160,4 @@ struct ncm_notify_t {
|
|||||||
uint32_t downlink, uplink;
|
uint32_t downlink, uplink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user