#ifndef _NET_DN_DEV_H #define _NET_DN_DEV_H struct dn_dev; struct dn_ifaddr { struct dn_ifaddr __rcu *ifa_next; struct dn_dev *ifa_dev; __le16 ifa_local; __le16 ifa_address; __u32 ifa_flags; __u8 ifa_scope; char ifa_label[IFNAMSIZ]; struct rcu_head rcu; }; #define DN_DEV_S_RU 0 /* Run - working normally */ #define DN_DEV_S_CR 1 /* Circuit Rejected */ #define DN_DEV_S_DS 2 /* Data Link Start */ #define DN_DEV_S_RI 3 /* Routing Layer Initialize */ #define DN_DEV_S_RV 4 /* Routing Layer Verify */ #define DN_DEV_S_RC 5 /* Routing Layer Complete */ #define DN_DEV_S_OF 6 /* Off */ #define DN_DEV_S_HA 7 /* Halt */ /* * The dn_dev_parms structure contains the set of parameters * for each device (hence inclusion in the dn_dev structure) * and an array is used to store the default types of supported * device (in dn_dev.c). * * The type field matches the ARPHRD_ constants and is used in * searching the list for supported devices when new devices * come up. * * The mode field is used to find out if a device is broadcast, * multipoint, or pointopoint. Please note that DECnet thinks * different ways about devices to the rest of the kernel * so the normal IFF_xxx flags are invalid here. For devices * which can be any combination of the previously mentioned * attributes, you can set this on a per device basis by * installing an up() routine. * * The device state field, defines the initial state in which the * device will come up. In the dn_dev structure, it is the actual * state. * * Things have changed here. I've killed timer1 since it's a user space * issue for a user space routing deamon to sort out. The kernel does * not need to be bothered with it. * * Timers: * t2 - Rate limit timer, min time between routing and hello messages * t3 - Hello timer, send hello messages when it expires * * Callbacks: * up() - Called to initialize device, return value can veto use of * device with DECnet. * down() - Called to turn device off when it goes down * timer3() - Called once for each ifaddr when timer 3 goes off * * sysctl - Hook for sysctl things * */ struct dn_dev_parms { int type; /* ARPHRD_xxx */ int mode; /* Broadcast, Unicast, Mulitpoint */ #define DN_DEV_BCAST 1 #define DN_DEV_UCAST 2 #define DN_DEV_MPOINT 4 int state; /* Initial state */ int forwarding; /* 0=EndNode, 1=L1Router, 2=L2Router */ unsigned long t2; /* Default value of t2 */ unsigned long t3; /* Default value of t3 */ int priority; /* Priority to be a router */ char *name; /* Name for sysctl */ int (*up)(struct net_device *); void (*down)(struct net_device *); void (*timer3)(struct net_device *, struct dn_ifaddr *ifa); void *sysctl; }; struct dn_dev { struct dn_ifaddr __rcu *ifa_list; struct net_device *dev; struct dn_dev_parms parms; char use_long; struct timer_list timer; unsigned long t3; struct neigh_parms *neigh_parms; __u8 addr[ETH_ALEN]; struct neighbour *router; /* Default router on circuit */ struct neighbour *peer; /* Peer on pointopoint links */ unsigned long uptime; /* Time device went up in jiffies */ }; struct dn_short_packet { __u8 msgflg; __le16 dstnode; __le16 srcnode; __u8 forward; } __packed; struct dn_long_packet { __u8 msgflg; __u8 d_area; __u8 d_subarea; __u8 d_id[6]; __u8 s_area; __u8 s_subarea; __u8 s_id[6]; __u8 nl2; __u8 visit_ct; __u8 s_class; __u8 pt; } __packed; /*------------------------- DRP - Routing messages ---------------------*/ struct endnode_hello_message { __u8 msgflg; __u8 tiver[3]; __u8 id[6]; __u8 iinfo; __le16 blksize; __u8 area; __u8 seed[8]; __u8 neighbor[6]; __le16 timer; __u8 mpd; __u8 datalen; __u8 data[2]; } __packed; struct rtnode_hello_message { __u8 msgflg; __u8 tiver[3]; __u8 id[6]; __u8 iinfo; __le16 blksize; __u8 priority; __u8 area; __le16 timer; __u8 mpd; } __packed; void dn_dev_init(void); void dn_dev_cleanup(void); int dn_dev_ioctl(unsigned int cmd, void __user *arg); void dn_dev_devices_off(void); void dn_dev_devices_on(void); void dn_dev_init_pkt(struct sk_buff *skb); void dn_dev_veri_pkt(struct sk_buff *skb); void dn_dev_hello(struct sk_buff *skb); void dn_dev_up(struct net_device *); void dn_dev_down(struct net_device *); int dn_dev_set_default(struct net_device *dev, int force); struct net_device *dn_dev_get_default(void); int dn_dev_bind_default(__le16 *addr); int register_dnaddr_notifier(struct notifier_block *nb); int unregister_dnaddr_notifier(struct notifier_block *nb); static inline int dn_dev_islocal(struct net_device *dev, __le16 addr) { struct dn_dev *dn_db; struct dn_ifaddr *ifa; int res = 0; rcu_read_lock(); dn_db = rcu_dereference(dev->dn_ptr); if (dn_db == NULL) { printk(KERN_DEBUG "dn_dev_islocal: Called for non DECnet device\n"); goto out; } for (ifa = rcu_dereference(dn_db->ifa_list); ifa != NULL; ifa = rcu_dereference(ifa->ifa_next)) if ((addr ^ ifa->ifa_local) == 0) { res = 1; break; } out: rcu_read_unlock(); return res; } #endif /* _NET_DN_DEV_H */ ---- 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-01Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds4-19/+26 Pull networking fixes from David Miller: 1) Fix handling of interrupt status in stmmac driver. Just because we have masked the event from generating interrupts, doesn't mean the bit won't still be set in the interrupt status register. From Alexey Brodkin. 2) Fix DMA API debugging splats in gianfar driver, from Arseny Solokha. 3) Fix off-by-one error in __ip6_append_data(), from Vlad Yasevich. 4) cls_flow does not match on icmpv6 codes properly, from Simon Horman. 5) Initial MAC address can be set incorrectly in some scenerios, from Ivan Vecera. 6) Packet header pointer arithmetic fix in ip6_tnl_parse_tlv_end_lim(), from Dan Carpenter. 7) Fix divide by zero in __tcp_select_window(), from Eric Dumazet. 8) Fix crash in iwlwifi when unregistering thermal zone, from Jens Axboe. 9) Check for DMA mapping errors in starfire driver, from Alexey Khoroshilov. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (31 commits) tcp: fix 0 divide in __tcp_select_window() ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() net: fix ndo_features_check/ndo_fix_features comment ordering net/sched: matchall: Fix configuration race be2net: fix initial MAC setting ipv6: fix flow labels when the traffic class is non-0 net: thunderx: avoid dereferencing xcv when NULL net/sched: cls_flower: Correct matching on ICMPv6 code ipv6: Paritially checksum full MTU frames net/mlx4_core: Avoid command timeouts during VF driver device shutdown gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page net: ethtool: add support for 2500BaseT and 5000BaseT link modes can: bcm: fix hrtimer/tasklet termination in bcm op removal net: adaptec: starfire: add checks for dma mapping errors net: phy: micrel: KSZ8795 do not set SUPPORTED_[Asym_]Pause can: Fix kernel panic at security_sock_rcv_skb net: macb: Fix 64 bit addressing support for GEM stmmac: Discard masked flags in interrupt status register net/mlx5e: Check ets capability before ets query FW command net/mlx5e: Fix update of hash function/key via ethtool ... 2017-02-01Merge branch 'for-linus' of ↵Linus Torvalds1-0/+1 git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull fscache fixes from Al Viro. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fscache: Fix dead object requeue fscache: Clear outstanding writes when disabling a cookie FS-Cache: Initialise stores_lock in netfs cookie 2017-02-01Merge tag 'wireless-drivers-next-for-davem-2017-02-01' of ↵David S. Miller2-1/+2 git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next Kalle Valo says: ==================== wireless-drivers-next patches for 4.11 It's nice to see rt2x00 development has becoming active, for example adding support for a new chip version. Also wcn36xx has been converted to use the recently merged QCOM_SMD subsystem. Otherwise new features and fixes it lots of drivers. Major changes: iwlwifi * some more work in preparation for A000 family support * add support for radiotap timestamps * some work on our firmware debugging capabilities wcn36xx * convert to a proper QCOM_SMD driver (from the platform_driver interface) ath10k * VHT160 support * dump Copy Engine registers during firmware crash * search board file extension from SMBIOS wil6210 * add disable_ap_sme module parameter rt2x00 * support RT3352 with external PA * support for RT3352 with 20MHz crystal * add support for RT5350 WiSoC brcmfmac * add support for BCM43455 sdio device rtl8xxxu * add support for D-Link DWA-131 rev E1, TP-Link TL-WN822N v4 and others ==================== Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net: fix ndo_features_check/ndo_fix_features comment orderingDimitris Michailidis1-14/+15 Commit cdba756f5803a2 ("net: move ndo_features_check() close to ndo_start_xmit()") inadvertently moved the doc comment for .ndo_fix_features instead of .ndo_features_check. Fix the comment ordering. Fixes: cdba756f5803a2 ("net: move ndo_features_check() close to ndo_start_xmit()") Signed-off-by: Dimitris Michailidis <dmichail@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>