diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-04-01 18:20:23 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-02 00:43:18 +0400 |
commit | 408eccce32044ee3285a7f6a812723ba3540c3e7 (patch) | |
tree | 958eefea88ca8eb30cb6228df8b6a6878e146c64 /drivers | |
parent | 7baea6efb4b716db7d49c3a6815305dfe6afb888 (diff) | |
download | linux-408eccce32044ee3285a7f6a812723ba3540c3e7.tar.xz |
net: ptp: move PTP classifier in its own file
This commit fixes a build error reported by Fengguang, that is
triggered when CONFIG_NETWORK_PHY_TIMESTAMPING is not set:
ERROR: "ptp_classify_raw" [drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.ko] undefined!
The fix is to introduce its own file for the PTP BPF classifier,
so that PTP_1588_CLOCK and/or NETWORK_PHY_TIMESTAMPING can select
it independently from each other. IXP4xx driver on ARM needs to
select it as well since it does not seem to select PTP_1588_CLOCK
or similar that would pull it in automatically.
This also allows for hiding all of the internals of the BPF PTP
program inside that file, and only exporting relevant API bits
to drivers.
This patch also adds a kdoc documentation of ptp_classify_raw()
API to make it clear that it can return PTP_CLASS_* defines. Also,
the BPF program has been translated into bpf_asm code, so that it
can be more easily read and altered (extensively documented in [1]).
In the kernel tree under tools/net/ we have bpf_asm and bpf_dbg
tools, so the commented program can simply be translated via
`./bpf_asm -c prog` where prog is a file that contains the
commented code. This makes it easily readable/verifiable and when
there's a need to change something, jump offsets etc do not need
to be replaced manually which can be very error prone. Instead,
a newly translated version via bpf_asm can simply replace the old
code. I have checked opcode diffs before/after and it's the very
same filter.
[1] Documentation/networking/filter.txt
Fixes: 164d8c666521 ("net: ptp: do not reimplement PTP/BPF classifier")
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jiri Benc <jbenc@redhat.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/xscale/Kconfig | 1 | ||||
-rw-r--r-- | drivers/net/phy/dp83640.c | 1 | ||||
-rw-r--r-- | drivers/ptp/Kconfig | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/xscale/Kconfig b/drivers/net/ethernet/xscale/Kconfig index 3f431019e615..b81bc9fca378 100644 --- a/drivers/net/ethernet/xscale/Kconfig +++ b/drivers/net/ethernet/xscale/Kconfig @@ -23,6 +23,7 @@ config IXP4XX_ETH tristate "Intel IXP4xx Ethernet support" depends on ARM && ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR select PHYLIB + select NET_PTP_CLASSIFY ---help--- Say Y here if you want to use built-in Ethernet ports on IXP4xx processor. diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 352c5e45fe9c..6a999e6814a0 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -27,6 +27,7 @@ #include <linux/module.h> #include <linux/net_tstamp.h> #include <linux/netdevice.h> +#include <linux/if_vlan.h> #include <linux/phy.h> #include <linux/ptp_classify.h> #include <linux/ptp_clock_kernel.h> diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 5a7910e61e17..6963bdf54175 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig @@ -7,6 +7,7 @@ menu "PTP clock support" config PTP_1588_CLOCK tristate "PTP clock support" select PPS + select NET_PTP_CLASSIFY help The IEEE 1588 standard defines a method to precisely synchronize distributed clocks over Ethernet networks. The |