* [PATCH net-next] enic: add sw timestamp support
@ 2017-12-01 18:21 Govindarajulu Varadarajan
2017-12-03 15:16 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Govindarajulu Varadarajan @ 2017-12-01 18:21 UTC (permalink / raw)
To: davem, netdev; +Cc: benve, Govindarajulu Varadarajan
Add ethtool ops to advertise sw timestamping.
Call skb_tx_timestamp() just before ringing the wq doorbell.
Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
---
drivers/net/ethernet/cisco/enic/enic_ethtool.c | 12 ++++++++++++
drivers/net/ethernet/cisco/enic/enic_main.c | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index 462d0ce51240..efb9333c7cf8 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -18,6 +18,7 @@
#include <linux/netdevice.h>
#include <linux/ethtool.h>
+#include <linux/net_tstamp.h>
#include "enic_res.h"
#include "enic.h"
@@ -578,6 +579,16 @@ static int enic_set_rxfh(struct net_device *netdev, const u32 *indir,
return __enic_set_rsskey(enic);
}
+static int enic_get_ts_info(struct net_device *netdev,
+ struct ethtool_ts_info *info)
+{
+ info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
+ SOF_TIMESTAMPING_RX_SOFTWARE |
+ SOF_TIMESTAMPING_SOFTWARE;
+
+ return 0;
+}
+
static const struct ethtool_ops enic_ethtool_ops = {
.get_drvinfo = enic_get_drvinfo,
.get_msglevel = enic_get_msglevel,
@@ -597,6 +608,7 @@ static const struct ethtool_ops enic_ethtool_ops = {
.get_rxfh = enic_get_rxfh,
.set_rxfh = enic_set_rxfh,
.get_link_ksettings = enic_get_ksettings,
+ .get_ts_info = enic_get_ts_info,
};
void enic_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index e130fb757e7b..d98676e43e03 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -856,6 +856,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
netif_tx_stop_queue(txq);
+ skb_tx_timestamp(skb);
if (!skb->xmit_more || netif_xmit_stopped(txq))
vnic_wq_doorbell(wq);
--
2.15.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] enic: add sw timestamp support
2017-12-01 18:21 [PATCH net-next] enic: add sw timestamp support Govindarajulu Varadarajan
@ 2017-12-03 15:16 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-12-03 15:16 UTC (permalink / raw)
To: gvaradar; +Cc: netdev, benve
From: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date: Fri, 1 Dec 2017 10:21:40 -0800
> Add ethtool ops to advertise sw timestamping.
> Call skb_tx_timestamp() just before ringing the wq doorbell.
>
> Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
...
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index e130fb757e7b..d98676e43e03 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
> @@ -856,6 +856,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
>
> if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS)
> netif_tx_stop_queue(txq);
> + skb_tx_timestamp(skb);
> if (!skb->xmit_more || netif_xmit_stopped(txq))
> vnic_wq_doorbell(wq);
>
Applied, but if you even make this queue processing code lockless you will
have a use-after-free here as you're placing the SKB into the TX queue
before accessing the 'skb' via skb_tx_timestamp() and it thus could be
freed by TX completion beforehand.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-03 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-01 18:21 [PATCH net-next] enic: add sw timestamp support Govindarajulu Varadarajan
2017-12-03 15:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).