mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
minor changes due to CR with HiFiPhile
This commit is contained in:
parent
327e3ec4bd
commit
ea55537fb2
@ -2,6 +2,7 @@
|
|||||||
* The MIT License (MIT)
|
* The MIT License (MIT)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021, Ha Thach (tinyusb.org)
|
* 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
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -29,42 +30,47 @@
|
|||||||
#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
|
#ifndef CFG_TUD_NCM_IN_NTB_MAX_SIZE
|
||||||
/// must be >> MTU
|
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE (2 * TCP_MSS + 100)
|
||||||
#define CFG_TUD_NCM_IN_NTB_MAX_SIZE 3200
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE
|
#ifndef CFG_TUD_NCM_OUT_NTB_MAX_SIZE
|
||||||
/// must be >> MTU
|
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE (2 * TCP_MSS + 100)
|
||||||
#define CFG_TUD_NCM_OUT_NTB_MAX_SIZE 3200
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_OUT_NTB_N
|
#ifndef CFG_TUD_NCM_OUT_NTB_N
|
||||||
/// number of ntb buffers for reception side
|
/// number of NTB buffers for reception side
|
||||||
/// 1 - good performance
|
/// 1 - good performance
|
||||||
/// 2 - up to 30% more performance with iperf with small packets
|
/// 2 - up to 30% more performance with iperf with small packets
|
||||||
/// >2 - no performance gain
|
/// >2 - no performance gain
|
||||||
#define CFG_TUD_NCM_OUT_NTB_N 2
|
/// -> for performance optimizations this parameter could be increased with the cost of additional RAM requirements
|
||||||
|
#define CFG_TUD_NCM_OUT_NTB_N 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_IN_NTB_N
|
#ifndef CFG_TUD_NCM_IN_NTB_N
|
||||||
/// number of ntb buffers for transmission side
|
/// number of NTB buffers for transmission side
|
||||||
/// 1 - good performance but SystemView shows lost events (on load test)
|
/// 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"
|
/// 2 - up to 50% more performance with iperf with small packets, "tud_network_can_xmit: request blocked"
|
||||||
/// happens from time to time with SystemView
|
/// happens from time to time with SystemView
|
||||||
/// 3 - "tud_network_can_xmit: request blocked" never happens
|
/// 3 - "tud_network_can_xmit: request blocked" never happens
|
||||||
/// >2 - no performance gain
|
/// >2 - no performance gain
|
||||||
#define CFG_TUD_NCM_IN_NTB_N 3
|
/// -> for performance optimizations this parameter could be increased with the cost of additional RAM requirements
|
||||||
|
#define CFG_TUD_NCM_IN_NTB_N 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB
|
#ifndef CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB
|
||||||
/// this is for the transmission size for allocation of \a ndp16_datagram_t
|
/// this is for the transmission side for allocation of \a ndp16_datagram_t
|
||||||
#define CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB 8
|
#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
|
#endif
|
||||||
|
|
||||||
#ifndef CFG_TUD_NCM_ALIGNMENT
|
#ifndef CFG_TUD_NCM_ALIGNMENT
|
||||||
#define CFG_TUD_NCM_ALIGNMENT 4
|
#define CFG_TUD_NCM_ALIGNMENT 4
|
||||||
#endif
|
#endif
|
||||||
#if (CFG_TUD_NCM_ALIGNMENT != 4)
|
#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)"
|
#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 {
|
struct {
|
||||||
nth16_t nth;
|
nth16_t nth;
|
||||||
ndp16_t ndp;
|
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];
|
uint8_t data[CFG_TUD_NCM_IN_NTB_MAX_SIZE];
|
||||||
} xmit_ntb_t;
|
} xmit_ntb_t;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
* The MIT License (MIT)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 Hardy Griech
|
|
||||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||||
|
* Copyright (c) 2024 Hardy Griech
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -126,7 +126,7 @@ CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN tu_static const ntb_parameters_t ntb_par
|
|||||||
.wNdbOutDivisor = 4,
|
.wNdbOutDivisor = 4,
|
||||||
.wNdbOutPayloadRemainder = 0,
|
.wNdbOutPayloadRemainder = 0,
|
||||||
.wNdbOutAlignment = CFG_TUD_NCM_ALIGNMENT,
|
.wNdbOutAlignment = CFG_TUD_NCM_ALIGNMENT,
|
||||||
.wNtbOutMaxDatagrams = 6 // 0=no limit
|
.wNtbOutMaxDatagrams = CFG_TUD_NCM_OUT_MAX_DATAGRAMS_PER_NTB,
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -371,7 +371,7 @@ static bool xmit_requested_datagram_fits_into_current_ntb(uint16_t datagram_size
|
|||||||
if (ncm_interface.xmit_glue_ntb == NULL) {
|
if (ncm_interface.xmit_glue_ntb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ncm_interface.xmit_glue_ntb_datagram_ndx >= CFG_TUD_NCM_MAX_DATAGRAMS_PER_NTB) {
|
if (ncm_interface.xmit_glue_ntb_datagram_ndx >= CFG_TUD_NCM_IN_MAX_DATAGRAMS_PER_NTB) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ncm_interface.xmit_glue_ntb->nth.wBlockLength + datagram_size + XMIT_ALIGN_OFFSET(datagram_size) > CFG_TUD_NCM_OUT_NTB_MAX_SIZE) {
|
if (ncm_interface.xmit_glue_ntb->nth.wBlockLength + datagram_size + XMIT_ALIGN_OFFSET(datagram_size) > CFG_TUD_NCM_OUT_NTB_MAX_SIZE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user