Line 91: |
Line 91: |
| == RegisterClient == | | == RegisterClient == |
| Takes a [[#LibraryConfigData]], the PID, the size of the transfer memory and a copy-handle of the latter. | | Takes a [[#LibraryConfigData]], the PID, the size of the transfer memory and a copy-handle of the latter. |
| + | |
| + | The transfer memory must be larger than a the computed size below. Should the transfer memory be smaller than that, the BSD sockets service would only send ZeroWindow packets (for TCP), resulting in a transfer rate not exceeding 1 byte/s. |
| + | |
| + | static size_t _bsdGetTransferMemSizeForBufferConfig(const BsdBufferConfig *config) |
| + | { |
| + | u32 tcp_tx_buf_max_size = config->tcp_tx_buf_max_size != 0 ? config->tcp_tx_buf_max_size : config->tcp_tx_buf_size; |
| + | u32 tcp_rx_buf_max_size = config->tcp_rx_buf_max_size != 0 ? config->tcp_rx_buf_max_size : config->tcp_rx_buf_size; |
| + | u32 sum = tcp_tx_buf_max_size + tcp_rx_buf_max_size + config->udp_tx_buf_size + config->udp_rx_buf_size; |
| + | |
| + | sum = ((sum + 0xFFF) >> 12) << 12; // page round-up |
| + | return (size_t)(config->sb_efficiency * sum); |
| + | } |
| | | |
| == Socket == | | == Socket == |
Line 653: |
Line 665: |
| | | |
| u32 sb_efficiency; ///< Number of buffers for each socket (standard values range from 1 to 8). | | u32 sb_efficiency; ///< Number of buffers for each socket (standard values range from 1 to 8). |
− | } BsdBufferConfig; | + | } LibraryConfigData; |
− | | |
− | | |
− | The transfer memory must be larger than a the computed size below. Should the transfer memory be smaller than that, the BSD sockets service would only send ZeroWindow packets (for TCP), resulting in a transfer rate not exceeding 1 byte/s.
| |
− | | |
− | static size_t _bsdGetTransferMemSizeForBufferConfig(const BsdBufferConfig *config)
| |
− | {
| |
− | u32 tcp_tx_buf_max_size = config->tcp_tx_buf_max_size != 0 ? config->tcp_tx_buf_max_size : config->tcp_tx_buf_size;
| |
− | u32 tcp_rx_buf_max_size = config->tcp_rx_buf_max_size != 0 ? config->tcp_rx_buf_max_size : config->tcp_rx_buf_size;
| |
− | u32 sum = tcp_tx_buf_max_size + tcp_rx_buf_max_size + config->udp_tx_buf_size + config->udp_rx_buf_size;
| |
− |
| |
− | sum = ((sum + 0xFFF) >> 12) << 12; // page round-up
| |
− | return (size_t)(config->sb_efficiency * sum);
| |
− | }
| |
| | | |
| = DeleteMode = | | = DeleteMode = |