/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _IMX_SSI_H #define _IMX_SSI_H #define SSI_STX0 0x00 #define SSI_STX1 0x04 #define SSI_SRX0 0x08 #define SSI_SRX1 0x0c #define SSI_SCR 0x10 #define SSI_SCR_CLK_IST (1 << 9) #define SSI_SCR_CLK_IST_SHIFT 9 #define SSI_SCR_TCH_EN (1 << 8) #define SSI_SCR_SYS_CLK_EN (1 << 7) #define SSI_SCR_I2S_MODE_NORM (0 << 5) #define SSI_SCR_I2S_MODE_MSTR (1 << 5) #define SSI_SCR_I2S_MODE_SLAVE (2 << 5) #define SSI_I2S_MODE_MASK (3 << 5) #define SSI_SCR_SYN (1 << 4) #define SSI_SCR_NET (1 << 3) #define SSI_SCR_RE (1 << 2) #define SSI_SCR_TE (1 << 1) #define SSI_SCR_SSIEN (1 << 0) #define SSI_SISR 0x14 #define SSI_SISR_MASK ((1 << 19) - 1) #define SSI_SISR_CMDAU (1 << 18) #define SSI_SISR_CMDDU (1 << 17) #define SSI_SISR_RXT (1 << 16) #define SSI_SISR_RDR1 (1 << 15) #define SSI_SISR_RDR0 (1 << 14) #define SSI_SISR_TDE1 (1 << 13) #define SSI_SISR_TDE0 (1 << 12) #define SSI_SISR_ROE1 (1 << 11) #define SSI_SISR_ROE0 (1 << 10) #define SSI_SISR_TUE1 (1 << 9) #define SSI_SISR_TUE0 (1 << 8) #define SSI_SISR_TFS (1 << 7) #define SSI_SISR_RFS (1 << 6) #define SSI_SISR_TLS (1 << 5) #define SSI_SISR_RLS (1 << 4) #define SSI_SISR_RFF1 (1 << 3) #define SSI_SISR_RFF0 (1 << 2) #define SSI_SISR_TFE1 (1 << 1) #define SSI_SISR_TFE0 (1 << 0) #define SSI_SIER 0x18 #define SSI_SIER_RDMAE (1 << 22) #define SSI_SIER_RIE (1 << 21) #define SSI_SIER_TDMAE (1 << 20) #define SSI_SIER_TIE (1 << 19) #define SSI_SIER_CMDAU_EN (1 << 18) #define SSI_SIER_CMDDU_EN (1 << 17) #define SSI_SIER_RXT_EN (1 << 16) #define SSI_SIER_RDR1_EN (1 << 15) #define SSI_SIER_RDR0_EN (1 << 14) #define SSI_SIER_TDE1_EN (1 << 13) #define SSI_SIER_TDE0_EN (1 << 12) #define SSI_SIER_ROE1_EN (1 << 11) #define SSI_SIER_ROE0_EN (1 << 10) #define SSI_SIER_TUE1_EN (1 << 9) #define SSI_SIER_TUE0_EN (1 << 8) #define SSI_SIER_TFS_EN (1 << 7) #define SSI_SIER_RFS_EN (1 << 6) #define SSI_SIER_TLS_EN (1 << 5) #define SSI_SIER_RLS_EN (1 << 4) #define SSI_SIER_RFF1_EN (1 << 3) #define SSI_SIER_RFF0_EN (1 << 2) #define SSI_SIER_TFE1_EN (1 << 1) #define SSI_SIER_TFE0_EN (1 << 0) #define SSI_STCR 0x1c #define SSI_STCR_TXBIT0 (1 << 9) #define SSI_STCR_TFEN1 (1 << 8) #define SSI_STCR_TFEN0 (1 << 7) #define SSI_FIFO_ENABLE_0_SHIFT 7 #define SSI_STCR_TFDIR (1 << 6) #define SSI_STCR_TXDIR (1 << 5) #define SSI_STCR_TSHFD (1 << 4) #define SSI_STCR_TSCKP (1 << 3) #define SSI_STCR_TFSI (1 << 2) #define SSI_STCR_TFSL (1 << 1) #define SSI_STCR_TEFS (1 << 0) #define SSI_SRCR 0x20 #define SSI_SRCR_RXBIT0 (1 << 9) #define SSI_SRCR_RFEN1 (1 << 8) #define SSI_SRCR_RFEN0 (1 << 7) #define SSI_FIFO_ENABLE_0_SHIFT 7 #define SSI_SRCR_RFDIR (1 << 6) #define SSI_SRCR_RXDIR (1 << 5) #define SSI_SRCR_RSHFD (1 << 4) #define SSI_SRCR_RSCKP (1 << 3) #define SSI_SRCR_RFSI (1 << 2) #define SSI_SRCR_RFSL (1 << 1) #define SSI_SRCR_REFS (1 << 0) #define SSI_SRCCR 0x28 #define SSI_SRCCR_DIV2 (1 << 18) #define SSI_SRCCR_PSR (1 << 17) #define SSI_SRCCR_WL(x) ((((x) - 2) >> 1) << 13) #define SSI_SRCCR_DC(x) (((x) & 0x1f) << 8) #define SSI_SRCCR_PM(x) (((x) & 0xff) << 0) #define SSI_SRCCR_WL_MASK (0xf << 13) #define SSI_SRCCR_DC_MASK (0x1f << 8) #define SSI_SRCCR_PM_MASK (0xff << 0) #define SSI_STCCR 0x24 #define SSI_STCCR_DIV2 (1 << 18) #define SSI_STCCR_PSR (1 << 17) #define SSI_STCCR_WL(x) ((((x) - 2) >> 1) << 13) #define SSI_STCCR_DC(x) (((x) & 0x1f) << 8) #define SSI_STCCR_PM(x) (((x) & 0xff) << 0) #define SSI_STCCR_WL_MASK (0xf << 13) #define SSI_STCCR_DC_MASK (0x1f << 8) #define SSI_STCCR_PM_MASK (0xff << 0) #define SSI_SFCSR 0x2c #define SSI_SFCSR_RFCNT1(x) (((x) & 0xf) << 28) #define SSI_RX_FIFO_1_COUNT_SHIFT 28 #define SSI_SFCSR_TFCNT1(x) (((x) & 0xf) << 24) #define SSI_TX_FIFO_1_COUNT_SHIFT 24 #define SSI_SFCSR_RFWM1(x) (((x) & 0xf) << 20) #define SSI_SFCSR_TFWM1(x) (((x) & 0xf) << 16) #define SSI_SFCSR_RFCNT0(x) (((x) & 0xf) << 12) #define SSI_RX_FIFO_0_COUNT_SHIFT 12 #define SSI_SFCSR_TFCNT0(x) (((x) & 0xf) << 8) #define SSI_TX_FIFO_0_COUNT_SHIFT 8 #define SSI_SFCSR_RFWM0(x) (((x) & 0xf) << 4) #define SSI_SFCSR_TFWM0(x) (((x) & 0xf) << 0) #define SSI_SFCSR_RFWM0_MASK (0xf << 4) #define SSI_SFCSR_TFWM0_MASK (0xf << 0) #define SSI_STR 0x30 #define SSI_STR_TEST (1 << 15) #define SSI_STR_RCK2TCK (1 << 14) #define SSI_STR_RFS2TFS (1 << 13) #define SSI_STR_RXSTATE(x) (((x) & 0xf) << 8) #define SSI_STR_TXD2RXD (1 << 7) #define SSI_STR_TCK2RCK (1 << 6) #define SSI_STR_TFS2RFS (1 << 5) #define SSI_STR_TXSTATE(x) (((x) & 0xf) << 0) #define SSI_SOR 0x34 #define SSI_SOR_CLKOFF (1 << 6) #define SSI_SOR_RX_CLR (1 << 5) #define SSI_SOR_TX_CLR (1 << 4) #define SSI_SOR_INIT (1 << 3) #define SSI_SOR_WAIT(x) (((x) & 0x3) << 1) #define SSI_SOR_WAIT_MASK (0x3 << 1) #define SSI_SOR_SYNRST (1 << 0) #define SSI_SACNT 0x38 #define SSI_SACNT_FRDIV(x) (((x) & 0x3f) << 5) #define SSI_SACNT_WR (1 << 4) #define SSI_SACNT_RD (1 << 3) #define SSI_SACNT_TIF (1 << 2) #define SSI_SACNT_FV (1 << 1) #define SSI_SACNT_AC97EN (1 << 0) #define SSI_SACADD 0x3c #define SSI_SACDAT 0x40 #define SSI_SATAG 0x44 #define SSI_STMSK 0x48 #define SSI_SRMSK 0x4c #define SSI_SACCST 0x50 #define SSI_SACCEN 0x54 #define SSI_SACCDIS 0x58 /* SSI clock sources */ #define IMX_SSP_SYS_CLK 0 /* SSI audio dividers */ #define IMX_SSI_TX_DIV_2 0 #define IMX_SSI_TX_DIV_PSR 1 #define IMX_SSI_TX_DIV_PM 2 #define IMX_SSI_RX_DIV_2 3 #define IMX_SSI_RX_DIV_PSR 4 #define IMX_SSI_RX_DIV_PM 5 #define DRV_NAME "imx-ssi" #include #include #include #include "imx-pcm.h" struct imx_ssi { struct platform_device *ac97_dev; struct snd_soc_dai *imx_ac97; struct clk *clk; void __iomem *base; int irq; int fiq_enable; unsigned int offset; unsigned int flags; void (*ac97_reset) (struct snd_ac97 *ac97); void (*ac97_warm_reset)(struct snd_ac97 *ac97); struct snd_dmaengine_dai_dma_data dma_params_rx; struct snd_dmaengine_dai_dma_data dma_params_tx; struct imx_dma_data filter_data_tx; struct imx_dma_data filter_data_rx; struct imx_pcm_fiq_params fiq_params; int fiq_init; int dma_init; }; #endif /* _IMX_SSI_H */ llow up patch. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-08netfilter: nf_tables: add flush field to struct nft_set_iterPablo Neira Ayuso1-0/+1 This provides context to walk callback iterator, thus, we know if the walk happens from the set flush path. This is required by the new bitmap set type coming in a follow up patch which has no real struct nft_set_ext, so it has to allocate it based on the two bit compact element representation. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-08netfilter: nf_tables: rename deactivate_one() to flush()Pablo Neira Ayuso1-4/+4 Although semantics are similar to deactivate() with no implicit element lookup, this is only called from the set flush path, so better rename this to flush(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-08netfilter: nf_tables: pass netns to set->ops->remove()Pablo Neira Ayuso1-1/+2 This new parameter is required by the new bitmap set type that comes in a follow up patch. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-08netfilter: nft_exthdr: Add support for existence checkPhil Sutter1-0/+6 If NFT_EXTHDR_F_PRESENT is set, exthdr will not copy any header field data into *dest, but instead set it to 1 if the header is found and 0 otherwise. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-03net: remove support for per driver ndo_busy_poll()Eric Dumazet2-5/+0 We added generic support for busy polling in NAPI layer in linux-4.5 No network driver uses ndo_busy_poll() anymore, we can get rid of the pointer in struct net_device_ops, and its use in sk_busy_loop() Saves NETIF_F_BUSY_POLL features bit. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-nextDavid S. Miller11-40/+60 Pablo Neira Ayuso says: ==================== Netfilter updates for net-next The following patchset contains Netfilter updates for your net-next tree, they are: 1) Stash ctinfo 3-bit field into pointer to nf_conntrack object from sk_buff so we only access one single cacheline in the conntrack hotpath. Patchset from Florian Westphal. 2) Don't leak pointer to internal structures when exporting x_tables ruleset back to userspace, from Willem DeBruijn. This includes new helper functions to copy data to userspace such as xt_data_to_user() as well as conversions of our ip_tables, ip6_tables and arp_tables clients to use it. Not surprinsingly, ebtables requires an ad-hoc update. There is also a new field in x_tables extensions to indicate the amount of bytes that we copy to userspace. 3) Add nf_log_all_netns sysctl: This new knob allows you to enable logging via nf_log infrastructure for all existing netnamespaces. Given the effort to provide pernet syslog has been discontinued, let's provide a way to restore logging using netfilter kernel logging facilities in trusted environments. Patch from Michal Kubecek. 4) Validate SCTP checksum from conntrack helper, from Davide Caratti. 5) Merge UDPlite conntrack and NAT helpers into UDP, this was mostly a copy&paste from the original helper, from Florian Westphal. 6) Reset netfilter state when duplicating packets, also from Florian. 7) Remove unnecessary check for broadcast in IPv6 in pkttype match and nft_meta, from Liping Zhang. 8) Add missing code to deal with loopback packets from nft_meta when used by the netdev family, also from Liping. 9) Several cleanups on nf_tables, one to remove unnecessary check from the netlink control plane path to add table, set and stateful objects and code consolidation when unregister chain hooks, from Gao Feng. 10) Fix harmless reference counter underflow in IPVS that, however, results in problems with the introduction of the new refcount_t type, from David Windsor. 11) Enable LIBCRC32C from nf_ct_sctp instead of nf_nat_sctp, from Davide Caratti. 12) Missing documentation on nf_tables uapi header, from Liping Zhang. 13) Use rb_entry() helper in xt_connlimit, from Geliang Tang. ==================== Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03sched: cls_flower: expose priority to offloading netdeviceJiri Pirko1-0/+1 The driver that offloads flower rules needs to know with which priority user inserted the rules. So add this information into offload struct. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03lib: Introduce priority array area managerJiri Pirko1-0/+76 This introduces a infrastructure for management of linear priority areas. Priority order in an array matters, however order of items inside a priority group does not matter. As an initial implementation, L-sort algorithm is used. It is quite trivial. More advanced algorithm called P-sort will be introduced as a follow-up. The infrastructure is prepared for other algos. Alongside this, a testing module is introduced as well. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03list: introduce list_for_each_entry_from_reverse helperJiri Pirko1-0/+13 Similar to list_for_each_entry_continue and its reverse variant list_for_each_entry_continue_reverse, introduce reverse helper for list_for_each_entry_from. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03trace: rename trace_print_hex_seq arg and add kdocDaniel Borkmann2-3/+3 Steven suggested to improve trace_print_hex_seq() a bit after commit 2acae0d5b0f7 ("trace: add variant without spacing in trace_print_hex_seq") in two ways: i) by adding a kdoc comment for the helper function itself and ii) by renaming 'spacing' argument into 'concatenate' to better denote that we don't add spaces between each hex bytes. Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03bridge: uapi: add per vlan tunnel infoRoopa Prabhu3-0/+13 New nested netlink attribute to associate tunnel info per vlan. This is used by bridge driver to send tunnel metadata to bridge ports in vlan tunnel mode. This patch also adds new per port flag IFLA_BRPORT_VLAN_TUNNEL to enable vlan tunnel mode. off by default. One example use for this is a vxlan bridging gateway or vtep which maps vlans to vn-segments (or vnis). User can configure per-vlan tunnel information which the bridge driver can use to bridge vlan into the corresponding vn-segment. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03vxlan: support fdb and learning in COLLECT_METADATA modeRoopa Prabhu1-0/+1 Vxlan COLLECT_METADATA mode today solves the per-vni netdev scalability problem in l3 networks. It expects all forwarding information to be present in dst_metadata. This patch series enhances collect metadata mode to include the case where only vni is present in dst_metadata, and the vxlan driver can then use the rest of the forwarding information datbase to make forwarding decisions. There is no change to default COLLECT_METADATA behaviour. These changes only apply to COLLECT_METADATA when used with the bridging use-case with a special dst_metadata tunnel info flag (eg: where vxlan device is part of a bridge). For all this to work, the vxlan driver will need to now support a single fdb table hashed by mac + vni. This series essentially makes this happen. use-case and workflow: vxlan collect metadata device participates in bridging vlan to vn-segments. Bridge driver above the vxlan device, sends the vni corresponding to the vlan in the dst_metadata. vxlan driver will lookup forwarding database with (mac + vni) for the required remote destination information to forward the packet. Changes introduced by this patch: - allow learning and forwarding database state in vxlan netdev in COLLECT_METADATA mode. Current behaviour is not changed by default. tunnel info flag IP_TUNNEL_INFO_BRIDGE is used to support the new bridge friendly mode. - A single fdb table hashed by (mac, vni) to allow fdb entries with multiple vnis in the same fdb table - rx path already has the vni - tx path expects a vni in the packet with dst_metadata - prior to this series, fdb remote_dsts carried remote vni and the vxlan device carrying the fdb table represented the source vni. With the vxlan device now representing multiple vnis, this patch adds a src vni attribute to the fdb entry. The remote vni already uses NDA_VNI attribute. This patch introduces NDA_SRC_VNI netlink attribute to represent the src vni in a multi vni fdb table. iproute2 example (patched and pruned iproute2 output to just show relevant fdb entries): example shows same host mac learnt on two vni's. before (netdev per vni): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan1000 dst 12.0.0.8 self after this patch with collect metadata in bridged mode (single netdev): $bridge fdb show | grep "00:02:00:00:00:03" 00:02:00:00:00:03 dev vxlan0 src_vni 1001 dst 12.0.0.8 self 00:02:00:00:00:03 dev vxlan0 src_vni 1000 dst 12.0.0.8 self Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03ip_tunnels: new IP_TUNNEL_INFO_BRIDGE flag for ip_tunnel_info modeRoopa Prabhu1-0/+1 New ip_tunnel_info flag to represent bridged tunnel metadata. Used by bridge driver later in the series to pass per vlan dst metadata to bridge ports. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03net/sched: act_ife: Change to use ife moduleYotam Gigi2-10/+1 Use the encode/decode functionality from the ife module instead of using implementation inside the act_ife. Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03net: Introduce ife encapsulation moduleYotam Gigi3-0/+70 This module is responsible for the ife encapsulation protocol encode/decode logics. That module can: - ife_encode: encode skb and reserve space for the ife meta header - ife_decode: decode skb and extract the meta header size - ife_tlv_meta_encode - encodes one tlv entry into the reserved ife header space. - ife_tlv_meta_decode - decodes one tlv entry from the packet - ife_tlv_meta_next - advance to the next tlv Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03net/sched: act_ife: Unexport ife_tlv_meta_encodeYotam Gigi1-2/+0 As the function ife_tlv_meta_encode is not used by any other module, unexport it and make it static for the act_ife module. Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03tcp: add tcp_mss_clamp() helperEric Dumazet1-0/+9 Small cleanup factorizing code doing the TCP_MAXSEG clamping. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: add LINUX_MIB_PFMEMALLOCDROP counterEric Dumazet1-0/+1 Debugging issues caused by pfmemalloc is often tedious. Add a new SNMP counter to more easily diagnose these problems. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Josef Bacik <jbacik@fb.com> Acked-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: phy: marvell: Add support for 88e1545 PHYAndrew Lunn1-0/+1 The 88e1545 PHYs are discrete Marvell PHYs, found in a quad package on the zii-devel-b board. Add support for it to the Marvell PHY driver. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02unix: add ioctl to open a unix socket file with O_PATHAndrey Vagin1-0/+2 This ioctl opens a file to which a socket is bound and returns a file descriptor. The caller has to have CAP_NET_ADMIN in the socket network namespace. Currently it is impossible to get a path and a mount point for a socket file. socket_diag reports address, device ID and inode number for unix sockets. An address can contain a relative path or a file may be moved somewhere. And these properties say nothing about a mount namespace and a mount point of a socket file. With the introduced ioctl, we can get a path by reading /proc/self/fd/X and get mnt_id from /proc/self/fdinfo/X. In CRIU we are going to use this ioctl to dump and restore unix socket. Here is an example how it can be used: $ strace -e socket,bind,ioctl ./test /tmp/test_sock socket(AF_UNIX, SOCK_STREAM, 0) = 3 bind(3, {sa_family=AF_UNIX, sun_path="test_sock"}, 11) = 0 ioctl(3, SIOCUNIXFILE, 0) = 4 ^Z $ ss -a | grep test_sock u_str LISTEN 0 1 test_sock 17798 * 0 $ ls -l /proc/760/fd/{3,4} lrwx------ 1 root root 64 Feb 1 09:41 3 -> 'socket:[17798]' l--------- 1 root root 64 Feb 1 09:41 4 -> /tmp/test_sock $ cat /proc/760/fdinfo/4 pos: 0 flags: 012000000 mnt_id: 40 $ cat /proc/self/mountinfo | grep "^40\s" 40 19 0:37 / /tmp rw shared:23 - tmpfs tmpfs rw Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: phy: Marvell: Add mv88e6390 internal PHYAndrew Lunn1-0/+6 The mv88e6390 Ethernet switch has internal PHYs. These PHYs don't have an model ID in the ID2 register. So the MDIO driver in the switch intercepts reads to this register, and returns the switch family ID. Extend the Marvell PHY driver by including this ID, and treat the PHY as a 88E1540. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller9-30/+40 All merge conflicts were simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02netfilter: allow logging from non-init namespacesMichal Kubeček1-0/+3 Commit 69b34fb996b2 ("netfilter: xt_LOG: add net namespace support for xt_LOG") disabled logging packets using the LOG target from non-init namespaces. The motivation was to prevent containers from flooding kernel log of the host. The plan was to keep it that way until syslog namespace implementation allows containers to log in a safe way. However, the work on syslog namespace seems to have hit a dead end somewhere in 2013 and there are users who want to use xt_LOG in all network namespaces. This patch allows to do so by setting /proc/sys/net/netfilter/nf_log_all_netns to a nonzero value. This sysctl is only accessible from init_net so that one cannot switch the behaviour from inside a container. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02ipvs: free ip_vs_dest structs when refcnt=0David Windsor1-1/+1 Currently, the ip_vs_dest cache frees ip_vs_dest objects when their reference count becomes < 0. Aside from not being semantically sound, this is problematic for the new type refcount_t, which will be introduced shortly in a separate patch. refcount_t is the new kernel type for holding reference counts, and provides overflow protection and a constrained interface relative to atomic_t (the type currently being used for kernel reference counts). Per Julian Anastasov: "The problem is that dest_trash currently holds deleted dests (unlinked from RCU lists) with refcnt=0." Changing dest_trash to hold dest with refcnt=1 will allow us to free ip_vs_dest structs when their refcnt=0, in ip_vs_dest_put_and_free(). Signed-off-by: David Windsor <dwindsor@gmail.com> Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02netfilter: merge ctinfo into nfct pointer storage areaFlorian Westphal2-17/+15 After this change conntrack operations (lookup, creation, matching from ruleset) only access one instead of two sk_buff cache lines. This works for normal conntracks because those are allocated from a slab that guarantees hw cacheline or 8byte alignment (whatever is larger) so the 3 bits needed for ctinfo won't overlap with nf_conn addresses. Template allocation now does manual address alignment (see previous change) on arches that don't have sufficent kmalloc min alignment. Some spots intentionally use skb->_nfct instead of skb_nfct() helpers, this is to avoid undoing the skb_nfct() use when we remove untracked conntrack object in the future. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02netfilter: guarantee 8 byte minalign for template addressesFlorian Westphal1-0/+2 The next change will merge skb->nfct pointer and skb->nfctinfo status bits into single skb->_nfct (unsigned long) area. For this to work nf_conn addresses must always be aligned at least on an 8 byte boundary since we will need the lower 3bits to store nfctinfo. Conntrack templates are allocated via kmalloc. kbuild test robot reported BUILD_BUG_ON failed: NFCT_INFOMASK >= ARCH_KMALLOC_MINALIGN on v1 of this patchset, so not all platforms meet this requirement. Do manual alignment if needed, the alignment offset is stored in the nf_conn entry protocol area. This works because templates are not handed off to L4 protocol trackers. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02netfilter: add and use nf_ct_set helperFlorian Westphal2-2/+9 Add a helper to assign a nf_conn entry and the ctinfo bits to an sk_buff. This avoids changing code in followup patch that merges skb->nfct and skb->nfctinfo into skb->_nfct. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02skbuff: add and use skb_nfct helperFlorian Westphal2-4/+11 Followup patch renames skb->nfct and changes its type so add a helper to avoid intrusive rename change later. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02netfilter: reduce direct skb->nfct usageFlorian Westphal1-3/+6 Next patch makes direct skb->nfct access illegal, reduce noise in next patch by using accessors we already have. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 2017-02-02netfilter: conntrack: no need to pass ctinfo to error handlerFlorian Westphal1-1/+1 It is never accessed for reading and the only places that write to it are the icmp(6) handlers, which also set skb->nfct (and skb->nfctinfo). The conntrack core specifically checks for attached skb->nfct after ->error() invocation and returns early in this case. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>