mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-22 17:34:29 +03:00
nvethernetrm: mgbe: add rx stats
Bug 200565898 Change-Id: If3bb00422d77d24e2425764015db25cdf4e1d930 Signed-off-by: narayanr <narayanr@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2309521 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mahesh Patil <maheshp@nvidia.com> Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
This commit is contained in:
@@ -92,6 +92,9 @@ struct desc_ops {
|
||||
/** Called to get receive checksum */
|
||||
void (*get_rx_csum)(struct osi_rx_desc *rx_desc,
|
||||
struct osi_rx_pkt_cx *rx_pkt_cx);
|
||||
/** Called to get rx error stats */
|
||||
void (*update_rx_err_stats)(struct osi_rx_desc *rx_desc,
|
||||
struct osi_pkt_err_stats pkt_err_stats);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,38 @@
|
||||
#include "hw_desc.h"
|
||||
|
||||
/**
|
||||
* @brief get_rx_csum - Get the Rx checksum from descriptor if valid
|
||||
* @brief eqos_update_rx_err_stats - Detect Errors from Rx Descriptor
|
||||
*
|
||||
* Algorithm: This routine will be invoked by OSI layer itself which
|
||||
* checks for the Last Descriptor and updates the receive status errors
|
||||
* accordingly.
|
||||
*
|
||||
* @param[in] rx_desc: Rx Descriptor.
|
||||
* @param[in] pkt_err_stats: Packet error stats which stores the errors reported
|
||||
*/
|
||||
static inline void eqos_update_rx_err_stats(struct osi_rx_desc *rx_desc,
|
||||
struct osi_pkt_err_stats
|
||||
pkt_err_stats)
|
||||
{
|
||||
/* increment rx crc if we see CE bit set */
|
||||
if ((rx_desc->rdes3 & RDES3_ERR_CRC) == RDES3_ERR_CRC) {
|
||||
pkt_err_stats.rx_crc_error =
|
||||
osi_update_stats_counter(
|
||||
pkt_err_stats.rx_crc_error,
|
||||
1UL);
|
||||
}
|
||||
|
||||
/* increment rx frame error if we see RE bit set */
|
||||
if ((rx_desc->rdes3 & RDES3_ERR_RE) == RDES3_ERR_RE) {
|
||||
pkt_err_stats.rx_frame_error =
|
||||
osi_update_stats_counter(
|
||||
pkt_err_stats.rx_frame_error,
|
||||
1UL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief eqos_get_rx_csum - Get the Rx checksum from descriptor if valid
|
||||
*
|
||||
* @note
|
||||
* Algorithm:
|
||||
@@ -104,4 +135,5 @@ static void eqos_get_rx_csum(struct osi_rx_desc *rx_desc,
|
||||
void eqos_init_desc_ops(struct desc_ops *d_ops)
|
||||
{
|
||||
d_ops->get_rx_csum = eqos_get_rx_csum;
|
||||
d_ops->update_rx_err_stats = eqos_update_rx_err_stats;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
/** MGBE error summary bits for Received packet */
|
||||
#define RDES3_ES_MGBE 0x8000U
|
||||
#define RDES3_ERR_MGBE_CRC (OSI_BIT(16) | OSI_BIT(17))
|
||||
/**
|
||||
* @addtogroup EQOS_TxDesc Transmit Descriptors bit fields
|
||||
*
|
||||
|
||||
@@ -23,6 +23,28 @@
|
||||
#include "dma_local.h"
|
||||
#include "hw_desc.h"
|
||||
|
||||
/**
|
||||
* @brief mgbe_get_rx_err_stats - Detect Errors from Rx Descriptor
|
||||
*
|
||||
* Algorithm: This routine will be invoked by OSI layer itself which
|
||||
* checks for the Last Descriptor and updates the receive status errors
|
||||
* accordingly.
|
||||
*
|
||||
* @param[in] rx_desc: Rx Descriptor.
|
||||
* @param[in] pkt_err_stats: Packet error stats which stores the errors reported
|
||||
*/
|
||||
static inline void mgbe_update_rx_err_stats(struct osi_rx_desc *rx_desc,
|
||||
struct osi_pkt_err_stats
|
||||
pkt_err_stats)
|
||||
{
|
||||
/* increment rx crc if we see CE bit set */
|
||||
if ((rx_desc->rdes3 & RDES3_ERR_MGBE_CRC) == RDES3_ERR_MGBE_CRC) {
|
||||
pkt_err_stats.rx_crc_error =
|
||||
osi_update_stats_counter(pkt_err_stats.rx_crc_error,
|
||||
1UL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief mgbe_get_rx_csum - Get the Rx checksum from descriptor if valid
|
||||
*
|
||||
@@ -54,4 +76,5 @@ static void mgbe_get_rx_csum(struct osi_rx_desc *rx_desc,
|
||||
void mgbe_init_desc_ops(struct desc_ops *d_ops)
|
||||
{
|
||||
d_ops->get_rx_csum = mgbe_get_rx_csum;
|
||||
d_ops->update_rx_err_stats = mgbe_update_rx_err_stats;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ struct desc_ops {
|
||||
/** Called to get receive checksum */
|
||||
void (*get_rx_csum)(struct osi_rx_desc *rx_desc,
|
||||
struct osi_rx_pkt_cx *rx_pkt_cx);
|
||||
/** Called to get rx error stats */
|
||||
void (*update_rx_err_stats)(struct osi_rx_desc *rx_desc,
|
||||
struct osi_pkt_err_stats pkt_err_stats);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -359,8 +359,8 @@ nve32_t osi_process_rx_completions(struct osi_dma_priv_data *osi_dma,
|
||||
* are set
|
||||
*/
|
||||
rx_pkt_cx->flags &= ~OSI_PKT_CX_VALID;
|
||||
get_rx_err_stats(rx_desc,
|
||||
&osi_dma->pkt_err_stats);
|
||||
d_ops.update_rx_err_stats(rx_desc,
|
||||
osi_dma->pkt_err_stats);
|
||||
}
|
||||
|
||||
/* Check if COE Rx checksum is valid */
|
||||
|
||||
Reference in New Issue
Block a user