nvethernet: ptp support for upcoming chip

Bug 4221043

Change-Id: I4689259e48705aa975ec33dddaba8fd7e941d304
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/nvethernet-docs/+/2968051
Tested-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
This commit is contained in:
Rakesh Goyal
2023-09-22 05:56:42 +00:00
committed by Bhadram Varka
parent 7e2c08add0
commit eb29db2879
3 changed files with 14 additions and 4 deletions

View File

@@ -68,11 +68,12 @@ int ether_get_tx_ts(struct ether_priv_data *pdata)
ioctl_data.cmd = OSI_CMD_GET_TX_TS; ioctl_data.cmd = OSI_CMD_GET_TX_TS;
ioctl_data.tx_ts.pkt_id = pnode->pktid; ioctl_data.tx_ts.pkt_id = pnode->pktid;
ioctl_data.tx_ts.vdma_id = pnode->vdmaid;
ret = osi_handle_ioctl(pdata->osi_core, &ioctl_data); ret = osi_handle_ioctl(pdata->osi_core, &ioctl_data);
if (ret == 0) { if (ret == 0) {
/* get time stamp form ethernet server */ /* get time stamp form ethernet server */
dev_dbg(pdata->dev, "%s() pktid = %x, skb = %p\n", dev_dbg(pdata->dev,"%s() pktid = %x, skb = %p\n, vdmaid=%x",
__func__, pnode->pktid, pnode->skb); __func__, pnode->pktid, pnode->skb, pnode->vdmaid);
if ((ioctl_data.tx_ts.nsec & OSI_MAC_TCR_TXTSSMIS) == if ((ioctl_data.tx_ts.nsec & OSI_MAC_TCR_TXTSSMIS) ==
OSI_MAC_TCR_TXTSSMIS) { OSI_MAC_TCR_TXTSSMIS) {
@@ -5910,6 +5911,11 @@ static int ether_parse_dt(struct ether_priv_data *pdata)
dev_info(dev, "setting default PTP clk rate as 312.5MHz\n"); dev_info(dev, "setting default PTP clk rate as 312.5MHz\n");
pdata->ptp_ref_clock_speed = ETHER_DFLT_PTP_CLK; pdata->ptp_ref_clock_speed = ETHER_DFLT_PTP_CLK;
} }
if (osi_core->pre_sil == 0x1U) {
pdata->ptp_ref_clock_speed = ETHER_DFLT_PTP_CLK_UFPGA;
}
/* read promiscuous mode supported or not */ /* read promiscuous mode supported or not */
ret = of_property_read_u32(np, "nvidia,promisc_mode", ret = of_property_read_u32(np, "nvidia,promisc_mode",
&pdata->promisc_mode); &pdata->promisc_mode);

View File

@@ -112,6 +112,7 @@
* @brief Ethernet default PTP clock frequency * @brief Ethernet default PTP clock frequency
*/ */
#define ETHER_DFLT_PTP_CLK 312500000U #define ETHER_DFLT_PTP_CLK 312500000U
#define ETHER_DFLT_PTP_CLK_UFPGA 78125000U
/** /**
* @brief Ethernet default PTP default RxQ * @brief Ethernet default PTP default RxQ
@@ -391,6 +392,8 @@ struct ether_tx_ts_skb_list {
struct sk_buff *skb; struct sk_buff *skb;
/** packet id to identify timestamp */ /** packet id to identify timestamp */
unsigned int pktid; unsigned int pktid;
/** vdmaid to identify timestamp */
unsigned int vdmaid;
/** SKB jiffies to find time */ /** SKB jiffies to find time */
unsigned long pkt_jiffies; unsigned long pkt_jiffies;
}; };

View File

@@ -27,7 +27,7 @@ static inline unsigned int ether_get_free_tx_ts_node(struct ether_priv_data *pda
} }
static inline void add_skb_node(struct ether_priv_data *pdata, struct sk_buff *skb, static inline void add_skb_node(struct ether_priv_data *pdata, struct sk_buff *skb,
unsigned int pktid) { unsigned int pktid, unsigned int vdmaid) {
struct list_head *head_node, *temp_head_node; struct list_head *head_node, *temp_head_node;
struct ether_tx_ts_skb_list *pnode = NULL; struct ether_tx_ts_skb_list *pnode = NULL;
unsigned int idx; unsigned int idx;
@@ -72,6 +72,7 @@ empty:
pnode = &pdata->tx_ts_skb[idx]; pnode = &pdata->tx_ts_skb[idx];
pnode->skb = skb; pnode->skb = skb;
pnode->pktid = pktid; pnode->pktid = pktid;
pnode->vdmaid = vdmaid;
pnode->pkt_jiffies = now_jiffies; pnode->pkt_jiffies = now_jiffies;
dev_dbg(pdata->dev, "%s() SKB %p added for pktid = %x time=%lu\n", dev_dbg(pdata->dev, "%s() SKB %p added for pktid = %x time=%lu\n",
@@ -790,7 +791,7 @@ static void osd_transmit_complete(void *priv, const struct osi_tx_swcx *swcx,
ndev->stats.tx_packets++; ndev->stats.tx_packets++;
if ((txdone_pkt_cx->flags & OSI_TXDONE_CX_TS_DELAYED) == if ((txdone_pkt_cx->flags & OSI_TXDONE_CX_TS_DELAYED) ==
OSI_TXDONE_CX_TS_DELAYED) { OSI_TXDONE_CX_TS_DELAYED) {
add_skb_node(pdata, skb, txdone_pkt_cx->pktid); add_skb_node(pdata, skb, txdone_pkt_cx->pktid, txdone_pkt_cx->vdmaid);
/* Consume the timestamp immediately if already available */ /* Consume the timestamp immediately if already available */
if (ether_get_tx_ts(pdata) < 0) if (ether_get_tx_ts(pdata) < 0)
schedule_delayed_work(&pdata->tx_ts_work, schedule_delayed_work(&pdata->tx_ts_work,