// SPDX-License-Identifier: GPL-2.0-only /******************************************************************************* This contains the functions to handle the normal descriptors.
Copyright (C) 2007-2009 STMicroelectronics Ltd
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
/* This function verifies if each incoming frame has some errors * and, if required, updates the multicast statistics. * In case of success, it returns good_frame because the GMAC device
* is supposed to be able to compute the csum in HW. */ staticint ndesc_get_rx_status(struct stmmac_extra_stats *x, struct dma_desc *p)
{ int ret = good_frame; unsignedint rdes0 = le32_to_cpu(p->des0);
if (unlikely(rdes0 & RDES0_OWN)) return dma_own;
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
x->rx_length++; return discard_frame;
}
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR))
x->rx_desc++; if (unlikely(rdes0 & RDES0_SA_FILTER_FAIL))
x->sa_filter_fail++; if (unlikely(rdes0 & RDES0_OVERFLOW_ERROR))
x->overflow_error++; if (unlikely(rdes0 & RDES0_IPC_CSUM_ERROR))
x->ipc_csum_error++; if (unlikely(rdes0 & RDES0_COLLISION)) {
x->rx_collision++;
} if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
x->rx_crc_errors++;
}
ret = discard_frame;
} if (unlikely(rdes0 & RDES0_DRIBBLING))
x->dribbling_bit++;
if (unlikely(rdes0 & RDES0_LENGTH_ERROR)) {
x->rx_length++;
ret = discard_frame;
} if (unlikely(rdes0 & RDES0_MII_ERROR)) {
x->rx_mii++;
ret = discard_frame;
} #ifdef STMMAC_VLAN_TAG_USED if (rdes0 & RDES0_VLAN_TAG)
x->vlan_tag++; #endif return ret;
}
staticvoid ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, int end, int bfsize)
{ int bfsize1;
/* The type-1 checksum offload engines append the checksum at * the end of frame and the two bytes of checksum are added in * the length. * Adjust for that in the framelen for type-1 checksum offload * engines
*/ if (rx_coe_type == STMMAC_RX_COE_TYPE1)
csum = 2;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.