osi: dma: Fix PTP Tx timestamp for VLAN

Issue:
Tx timestamp is not propagate to QNX OSD driver.
OSI tx completion routine check for txdone_pkt_cx
flags OSI_TXDONE_CX_TS_DELAYED which is missing.

In case of QNX OSD, PTP untagged TX packet
 has LD and FD bit set for single descriptor
which is having valid mbuf.

In case of QNX OSD, ptp tagged packet have 2
separate descriptors. Valid mbuf is with descriptor
which has LD bit set.

Due to this OSD discard first descriptor data and
for last descriptor txdone_pkt_cxflags are not set.

Fix:
For TX timestamp, tx_swcx of last descriptor
should also set as
     last_swcx->flags |= OSI_PKT_CX_PTP;
     last_swcx->pktid = pkt_id;
so txdone_pkt_cx flags set for last descriptor
corresponds to tagged PTP tx packet.

Bug 4001072

Change-Id: Ie7e52b197ebfbc77c79d02a6e821b641f15707a4
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/2868500
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Rakesh Goyal
2023-03-09 19:21:07 +05:30
committed by mobile promotions
parent 047a42bef8
commit 1762865077

View File

@@ -846,7 +846,6 @@ static inline void fill_first_desc(OSI_UNUSED struct osi_tx_ring *tx_ring,
/* if TS is set enable timestamping */ /* if TS is set enable timestamping */
if ((tx_pkt_cx->flags & OSI_PKT_CX_PTP) == OSI_PKT_CX_PTP) { if ((tx_pkt_cx->flags & OSI_PKT_CX_PTP) == OSI_PKT_CX_PTP) {
tx_desc->tdes2 |= TDES2_TTSE; tx_desc->tdes2 |= TDES2_TTSE;
tx_swcx->flags |= OSI_PKT_CX_PTP;
//ptp master mode in one step sync //ptp master mode in one step sync
if (is_ptp_onestep_and_master_mode(ptp_flag) == if (is_ptp_onestep_and_master_mode(ptp_flag) ==
OSI_ENABLE) { OSI_ENABLE) {
@@ -986,6 +985,7 @@ nve32_t hw_transmit(struct osi_dma_priv_data *osi_dma,
struct osi_tx_pkt_cx *tx_pkt_cx = OSI_NULL; struct osi_tx_pkt_cx *tx_pkt_cx = OSI_NULL;
struct osi_tx_desc *first_desc = OSI_NULL; struct osi_tx_desc *first_desc = OSI_NULL;
struct osi_tx_desc *last_desc = OSI_NULL; struct osi_tx_desc *last_desc = OSI_NULL;
struct osi_tx_swcx *last_swcx = OSI_NULL;
struct osi_tx_desc *tx_desc = OSI_NULL; struct osi_tx_desc *tx_desc = OSI_NULL;
struct osi_tx_swcx *tx_swcx = OSI_NULL; struct osi_tx_swcx *tx_swcx = OSI_NULL;
struct osi_tx_desc *cx_desc = OSI_NULL; struct osi_tx_desc *cx_desc = OSI_NULL;
@@ -1076,18 +1076,12 @@ nve32_t hw_transmit(struct osi_dma_priv_data *osi_dma,
/* Fill first descriptor */ /* Fill first descriptor */
fill_first_desc(tx_ring, tx_pkt_cx, tx_desc, tx_swcx, osi_dma->ptp_flag); fill_first_desc(tx_ring, tx_pkt_cx, tx_desc, tx_swcx, osi_dma->ptp_flag);
if (((tx_pkt_cx->flags & OSI_PKT_CX_PTP) == OSI_PKT_CX_PTP) &&
(osi_dma->mac == OSI_MAC_HW_MGBE)) {
/* save packet id for first desc, time stamp will be with
* first FD only
*/
tx_swcx->pktid = pkt_id;
}
INCR_TX_DESC_INDEX(entry, osi_dma->tx_ring_sz); INCR_TX_DESC_INDEX(entry, osi_dma->tx_ring_sz);
first_desc = tx_desc; first_desc = tx_desc;
last_desc = tx_desc; last_desc = tx_desc;
last_swcx = tx_swcx;
tx_desc = tx_ring->tx_desc + entry; tx_desc = tx_ring->tx_desc + entry;
tx_swcx = tx_ring->tx_swcx + entry; tx_swcx = tx_ring->tx_swcx + entry;
desc_cnt--; desc_cnt--;
@@ -1102,12 +1096,19 @@ nve32_t hw_transmit(struct osi_dma_priv_data *osi_dma,
INCR_TX_DESC_INDEX(entry, osi_dma->tx_ring_sz); INCR_TX_DESC_INDEX(entry, osi_dma->tx_ring_sz);
last_desc = tx_desc; last_desc = tx_desc;
last_swcx = tx_swcx;
tx_desc = tx_ring->tx_desc + entry; tx_desc = tx_ring->tx_desc + entry;
tx_swcx = tx_ring->tx_swcx + entry; tx_swcx = tx_ring->tx_swcx + entry;
} }
/* Mark it as LAST descriptor */ /* Mark it as LAST descriptor */
last_desc->tdes3 |= TDES3_LD; last_desc->tdes3 |= TDES3_LD;
if (((tx_pkt_cx->flags & OSI_PKT_CX_PTP) == OSI_PKT_CX_PTP) &&
(osi_dma->mac == OSI_MAC_HW_MGBE)) {
last_swcx->flags |= OSI_PKT_CX_PTP;
last_swcx->pktid = pkt_id;
}
/* set Interrupt on Completion*/ /* set Interrupt on Completion*/
last_desc->tdes2 |= TDES2_IOC; last_desc->tdes2 |= TDES2_IOC;