@@ -398,58 +398,33 @@ void TC6_CB_OnRxEthernetSlice(TC6_t *pInst, const uint8_t *pRx, uint16_t offset,
398398{
399399 TC6LwIP_t *lw = TC6::GetContextTC6 (pInst);
400400 bool success = true ;
401- (void ) pInst;
402- (void ) pGlobalTag;
401+ (void )pInst;
402+ (void )pGlobalTag;
403403// TC6_ASSERT(lw->tc.tc6 == pInst);
404- if (lw->tc .rxInvalid )
405- {
404+ if (lw->tc .rxInvalid ) {
406405 success = false ;
407406 }
408- if (success && ((offset + len) > TC6LwIP_MTU))
409- {
410- // PrintRateLimited("on_rx_slice:packet greater than MTU", (offset + len));
407+ if (success && ((offset + len) > TC6LwIP_MTU)) {
408+ // PRINT("on_rx_slice:packet greater than MTU", (offset + len));
411409 lw->tc .rxInvalid = true ;
412410 success = false ;
413411 }
414- if (success && (0u != offset))
415- {
416- if (!lw->tc .pbuf || !lw->tc .rxLen )
417- {
418- // TC6_ASSERT(false);
419- lw->tc .rxInvalid = true ;
420- success = false ;
421- }
422- } else
423- {
424- if (success && (lw->tc .pbuf || lw->tc .rxLen ))
425- {
426- // TC6_ASSERT(false);
412+ if (success && (NULL == lw->tc .pbuf )) {
413+ lw->tc .pbuf = pbuf_alloc (PBUF_RAW, TC6LwIP_MTU, PBUF_RAM);
414+ if (!lw->tc .pbuf ) {
427415 lw->tc .rxInvalid = true ;
428416 success = false ;
429417 }
430-
431- if (success)
432- {
433- lw->tc .pbuf = pbuf_alloc (PBUF_RAW, TC6LwIP_MTU, PBUF_RAM);
434- if (!lw->tc .pbuf )
435- {
436- lw->tc .rxInvalid = true ;
437- success = false ;
438- }
439- }
440- if (success && (NULL != lw->tc .pbuf ->next ))
441- {
442- // TC6_ASSERT(lw->tc.pbuf->ref != 0);
443- // PrintRateLimited("rx_slice: could not allocate unsegmented memory diff", (lw->tc.pbuf->tot_len - lw->tc.pbuf->len));
418+ if (success && (NULL != lw->tc .pbuf ->next )) {
419+ // PRINT("rx_slice: could not allocate unsegmented memory diff", (lw->tc.pbuf->tot_len - lw->tc.pbuf->len));
444420 lw->tc .rxInvalid = true ;
445421 pbuf_free (lw->tc .pbuf );
446422 lw->tc .pbuf = NULL ;
447423 success = false ;
448424 }
449425 }
450- if (success)
451- {
452- (void ) memcpy ((uint8_t *) lw->tc .pbuf ->payload + offset, pRx, len);
426+ if (success) {
427+ (void )memcpy (lw->tc .pbuf ->payload + offset, pRx, len);
453428 lw->tc .rxLen += len;
454429 }
455430}
0 commit comments