Skip to content

Commit 55f6f3d

Browse files
vladimirolteankuba-moo
authored andcommitted
net: ftmac100: prepare data path for receiving single segment packets > 1514
Eliminate one check in the data path and move it elsewhere, to where our real limitation is. We'll want to start processing "too long" frames in the driver (currently there is a hardware MAC setting which drops theses). Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Sergei Antonov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 91e8704 commit 55f6f3d

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

drivers/net/ethernet/faraday/ftmac100.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,6 @@ static bool ftmac100_rxdes_crc_error(struct ftmac100_rxdes *rxdes)
218218
return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_CRC_ERR);
219219
}
220220

221-
static bool ftmac100_rxdes_frame_too_long(struct ftmac100_rxdes *rxdes)
222-
{
223-
return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_FTL);
224-
}
225-
226221
static bool ftmac100_rxdes_runt(struct ftmac100_rxdes *rxdes)
227222
{
228223
return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RUNT);
@@ -337,13 +332,7 @@ static bool ftmac100_rx_packet_error(struct ftmac100 *priv,
337332
error = true;
338333
}
339334

340-
if (unlikely(ftmac100_rxdes_frame_too_long(rxdes))) {
341-
if (net_ratelimit())
342-
netdev_info(netdev, "rx frame too long\n");
343-
344-
netdev->stats.rx_length_errors++;
345-
error = true;
346-
} else if (unlikely(ftmac100_rxdes_runt(rxdes))) {
335+
if (unlikely(ftmac100_rxdes_runt(rxdes))) {
347336
if (net_ratelimit())
348337
netdev_info(netdev, "rx runt\n");
349338

@@ -356,6 +345,11 @@ static bool ftmac100_rx_packet_error(struct ftmac100 *priv,
356345
netdev->stats.rx_length_errors++;
357346
error = true;
358347
}
348+
/*
349+
* FTMAC100_RXDES0_FTL is not an error, it just indicates that the
350+
* frame is longer than 1518 octets. Receiving these is possible when
351+
* we told the hardware not to drop them, via FTMAC100_MACCR_RX_FTL.
352+
*/
359353

360354
return error;
361355
}
@@ -400,12 +394,13 @@ static bool ftmac100_rx_packet(struct ftmac100 *priv, int *processed)
400394
return true;
401395
}
402396

403-
/*
404-
* It is impossible to get multi-segment packets
405-
* because we always provide big enough receive buffers.
406-
*/
397+
/* We don't support multi-segment packets for now, so drop them. */
407398
ret = ftmac100_rxdes_last_segment(rxdes);
408-
BUG_ON(!ret);
399+
if (unlikely(!ret)) {
400+
netdev->stats.rx_length_errors++;
401+
ftmac100_rx_drop_packet(priv);
402+
return true;
403+
}
409404

410405
/* start processing */
411406
skb = netdev_alloc_skb_ip_align(netdev, 128);

0 commit comments

Comments
 (0)