minor changes due to CR with HiFiPhile

This commit is contained in:
Hardy Griech
2024-05-05 20:33:01 +02:00
parent 327e3ec4bd
commit ea55537fb2
2 changed files with 31 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2021, Ha Thach (tinyusb.org)
* Copyright (c) 2024, Hardy Griech
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,42 +30,47 @@
#define _TUSB_NCM_H_
#include "common/tusb_common.h"
#include "lwipopts.h"
#ifndef CFG_TUD_NCM_IN_NTB_MAX_SIZE
/// must be >> MTU
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE 3200
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE (2 * TCP_MSS + 100)
#endif
#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE
/// must be >> MTU
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE 3200
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (2 * TCP_MSS + 100)
#endif
#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
#define CFG_TUD_NCM_OUT_NTB_N 2
/// 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
#endif
#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
#define CFG_TUD_NCM_IN_NTB_N 3
/// 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
#endif
#ifndef CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB
/// this is for the transmission size for allocation of \a ndp16_datagram_t
#define CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB 8
#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
#endif
#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
#endif
#ifndef CFG_TUD_NCM_ALIGNMENT
#define CFG_TUD_NCM_ALIGNMENT 4
#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)"
@@ -136,7 +142,7 @@ typedef union TU_ATTR_PACKED {
struct {
nth16_t nth;
ndp16_t ndp;
ndp16_datagram_t ndp_datagram[CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB + 1];
ndp16_datagram_t ndp_datagram[CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB + 1];
};
uint8_t data[CFG_TUD_NCM_IN_NTB_MAX_SIZE];
} xmit_ntb_t;