@@ -398,58 +398,33 @@ void TC6_CB_OnRxEthernetSlice(TC6_t *pInst, const uint8_t *pRx, uint16_t offset,
398
398
{
399
399
TC6LwIP_t *lw = TC6::GetContextTC6 (pInst);
400
400
bool success = true ;
401
- (void ) pInst;
402
- (void ) pGlobalTag;
401
+ (void )pInst;
402
+ (void )pGlobalTag;
403
403
// TC6_ASSERT(lw->tc.tc6 == pInst);
404
- if (lw->tc .rxInvalid )
405
- {
404
+ if (lw->tc .rxInvalid ) {
406
405
success = false ;
407
406
}
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));
411
409
lw->tc .rxInvalid = true ;
412
410
success = false ;
413
411
}
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 ) {
427
415
lw->tc .rxInvalid = true ;
428
416
success = false ;
429
417
}
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));
444
420
lw->tc .rxInvalid = true ;
445
421
pbuf_free (lw->tc .pbuf );
446
422
lw->tc .pbuf = NULL ;
447
423
success = false ;
448
424
}
449
425
}
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);
453
428
lw->tc .rxLen += len;
454
429
}
455
430
}
0 commit comments