summaryrefslogtreecommitdiff
path: root/tstamping.c
blob: 860b7a0b28386c0896f8a9f60e11ef9afe4a5e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/sockios.h>
#include <linux/net_tstamp.h>
#include <linux/if_packet.h>
#include <linux/if.h>

#include "str.h"
#include "tstamping.h"

int set_sockopt_hwtimestamp(int sock, const char *dev)
{
	int timesource, ret;
	struct hwtstamp_config hwconfig;
	struct ifreq ifr;

	if (!strncmp("any", dev, strlen("any")))
		return -1;

	memset(&hwconfig, 0, sizeof(hwconfig));
	hwconfig.tx_type = HWTSTAMP_TX_OFF;
	hwconfig.rx_filter = HWTSTAMP_FILTER_ALL;

	memset(&ifr, 0, sizeof(ifr));
	strlcpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
	ifr.ifr_data = &hwconfig;

	ret = ioctl(sock, SIOCSHWTSTAMP, &ifr);
	if (ret < 0)
		return -1;

	timesource = SOF_TIMESTAMPING_RAW_HARDWARE;

	return setsockopt(sock, SOL_PACKET, PACKET_TIMESTAMP, &timesource,
			  sizeof(timesource));
}
' is set for ll_statahead(), sa_put() shouldn't kill the entry found, because its inflight RPC may not finish yet. * remove 'sai_generation', add 'lli_sa_generation' because the former one is not safe to access without lock. * revalidate_statahead_dentry() may fail to wait for statahead entry to become ready, in this case it should not release this entry, because it may be used by inflight statahead RPC. cleanups: * rename ll_statahead_enter() to ll_statahead(). * move dentry 'lld_sa_generation' update to ll_statahead() to simplify code and logic. * other small cleanups. Signed-off-by: Lai Siyao <lai.siyao@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3270 Reviewed-on: http://review.whamcloud.com/9667 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6222 Reviewed-on: http://review.whamcloud.com/13708 Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Bobi Jam <bobijam@hotmail.com> Reviewed-by: James Simmons <uja.ornl@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat