mirror of
git://nv-tegra.nvidia.com/kernel/nvethernetrm.git
synced 2025-12-24 02:22:16 +03:00
osi: dma: mgbe: drop ctxt desc for TSD
Issue description: - For announce / managament / signaling ptp packets, MGBE populates context descriptor with Timestamp dropped status (TSD). It leads to 10us busy loop in rx path for every such packet. - Also, it results into forwarding context descriptor to OSD through receive callback, leads to error spew from OSD. Fix description: - Removed busy loop when TSD is set in mgbe context descriptor. - Consume context descriptor in OSI DMA itself when packet context descriptor found to be available (CDA). Bug 5199635 Change-Id: I92785c5c434256d072405c4dd616486f64de2ff6 Signed-off-by: Hareesh Kesireddy <hkesireddy@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3338247 (cherry picked from commit 1f165baec2635ffae05661306bd2a6ebba339601) Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3344960 Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
58bbd73ad6
commit
b394b50ed4
@@ -24,6 +24,9 @@
|
|||||||
#include "hw_desc.h"
|
#include "hw_desc.h"
|
||||||
#include "mgbe_desc.h"
|
#include "mgbe_desc.h"
|
||||||
|
|
||||||
|
/** @brief retry count for ptp context descriptor readiness */
|
||||||
|
#define PTP_CTX_DESC_RETRY_CNT (10)
|
||||||
|
|
||||||
#ifndef OSI_STRIPPED_LIB
|
#ifndef OSI_STRIPPED_LIB
|
||||||
/**
|
/**
|
||||||
* @brief mgbe_get_rx_vlan - Get Rx VLAN from descriptor
|
* @brief mgbe_get_rx_vlan - Get Rx VLAN from descriptor
|
||||||
@@ -218,36 +221,45 @@ static nve32_t mgbe_get_rx_hwstamp(const struct osi_dma_priv_data *const osi_dma
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (retry = 0; retry < 10; retry++) {
|
/* RDES3_CDA is set, hence it is a context descriptor.
|
||||||
|
* Return always 0 from here on to allow caller to discard context descriptor
|
||||||
|
*/
|
||||||
|
for (retry = 0; retry < PTP_CTX_DESC_RETRY_CNT; retry++) {
|
||||||
if ((context_desc->rdes3 & (RDES3_OWN | RDES3_CTXT | RDES3_TSA | RDES3_TSD)) ==
|
if ((context_desc->rdes3 & (RDES3_OWN | RDES3_CTXT | RDES3_TSA | RDES3_TSD)) ==
|
||||||
(RDES3_CTXT | RDES3_TSA)) {
|
(RDES3_CTXT | RDES3_TSA)) {
|
||||||
if ((context_desc->rdes0 == OSI_INVALID_VALUE) &&
|
if ((context_desc->rdes0 == OSI_INVALID_VALUE) &&
|
||||||
(context_desc->rdes1 == OSI_INVALID_VALUE)) {
|
(context_desc->rdes1 == OSI_INVALID_VALUE)) {
|
||||||
/* Invalid time stamp */
|
/* Invalid time stamp */
|
||||||
ret = -1;
|
break;
|
||||||
goto fail;
|
}
|
||||||
|
/* Time Stamp can be read */
|
||||||
|
rx_pkt_cx->ns = context_desc->rdes0 + (OSI_NSEC_PER_SEC * context_desc->rdes1);
|
||||||
|
if (rx_pkt_cx->ns < context_desc->rdes0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* Update rx pkt context flags to indicate PTP */
|
/* Update rx pkt context flags to indicate PTP */
|
||||||
rx_pkt_cx->flags |= OSI_PKT_CX_PTP;
|
rx_pkt_cx->flags |= OSI_PKT_CX_PTP;
|
||||||
/* Time Stamp can be read */
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
if ((context_desc->rdes3 & (RDES3_OWN | RDES3_CTXT | RDES3_TSD)) ==
|
||||||
|
(RDES3_CTXT | RDES3_TSD)) {
|
||||||
|
/* Timestamp Dropped by HW, no need to retry */
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* TS not available yet, so retrying */
|
/* TS not available yet, so retrying */
|
||||||
osi_dma->osd_ops.udelay(OSI_DELAY_1US);
|
osi_dma->osd_ops.udelay(OSI_DELAY_1US);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retry == 10) {
|
if (retry == PTP_CTX_DESC_RETRY_CNT) {
|
||||||
/* Timed out waiting for Rx timestamp */
|
/* Timed out waiting for Rx timestamp */
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
OSI_DMA_ERR(osi_dma->osd, OSI_LOG_ARG_INVALID,
|
||||||
|
"hwstamp: Context descriptor OWN bit not cleared by HW\n",
|
||||||
|
(nveul64_t)(context_desc->rdes3));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_pkt_cx->ns = context_desc->rdes0 + (OSI_NSEC_PER_SEC * context_desc->rdes1);
|
|
||||||
if (rx_pkt_cx->ns < context_desc->rdes0) {
|
|
||||||
ret = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user