// SPDX-License-Identifier: GPL-2.0-only /******************************************************************************* This contains the functions to handle the enhanced descriptors.
Copyright (C) 2007-2014 STMicroelectronics Ltd
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
if (unlikely(rdes0 & ERDES0_RX_MAC_ADDR)) { int message_type = (rdes4 & ERDES4_MSG_TYPE_MASK) >> 8;
if (rdes4 & ERDES4_IP_HDR_ERR)
x->ip_hdr_err++; if (rdes4 & ERDES4_IP_PAYLOAD_ERR)
x->ip_payload_err++; if (rdes4 & ERDES4_IP_CSUM_BYPASSED)
x->ip_csum_bypassed++; if (rdes4 & ERDES4_IPV4_PKT_RCVD)
x->ipv4_pkt_rcvd++; if (rdes4 & ERDES4_IPV6_PKT_RCVD)
x->ipv6_pkt_rcvd++;
if (rdes4 & ERDES4_PTP_FRAME_TYPE)
x->ptp_frame_type++; if (rdes4 & ERDES4_PTP_VER)
x->ptp_ver++; if (rdes4 & ERDES4_TIMESTAMP_DROPPED)
x->timestamp_dropped++; if (rdes4 & ERDES4_AV_PKT_RCVD)
x->av_pkt_rcvd++; if (rdes4 & ERDES4_AV_TAGGED_PKT_RCVD)
x->av_tagged_pkt_rcvd++; if ((rdes4 & ERDES4_VLAN_TAG_PRI_VAL_MASK) >> 18)
x->vlan_tag_priority_val++; if (rdes4 & ERDES4_L3_FILTER_MATCH)
x->l3_filter_match++; if (rdes4 & ERDES4_L4_FILTER_MATCH)
x->l4_filter_match++; if ((rdes4 & ERDES4_L3_L4_FILT_NO_MATCH_MASK) >> 26)
x->l3_l4_filter_no_match++;
}
}
staticint enh_desc_get_rx_status(struct stmmac_extra_stats *x, struct dma_desc *p)
{ unsignedint rdes0 = le32_to_cpu(p->des0); int ret = good_frame;
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++;
x->rx_length++;
} if (unlikely(rdes0 & RDES0_OVERFLOW_ERROR))
x->rx_gmac_overflow++;
if (unlikely(rdes0 & RDES0_IPC_CSUM_ERROR))
pr_err("\tIPC Csum Error/Giant frame\n");
if (unlikely(rdes0 & RDES0_COLLISION))
x->rx_collision++; if (unlikely(rdes0 & RDES0_RECEIVE_WATCHDOG))
x->rx_watchdog++;
if (unlikely(rdes0 & RDES0_MII_ERROR)) /* GMII */
x->rx_mii++;
if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
x->rx_crc_errors++;
}
ret = discard_frame;
}
/* After a payload csum error, the ES bit is set. * It doesn't match with the information reported into the databook. * At any rate, we need to understand if the CSUM hw computation is ok
* and report this info to the upper layers. */ if (likely(ret == good_frame))
ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR),
!!(rdes0 & RDES0_FRAME_TYPE),
!!(rdes0 & ERDES0_RX_MAC_ADDR));
if (unlikely(rdes0 & RDES0_DRIBBLING))
x->dribbling_bit++;
if (unlikely(rdes0 & RDES0_SA_FILTER_FAIL)) {
x->sa_rx_filter_fail++;
ret = discard_frame;
} if (unlikely(rdes0 & RDES0_DA_FILTER_FAIL)) {
x->da_rx_filter_fail++;
ret = discard_frame;
} if (unlikely(rdes0 & RDES0_LENGTH_ERROR)) {
x->rx_length++;
ret = discard_frame;
} #ifdef STMMAC_VLAN_TAG_USED if (rdes0 & RDES0_VLAN_TAG)
x->rx_vlan++; #endif
return ret;
}
staticvoid enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, int end, int bfsize)
{ int bfsize1;
/* Finally set the OWN bit. Later the DMA will start! */ if (tx_own)
tdes0 |= ETDES0_OWN;
if (is_fs && tx_own) /* When the own bit, for the first frame, has to be set, all * descriptors for the same frame has to be set before, to * avoid race condition.
*/
dma_wmb();
staticint enh_desc_get_rx_frame_len(struct dma_desc *p, int rx_coe_type)
{ unsignedint csum = 0; /* 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.0.0Bemerkung:
(vorverarbeitet)
¤
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.