Skip to content

Commit fb7516d

Browse files
Govindarajulu Varadarajandavem330
authored andcommitted
enic: add sw timestamp support
Add ethtool ops to advertise sw timestamping. Call skb_tx_timestamp() just before ringing the wq doorbell. Signed-off-by: Govindarajulu Varadarajan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b8278f2 commit fb7516d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/net/ethernet/cisco/enic/enic_ethtool.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <linux/netdevice.h>
2020
#include <linux/ethtool.h>
21+
#include <linux/net_tstamp.h>
2122

2223
#include "enic_res.h"
2324
#include "enic.h"
@@ -578,6 +579,16 @@ static int enic_set_rxfh(struct net_device *netdev, const u32 *indir,
578579
return __enic_set_rsskey(enic);
579580
}
580581

582+
static int enic_get_ts_info(struct net_device *netdev,
583+
struct ethtool_ts_info *info)
584+
{
585+
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
586+
SOF_TIMESTAMPING_RX_SOFTWARE |
587+
SOF_TIMESTAMPING_SOFTWARE;
588+
589+
return 0;
590+
}
591+
581592
static const struct ethtool_ops enic_ethtool_ops = {
582593
.get_drvinfo = enic_get_drvinfo,
583594
.get_msglevel = enic_get_msglevel,
@@ -597,6 +608,7 @@ static const struct ethtool_ops enic_ethtool_ops = {
597608
.get_rxfh = enic_get_rxfh,
598609
.set_rxfh = enic_set_rxfh,
599610
.get_link_ksettings = enic_get_ksettings,
611+
.get_ts_info = enic_get_ts_info,
600612
};
601613

602614
void enic_set_ethtool_ops(struct net_device *netdev)

drivers/net/ethernet/cisco/enic/enic_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
856856

857857
if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
858858
netif_tx_stop_queue(txq);
859+
skb_tx_timestamp(skb);
859860
if (!skb->xmit_more || netif_xmit_stopped(txq))
860861
vnic_wq_doorbell(wq);
861862

0 commit comments

Comments
 (0)