dev(): Небольшие оптимизации

This commit is contained in:
algin 2024-01-19 14:57:14 +03:00
parent 546220b3b1
commit 24f5a680fa
2 changed files with 19 additions and 3 deletions

View File

@ -178,6 +178,8 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
EnetApp_GetDmaHandleInArgs rxInArgs;
EnetApp_GetRxDmaHandleOutArgs rxChInfo;
constexpr uint32_t numPkts[2] = {ENET_DMA_RX_CH0_NUM_PKTS, ENET_DMA_RX_CH1_NUM_PKTS};
EnetAppUtils_print("rx_flow %u: opening flow...\r\n", id);
if (open_) {
@ -216,7 +218,7 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EnetAppUtils_assert(rxChInfo.useGlobalEvt == true);
EnetAppUtils_assert(rxChInfo.sizeThreshEn == 0U);
EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= (ENET_SYSCFG_TOTAL_NUM_RX_PKT/2U));
EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= numPkts[enetDmaRxChId]);
EnetAppUtils_assert(rxChInfo.chIdx == id_);
EnetAppUtils_assert(rxChInfo.useDefaultFlow == true);
@ -228,8 +230,8 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
}
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
initRxFreePktQ(this, &rx_free_pktq_, ENET_SYSCFG_TOTAL_NUM_RX_PKT/2);
submitFreeRxPkts(ENET_SYSCFG_TOTAL_NUM_RX_PKT/4);
initRxFreePktQ(this, &rx_free_pktq_, numPkts[enetDmaRxChId]);
submitFreeRxPkts(numPkts[enetDmaRxChId]/2);
open_ = true;

View File

@ -15,6 +15,8 @@
#include <networking/enet/utils/include/enet_appmemutils_cfg.h>
#include <networking/enet/utils/include/enet_apputils.h>
#include <task.h>
/*----------------------------------------------------------------------*/
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> sysconfig.
@ -159,6 +161,8 @@ void free_rtos::EthTxFlow::disable(TEthMacPorts port_id) {
bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t len)
{
if (port_id >= e_ethMacTotal) {
EnetAppUtils_print("Wrong port id\r\n");
return false;
}
@ -176,6 +180,11 @@ bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
while(txPktInfo == NULL)
{
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
}
if (txPktInfo != NULL)
{
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
@ -239,6 +248,11 @@ bool free_rtos::EthTxFlow::send(TxFlowHandlerArgs& handlerArgs, uint32_t numScat
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
while(txPktInfo == NULL)
{
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
}
if (txPktInfo != NULL)
{
for(size_t scatter_segment = 0; scatter_segment < numScatterSegments; scatter_segment++)