mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
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:
committed by
Bhadram Varka
parent
7e2c08add0
commit
eb29db2879
@@ -68,11 +68,12 @@ int ether_get_tx_ts(struct ether_priv_data *pdata)
|
||||
|
||||
ioctl_data.cmd = OSI_CMD_GET_TX_TS;
|
||||
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);
|
||||
if (ret == 0) {
|
||||
/* get time stamp form ethernet server */
|
||||
dev_dbg(pdata->dev, "%s() pktid = %x, skb = %p\n",
|
||||
__func__, pnode->pktid, pnode->skb);
|
||||
dev_dbg(pdata->dev,"%s() pktid = %x, skb = %p\n, vdmaid=%x",
|
||||
__func__, pnode->pktid, pnode->skb, pnode->vdmaid);
|
||||
|
||||
if ((ioctl_data.tx_ts.nsec & 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");
|
||||
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 */
|
||||
ret = of_property_read_u32(np, "nvidia,promisc_mode",
|
||||
&pdata->promisc_mode);
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
* @brief Ethernet default PTP clock frequency
|
||||
*/
|
||||
#define ETHER_DFLT_PTP_CLK 312500000U
|
||||
#define ETHER_DFLT_PTP_CLK_UFPGA 78125000U
|
||||
|
||||
/**
|
||||
* @brief Ethernet default PTP default RxQ
|
||||
@@ -391,6 +392,8 @@ struct ether_tx_ts_skb_list {
|
||||
struct sk_buff *skb;
|
||||
/** packet id to identify timestamp */
|
||||
unsigned int pktid;
|
||||
/** vdmaid to identify timestamp */
|
||||
unsigned int vdmaid;
|
||||
/** SKB jiffies to find time */
|
||||
unsigned long pkt_jiffies;
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
unsigned int pktid) {
|
||||
unsigned int pktid, unsigned int vdmaid) {
|
||||
struct list_head *head_node, *temp_head_node;
|
||||
struct ether_tx_ts_skb_list *pnode = NULL;
|
||||
unsigned int idx;
|
||||
@@ -72,6 +72,7 @@ empty:
|
||||
pnode = &pdata->tx_ts_skb[idx];
|
||||
pnode->skb = skb;
|
||||
pnode->pktid = pktid;
|
||||
pnode->vdmaid = vdmaid;
|
||||
pnode->pkt_jiffies = now_jiffies;
|
||||
|
||||
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++;
|
||||
if ((txdone_pkt_cx->flags & 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 */
|
||||
if (ether_get_tx_ts(pdata) < 0)
|
||||
schedule_delayed_work(&pdata->tx_ts_work,
|
||||
|
||||
Reference in New Issue
Block a user