mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-06 11:36:39 +07:00
cd6362befe
Pull networking updates from David Miller: "Here is my initial pull request for the networking subsystem during this merge window: 1) Support for ESN in AH (RFC 4302) from Fan Du. 2) Add full kernel doc for ethtool command structures, from Ben Hutchings. 3) Add BCM7xxx PHY driver, from Florian Fainelli. 4) Export computed TCP rate information in netlink socket dumps, from Eric Dumazet. 5) Allow IPSEC SA to be dumped partially using a filter, from Nicolas Dichtel. 6) Convert many drivers to pci_enable_msix_range(), from Alexander Gordeev. 7) Record SKB timestamps more efficiently, from Eric Dumazet. 8) Switch to microsecond resolution for TCP round trip times, also from Eric Dumazet. 9) Clean up and fix 6lowpan fragmentation handling by making use of the existing inet_frag api for it's implementation. 10) Add TX grant mapping to xen-netback driver, from Zoltan Kiss. 11) Auto size SKB lengths when composing netlink messages based upon past message sizes used, from Eric Dumazet. 12) qdisc dumps can take a long time, add a cond_resched(), From Eric Dumazet. 13) Sanitize netpoll core and drivers wrt. SKB handling semantics. Get rid of never-used-in-tree netpoll RX handling. From Eric W Biederman. 14) Support inter-address-family and namespace changing in VTI tunnel driver(s). From Steffen Klassert. 15) Add Altera TSE driver, from Vince Bridgers. 16) Optimizing csum_replace2() so that it doesn't adjust the checksum by checksumming the entire header, from Eric Dumazet. 17) Expand BPF internal implementation for faster interpreting, more direct translations into JIT'd code, and much cleaner uses of BPF filtering in non-socket ocntexts. From Daniel Borkmann and Alexei Starovoitov" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1976 commits) netpoll: Use skb_irq_freeable to make zap_completion_queue safe. net: Add a test to see if a skb is freeable in irq context qlcnic: Fix build failure due to undefined reference to `vxlan_get_rx_port' net: ptp: move PTP classifier in its own file net: sxgbe: make "core_ops" static net: sxgbe: fix logical vs bitwise operation net: sxgbe: sxgbe_mdio_register() frees the bus Call efx_set_channels() before efx->type->dimension_resources() xen-netback: disable rogue vif in kthread context net/mlx4: Set proper build dependancy with vxlan be2net: fix build dependency on VxLAN mac802154: make csma/cca parameters per-wpan mac802154: allow only one WPAN to be up at any given time net: filter: minor: fix kdoc in __sk_run_filter netlink: don't compare the nul-termination in nla_strcmp can: c_can: Avoid led toggling for every packet. can: c_can: Simplify TX interrupt cleanup can: c_can: Store dlc private can: c_can: Reduce register access can: c_can: Make the code readable ...
78 lines
2.4 KiB
C
78 lines
2.4 KiB
C
/*
|
|
* OF helpers for network devices.
|
|
*
|
|
* This file is released under the GPLv2
|
|
*
|
|
* Initially copied out of arch/powerpc/kernel/prom_parse.c
|
|
*/
|
|
#include <linux/etherdevice.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/of_net.h>
|
|
#include <linux/phy.h>
|
|
#include <linux/export.h>
|
|
|
|
/**
|
|
* of_get_phy_mode - Get phy mode for given device_node
|
|
* @np: Pointer to the given device_node
|
|
*
|
|
* The function gets phy interface string from property 'phy-mode' or
|
|
* 'phy-connection-type', and return its index in phy_modes table, or errno in
|
|
* error case.
|
|
*/
|
|
int of_get_phy_mode(struct device_node *np)
|
|
{
|
|
const char *pm;
|
|
int err, i;
|
|
|
|
err = of_property_read_string(np, "phy-mode", &pm);
|
|
if (err < 0)
|
|
err = of_property_read_string(np, "phy-connection-type", &pm);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
for (i = 0; i < PHY_INTERFACE_MODE_MAX; i++)
|
|
if (!strcasecmp(pm, phy_modes(i)))
|
|
return i;
|
|
|
|
return -ENODEV;
|
|
}
|
|
EXPORT_SYMBOL_GPL(of_get_phy_mode);
|
|
|
|
/**
|
|
* Search the device tree for the best MAC address to use. 'mac-address' is
|
|
* checked first, because that is supposed to contain to "most recent" MAC
|
|
* address. If that isn't set, then 'local-mac-address' is checked next,
|
|
* because that is the default address. If that isn't set, then the obsolete
|
|
* 'address' is checked, just in case we're using an old device tree.
|
|
*
|
|
* Note that the 'address' property is supposed to contain a virtual address of
|
|
* the register set, but some DTS files have redefined that property to be the
|
|
* MAC address.
|
|
*
|
|
* All-zero MAC addresses are rejected, because those could be properties that
|
|
* exist in the device tree, but were not set by U-Boot. For example, the
|
|
* DTS could define 'mac-address' and 'local-mac-address', with zero MAC
|
|
* addresses. Some older U-Boots only initialized 'local-mac-address'. In
|
|
* this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
|
|
* but is all zeros.
|
|
*/
|
|
const void *of_get_mac_address(struct device_node *np)
|
|
{
|
|
struct property *pp;
|
|
|
|
pp = of_find_property(np, "mac-address", NULL);
|
|
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
|
|
return pp->value;
|
|
|
|
pp = of_find_property(np, "local-mac-address", NULL);
|
|
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
|
|
return pp->value;
|
|
|
|
pp = of_find_property(np, "address", NULL);
|
|
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
|
|
return pp->value;
|
|
|
|
return NULL;
|
|
}
|
|
EXPORT_SYMBOL(of_get_mac_address);
|