* [PATCH net-next] net: phy: icplus: add config_intr callback
From: Heiner Kallweit @ 2018-11-11 20:49 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
Move IRQ configuration for IP101A/G from config_init to config_intr
callback. Reasons:
1. This allows phylib to disable interrupts if needed.
2. Icplus was the only driver supporting interrupts w/o defining a
config_intr callback. Now we can add a phylib plausibility check
disabling interrupt mode if one of the two irq-related callbacks
isn't defined.
I don't own hardware with this PHY, and the change is based on the
datasheet for IP101A LF (which is supposed to be register-compatible
with IP101A/G). Change is compile-tested only.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/icplus.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index 21ce68964..ad87bd328 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -42,8 +42,8 @@ MODULE_LICENSE("GPL");
#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
#define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */
-#define IP101A_G_IRQ_PIN_USED (1<<15) /* INTR pin used */
-#define IP101A_G_IRQ_DEFAULT IP101A_G_IRQ_PIN_USED
+#define IP101A_G_IRQ_PIN_USED BIT(15) /* INTR pin used */
+#define IP101A_G_NO_IRQ BIT(11) /* IRQ's inactive */
static int ip175c_config_init(struct phy_device *phydev)
{
@@ -170,11 +170,6 @@ static int ip101a_g_config_init(struct phy_device *phydev)
if (c < 0)
return c;
- /* INTR pin used: speed/link/duplex will cause an interrupt */
- c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT);
- if (c < 0)
- return c;
-
/* Enable Auto Power Saving mode */
c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
c |= IP101A_G_APS_ON;
@@ -201,6 +196,19 @@ static int ip175c_config_aneg(struct phy_device *phydev)
return 0;
}
+static int ip101a_g_config_intr(struct phy_device *phydev)
+{
+ u16 val;
+
+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+ /* INTR pin used: Speed/link/duplex will cause an interrupt */
+ val = IP101A_G_IRQ_PIN_USED;
+ else
+ val = IP101A_G_NO_IRQ;
+
+ return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
+}
+
static int ip101a_g_ack_interrupt(struct phy_device *phydev)
{
int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
@@ -234,6 +242,7 @@ static struct phy_driver icplus_driver[] = {
.name = "ICPlus IP101A/G",
.phy_id_mask = 0x0ffffff0,
.features = PHY_BASIC_FEATURES,
+ .config_intr = ip101a_g_config_intr,
.ack_interrupt = ip101a_g_ack_interrupt,
.config_init = &ip101a_g_config_init,
.suspend = genphy_suspend,
--
2.19.1
^ permalink raw reply related
* Why Me In This Terrible Condition.
From: Mrs Franisca carlsen @ 2018-11-11 20:51 UTC (permalink / raw)
Greetings My Dear,
I sent this mail praying it will found you in a good condition of
health, since I myself are in a very critical health condition in
which I sleep every night without knowing if I may be alive to see
the next day. I am Mrs. Francisca Carlsen from Denmark wife of late
Mr John Carlsen, a widow suffering from long time illness. I have some
funds I inherited from my late husband, the sum of (eleven million
dollars) my Doctor told me recently that I have serious sickness which
is cancer problem. What disturbs me most is my stroke sickness. Having
known my condition, I decided to donate this fund to a good person
that will utilize it the way i am going to instruct herein. I need a
very honest and God fearing person who can claim this money and use it
for Charity works, for orphanages, widows and also build schools for
less privileges that will be named after my late husband if possible
and to promote the word of God and the effort that the house of God is
maintained.
I do not want a situation where this money will be used in an ungodly
manner. That's why I'm taking this decision. I'm not afraid of death,
so I know where I'm going. I accept this decision because I do not
have any child who will inherit this money after I die. Please I want
your sincerely and urgent answer to know if you will be able to
execute this project, and I will give you more information on how the
fund will be transferred to your bank account. I am waiting for your
reply.
May God Bless you,
Mrs. Francisca Carlsen
^ permalink raw reply
* [PATCH net-next] net: phy: switch to lockdep_assert_held in phylib
From: Heiner Kallweit @ 2018-11-11 21:33 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
These checks are relevant during development / testing only,
therefore switch to lockdep_assert_held and friends.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/mdio_bus.c | 4 ++--
drivers/net/phy/phy.c | 2 +-
drivers/net/phy/phy_device.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 2e59a8419..5cb06f021 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -541,7 +541,7 @@ int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
{
int retval;
- WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock));
+ lockdep_assert_held_once(&bus->mdio_lock);
retval = bus->read(bus, addr, regnum);
@@ -566,7 +566,7 @@ int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val)
{
int err;
- WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock));
+ lockdep_assert_held_once(&bus->mdio_lock);
err = bus->write(bus, addr, regnum, val);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 083977d2f..b0b3c9ac4 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -514,7 +514,7 @@ static int phy_check_link_status(struct phy_device *phydev)
{
int err;
- WARN_ON(!mutex_is_locked(&phydev->lock));
+ lockdep_assert_held(&phydev->lock);
err = phy_read_status(phydev);
if (err)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0f56d408b..1c20a0df3 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1340,7 +1340,7 @@ int __phy_resume(struct phy_device *phydev)
struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
int ret = 0;
- WARN_ON(!mutex_is_locked(&phydev->lock));
+ lockdep_assert_held(&phydev->lock);
if (phydev->drv && phydrv->resume)
ret = phydrv->resume(phydev);
--
2.19.1
^ permalink raw reply related
* Re: [PATCH net-next 0/3] tcp: tso defer improvements
From: David Miller @ 2018-11-11 21:55 UTC (permalink / raw)
To: edumazet; +Cc: netdev, soheil, eric.dumazet
In-Reply-To: <20181111144131.156754-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Sun, 11 Nov 2018 06:41:28 -0800
> This series makes tcp_tso_should_defer() a bit smarter :
>
> 1) MSG_EOR gives a hint to TCP to not defer some skbs
>
> 2) Second patch takes into account that head tstamp
> can be in the future.
>
> 3) Third patch uses existing high resolution state variables
> to have a more precise heuristic.
This stuff is fantastic, series applied.
^ permalink raw reply
* Re: [PATCH net-next] tcp: tsq: no longer use limit_output_bytes for paced flows
From: David Miller @ 2018-11-11 21:57 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet
In-Reply-To: <20181111153428.198810-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Sun, 11 Nov 2018 07:34:28 -0800
> FQ pacing guarantees that paced packets queued by one flow do not
> add head-of-line blocking for other flows.
>
> After TCP GSO conversion, increasing limit_output_bytes to 1 MB is safe,
> since this maps to 16 skbs at most in qdisc or device queues.
> (or slightly more if some drivers lower {gso_max_segs|size})
>
> We still can queue at most 1 ms worth of traffic (this can be scaled
> by wifi drivers if they need to)
>
> Tested:
...
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net_sched: sch_fq: add dctcp-like marking
From: David Miller @ 2018-11-11 21:59 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet
In-Reply-To: <20181111171131.24115-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Sun, 11 Nov 2018 09:11:31 -0800
> Similar to 80ba92fa1a92 ("codel: add ce_threshold attribute")
>
> After EDT adoption, it became easier to implement DCTCP-like CE marking.
>
> In many cases, queues are not building in the network fabric but on
> the hosts themselves.
>
> If packets leaving fq missed their Earliest Departure Time by XXX usec,
> we mark them with ECN CE. This gives a feedback (after one RTT) to
> the sender to slow down and find better operating mode.
>
> Example :
>
> tc qd replace dev eth0 root fq ce_threshold 2.5ms
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: [PATCH net-next v3] PCI: add USR vendor id and use it in r8169 and w6692 driver
From: David Miller @ 2018-11-11 22:00 UTC (permalink / raw)
To: hkallweit1; +Cc: bhelgaas, isdn, netdev, linux-pci
In-Reply-To: <a1c56e9d-b427-af43-840e-c527c79feadc@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 11 Nov 2018 20:31:21 +0100
> The PCI vendor id of U.S. Robotics isn't defined in pci_ids.h so far,
> only ISDN driver w6692 has a private definition. Move the definition
> to pci_ids.h and use it in the r8169 driver too.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> v2:
> - The original patch caused a build failure in w6692 driver because
> it broke the private PCI device id definition.
> v3:
> - Don't move device id's to pci_ids.h because they are used in
> one module only respectively.
Yep, that's better.
Applied, thanks!
^ permalink raw reply
* Re: KASAN: use-after-free Read in nbp_vlan_rcu_free
From: nikolay @ 2018-11-12 8:32 UTC (permalink / raw)
To: syzbot, bridge, davem, linux-kernel, netdev, roopa,
syzkaller-bugs
In-Reply-To: <00000000000047feb5057a714975@google.com>
On 12 November 2018 06:51:02 CET, syzbot <syzbot+04681da557a0e49a52e5@syzkaller.appspotmail.com> wrote:
>Hello,
>
>syzbot found the following crash on:
>
>HEAD commit: e12e00e388de Merge tag 'kbuild-fixes-v4.20' of
>git://git.k..
>git tree: upstream
>console output:
>https://syzkaller.appspot.com/x/log.txt?x=14cdb6f5400000
>kernel config:
>https://syzkaller.appspot.com/x/.config?x=8f215f21f041a0d7
>dashboard link:
>https://syzkaller.appspot.com/bug?extid=04681da557a0e49a52e5
>compiler: gcc (GCC) 8.0.1 20180413 (experimental)
>
>Unfortunately, I don't have any reproducer for this crash yet.
>
>IMPORTANT: if you fix the bug, please add the following tag to the
>commit:
>Reported-by: syzbot+04681da557a0e49a52e5@syzkaller.appspotmail.com
Thanks, I'm about to fly out for LPC. Will take a look in a day.
^ permalink raw reply
* Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Hans Verkuil @ 2018-11-12 8:43 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, linux-kernel
Cc: linux-fbdev, linux-ia64, linux-rdma, netdev, dri-devel,
linux-block, sparclinux, iommu, intel-wired-lan, linux-alpha,
dmaengine, linuxppc-dev, ocfs2-devel, linux-media
In-Reply-To: <1541990515-11670-1-git-send-email-anshuman.khandual@arm.com>
On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
>
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
The 'node' in the drivers/media and the drivers/video sources has nothing to
do with numa. It's an index for a framebuffer instead (i.e. the X in /dev/fbX).
Regards,
Hans
>
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
>
> arch/alpha/include/asm/topology.h | 2 +-
> arch/ia64/kernel/numa.c | 2 +-
> arch/ia64/mm/discontig.c | 6 +++---
> arch/ia64/sn/kernel/io_common.c | 2 +-
> arch/powerpc/include/asm/pci-bridge.h | 2 +-
> arch/powerpc/kernel/paca.c | 2 +-
> arch/powerpc/kernel/pci-common.c | 2 +-
> arch/powerpc/mm/numa.c | 14 +++++++-------
> arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
> arch/sparc/kernel/auxio_32.c | 2 +-
> arch/sparc/kernel/pci_fire.c | 2 +-
> arch/sparc/kernel/pci_schizo.c | 2 +-
> arch/sparc/kernel/pcic.c | 6 +++---
> arch/sparc/kernel/psycho_common.c | 2 +-
> arch/sparc/kernel/sbus.c | 2 +-
> arch/sparc/mm/init_64.c | 6 +++---
> arch/sparc/prom/init_32.c | 2 +-
> arch/sparc/prom/init_64.c | 4 ++--
> arch/sparc/prom/tree_32.c | 12 ++++++------
> arch/sparc/prom/tree_64.c | 18 +++++++++---------
> arch/x86/include/asm/pci.h | 2 +-
> arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
> arch/x86/kernel/smpboot.c | 2 +-
> arch/x86/platform/olpc/olpc_dt.c | 16 ++++++++--------
> drivers/block/mtip32xx/mtip32xx.c | 4 ++--
> drivers/dma/dmaengine.c | 3 ++-
> drivers/infiniband/hw/hfi1/affinity.c | 2 +-
> drivers/infiniband/hw/hfi1/init.c | 2 +-
> drivers/iommu/dmar.c | 4 ++--
> drivers/iommu/intel-iommu.c | 2 +-
> drivers/media/pci/ivtv/ivtvfb.c | 2 +-
> drivers/media/platform/vivid/vivid-osd.c | 2 +-
> drivers/misc/sgi-xp/xpc_uv.c | 2 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++--
> drivers/video/fbdev/mmp/fb/mmpfb.c | 2 +-
> drivers/video/fbdev/pxa168fb.c | 2 +-
> drivers/video/fbdev/w100fb.c | 2 +-
> fs/ocfs2/dlm/dlmcommon.h | 2 +-
> fs/ocfs2/dlm/dlmdomain.c | 10 +++++-----
> fs/ocfs2/dlm/dlmmaster.c | 2 +-
> fs/ocfs2/dlm/dlmrecovery.c | 2 +-
> fs/ocfs2/stack_user.c | 6 +++---
> init/init_task.c | 2 +-
> kernel/kthread.c | 2 +-
> kernel/sched/fair.c | 15 ++++++++-------
> lib/cpumask.c | 2 +-
> mm/huge_memory.c | 12 ++++++------
> mm/hugetlb.c | 2 +-
> mm/ksm.c | 2 +-
> mm/memory.c | 6 +++---
> mm/memory_hotplug.c | 12 ++++++------
> mm/mempolicy.c | 2 +-
> mm/page_alloc.c | 4 ++--
> mm/page_ext.c | 2 +-
> net/core/pktgen.c | 2 +-
> net/qrtr/qrtr.c | 2 +-
> tools/perf/bench/numa.c | 6 +++---
> 57 files changed, 125 insertions(+), 123 deletions(-)
>
> diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
> {
> int cpu;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return cpu_all_mask;
>
> cpumask_clear(&node_to_cpumask_map[node]);
> diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
> index 92c3762..1315da6 100644
> --- a/arch/ia64/kernel/numa.c
> +++ b/arch/ia64/kernel/numa.c
> @@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
> cpumask_clear(&node_to_cpu_mask[node]);
>
> for_each_possible_early_cpu(cpu) {
> - node = -1;
> + node = NUMA_NO_NODE;
> for (i = 0; i < NR_CPUS; ++i)
> if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
> node = node_cpuid[i].nid;
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 8a96578..f9c3675 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
> * CPUs are put into groups according to node. Walk cpu_map
> * and create new groups at node boundaries.
> */
> - prev_node = -1;
> + prev_node = NUMA_NO_NODE;
> ai->nr_groups = 0;
> for (unit = 0; unit < nr_units; unit++) {
> cpu = cpu_map[unit];
> @@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> {
> void *ptr = NULL;
> u8 best = 0xff;
> - int bestnode = -1, node, anynode = 0;
> + int bestnode = NUMA_NO_NODE, node, anynode = 0;
>
> for_each_online_node(node) {
> if (node_isset(node, memory_less_mask))
> @@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> anynode = node;
> }
>
> - if (bestnode == -1)
> + if (bestnode == NUMA_NO_NODE)
> bestnode = anynode;
>
> ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
> diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
> index 8df13d0..86b3fcb 100644
> --- a/arch/ia64/sn/kernel/io_common.c
> +++ b/arch/ia64/sn/kernel/io_common.c
> @@ -344,7 +344,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
> printk(KERN_WARNING "on node %d but only %d nodes online."
> "Association set to undetermined.\n",
> controller->node, num_online_nodes());
> - controller->node = -1;
> + controller->node = NUMA_NO_NODE;
> }
> }
>
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 94d4490..25a9e33 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -264,7 +264,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
> #ifdef CONFIG_NUMA
> #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
> #else
> -#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
> +#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
> #endif
>
> #endif /* CONFIG_PPC64 */
> diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
> index 913bfca..6a0bd51 100644
> --- a/arch/powerpc/kernel/paca.c
> +++ b/arch/powerpc/kernel/paca.c
> @@ -36,7 +36,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
> * which will put its paca in the right place.
> */
> if (cpu == boot_cpuid) {
> - nid = -1;
> + nid = NUMA_NO_NODE;
> memblock_set_bottom_up(true);
> } else {
> nid = early_cpu_to_node(cpu);
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 88e4f69..14c33a9 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -132,7 +132,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
> int nid = of_node_to_nid(dev);
>
> if (nid < 0 || !node_online(nid))
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> PHB_SET_NODE(phb, nid);
> }
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 3a048e9..77808a2 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
> */
> static int associativity_to_nid(const __be32 *associativity)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> if (min_common_depth == -1)
> goto out;
> @@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
>
> /* POWER4 LPAR uses 0xffff as invalid node */
> if (nid == 0xffff || nid >= MAX_NUMNODES)
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> if (nid > 0 &&
> of_read_number(associativity, 1) >= distance_ref_points_depth) {
> @@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
> */
> static int of_node_to_nid_single(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> const __be32 *tmp;
>
> tmp = of_get_associativity(device);
> @@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
> /* Walk the device tree upwards, looking for an associativity id */
> int of_node_to_nid(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> of_node_get(device);
> while (device) {
> @@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
> */
> static int numa_setup_cpu(unsigned long lcpu)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> struct device_node *cpu;
>
> /*
> @@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> {
> struct drmem_lmb *lmb;
> unsigned long lmb_size;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> lmb_size = drmem_lmb_size();
>
> @@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> static int hot_add_node_scn_to_nid(unsigned long scn_addr)
> {
> struct device_node *memory;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> for_each_node_by_type(memory, "memory") {
> unsigned long start, size;
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 84d038e..1ce3bfc 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -223,7 +223,7 @@ static int memtrace_online(void)
> ent = &memtrace_array[i];
>
> /* We have onlined this chunk previously */
> - if (ent->nid == -1)
> + if (ent->nid == NUMA_NO_NODE)
> continue;
>
> /* Remove from io mappings */
> @@ -257,7 +257,7 @@ static int memtrace_online(void)
> */
> debugfs_remove_recursive(ent->dir);
> pr_info("Added trace memory back to node %d\n", ent->nid);
> - ent->size = ent->start = ent->nid = -1;
> + ent->size = ent->start = ent->nid = NUMA_NO_NODE;
> }
> if (ret)
> return ret;
> diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
> index a32d588..39f6c59 100644
> --- a/arch/sparc/kernel/auxio_32.c
> +++ b/arch/sparc/kernel/auxio_32.c
> @@ -120,7 +120,7 @@ void __init auxio_power_probe(void)
> node = prom_searchsiblings(node, "obio");
> node = prom_getchild(node);
> node = prom_searchsiblings(node, "power");
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return;
>
> /* Map the power control register. */
> diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
> index be71ae0..474d3be 100644
> --- a/arch/sparc/kernel/pci_fire.c
> +++ b/arch/sparc/kernel/pci_fire.c
> @@ -416,7 +416,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
> struct device_node *dp = op->dev.of_node;
> int err;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 12;
> diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
> index 934b97c..87bb231 100644
> --- a/arch/sparc/kernel/pci_schizo.c
> +++ b/arch/sparc/kernel/pci_schizo.c
> @@ -1347,7 +1347,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
> pbm->next = pci_pbm_root;
> pci_pbm_root = pbm;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 8;
> diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
> index ee4c9a9..d5fe898 100644
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c
> @@ -476,7 +476,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
> unsigned long flags;
> int j;
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
> @@ -535,7 +535,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
> int i, ivec;
> char namebuf[64];
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, sizeof(namebuf));
> @@ -625,7 +625,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
> list_for_each_entry(dev, &bus->devices, bus_list) {
> node = pdev_to_pnode(&pcic->pbm, dev);
> if(node == 0)
> - node = -1;
> + node = NUMA_NO_NODE;
>
> /* cookies */
> pcp = pci_devcookie_alloc();
> diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
> index 81aa91e..dcbf492 100644
> --- a/arch/sparc/kernel/psycho_common.c
> +++ b/arch/sparc/kernel/psycho_common.c
> @@ -454,7 +454,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
> struct device_node *dp = op->dev.of_node;
>
> pbm->name = dp->full_name;
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
> pbm->chip_type = chip_type;
> pbm->chip_version = of_getintprop_default(dp, "version#", 0);
> pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
> diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
> index c133dfc..28a4aa9 100644
> --- a/arch/sparc/kernel/sbus.c
> +++ b/arch/sparc/kernel/sbus.c
> @@ -561,7 +561,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
>
> op->dev.archdata.iommu = iommu;
> op->dev.archdata.stc = strbuf;
> - op->dev.archdata.numa_node = -1;
> + op->dev.archdata.numa_node = NUMA_NO_NODE;
>
> reg_base = regs + SYSIO_IOMMUREG_BASE;
> iommu->iommu_control = reg_base + IOMMU_CONTROL;
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 3c8aac2..cb1bed1 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
> {
> int prev_nid, new_nid;
>
> - prev_nid = -1;
> + prev_nid = NUMA_NO_NODE;
> for ( ; start < end; start += PAGE_SIZE) {
> for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
> struct node_mem_mask *p = &node_masks[new_nid];
>
> if ((start & p->mask) == p->match) {
> - if (prev_nid == -1)
> + if (prev_nid == NUMA_NO_NODE)
> prev_nid = new_nid;
> break;
> }
> @@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
> md = mdesc_grab();
>
> count = 0;
> - nid = -1;
> + nid = NUMA_NO_NODE;
> mdesc_for_each_node_by_name(md, grp, "group") {
> if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
> nid = count;
> diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
> index d204701..4c6e540 100644
> --- a/arch/sparc/prom/init_32.c
> +++ b/arch/sparc/prom/init_32.c
> @@ -58,7 +58,7 @@ void __init prom_init(struct linux_romvec *rp)
> prom_nodeops = romvec->pv_nodeops;
>
> prom_root_node = prom_getsibling(0);
> - if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
> + if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
> prom_halt();
>
> if((((unsigned long) prom_nodeops) == 0) ||
> diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
> index 103aa91..85669c0 100644
> --- a/arch/sparc/prom/init_64.c
> +++ b/arch/sparc/prom/init_64.c
> @@ -36,13 +36,13 @@ void __init prom_init(void *cif_handler)
> prom_cif_init(cif_handler);
>
> prom_chosen_node = prom_finddevice(prom_chosen_path);
> - if (!prom_chosen_node || (s32)prom_chosen_node == -1)
> + if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
> prom_halt();
>
> prom_stdout = prom_getint(prom_chosen_node, "stdout");
>
> node = prom_finddevice("/openprom");
> - if (!node || (s32)node == -1)
> + if (!node || (s32)node == NUMA_NO_NODE)
> prom_halt();
>
> prom_getstring(node, "version", prom_version, sizeof(prom_version));
> diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
> index 0fed893..2d0a204 100644
> --- a/arch/sparc/prom/tree_32.c
> +++ b/arch/sparc/prom/tree_32.c
> @@ -41,11 +41,11 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> cnode = __prom_getchild(node);
> - if (cnode == 0 || (s32)cnode == -1)
> + if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
> return 0;
>
> return cnode;
> @@ -73,11 +73,11 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> sibnode = __prom_getsibling(node);
> - if (sibnode == 0 || (s32)sibnode == -1)
> + if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -220,7 +220,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
> */
> char *prom_nextprop(phandle node, char *oprop, char *buffer)
> {
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return "";
>
> return __prom_nextprop(node, oprop);
> @@ -304,7 +304,7 @@ phandle prom_inst2pkg(int inst)
> node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
> restore_current();
> spin_unlock_irqrestore(&prom_lock, flags);
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
> index 989e799..2b4c515 100644
> --- a/arch/sparc/prom/tree_64.c
> +++ b/arch/sparc/prom/tree_64.c
> @@ -44,10 +44,10 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = __prom_getchild(node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -57,10 +57,10 @@ inline phandle prom_getparent(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = prom_node_to_node("parent", node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -77,10 +77,10 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> sibnode = __prom_getsibling(node);
> - if ((s32)sibnode == -1)
> + if ((s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -241,7 +241,7 @@ char *prom_firstprop(phandle node, char *buffer)
> unsigned long args[7];
>
> *buffer = 0;
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return buffer;
>
> args[0] = (unsigned long) prom_nextprop_name;
> @@ -267,7 +267,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
> unsigned long args[7];
> char buf[32];
>
> - if ((s32)node == -1) {
> + if ((s32)node == NUMA_NO_NODE) {
> *buffer = 0;
> return buffer;
> }
> @@ -370,7 +370,7 @@ inline phandle prom_inst2pkg(int inst)
> p1275_cmd_direct(args);
>
> node = (int) args[4];
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
> index 6629636..dee2a31 100644
> --- a/arch/x86/include/asm/pci.h
> +++ b/arch/x86/include/asm/pci.h
> @@ -141,7 +141,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
> int node;
>
> node = __pcibus_to_node(bus);
> - return (node == -1) ? cpu_online_mask :
> + return (node == NUMA_NO_NODE) ? cpu_online_mask :
> cpumask_of_node(node);
> }
> #endif
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 391f358..3c3378a 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -1390,7 +1390,7 @@ static void __init build_socket_tables(void)
> }
>
> /* Set socket -> node values: */
> - lnid = -1;
> + lnid = NUMA_NO_NODE;
> for_each_present_cpu(cpu) {
> int nid = cpu_to_node(cpu);
> int apicid, sockid;
> @@ -1521,7 +1521,7 @@ static void __init uv_system_init_hub(void)
> new_hub->pnode = 0xffff;
>
> new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
> - new_hub->memory_nid = -1;
> + new_hub->memory_nid = NUMA_NO_NODE;
> new_hub->nr_possible_cpus = 0;
> new_hub->nr_online_cpus = 0;
> }
> @@ -1538,7 +1538,7 @@ static void __init uv_system_init_hub(void)
>
> uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
> uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
> - if (uv_cpu_hub_info(cpu)->memory_nid == -1)
> + if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
> uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
>
> /* Init memoryless node: */
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index a9134d1..c1d45dc 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -841,7 +841,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
> /* reduce the number of lines printed when booting a large cpu count system */
> static void announce_cpu(int cpu, int apicid)
> {
> - static int current_node = -1;
> + static int current_node = NUMA_NO_NODE;
> int node = early_cpu_to_node(cpu);
> static int width, node_width;
>
> diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
> index 24d2175..7098127 100644
> --- a/arch/x86/platform/olpc/olpc_dt.c
> +++ b/arch/x86/platform/olpc/olpc_dt.c
> @@ -29,10 +29,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("peer", args, res) || (s32)node == -1)
> + if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
> return 0;
>
> return node;
> @@ -43,10 +43,10 @@ static phandle __init olpc_dt_getchild(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("child", args, res) || (s32)node == -1) {
> + if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
> pr_err("PROM: %s: fetching child failed!\n", __func__);
> return 0;
> }
> @@ -60,7 +60,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
> int len;
> void *res[] = { &len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("getproplen", args, res)) {
> @@ -100,7 +100,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
>
> buf[0] = '\0';
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("nextprop", args, res) || success != 1)
> @@ -115,7 +115,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
> const void *args[] = { (void *)node, buf, (void *)buflen };
> void *res[] = { len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("package-to-path", args, res) || *len < 1)
> @@ -176,7 +176,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
> return 0;
> }
>
> - if ((s32) node == -1)
> + if ((s32) node == NUMA_NO_NODE)
> return 0;
>
> return node;
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a7daa8a..b889452 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -4084,9 +4084,9 @@ static int get_least_used_cpu_on_node(int node)
> /* Helper for selecting a node in round robin mode */
> static inline int mtip_get_next_rr_node(void)
> {
> - static int next_node = -1;
> + static int next_node = NUMA_NO_NODE;
>
> - if (next_node == -1) {
> + if (next_node == NUMA_NO_NODE) {
> next_node = first_online_node;
> return next_node;
> }
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index f1a441ab..1aeefc7 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
> static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
> {
> int node = dev_to_node(chan->device->dev);
> - return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
> + return node == NUMA_NO_NODE ||
> + cpumask_test_cpu(cpu, cpumask_of_node(node));
> }
>
> /**
> diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
> index 2baf38c..3e8acb8 100644
> --- a/drivers/infiniband/hw/hfi1/affinity.c
> +++ b/drivers/infiniband/hw/hfi1/affinity.c
> @@ -777,7 +777,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
> _dev_comp_vect_cpu_mask_clean_up(dd, entry);
> unlock:
> mutex_unlock(&node_affinity.lock);
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
> }
>
> /*
> diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
> index 0904490..0bf4577 100644
> --- a/drivers/infiniband/hw/hfi1/init.c
> +++ b/drivers/infiniband/hw/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
> dd->unit = ret;
> list_add(&dd->list, &hfi1_dev_list);
> }
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
>
> spin_unlock_irqrestore(&hfi1_devs_lock, flags);
> idr_preload_end();
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index d9c748b..86a9c19 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -477,7 +477,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
> int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
>
> if (!node_online(node))
> - node = -1;
> + node = NUMA_NO_NODE;
> drhd->iommu->node = node;
> return 0;
> }
> @@ -1062,7 +1062,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
> iommu->msagaw = msagaw;
> iommu->segment = drhd->segment;
>
> - iommu->node = -1;
> + iommu->node = NUMA_NO_NODE;
>
> ver = readl(iommu->reg + DMAR_VER_REG);
> pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index f3ccf02..9f6fb13 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -1772,7 +1772,7 @@ static struct dmar_domain *alloc_domain(int flags)
> return NULL;
>
> memset(domain, 0, sizeof(*domain));
> - domain->nid = -1;
> + domain->nid = NUMA_NO_NODE;
> domain->flags = flags;
> domain->has_iotlb_device = false;
> INIT_LIST_HEAD(&domain->devices);
> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
> index 3e02de0..81bd41c 100644
> --- a/drivers/media/pci/ivtv/ivtvfb.c
> +++ b/drivers/media/pci/ivtv/ivtvfb.c
> @@ -1054,7 +1054,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
>
> /* Generate valid fb_info */
>
> - oi->ivtvfb_info.node = -1;
> + oi->ivtvfb_info.node = NUMA_NO_NODE;
> oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
> oi->ivtvfb_info.fbops = &ivtvfb_ops;
> oi->ivtvfb_info.par = itv;
> diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
> index 1a89593..56a2d41 100644
> --- a/drivers/media/platform/vivid/vivid-osd.c
> +++ b/drivers/media/platform/vivid/vivid-osd.c
> @@ -309,7 +309,7 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
>
> /* Generate valid fb_info */
>
> - dev->fb_info.node = -1;
> + dev->fb_info.node = NUMA_NO_NODE;
> dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
> dev->fb_info.fbops = &vivid_fb_ops;
> dev->fb_info.par = dev;
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 0441abe..eef36dd 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -61,7 +61,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
> XPC_NOTIFY_MSG_SIZE_UV)
> #define XPC_NOTIFY_IRQ_NAME "xpc_notify"
>
> -static int xpc_mq_node = -1;
> +static int xpc_mq_node = NUMA_NO_NODE;
>
> static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
> static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 113b38e..4fae85c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6414,7 +6414,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
> {
> struct device *dev = tx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
> @@ -6508,7 +6508,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
> {
> struct device *dev = rx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
> diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
> index ee212be..298be9b 100644
> --- a/drivers/video/fbdev/mmp/fb/mmpfb.c
> +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
> @@ -519,7 +519,7 @@ static int fb_info_setup(struct fb_info *info,
> /* Initialise static fb parameters.*/
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strcpy(info->fix.id, fbi->name);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
> index e31340f..7d775de 100644
> --- a/drivers/video/fbdev/pxa168fb.c
> +++ b/drivers/video/fbdev/pxa168fb.c
> @@ -649,7 +649,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
> */
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strlcpy(info->fix.id, mi->id, 16);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
> index 696106e..8b0f20c 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -703,7 +703,7 @@ int w100fb_probe(struct platform_device *pdev)
> info->fbops = &w100fb_ops;
> info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
> FBINFO_HWACCEL_FILLRECT;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
> info->screen_size = REMAPPED_FB_LEN;
>
> diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> index d06e27e..11111f6 100644
> --- a/fs/ocfs2/dlm/dlmcommon.h
> +++ b/fs/ocfs2/dlm/dlmcommon.h
> @@ -1121,7 +1121,7 @@ static inline void dlm_node_iter_init(unsigned long *map,
> struct dlm_node_iter *iter)
> {
> memcpy(iter->node_map, map, sizeof(iter->node_map));
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> }
>
> static inline int dlm_node_iter_next(struct dlm_node_iter *iter)
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 2acd58b..381a323 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -546,7 +546,7 @@ static void dlm_mark_domain_leaving(struct dlm_ctxt *dlm)
>
> static void __dlm_print_nodes(struct dlm_ctxt *dlm)
> {
> - int node = -1, num = 0;
> + int node = NUMA_NO_NODE, num = 0;
>
> assert_spin_locked(&dlm->spinlock);
>
> @@ -613,7 +613,7 @@ static int dlm_send_one_domain_exit(struct dlm_ctxt *dlm, u32 msg_type,
>
> static void dlm_begin_exit_domain(struct dlm_ctxt *dlm)
> {
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> /* Support for begin exit domain was added in 1.2 */
> if (dlm->dlm_locking_proto.pv_major == 1 &&
> @@ -1407,7 +1407,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
> }
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1547,7 +1547,7 @@ static void dlm_send_join_asserts(struct dlm_ctxt *dlm,
> int status, node, live;
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1631,7 +1631,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
>
> spin_unlock(&dlm->spinlock);
>
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(ctxt->live_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 826f056..e54bbbc 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -1183,7 +1183,7 @@ static void dlm_bitmap_diff_iter_init(struct dlm_bitmap_diff_iter *iter,
> unsigned long p1, p2;
> int i;
>
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> iter->orig_bm = orig_bm;
> iter->cur_bm = cur_bm;
>
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index 802636d5..704fa8b 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -2903,7 +2903,7 @@ static int dlm_send_finalize_reco_message(struct dlm_ctxt *dlm)
> }
> if (stage == 1) {
> /* reset the node_iter back to the top and send finalize2 */
> - iter.curnode = -1;
> + iter.curnode = NUMA_NO_NODE;
> stage = 2;
> goto stage2;
> }
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index d2fb97b..a673efa 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -171,7 +171,7 @@ union ocfs2_control_message {
> static struct ocfs2_stack_plugin ocfs2_user_plugin;
>
> static atomic_t ocfs2_control_opened;
> -static int ocfs2_control_this_node = -1;
> +static int ocfs2_control_this_node = NUMA_NO_NODE;
> static struct ocfs2_protocol_version running_proto;
>
> static LIST_HEAD(ocfs2_live_connection_list);
> @@ -589,7 +589,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
> * Last valid close clears the node number and resets
> * the locking protocol version
> */
> - ocfs2_control_this_node = -1;
> + ocfs2_control_this_node = NUMA_NO_NODE;
> running_proto.pv_major = 0;
> running_proto.pv_minor = 0;
> }
> @@ -612,7 +612,7 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)
> p = kzalloc(sizeof(struct ocfs2_control_private), GFP_KERNEL);
> if (!p)
> return -ENOMEM;
> - p->op_this_node = -1;
> + p->op_this_node = NUMA_NO_NODE;
>
> mutex_lock(&ocfs2_control_lock);
> file->private_data = p;
> diff --git a/init/init_task.c b/init/init_task.c
> index 5aebe3b..6641836 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -154,7 +154,7 @@ struct task_struct init_task
> .vtime.state = VTIME_SYS,
> #endif
> #ifdef CONFIG_NUMA_BALANCING
> - .numa_preferred_nid = -1,
> + .numa_preferred_nid = NUMA_NO_NODE,
> .numa_group = NULL,
> .numa_faults = NULL,
> #endif
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 087d18d..77f3d94 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -675,7 +675,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
> {
> struct kthread_worker *worker;
> struct task_struct *task;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> worker = kzalloc(sizeof(*worker), GFP_KERNEL);
> if (!worker)
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ee271bb..d830fa7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> /* New address space, reset the preferred nid */
> if (!(clone_flags & CLONE_VM)) {
> - p->numa_preferred_nid = -1;
> + p->numa_preferred_nid = NUMA_NO_NODE;
> return;
> }
>
> @@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running += (p->numa_preferred_nid != -1);
> + rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
> }
>
> static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running -= (p->numa_preferred_nid != -1);
> + rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
> }
>
> @@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
> * two full passes of the "multi-stage node selection" test that is
> * executed below.
> */
> - if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
> + if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
> (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
> return true;
>
> @@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
> unsigned long interval = HZ;
>
> /* This task has no NUMA fault statistics yet */
> - if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
> + if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
> return;
>
> /* Periodically retry migrating the task to the preferred node */
> @@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
>
> static void task_numa_placement(struct task_struct *p)
> {
> - int seq, nid, max_nid = -1;
> + int seq, nid, max_nid = NUMA_NO_NODE;
> unsigned long max_faults = 0;
> unsigned long fault_types[2] = { 0, 0 };
> unsigned long total_faults;
> @@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
> * the preferred node.
> */
> if (dst_nid == p->numa_preferred_nid ||
> - (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
> + (p->numa_preferred_nid != NUMA_NO_NODE &&
> + src_nid != p->numa_preferred_nid))
> return;
> }
>
> diff --git a/lib/cpumask.c b/lib/cpumask.c
> index 8d666ab..a089c3f 100644
> --- a/lib/cpumask.c
> +++ b/lib/cpumask.c
> @@ -206,7 +206,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
> /* Wrap: we always want a cpu. */
> i %= num_online_cpus();
>
> - if (node == -1) {
> + if (node == NUMA_NO_NODE) {
> for_each_cpu(cpu, cpu_online_mask)
> if (i-- == 0)
> return cpu;
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 55478ab..5ccf89e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1480,7 +1480,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> struct anon_vma *anon_vma = NULL;
> struct page *page;
> unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
> - int page_nid = -1, this_nid = numa_node_id();
> + int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
> int target_nid, last_cpupid = -1;
> bool page_locked;
> bool migrated = false;
> @@ -1526,7 +1526,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> */
> page_locked = trylock_page(page);
> target_nid = mpol_misplaced(page, vma, haddr);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> /* If the page was locked, there are no parallel migrations */
> if (page_locked)
> goto clear_pmdnuma;
> @@ -1534,7 +1534,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>
> /* Migration could have started since the pmd_trans_migrating check */
> if (!page_locked) {
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> if (!get_page_unless_zero(page))
> goto out_unlock;
> spin_unlock(vmf->ptl);
> @@ -1556,14 +1556,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
> unlock_page(page);
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto out_unlock;
> }
>
> /* Bail if we fail to protect against THP splits for any reason */
> if (unlikely(!anon_vma)) {
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto clear_pmdnuma;
> }
>
> @@ -1625,7 +1625,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (anon_vma)
> page_unlock_anon_vma_read(anon_vma);
>
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
> flags);
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c007fb5..b769db7 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -887,7 +887,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
> struct zonelist *zonelist;
> struct zone *zone;
> struct zoneref *z;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> zonelist = node_zonelist(nid, gfp_mask);
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..d5f8834 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
> chain->chain_prune_time = jiffies;
> chain->rmap_hlist_len = STABLE_NODE_CHAIN;
> #if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
> - chain->nid = -1; /* debug */
> + chain->nid = NUMA_NO_NODE; /* debug */
> #endif
> ksm_stable_node_chains++;
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 4ad2d29..c0e0348 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3564,7 +3564,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> {
> struct vm_area_struct *vma = vmf->vma;
> struct page *page = NULL;
> - int page_nid = -1;
> + int page_nid = NUMA_NO_NODE;
> int last_cpupid;
> int target_nid;
> bool migrated = false;
> @@ -3631,7 +3631,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
> &flags);
> pte_unmap_unlock(vmf->pte, vmf->ptl);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> put_page(page);
> goto out;
> }
> @@ -3645,7 +3645,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> flags |= TNF_MIGRATE_FAIL;
>
> out:
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, 1, flags);
> return 0;
> }
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 2b2b3cc..70e02f8 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
> {
> int nid = zone_to_nid(zone);
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> if (!node_state(nid, N_MEMORY))
> arg->status_change_nid = nid;
> @@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
> unsigned long present_pages = 0;
> enum zone_type zt;
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> /*
> * Check whether node_states[N_NORMAL_MEMORY] will be changed.
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 5837a06..e4f8248 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
> unsigned long pgoff;
> int thiscpu = raw_smp_processor_id();
> int thisnid = cpu_to_node(thiscpu);
> - int polnid = -1;
> + int polnid = NUMA_NO_NODE;
> int ret = -1;
>
> pol = get_vma_policy(vma, addr);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index a919ba5..9d38d9c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5846,7 +5846,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
> return state->last_nid;
>
> nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
> - if (nid != -1) {
> + if (nid != NUMA_NO_NODE) {
> state->last_start = start_pfn;
> state->last_end = end_pfn;
> state->last_nid = nid;
> @@ -6607,7 +6607,7 @@ unsigned long __init node_map_pfn_alignment(void)
> {
> unsigned long accl_mask = 0, last_end = 0;
> unsigned long start, end, mask;
> - int last_nid = -1;
> + int last_nid = NUMA_NO_NODE;
> int i, nid;
>
> for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index ae44f7a..dfb0206 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
> start = SECTION_ALIGN_DOWN(start_pfn);
> end = SECTION_ALIGN_UP(start_pfn + nr_pages);
>
> - if (nid == -1) {
> + if (nid == NUMA_NO_NODE) {
> /*
> * In this case, "nid" already exists and contains valid memory.
> * "start_pfn" passed to us is a pfn which is an arg for
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 6ac9198..af3a746 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3625,7 +3625,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
> pkt_dev->svlan_cfi = 0;
> pkt_dev->svlan_id = 0xffff;
> pkt_dev->burst = 1;
> - pkt_dev->node = -1;
> + pkt_dev->node = NUMA_NO_NODE;
>
> err = pktgen_setup_dev(t->net, pkt_dev, ifname);
> if (err)
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 86e1e37..0c56ae2 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -101,7 +101,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
> return container_of(sk, struct qrtr_sock, sk);
> }
>
> -static unsigned int qrtr_local_nid = -1;
> +static unsigned int qrtr_local_nid = NUMA_NO_NODE;
>
> /* for node ids */
> static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
> diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
> index 4419551..e0ad5f1 100644
> --- a/tools/perf/bench/numa.c
> +++ b/tools/perf/bench/numa.c
> @@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
>
> CPU_ZERO(&mask);
>
> - if (target_node == -1) {
> + if (target_node == NUMA_NO_NODE) {
> for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
> CPU_SET(cpu, &mask);
> } else {
> @@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
> unsigned long nodemask;
> int ret;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return;
>
> BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
> @@ -1363,7 +1363,7 @@ static void init_thread_data(void)
> int cpu;
>
> /* Allow all nodes by default: */
> - td->bind_node = -1;
> + td->bind_node = NUMA_NO_NODE;
>
> /* Allow all CPUs by default: */
> CPU_ZERO(&td->bind_cpumask);
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Price enquiry
From: Daniel Murray @ 2018-11-11 14:56 UTC (permalink / raw)
To: netdev
Hi,friend,
This is Daniel Murray and i am from Sinara Group Co.Ltd Group Co.,LTD in Russia.
We are glad to know about your company from the web and we are interested in your products.
Could you kindly send us your Latest catalog and price list for our trial order.
Best Regards,
Daniel Murray
Purchasing Manager
^ permalink raw reply
* RE:(2) [PATCH net] ip: hash fragments consistently
From: 배석진 @ 2018-11-12 0:40 UTC (permalink / raw)
To: Eric Dumazet, Paolo Abeni, netdev@vger.kernel.org; +Cc: David S. Miller
In-Reply-To: <e9e9703f-8fbe-4d81-4bb1-1cdafd0a4955@gmail.com>
> Also we might note that flow dissector itself is buggy as
> found by Soukjin Bae ( https://patchwork.ozlabs.org/patch/994601/ )
>
> I will send a v2 of his patch with a different changelog.
>
> Defrag is fixed [1] but the bug in flow dissector is adding
> extra work and hash inconsistencies.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=0d5b9311baf27bb545f187f12ecfd558220c607d
Dear all,
it's good news to mee too.
thanks for accept my work :)
^ permalink raw reply
* Re: [PATCH v3 1/2] kretprobe: produce sane stack traces
From: Aleksa Sarai @ 2018-11-12 10:38 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Aleksa Sarai, Steven Rostedt, Naveen N. Rao, Anil S Keshavamurthy,
David S. Miller, Jonathan Corbet, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
Brendan Gregg, Christian Brauner, netdev, linux-doc, linux-kernel
In-Reply-To: <20181111003137.c9df7a077d983cde57c06ee8@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1982 bytes --]
On 2018-11-11, Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > + addr = kretprobe_ret_addr(current, addr, stack_addr(regs));
> > >
> > > But since kretprobe will be an event, which can kick the stackdump.
> > > BTW, from kretprobe, regs->ip should always be the trampoline handler,
> > > see arch/x86/kernel/kprobes/core.c:772 :-)
> > > So it must be fixed always.
> >
> > Right, but kretprobe_ret_addr() is returning the *original* return
> > address (and we need to do an (addr == kretprobe_trampoline)). The
> > real problem is that stack_addr(regs) isn't the same as it is during
> > kretprobe setup (but kretprobe_ret_addr() works everywhere else).
>
> I think stack_addr(regs) should be same when this is called from kretprobe
> handler context. Otherwise, yes, it is not same, but in that case, regs->ip
> is not kretprobe_trampoline too.
I figured it out.
It should be (regs->sp - 1) (just like it is inside the relevant
unwinder function for ORC). I now have a prototype which works under the
frame unwinder[*] -- however under ORC you can only see the top-most
function (the unwinder doesn't see the other function calls). I'm
playing with ORC hints with kretprobe_trampoline to try to improve
things but it's still a bit screwy.
[*]: However, I've noticed that the stack traces between the two traces
no longer match. On kprobe you get function_name+1, but on
kretprobe you get function_caller+foo. Obviously it's working but
the return address results in slightly different stack traces. This
means that stack trace aggregation between kprobe and kretprobe
won't work anymore -- at least not like it did in my original
patch. So I'm really not sure where to go from here.
I can send around another patchset to illustrate the problem if you like
(as well as show how the current unwinding code works).
--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH v2 3/5] phy: ocelot-serdes: convert to use eth phy mode and submode
From: Kishon Vijay Abraham I @ 2018-11-12 10:42 UTC (permalink / raw)
To: Grygorii Strashko, David S. Miller, Russell King - ARM Linux,
Quentin Schulz
Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel,
Tony Lindgren, linux-amlogic, linux-mediatek, Alexandre Belloni,
Antoine Tenart, Vivek Gautam, Maxime Ripard, Chen-Yu Tsai,
Carlo Caione, Chunfeng Yun, Matthias Brugger, Manu Gautam,
Gustavo A. R. Silva
In-Reply-To: <20181109234755.21687-4-grygorii.strashko@ti.com>
Hi Quentin, David Miller
Need your ACK on this patch.
Thanks
Kishon
On 10/11/18 5:17 AM, Grygorii Strashko wrote:
> Convert ocelot-serdes PHY driver to use recently introduced
> PHY_MODE_ETHERNET and phy_set_mode_ext().
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> drivers/net/ethernet/mscc/ocelot.c | 9 ++-------
> drivers/phy/mscc/phy-ocelot-serdes.c | 14 ++++++++++----
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
> index 3238b9e..3edb608 100644
> --- a/drivers/net/ethernet/mscc/ocelot.c
> +++ b/drivers/net/ethernet/mscc/ocelot.c
> @@ -472,7 +472,6 @@ static int ocelot_port_open(struct net_device *dev)
> {
> struct ocelot_port *port = netdev_priv(dev);
> struct ocelot *ocelot = port->ocelot;
> - enum phy_mode phy_mode;
> int err;
>
> /* Enable receiving frames on the port, and activate auto-learning of
> @@ -484,12 +483,8 @@ static int ocelot_port_open(struct net_device *dev)
> ANA_PORT_PORT_CFG, port->chip_port);
>
> if (port->serdes) {
> - if (port->phy_mode == PHY_INTERFACE_MODE_SGMII)
> - phy_mode = PHY_MODE_SGMII;
> - else
> - phy_mode = PHY_MODE_QSGMII;
> -
> - err = phy_set_mode(port->serdes, phy_mode);
> + err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET,
> + port->phy_mode);
> if (err) {
> netdev_err(dev, "Could not set mode of SerDes\n");
> return err;
> diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c
> index c61a9890..f525a21 100644
> --- a/drivers/phy/mscc/phy-ocelot-serdes.c
> +++ b/drivers/phy/mscc/phy-ocelot-serdes.c
> @@ -11,6 +11,7 @@
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> +#include <linux/phy.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> #include <linux/regmap.h>
> @@ -116,8 +117,10 @@ struct serdes_mux {
> .mux = _mux, \
> }
>
> -#define SERDES_MUX_SGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_SGMII, m, c)
> -#define SERDES_MUX_QSGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_QSGMII, m, c)
> +#define SERDES_MUX_SGMII(i, p, m, c) \
> + SERDES_MUX(i, p, PHY_INTERFACE_MODE_SGMII, m, c)
> +#define SERDES_MUX_QSGMII(i, p, m, c) \
> + SERDES_MUX(i, p, PHY_INTERFACE_MODE_QSGMII, m, c)
>
> static const struct serdes_mux ocelot_serdes_muxes[] = {
> SERDES_MUX_SGMII(SERDES1G(0), 0, 0, 0),
> @@ -164,12 +167,15 @@ static int serdes_set_mode(struct phy *phy, enum phy_mode mode, int submode)
> unsigned int i;
> int ret;
>
> + if (mode != PHY_MODE_ETHERNET)
> + return -EINVAL;
> +
> for (i = 0; i < ARRAY_SIZE(ocelot_serdes_muxes); i++) {
> if (macro->idx != ocelot_serdes_muxes[i].idx ||
> - mode != ocelot_serdes_muxes[i].mode)
> + submode != ocelot_serdes_muxes[i].mode)
> continue;
>
> - if (mode != PHY_MODE_QSGMII &&
> + if (submode != PHY_INTERFACE_MODE_QSGMII &&
> macro->port != ocelot_serdes_muxes[i].port)
> continue;
>
>
^ permalink raw reply
* Re: [PATCH v2 4/5] phy: mvebu-cp110-comphy: convert to use eth phy mode and submode
From: Kishon Vijay Abraham I @ 2018-11-12 10:48 UTC (permalink / raw)
To: Grygorii Strashko, David S. Miller, Russell King - ARM Linux,
Antoine Tenart
Cc: netdev, Sekhar Nori, linux-kernel, linux-arm-kernel,
Tony Lindgren, linux-amlogic, linux-mediatek, Alexandre Belloni,
Quentin Schulz, Vivek Gautam, Maxime Ripard, Chen-Yu Tsai,
Carlo Caione, Chunfeng Yun, Matthias Brugger, Manu Gautam
In-Reply-To: <20181109234755.21687-5-grygorii.strashko@ti.com>
Hi Antoine, David Miller
Please ACK this patch if it looks okay.
Thanks
Kishon
On 10/11/18 5:17 AM, Grygorii Strashko wrote:
> Convert mvebu-cp110-comphy PHY driver to use recently introduced
> PHY_MODE_ETHERNET and phy_set_mode_ext().
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
> drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 19 +-----
> drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 83 ++++++++++++++-----------
> 2 files changed, 48 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 7a37a37..731793a 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -1165,28 +1165,13 @@ static void mvpp22_gop_setup_irq(struct mvpp2_port *port)
> */
> static int mvpp22_comphy_init(struct mvpp2_port *port)
> {
> - enum phy_mode mode;
> int ret;
>
> if (!port->comphy)
> return 0;
>
> - switch (port->phy_interface) {
> - case PHY_INTERFACE_MODE_SGMII:
> - case PHY_INTERFACE_MODE_1000BASEX:
> - mode = PHY_MODE_SGMII;
> - break;
> - case PHY_INTERFACE_MODE_2500BASEX:
> - mode = PHY_MODE_2500SGMII;
> - break;
> - case PHY_INTERFACE_MODE_10GKR:
> - mode = PHY_MODE_10GKR;
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - ret = phy_set_mode(port->comphy, mode);
> + ret = phy_set_mode_ext(port->comphy, PHY_MODE_ETHERNET,
> + port->phy_interface);
> if (ret)
> return ret;
>
> diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> index 79b52c3..7dee72b 100644
> --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
> @@ -9,6 +9,7 @@
> #include <linux/iopoll.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> +#include <linux/phy.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> #include <linux/regmap.h>
> @@ -131,26 +132,26 @@ struct mvebu_comhy_conf {
>
> static const struct mvebu_comhy_conf mvebu_comphy_cp110_modes[] = {
> /* lane 0 */
> - MVEBU_COMPHY_CONF(0, 1, PHY_MODE_SGMII, 0x1),
> - MVEBU_COMPHY_CONF(0, 1, PHY_MODE_2500SGMII, 0x1),
> + MVEBU_COMPHY_CONF(0, 1, PHY_INTERFACE_MODE_SGMII, 0x1),
> + MVEBU_COMPHY_CONF(0, 1, PHY_INTERFACE_MODE_2500BASEX, 0x1),
> /* lane 1 */
> - MVEBU_COMPHY_CONF(1, 2, PHY_MODE_SGMII, 0x1),
> - MVEBU_COMPHY_CONF(1, 2, PHY_MODE_2500SGMII, 0x1),
> + MVEBU_COMPHY_CONF(1, 2, PHY_INTERFACE_MODE_SGMII, 0x1),
> + MVEBU_COMPHY_CONF(1, 2, PHY_INTERFACE_MODE_2500BASEX, 0x1),
> /* lane 2 */
> - MVEBU_COMPHY_CONF(2, 0, PHY_MODE_SGMII, 0x1),
> - MVEBU_COMPHY_CONF(2, 0, PHY_MODE_2500SGMII, 0x1),
> - MVEBU_COMPHY_CONF(2, 0, PHY_MODE_10GKR, 0x1),
> + MVEBU_COMPHY_CONF(2, 0, PHY_INTERFACE_MODE_SGMII, 0x1),
> + MVEBU_COMPHY_CONF(2, 0, PHY_INTERFACE_MODE_2500BASEX, 0x1),
> + MVEBU_COMPHY_CONF(2, 0, PHY_INTERFACE_MODE_10GKR, 0x1),
> /* lane 3 */
> - MVEBU_COMPHY_CONF(3, 1, PHY_MODE_SGMII, 0x2),
> - MVEBU_COMPHY_CONF(3, 1, PHY_MODE_2500SGMII, 0x2),
> + MVEBU_COMPHY_CONF(3, 1, PHY_INTERFACE_MODE_SGMII, 0x2),
> + MVEBU_COMPHY_CONF(3, 1, PHY_INTERFACE_MODE_2500BASEX, 0x2),
> /* lane 4 */
> - MVEBU_COMPHY_CONF(4, 0, PHY_MODE_SGMII, 0x2),
> - MVEBU_COMPHY_CONF(4, 0, PHY_MODE_2500SGMII, 0x2),
> - MVEBU_COMPHY_CONF(4, 0, PHY_MODE_10GKR, 0x2),
> - MVEBU_COMPHY_CONF(4, 1, PHY_MODE_SGMII, 0x1),
> + MVEBU_COMPHY_CONF(4, 0, PHY_INTERFACE_MODE_SGMII, 0x2),
> + MVEBU_COMPHY_CONF(4, 0, PHY_INTERFACE_MODE_2500BASEX, 0x2),
> + MVEBU_COMPHY_CONF(4, 0, PHY_INTERFACE_MODE_10GKR, 0x2),
> + MVEBU_COMPHY_CONF(4, 1, PHY_INTERFACE_MODE_SGMII, 0x1),
> /* lane 5 */
> - MVEBU_COMPHY_CONF(5, 2, PHY_MODE_SGMII, 0x1),
> - MVEBU_COMPHY_CONF(5, 2, PHY_MODE_2500SGMII, 0x1),
> + MVEBU_COMPHY_CONF(5, 2, PHY_INTERFACE_MODE_SGMII, 0x1),
> + MVEBU_COMPHY_CONF(5, 2, PHY_INTERFACE_MODE_2500BASEX, 0x1),
> };
>
> struct mvebu_comphy_priv {
> @@ -163,10 +164,12 @@ struct mvebu_comphy_lane {
> struct mvebu_comphy_priv *priv;
> unsigned id;
> enum phy_mode mode;
> + int submode;
> int port;
> };
>
> -static int mvebu_comphy_get_mux(int lane, int port, enum phy_mode mode)
> +static int mvebu_comphy_get_mux(int lane, int port,
> + enum phy_mode mode, int submode)
> {
> int i, n = ARRAY_SIZE(mvebu_comphy_cp110_modes);
>
> @@ -177,7 +180,7 @@ static int mvebu_comphy_get_mux(int lane, int port, enum phy_mode mode)
> for (i = 0; i < n; i++) {
> if (mvebu_comphy_cp110_modes[i].lane == lane &&
> mvebu_comphy_cp110_modes[i].port == port &&
> - mvebu_comphy_cp110_modes[i].mode == mode)
> + mvebu_comphy_cp110_modes[i].mode == submode)
> break;
> }
>
> @@ -187,8 +190,7 @@ static int mvebu_comphy_get_mux(int lane, int port, enum phy_mode mode)
> return mvebu_comphy_cp110_modes[i].mux;
> }
>
> -static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane,
> - enum phy_mode mode)
> +static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane)
> {
> struct mvebu_comphy_priv *priv = lane->priv;
> u32 val;
> @@ -206,14 +208,14 @@ static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane,
> MVEBU_COMPHY_SERDES_CFG0_HALF_BUS |
> MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0xf) |
> MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0xf));
> - if (mode == PHY_MODE_10GKR)
> + if (lane->submode == PHY_INTERFACE_MODE_10GKR)
> val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0xe) |
> MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0xe);
> - else if (mode == PHY_MODE_2500SGMII)
> + else if (lane->submode == PHY_INTERFACE_MODE_2500BASEX)
> val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0x8) |
> MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0x8) |
> MVEBU_COMPHY_SERDES_CFG0_HALF_BUS;
> - else if (mode == PHY_MODE_SGMII)
> + else if (lane->submode == PHY_INTERFACE_MODE_SGMII)
> val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0x6) |
> MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0x6) |
> MVEBU_COMPHY_SERDES_CFG0_HALF_BUS;
> @@ -243,7 +245,7 @@ static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane,
> /* refclk selection */
> val = readl(priv->base + MVEBU_COMPHY_MISC_CTRL0(lane->id));
> val &= ~MVEBU_COMPHY_MISC_CTRL0_REFCLK_SEL;
> - if (mode == PHY_MODE_10GKR)
> + if (lane->submode == PHY_INTERFACE_MODE_10GKR)
> val |= MVEBU_COMPHY_MISC_CTRL0_ICP_FORCE;
> writel(val, priv->base + MVEBU_COMPHY_MISC_CTRL0(lane->id));
>
> @@ -261,8 +263,7 @@ static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane,
> writel(val, priv->base + MVEBU_COMPHY_LOOPBACK(lane->id));
> }
>
> -static int mvebu_comphy_init_plls(struct mvebu_comphy_lane *lane,
> - enum phy_mode mode)
> +static int mvebu_comphy_init_plls(struct mvebu_comphy_lane *lane)
> {
> struct mvebu_comphy_priv *priv = lane->priv;
> u32 val;
> @@ -303,13 +304,13 @@ static int mvebu_comphy_init_plls(struct mvebu_comphy_lane *lane,
> return 0;
> }
>
> -static int mvebu_comphy_set_mode_sgmii(struct phy *phy, enum phy_mode mode)
> +static int mvebu_comphy_set_mode_sgmii(struct phy *phy)
> {
> struct mvebu_comphy_lane *lane = phy_get_drvdata(phy);
> struct mvebu_comphy_priv *priv = lane->priv;
> u32 val;
>
> - mvebu_comphy_ethernet_init_reset(lane, mode);
> + mvebu_comphy_ethernet_init_reset(lane);
>
> val = readl(priv->base + MVEBU_COMPHY_RX_CTRL1(lane->id));
> val &= ~MVEBU_COMPHY_RX_CTRL1_CLK8T_EN;
> @@ -330,7 +331,7 @@ static int mvebu_comphy_set_mode_sgmii(struct phy *phy, enum phy_mode mode)
> val |= MVEBU_COMPHY_GEN1_S0_TX_EMPH(0x1);
> writel(val, priv->base + MVEBU_COMPHY_GEN1_S0(lane->id));
>
> - return mvebu_comphy_init_plls(lane, PHY_MODE_SGMII);
> + return mvebu_comphy_init_plls(lane);
> }
>
> static int mvebu_comphy_set_mode_10gkr(struct phy *phy)
> @@ -339,7 +340,7 @@ static int mvebu_comphy_set_mode_10gkr(struct phy *phy)
> struct mvebu_comphy_priv *priv = lane->priv;
> u32 val;
>
> - mvebu_comphy_ethernet_init_reset(lane, PHY_MODE_10GKR);
> + mvebu_comphy_ethernet_init_reset(lane);
>
> val = readl(priv->base + MVEBU_COMPHY_RX_CTRL1(lane->id));
> val |= MVEBU_COMPHY_RX_CTRL1_RXCLK2X_SEL |
> @@ -469,7 +470,7 @@ static int mvebu_comphy_set_mode_10gkr(struct phy *phy)
> val |= MVEBU_COMPHY_EXT_SELV_RX_SAMPL(0x1a);
> writel(val, priv->base + MVEBU_COMPHY_EXT_SELV(lane->id));
>
> - return mvebu_comphy_init_plls(lane, PHY_MODE_10GKR);
> + return mvebu_comphy_init_plls(lane);
> }
>
> static int mvebu_comphy_power_on(struct phy *phy)
> @@ -479,7 +480,8 @@ static int mvebu_comphy_power_on(struct phy *phy)
> int ret, mux;
> u32 val;
>
> - mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode);
> + mux = mvebu_comphy_get_mux(lane->id, lane->port,
> + lane->mode, lane->submode);
> if (mux < 0)
> return -ENOTSUPP;
>
> @@ -492,12 +494,12 @@ static int mvebu_comphy_power_on(struct phy *phy)
> val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id);
> regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val);
>
> - switch (lane->mode) {
> - case PHY_MODE_SGMII:
> - case PHY_MODE_2500SGMII:
> - ret = mvebu_comphy_set_mode_sgmii(phy, lane->mode);
> + switch (lane->submode) {
> + case PHY_INTERFACE_MODE_SGMII:
> + case PHY_INTERFACE_MODE_2500BASEX:
> + ret = mvebu_comphy_set_mode_sgmii(phy);
> break;
> - case PHY_MODE_10GKR:
> + case PHY_INTERFACE_MODE_10GKR:
> ret = mvebu_comphy_set_mode_10gkr(phy);
> break;
> default:
> @@ -517,10 +519,17 @@ static int mvebu_comphy_set_mode(struct phy *phy,
> {
> struct mvebu_comphy_lane *lane = phy_get_drvdata(phy);
>
> - if (mvebu_comphy_get_mux(lane->id, lane->port, mode) < 0)
> + if (mode != PHY_MODE_ETHERNET)
> + return -EINVAL;
> +
> + if (submode == PHY_INTERFACE_MODE_1000BASEX)
> + submode = PHY_INTERFACE_MODE_SGMII;
> +
> + if (mvebu_comphy_get_mux(lane->id, lane->port, mode, submode) < 0)
> return -EINVAL;
>
> lane->mode = mode;
> + lane->submode = submode;
> return 0;
> }
>
>
^ permalink raw reply
* Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12 11:47 UTC (permalink / raw)
To: Hans Verkuil, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
In-Reply-To: <de754de5-cdf9-87d2-7ab2-a3630c034121@xs4all.nl>
On 11/12/2018 02:13 PM, Hans Verkuil wrote:
> On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
>> At present there are multiple places where invalid node number is encoded
>> as -1. Even though implicitly understood it is always better to have macros
>> in there. Replace these open encodings for an invalid node number with the
>> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
>> 'invalid node' from various places redirecting them to a common definition.
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> Build tested this with multiple cross compiler options like alpha, sparc,
>> arm64, x86, powerpc64le etc with their default config which might not have
>> compiled tested all driver related changes. I will appreciate folks giving
>> this a test in their respective build environment.
>>
>> All these places for replacement were found by running the following grep
>> patterns on the entire kernel code. Please let me know if this might have
>> missed some instances. This might also have replaced some false positives.
>> I will appreciate suggestions, inputs and review.
> The 'node' in the drivers/media and the drivers/video sources has nothing to
> do with numa. It's an index for a framebuffer instead (i.e. the X in /dev/fbX).
Thanks for the input. Will drop the changes there.
^ permalink raw reply
* [PATCH 01/20] can: raw: check for CAN FD capable netdev in raw_sendmsg()
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Oliver Hartkopp, linux-stable,
Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Oliver Hartkopp <socketcan@hartkopp.net>
When the socket is CAN FD enabled it can handle CAN FD frame
transmissions. Add an additional check in raw_sendmsg() as a CAN2.0 CAN
driver (non CAN FD) should never see a CAN FD frame. Due to the commonly
used can_dropped_invalid_skb() function the CAN 2.0 driver would drop
that CAN FD frame anyway - but with this patch the user gets a proper
-EINVAL return code.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
net/can/raw.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/net/can/raw.c b/net/can/raw.c
index 1051eee82581..3aab7664933f 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -745,18 +745,19 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
} else
ifindex = ro->ifindex;
- if (ro->fd_frames) {
+ dev = dev_get_by_index(sock_net(sk), ifindex);
+ if (!dev)
+ return -ENXIO;
+
+ err = -EINVAL;
+ if (ro->fd_frames && dev->mtu == CANFD_MTU) {
if (unlikely(size != CANFD_MTU && size != CAN_MTU))
- return -EINVAL;
+ goto put_dev;
} else {
if (unlikely(size != CAN_MTU))
- return -EINVAL;
+ goto put_dev;
}
- dev = dev_get_by_index(sock_net(sk), ifindex);
- if (!dev)
- return -ENXIO;
-
skb = sock_alloc_send_skb(sk, size + sizeof(struct can_skb_priv),
msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb)
--
2.19.1
^ permalink raw reply related
* [PATCH 02/20] can: kvaser_usb: Fix potential uninitialized variable use
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Jimmy Assarsson, linux-stable,
Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Jimmy Assarsson <jimmyassarsson@gmail.com>
If alloc_can_err_skb() fails, cf is never initialized.
Move assignment of cf inside check.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
index c084bae5ec0a..5fc0be564274 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
@@ -1019,6 +1019,11 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv,
new_state : CAN_STATE_ERROR_ACTIVE;
can_change_state(netdev, cf, tx_state, rx_state);
+
+ if (priv->can.restart_ms &&
+ old_state >= CAN_STATE_BUS_OFF &&
+ new_state < CAN_STATE_BUS_OFF)
+ cf->can_id |= CAN_ERR_RESTARTED;
}
if (new_state == CAN_STATE_BUS_OFF) {
@@ -1028,11 +1033,6 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv,
can_bus_off(netdev);
}
-
- if (priv->can.restart_ms &&
- old_state >= CAN_STATE_BUS_OFF &&
- new_state < CAN_STATE_BUS_OFF)
- cf->can_id |= CAN_ERR_RESTARTED;
}
if (!skb) {
--
2.19.1
^ permalink raw reply related
* [PATCH 03/20] can: kvaser_usb: Fix accessing freed memory in kvaser_usb_start_xmit()
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Jimmy Assarsson, linux-stable,
Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Jimmy Assarsson <jimmyassarsson@gmail.com>
The call to can_put_echo_skb() may result in the skb being freed. The skb
is later used in the call to dev->ops->dev_frame_to_cmd().
This is avoided by moving the call to can_put_echo_skb() after
dev->ops->dev_frame_to_cmd().
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
index b939a4c10b84..c89c7d4900d7 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
@@ -528,7 +528,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
context = &priv->tx_contexts[i];
context->echo_index = i;
- can_put_echo_skb(skb, netdev, context->echo_index);
++priv->active_tx_contexts;
if (priv->active_tx_contexts >= (int)dev->max_tx_urbs)
netif_stop_queue(netdev);
@@ -553,7 +552,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
dev_kfree_skb(skb);
spin_lock_irqsave(&priv->tx_contexts_lock, flags);
- can_free_echo_skb(netdev, context->echo_index);
context->echo_index = dev->max_tx_urbs;
--priv->active_tx_contexts;
netif_wake_queue(netdev);
@@ -564,6 +562,8 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
context->priv = priv;
+ can_put_echo_skb(skb, netdev, context->echo_index);
+
usb_fill_bulk_urb(urb, dev->udev,
usb_sndbulkpipe(dev->udev,
dev->bulk_out->bEndpointAddress),
--
2.19.1
^ permalink raw reply related
* [PATCH 09/20] can: hi311x: Use level-triggered interrupt
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Lukas Wunner, Mathias Duckeck,
Akshay Bhat, Casey Fitzpatrick, linux-stable, Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Lukas Wunner <lukas@wunner.de>
If the hi3110 shares the SPI bus with another traffic-intensive device
and packets are received in high volume (by a separate machine sending
with "cangen -g 0 -i -x"), reception stops after a few minutes and the
counter in /proc/interrupts stops incrementing. Bus state is "active".
Bringing the interface down and back up reconvenes the reception. The
issue is not observed when the hi3110 is the sole device on the SPI bus.
Using a level-triggered interrupt makes the issue go away and lets the
hi3110 successfully receive 2 GByte over the course of 5 days while a
ks8851 Ethernet chip on the same SPI bus handles 6 GByte of traffic.
Unfortunately the hi3110 datasheet is mum on the trigger type. The pin
description on page 3 only specifies the polarity (active high):
http://www.holtic.com/documents/371-hi-3110_v-rev-kpdf.do
Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Cc: Akshay Bhat <akshay.bhat@timesys.com>
Cc: Casey Fitzpatrick <casey.fitzpatrick@timesys.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Documentation/devicetree/bindings/net/can/holt_hi311x.txt | 2 +-
drivers/net/can/spi/hi311x.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
index 903a78da65be..3a9926f99937 100644
--- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
+++ b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
@@ -17,7 +17,7 @@ Example:
reg = <1>;
clocks = <&clk32m>;
interrupt-parent = <&gpio4>;
- interrupts = <13 IRQ_TYPE_EDGE_RISING>;
+ interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
vdd-supply = <®5v0>;
xceiver-supply = <®5v0>;
};
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index 53e320c92a8b..ddaf46239e39 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -760,7 +760,7 @@ static int hi3110_open(struct net_device *net)
{
struct hi3110_priv *priv = netdev_priv(net);
struct spi_device *spi = priv->spi;
- unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_RISING;
+ unsigned long flags = IRQF_ONESHOT | IRQF_TRIGGER_HIGH;
int ret;
ret = open_candev(net);
--
2.19.1
^ permalink raw reply related
* [PATCH 11/20] can: flexcan: Always use last mailbox for TX
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Alexander Stein, linux-stable,
Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Alexander Stein <alexander.stein@systec-electronic.com>
Essentially this patch moves the TX mailbox to position 63, regardless
of timestamp based offloading or RX FIFO. So mainly the iflag register
usage regarding TX has changed. The rest is consolidating RX FIFO and
timestamp offloading as they now use both the same TX mailbox.
The reason is a very annoying behavior regarding sending RTR frames when
_not_ using RX FIFO:
If a TX mailbox sent a RTR frame it becomes a RX mailbox. For that
reason flexcan_irq disables the TX mailbox again. But if during the time
the RTR was sent and the TX mailbox is disabled a new CAN frames is
received, it is lost without notice. The reason is that so-called
"Move-in" process starts from the lowest mailbox which happen to be a TX
mailbox set to EMPTY.
Steps to reproduce (I used an imx7d):
1. generate regular bursts of messages
2. send a RTR from flexcan with higher priority than burst messages every
1ms, e.g. cangen -I 0x100 -L 0 -g 1 -R can0
3. notice a lost message without notification after some seconds
When running an iperf in parallel this problem is occurring even more
frequently. Using filters is not possible as at least one single CAN-ID
is allowed. Handling the TX MB during RX is also not possible as there
is no race-free disable of RX MB.
There is still a slight window when the described problem can occur. But
for that all RX MB must be in use which is essentially next to an
overrun. Still there will be no indication if it ever occurs.
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 67 +++++++++++++++++++--------------------
1 file changed, 33 insertions(+), 34 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 0431f8d05518..677c41701cf3 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -135,13 +135,12 @@
/* FLEXCAN interrupt flag register (IFLAG) bits */
/* Errata ERR005829 step7: Reserve first valid MB */
-#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8
-#define FLEXCAN_TX_MB_OFF_FIFO 9
+#define FLEXCAN_TX_MB_RESERVED_OFF_FIFO 8
#define FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP 0
-#define FLEXCAN_TX_MB_OFF_TIMESTAMP 1
-#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_OFF_TIMESTAMP + 1)
-#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST 63
-#define FLEXCAN_IFLAG_MB(x) BIT(x)
+#define FLEXCAN_TX_MB 63
+#define FLEXCAN_RX_MB_OFF_TIMESTAMP_FIRST (FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP + 1)
+#define FLEXCAN_RX_MB_OFF_TIMESTAMP_LAST (FLEXCAN_TX_MB - 1)
+#define FLEXCAN_IFLAG_MB(x) BIT(x & 0x1f)
#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7)
#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6)
#define FLEXCAN_IFLAG_RX_FIFO_AVAILABLE BIT(5)
@@ -737,9 +736,9 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv)
struct flexcan_regs __iomem *regs = priv->regs;
u32 iflag1, iflag2;
- iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default;
- iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default &
+ iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default &
~FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
+ iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default;
return (u64)iflag2 << 32 | iflag1;
}
@@ -751,11 +750,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
struct flexcan_priv *priv = netdev_priv(dev);
struct flexcan_regs __iomem *regs = priv->regs;
irqreturn_t handled = IRQ_NONE;
- u32 reg_iflag1, reg_esr;
+ u32 reg_iflag2, reg_esr;
enum can_state last_state = priv->can.state;
- reg_iflag1 = priv->read(®s->iflag1);
-
/* reception interrupt */
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
u64 reg_iflag;
@@ -769,6 +766,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
break;
}
} else {
+ u32 reg_iflag1;
+
+ reg_iflag1 = priv->read(®s->iflag1);
if (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE) {
handled = IRQ_HANDLED;
can_rx_offload_irq_offload_fifo(&priv->offload);
@@ -784,8 +784,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
}
}
+ reg_iflag2 = priv->read(®s->iflag2);
+
/* transmission complete interrupt */
- if (reg_iflag1 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) {
+ if (reg_iflag2 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) {
handled = IRQ_HANDLED;
stats->tx_bytes += can_get_echo_skb(dev, 0);
stats->tx_packets++;
@@ -794,7 +796,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
/* after sending a RTR frame MB is in RX mode */
priv->write(FLEXCAN_MB_CODE_TX_INACTIVE,
&priv->tx_mb->can_ctrl);
- priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag1);
+ priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag2);
netif_wake_queue(dev);
}
@@ -936,15 +938,13 @@ static int flexcan_chip_start(struct net_device *dev)
reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV |
FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SRX_DIS | FLEXCAN_MCR_IRMQ |
- FLEXCAN_MCR_IDAM_C;
+ FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(priv->tx_mb_idx);
- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
+ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
reg_mcr &= ~FLEXCAN_MCR_FEN;
- reg_mcr |= FLEXCAN_MCR_MAXMB(priv->offload.mb_last);
- } else {
- reg_mcr |= FLEXCAN_MCR_FEN |
- FLEXCAN_MCR_MAXMB(priv->tx_mb_idx);
- }
+ else
+ reg_mcr |= FLEXCAN_MCR_FEN;
+
netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
priv->write(reg_mcr, ®s->mcr);
@@ -987,16 +987,17 @@ static int flexcan_chip_start(struct net_device *dev)
priv->write(reg_ctrl2, ®s->ctrl2);
}
- /* clear and invalidate all mailboxes first */
- for (i = priv->tx_mb_idx; i < ARRAY_SIZE(regs->mb); i++) {
- priv->write(FLEXCAN_MB_CODE_RX_INACTIVE,
- ®s->mb[i].can_ctrl);
- }
-
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
- for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++)
+ for (i = priv->offload.mb_first; i <= priv->offload.mb_last; i++) {
priv->write(FLEXCAN_MB_CODE_RX_EMPTY,
®s->mb[i].can_ctrl);
+ }
+ } else {
+ /* clear and invalidate unused mailboxes first */
+ for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= ARRAY_SIZE(regs->mb); i++) {
+ priv->write(FLEXCAN_MB_CODE_RX_INACTIVE,
+ ®s->mb[i].can_ctrl);
+ }
}
/* Errata ERR005829: mark first TX mailbox as INACTIVE */
@@ -1360,17 +1361,15 @@ static int flexcan_probe(struct platform_device *pdev)
priv->devtype_data = devtype_data;
priv->reg_xceiver = reg_xceiver;
- if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
- priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_TIMESTAMP;
+ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP];
- } else {
- priv->tx_mb_idx = FLEXCAN_TX_MB_OFF_FIFO;
+ else
priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_FIFO];
- }
+ priv->tx_mb_idx = FLEXCAN_TX_MB;
priv->tx_mb = ®s->mb[priv->tx_mb_idx];
- priv->reg_imask1_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
- priv->reg_imask2_default = 0;
+ priv->reg_imask1_default = 0;
+ priv->reg_imask2_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
priv->offload.mailbox_read = flexcan_mailbox_read;
--
2.19.1
^ permalink raw reply related
* [PATCH 12/20] can: flexcan: remove not needed struct flexcan_priv::tx_mb and struct flexcan_priv::tx_mb_idx
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
The previous patch changes the TX path to always use the last mailbox
regardless of the used offload scheme (rx-fifo or timestamp based). This
means members "tx_mb" and "tx_mb_idx" of the struct flexcan_priv don't
depend on the offload scheme, so replace them by compile time constants.
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 677c41701cf3..68b46395c580 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -258,9 +258,7 @@ struct flexcan_priv {
struct can_rx_offload offload;
struct flexcan_regs __iomem *regs;
- struct flexcan_mb __iomem *tx_mb;
struct flexcan_mb __iomem *tx_mb_reserved;
- u8 tx_mb_idx;
u32 reg_ctrl_default;
u32 reg_imask1_default;
u32 reg_imask2_default;
@@ -514,6 +512,7 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
const struct flexcan_priv *priv = netdev_priv(dev);
+ struct flexcan_regs __iomem *regs = priv->regs;
struct can_frame *cf = (struct can_frame *)skb->data;
u32 can_id;
u32 data;
@@ -536,17 +535,17 @@ static netdev_tx_t flexcan_start_xmit(struct sk_buff *skb, struct net_device *de
if (cf->can_dlc > 0) {
data = be32_to_cpup((__be32 *)&cf->data[0]);
- priv->write(data, &priv->tx_mb->data[0]);
+ priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[0]);
}
if (cf->can_dlc > 4) {
data = be32_to_cpup((__be32 *)&cf->data[4]);
- priv->write(data, &priv->tx_mb->data[1]);
+ priv->write(data, ®s->mb[FLEXCAN_TX_MB].data[1]);
}
can_put_echo_skb(skb, dev, 0);
- priv->write(can_id, &priv->tx_mb->can_id);
- priv->write(ctrl, &priv->tx_mb->can_ctrl);
+ priv->write(can_id, ®s->mb[FLEXCAN_TX_MB].can_id);
+ priv->write(ctrl, ®s->mb[FLEXCAN_TX_MB].can_ctrl);
/* Errata ERR005829 step8:
* Write twice INACTIVE(0x8) code to first MB.
@@ -737,7 +736,7 @@ static inline u64 flexcan_read_reg_iflag_rx(struct flexcan_priv *priv)
u32 iflag1, iflag2;
iflag2 = priv->read(®s->iflag2) & priv->reg_imask2_default &
- ~FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
+ ~FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB);
iflag1 = priv->read(®s->iflag1) & priv->reg_imask1_default;
return (u64)iflag2 << 32 | iflag1;
@@ -787,7 +786,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
reg_iflag2 = priv->read(®s->iflag2);
/* transmission complete interrupt */
- if (reg_iflag2 & FLEXCAN_IFLAG_MB(priv->tx_mb_idx)) {
+ if (reg_iflag2 & FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB)) {
handled = IRQ_HANDLED;
stats->tx_bytes += can_get_echo_skb(dev, 0);
stats->tx_packets++;
@@ -795,8 +794,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
/* after sending a RTR frame MB is in RX mode */
priv->write(FLEXCAN_MB_CODE_TX_INACTIVE,
- &priv->tx_mb->can_ctrl);
- priv->write(FLEXCAN_IFLAG_MB(priv->tx_mb_idx), ®s->iflag2);
+ ®s->mb[FLEXCAN_TX_MB].can_ctrl);
+ priv->write(FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB), ®s->iflag2);
netif_wake_queue(dev);
}
@@ -938,7 +937,7 @@ static int flexcan_chip_start(struct net_device *dev)
reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV |
FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_SRX_DIS | FLEXCAN_MCR_IRMQ |
- FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(priv->tx_mb_idx);
+ FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(FLEXCAN_TX_MB);
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
reg_mcr &= ~FLEXCAN_MCR_FEN;
@@ -1006,7 +1005,7 @@ static int flexcan_chip_start(struct net_device *dev)
/* mark TX mailbox as INACTIVE */
priv->write(FLEXCAN_MB_CODE_TX_INACTIVE,
- &priv->tx_mb->can_ctrl);
+ ®s->mb[FLEXCAN_TX_MB].can_ctrl);
/* acceptance mask/acceptance code (accept everything) */
priv->write(0x0, ®s->rxgmask);
@@ -1365,11 +1364,9 @@ static int flexcan_probe(struct platform_device *pdev)
priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_TIMESTAMP];
else
priv->tx_mb_reserved = ®s->mb[FLEXCAN_TX_MB_RESERVED_OFF_FIFO];
- priv->tx_mb_idx = FLEXCAN_TX_MB;
- priv->tx_mb = ®s->mb[priv->tx_mb_idx];
priv->reg_imask1_default = 0;
- priv->reg_imask2_default = FLEXCAN_IFLAG_MB(priv->tx_mb_idx);
+ priv->reg_imask2_default = FLEXCAN_IFLAG_MB(FLEXCAN_TX_MB);
priv->offload.mailbox_read = flexcan_mailbox_read;
--
2.19.1
^ permalink raw reply related
* [PATCH 14/20] can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame to access frame length
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
This patch replaces the use of "struct can_frame::can_dlc" by "struct
canfd_frame::len" to access the frame's length. As it is ensured that
both structures have a compatible memory layout for this member this is
no functional change. Futher, this compatibility is documented in a
comment.
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 80530ab37b1e..46cc5fec4043 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -484,11 +484,14 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8
BUG_ON(idx >= priv->echo_skb_max);
if (priv->echo_skb[idx]) {
+ /* Using "struct canfd_frame::len" for the frame
+ * length is supported on both CAN and CANFD frames.
+ */
struct sk_buff *skb = priv->echo_skb[idx];
- struct can_frame *cf = (struct can_frame *)skb->data;
- u8 dlc = cf->can_dlc;
+ struct canfd_frame *cf = (struct canfd_frame *)skb->data;
+ u8 len = cf->len;
- *len_ptr = dlc;
+ *len_ptr = len;
priv->echo_skb[idx] = NULL;
return skb;
--
2.19.1
^ permalink raw reply related
* [PATCH 15/20] can: dev: __can_get_echo_skb(): Don't crash the kernel if can_priv::echo_skb is accessed out of bounds
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
If the "struct can_priv::echo_skb" is accessed out of bounds would lead
to a kernel crash. Better print a sensible warning message instead and
try to recover.
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 46cc5fec4043..c05e4d50d43d 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -481,7 +481,11 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8
{
struct can_priv *priv = netdev_priv(dev);
- BUG_ON(idx >= priv->echo_skb_max);
+ if (idx >= priv->echo_skb_max) {
+ netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n",
+ __func__, idx, priv->echo_skb_max);
+ return NULL;
+ }
if (priv->echo_skb[idx]) {
/* Using "struct canfd_frame::len" for the frame
--
2.19.1
^ permalink raw reply related
* [PATCH 16/20] can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
Prior to echoing a successfully transmitted CAN frame (by calling
can_get_echo_skb()), CAN drivers have to put the CAN frame (by calling
can_put_echo_skb() in the transmit function). These put and get function
take an index as parameter, which is used to identify the CAN frame.
A driver calling can_get_echo_skb() with a index not pointing to a skb
is a BUG, so add an appropriate error message.
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index c05e4d50d43d..3b3f88ffab53 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -480,6 +480,8 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr)
{
struct can_priv *priv = netdev_priv(dev);
+ struct sk_buff *skb = priv->echo_skb[idx];
+ struct canfd_frame *cf;
if (idx >= priv->echo_skb_max) {
netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n",
@@ -487,21 +489,20 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8
return NULL;
}
- if (priv->echo_skb[idx]) {
- /* Using "struct canfd_frame::len" for the frame
- * length is supported on both CAN and CANFD frames.
- */
- struct sk_buff *skb = priv->echo_skb[idx];
- struct canfd_frame *cf = (struct canfd_frame *)skb->data;
- u8 len = cf->len;
-
- *len_ptr = len;
- priv->echo_skb[idx] = NULL;
-
- return skb;
+ if (!skb) {
+ netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n",
+ __func__, idx);
+ return NULL;
}
- return NULL;
+ /* Using "struct canfd_frame::len" for the frame
+ * length is supported on both CAN and CANFD frames.
+ */
+ cf = (struct canfd_frame *)skb->data;
+ *len_ptr = cf->len;
+ priv->echo_skb[idx] = NULL;
+
+ return skb;
}
/*
--
2.19.1
^ permalink raw reply related
* [PATCH 17/20] can: rx-offload: introduce can_rx_offload_get_echo_skb() and can_rx_offload_queue_sorted() functions
From: Marc Kleine-Budde @ 2018-11-12 11:57 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Oleksij Rempel, linux-stable,
Marc Kleine-Budde
In-Reply-To: <20181112115728.18331-1-mkl@pengutronix.de>
From: Oleksij Rempel <o.rempel@pengutronix.de>
Current CAN framework can't guarantee proper/chronological order
of RX and TX-ECHO messages. To make this possible, drivers should use
this functions instead of can_get_echo_skb().
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/rx-offload.c | 46 ++++++++++++++++++++++++++++++++++
include/linux/can/rx-offload.h | 4 +++
2 files changed, 50 insertions(+)
diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c
index c7d05027a7a0..c368686e2164 100644
--- a/drivers/net/can/rx-offload.c
+++ b/drivers/net/can/rx-offload.c
@@ -211,6 +211,52 @@ int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload)
}
EXPORT_SYMBOL_GPL(can_rx_offload_irq_offload_fifo);
+int can_rx_offload_queue_sorted(struct can_rx_offload *offload,
+ struct sk_buff *skb, u32 timestamp)
+{
+ struct can_rx_offload_cb *cb;
+ unsigned long flags;
+
+ if (skb_queue_len(&offload->skb_queue) >
+ offload->skb_queue_len_max)
+ return -ENOMEM;
+
+ cb = can_rx_offload_get_cb(skb);
+ cb->timestamp = timestamp;
+
+ spin_lock_irqsave(&offload->skb_queue.lock, flags);
+ __skb_queue_add_sort(&offload->skb_queue, skb, can_rx_offload_compare);
+ spin_unlock_irqrestore(&offload->skb_queue.lock, flags);
+
+ can_rx_offload_schedule(offload);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(can_rx_offload_queue_sorted);
+
+unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
+ unsigned int idx, u32 timestamp)
+{
+ struct net_device *dev = offload->dev;
+ struct net_device_stats *stats = &dev->stats;
+ struct sk_buff *skb;
+ u8 len;
+ int err;
+
+ skb = __can_get_echo_skb(dev, idx, &len);
+ if (!skb)
+ return 0;
+
+ err = can_rx_offload_queue_sorted(offload, skb, timestamp);
+ if (err) {
+ stats->rx_errors++;
+ stats->tx_fifo_errors++;
+ }
+
+ return len;
+}
+EXPORT_SYMBOL_GPL(can_rx_offload_get_echo_skb);
+
int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb)
{
if (skb_queue_len(&offload->skb_queue) >
diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h
index cb31683bbe15..01a7c9e5d8d8 100644
--- a/include/linux/can/rx-offload.h
+++ b/include/linux/can/rx-offload.h
@@ -41,6 +41,10 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload *
int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight);
int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg);
int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
+int can_rx_offload_queue_sorted(struct can_rx_offload *offload,
+ struct sk_buff *skb, u32 timestamp);
+unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
+ unsigned int idx, u32 timestamp);
int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb);
void can_rx_offload_reset(struct can_rx_offload *offload);
void can_rx_offload_del(struct can_rx_offload *offload);
--
2.19.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox