diff options
116 files changed, 1097 insertions, 427 deletions
diff --git a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt index 36603419d6f8..0e72183f52bc 100644 --- a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt +++ b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt | |||
| @@ -4,14 +4,10 @@ Required properties: | |||
| 4 | - compatible : "olpc,ap-sp" | 4 | - compatible : "olpc,ap-sp" |
| 5 | - reg : base address and length of SoC's WTM registers | 5 | - reg : base address and length of SoC's WTM registers |
| 6 | - interrupts : SP-AP interrupt | 6 | - interrupts : SP-AP interrupt |
| 7 | - clocks : phandle + clock-specifier for the clock that drives the WTM | ||
| 8 | - clock-names: should be "sp" | ||
| 9 | 7 | ||
| 10 | Example: | 8 | Example: |
| 11 | ap-sp@d4290000 { | 9 | ap-sp@d4290000 { |
| 12 | compatible = "olpc,ap-sp"; | 10 | compatible = "olpc,ap-sp"; |
| 13 | reg = <0xd4290000 0x1000>; | 11 | reg = <0xd4290000 0x1000>; |
| 14 | interrupts = <40>; | 12 | interrupts = <40>; |
| 15 | clocks = <&soc_clocks MMP2_CLK_SP>; | ||
| 16 | clock-names = "sp"; | ||
| 17 | } | 13 | } |
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt index 819caf8ca05f..58649bd4fcfc 100644 --- a/Documentation/sysctl/fs.txt +++ b/Documentation/sysctl/fs.txt | |||
| @@ -56,26 +56,32 @@ of any kernel data structures. | |||
| 56 | 56 | ||
| 57 | dentry-state: | 57 | dentry-state: |
| 58 | 58 | ||
| 59 | From linux/fs/dentry.c: | 59 | From linux/include/linux/dcache.h: |
| 60 | -------------------------------------------------------------- | 60 | -------------------------------------------------------------- |
| 61 | struct { | 61 | struct dentry_stat_t dentry_stat { |
| 62 | int nr_dentry; | 62 | int nr_dentry; |
| 63 | int nr_unused; | 63 | int nr_unused; |
| 64 | int age_limit; /* age in seconds */ | 64 | int age_limit; /* age in seconds */ |
| 65 | int want_pages; /* pages requested by system */ | 65 | int want_pages; /* pages requested by system */ |
| 66 | int dummy[2]; | 66 | int nr_negative; /* # of unused negative dentries */ |
| 67 | } dentry_stat = {0, 0, 45, 0,}; | 67 | int dummy; /* Reserved for future use */ |
| 68 | -------------------------------------------------------------- | 68 | }; |
| 69 | 69 | -------------------------------------------------------------- | |
| 70 | Dentries are dynamically allocated and deallocated, and | 70 | |
| 71 | nr_dentry seems to be 0 all the time. Hence it's safe to | 71 | Dentries are dynamically allocated and deallocated. |
| 72 | assume that only nr_unused, age_limit and want_pages are | 72 | |
| 73 | used. Nr_unused seems to be exactly what its name says. | 73 | nr_dentry shows the total number of dentries allocated (active |
| 74 | + unused). nr_unused shows the number of dentries that are not | ||
| 75 | actively used, but are saved in the LRU list for future reuse. | ||
| 76 | |||
| 74 | Age_limit is the age in seconds after which dcache entries | 77 | Age_limit is the age in seconds after which dcache entries |
| 75 | can be reclaimed when memory is short and want_pages is | 78 | can be reclaimed when memory is short and want_pages is |
| 76 | nonzero when shrink_dcache_pages() has been called and the | 79 | nonzero when shrink_dcache_pages() has been called and the |
| 77 | dcache isn't pruned yet. | 80 | dcache isn't pruned yet. |
| 78 | 81 | ||
| 82 | nr_negative shows the number of unused dentries that are also | ||
| 83 | negative dentries which do not mapped to actual files. | ||
| 84 | |||
| 79 | ============================================================== | 85 | ============================================================== |
| 80 | 86 | ||
| 81 | dquot-max & dquot-nr: | 87 | dquot-max & dquot-nr: |
diff --git a/MAINTAINERS b/MAINTAINERS index 9f64f8d3740e..2d3c1918f1b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -16673,6 +16673,24 @@ T: git git://linuxtv.org/media_tree.git | |||
| 16673 | S: Maintained | 16673 | S: Maintained |
| 16674 | F: drivers/media/tuners/tuner-xc2028.* | 16674 | F: drivers/media/tuners/tuner-xc2028.* |
| 16675 | 16675 | ||
| 16676 | XDP (eXpress Data Path) | ||
| 16677 | M: Alexei Starovoitov <ast@kernel.org> | ||
| 16678 | M: Daniel Borkmann <daniel@iogearbox.net> | ||
| 16679 | M: David S. Miller <davem@davemloft.net> | ||
| 16680 | M: Jakub Kicinski <jakub.kicinski@netronome.com> | ||
| 16681 | M: Jesper Dangaard Brouer <hawk@kernel.org> | ||
| 16682 | M: John Fastabend <john.fastabend@gmail.com> | ||
| 16683 | L: netdev@vger.kernel.org | ||
| 16684 | L: xdp-newbies@vger.kernel.org | ||
| 16685 | S: Supported | ||
| 16686 | F: net/core/xdp.c | ||
| 16687 | F: include/net/xdp.h | ||
| 16688 | F: kernel/bpf/devmap.c | ||
| 16689 | F: kernel/bpf/cpumap.c | ||
| 16690 | F: include/trace/events/xdp.h | ||
| 16691 | K: xdp | ||
| 16692 | N: xdp | ||
| 16693 | |||
| 16676 | XDP SOCKETS (AF_XDP) | 16694 | XDP SOCKETS (AF_XDP) |
| 16677 | M: Björn Töpel <bjorn.topel@intel.com> | 16695 | M: Björn Töpel <bjorn.topel@intel.com> |
| 16678 | M: Magnus Karlsson <magnus.karlsson@intel.com> | 16696 | M: Magnus Karlsson <magnus.karlsson@intel.com> |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 318394ed5c7a..95a11d5b3587 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
| @@ -83,7 +83,7 @@ static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, | |||
| 83 | } else /* remote PCI bus */ | 83 | } else /* remote PCI bus */ |
| 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); | 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); |
| 85 | 85 | ||
| 86 | return base + (where & 0xffc) + (devfn << 12); | 86 | return base + where + (devfn << 12); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
| @@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
| 93 | u32 mask = (0x1ull << (size * 8)) - 1; | 93 | u32 mask = (0x1ull << (size * 8)) - 1; |
| 94 | int shift = (where % 4) * 8; | 94 | int shift = (where % 4) * 8; |
| 95 | 95 | ||
| 96 | ret = pci_generic_config_read32(bus, devfn, where, size, val); | 96 | ret = pci_generic_config_read(bus, devfn, where, size, val); |
| 97 | 97 | ||
| 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && | 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && |
| 99 | (where & 0xffc) == PCI_CLASS_REVISION) | 99 | (where & 0xffc) == PCI_CLASS_REVISION) |
diff --git a/arch/x86/lib/iomem.c b/arch/x86/lib/iomem.c index 66894675f3c8..df50451d94ef 100644 --- a/arch/x86/lib/iomem.c +++ b/arch/x86/lib/iomem.c | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
| 3 | #include <linux/io.h> | 3 | #include <linux/io.h> |
| 4 | 4 | ||
| 5 | #define movs(type,to,from) \ | ||
| 6 | asm volatile("movs" type:"=&D" (to), "=&S" (from):"0" (to), "1" (from):"memory") | ||
| 7 | |||
| 5 | /* Originally from i386/string.h */ | 8 | /* Originally from i386/string.h */ |
| 6 | static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | 9 | static __always_inline void rep_movs(void *to, const void *from, size_t n) |
| 7 | { | 10 | { |
| 8 | unsigned long d0, d1, d2; | 11 | unsigned long d0, d1, d2; |
| 9 | asm volatile("rep ; movsl\n\t" | 12 | asm volatile("rep ; movsl\n\t" |
| @@ -21,13 +24,37 @@ static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | |||
| 21 | 24 | ||
| 22 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) | 25 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) |
| 23 | { | 26 | { |
| 24 | __iomem_memcpy(to, (const void *)from, n); | 27 | if (unlikely(!n)) |
| 28 | return; | ||
| 29 | |||
| 30 | /* Align any unaligned source IO */ | ||
| 31 | if (unlikely(1 & (unsigned long)from)) { | ||
| 32 | movs("b", to, from); | ||
| 33 | n--; | ||
| 34 | } | ||
| 35 | if (n > 1 && unlikely(2 & (unsigned long)from)) { | ||
| 36 | movs("w", to, from); | ||
| 37 | n-=2; | ||
| 38 | } | ||
| 39 | rep_movs(to, (const void *)from, n); | ||
| 25 | } | 40 | } |
| 26 | EXPORT_SYMBOL(memcpy_fromio); | 41 | EXPORT_SYMBOL(memcpy_fromio); |
| 27 | 42 | ||
| 28 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) | 43 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) |
| 29 | { | 44 | { |
| 30 | __iomem_memcpy((void *)to, (const void *) from, n); | 45 | if (unlikely(!n)) |
| 46 | return; | ||
| 47 | |||
| 48 | /* Align any unaligned destination IO */ | ||
| 49 | if (unlikely(1 & (unsigned long)to)) { | ||
| 50 | movs("b", to, from); | ||
| 51 | n--; | ||
| 52 | } | ||
| 53 | if (n > 1 && unlikely(2 & (unsigned long)to)) { | ||
| 54 | movs("w", to, from); | ||
| 55 | n-=2; | ||
| 56 | } | ||
| 57 | rep_movs((void *)to, (const void *) from, n); | ||
| 31 | } | 58 | } |
| 32 | EXPORT_SYMBOL(memcpy_toio); | 59 | EXPORT_SYMBOL(memcpy_toio); |
| 33 | 60 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 457be03b744d..0ea2139c50d8 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -130,7 +130,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) | |||
| 130 | { | 130 | { |
| 131 | int autosuspend_delay; | 131 | int autosuspend_delay; |
| 132 | u64 last_busy, expires = 0; | 132 | u64 last_busy, expires = 0; |
| 133 | u64 now = ktime_to_ns(ktime_get()); | 133 | u64 now = ktime_get_mono_fast_ns(); |
| 134 | 134 | ||
| 135 | if (!dev->power.use_autosuspend) | 135 | if (!dev->power.use_autosuspend) |
| 136 | goto out; | 136 | goto out; |
| @@ -909,7 +909,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 909 | * If 'expires' is after the current time, we've been called | 909 | * If 'expires' is after the current time, we've been called |
| 910 | * too early. | 910 | * too early. |
| 911 | */ | 911 | */ |
| 912 | if (expires > 0 && expires < ktime_to_ns(ktime_get())) { | 912 | if (expires > 0 && expires < ktime_get_mono_fast_ns()) { |
| 913 | dev->power.timer_expires = 0; | 913 | dev->power.timer_expires = 0; |
| 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? | 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? |
| 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); | 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); |
| @@ -928,7 +928,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) | 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) |
| 929 | { | 929 | { |
| 930 | unsigned long flags; | 930 | unsigned long flags; |
| 931 | ktime_t expires; | 931 | u64 expires; |
| 932 | int retval; | 932 | int retval; |
| 933 | 933 | ||
| 934 | spin_lock_irqsave(&dev->power.lock, flags); | 934 | spin_lock_irqsave(&dev->power.lock, flags); |
| @@ -945,8 +945,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) | |||
| 945 | /* Other scheduled or pending requests need to be canceled. */ | 945 | /* Other scheduled or pending requests need to be canceled. */ |
| 946 | pm_runtime_cancel_pending(dev); | 946 | pm_runtime_cancel_pending(dev); |
| 947 | 947 | ||
| 948 | expires = ktime_add(ktime_get(), ms_to_ktime(delay)); | 948 | expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; |
| 949 | dev->power.timer_expires = ktime_to_ns(expires); | 949 | dev->power.timer_expires = expires; |
| 950 | dev->power.timer_autosuspends = 0; | 950 | dev->power.timer_autosuspends = 0; |
| 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); | 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); |
| 952 | 952 | ||
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 6ccdbedb02f3..d2477a5058ac 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
| @@ -1513,9 +1513,19 @@ static int clk_fetch_parent_index(struct clk_core *core, | |||
| 1513 | if (!parent) | 1513 | if (!parent) |
| 1514 | return -EINVAL; | 1514 | return -EINVAL; |
| 1515 | 1515 | ||
| 1516 | for (i = 0; i < core->num_parents; i++) | 1516 | for (i = 0; i < core->num_parents; i++) { |
| 1517 | if (clk_core_get_parent_by_index(core, i) == parent) | 1517 | if (core->parents[i] == parent) |
| 1518 | return i; | ||
| 1519 | |||
| 1520 | if (core->parents[i]) | ||
| 1521 | continue; | ||
| 1522 | |||
| 1523 | /* Fallback to comparing globally unique names */ | ||
| 1524 | if (!strcmp(parent->name, core->parent_names[i])) { | ||
| 1525 | core->parents[i] = parent; | ||
| 1518 | return i; | 1526 | return i; |
| 1527 | } | ||
| 1528 | } | ||
| 1519 | 1529 | ||
| 1520 | return -EINVAL; | 1530 | return -EINVAL; |
| 1521 | } | 1531 | } |
diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c index 0026c3969b1e..76b9eb15604e 100644 --- a/drivers/clk/imx/clk-frac-pll.c +++ b/drivers/clk/imx/clk-frac-pll.c | |||
| @@ -155,13 +155,14 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 155 | { | 155 | { |
| 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); | 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); |
| 157 | u32 val, divfi, divff; | 157 | u32 val, divfi, divff; |
| 158 | u64 temp64 = parent_rate; | 158 | u64 temp64; |
| 159 | int ret; | 159 | int ret; |
| 160 | 160 | ||
| 161 | parent_rate *= 8; | 161 | parent_rate *= 8; |
| 162 | rate *= 2; | 162 | rate *= 2; |
| 163 | divfi = rate / parent_rate; | 163 | divfi = rate / parent_rate; |
| 164 | temp64 *= rate - divfi; | 164 | temp64 = parent_rate * divfi; |
| 165 | temp64 = rate - temp64; | ||
| 165 | temp64 *= PLL_FRAC_DENOM; | 166 | temp64 *= PLL_FRAC_DENOM; |
| 166 | do_div(temp64, parent_rate); | 167 | do_div(temp64, parent_rate); |
| 167 | divff = temp64; | 168 | divff = temp64; |
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index 61fefc046ec5..d083b860f083 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c | |||
| @@ -53,7 +53,6 @@ | |||
| 53 | #define APMU_DISP1 0x110 | 53 | #define APMU_DISP1 0x110 |
| 54 | #define APMU_CCIC0 0x50 | 54 | #define APMU_CCIC0 0x50 |
| 55 | #define APMU_CCIC1 0xf4 | 55 | #define APMU_CCIC1 0xf4 |
| 56 | #define APMU_SP 0x68 | ||
| 57 | #define MPMU_UART_PLL 0x14 | 56 | #define MPMU_UART_PLL 0x14 |
| 58 | 57 | ||
| 59 | struct mmp2_clk_unit { | 58 | struct mmp2_clk_unit { |
| @@ -210,8 +209,6 @@ static struct mmp_clk_mix_config ccic1_mix_config = { | |||
| 210 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), | 209 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), |
| 211 | }; | 210 | }; |
| 212 | 211 | ||
| 213 | static DEFINE_SPINLOCK(sp_lock); | ||
| 214 | |||
| 215 | static struct mmp_param_mux_clk apmu_mux_clks[] = { | 212 | static struct mmp_param_mux_clk apmu_mux_clks[] = { |
| 216 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, | 213 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, |
| 217 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, | 214 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, |
| @@ -242,7 +239,6 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = { | |||
| 242 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, | 239 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, |
| 243 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, | 240 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, |
| 244 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, | 241 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, |
| 245 | {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock}, | ||
| 246 | }; | 242 | }; |
| 247 | 243 | ||
| 248 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) | 244 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) |
diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c index c782e62dd98b..58fa5c247af1 100644 --- a/drivers/clk/qcom/gcc-sdm845.c +++ b/drivers/clk/qcom/gcc-sdm845.c | |||
| @@ -115,8 +115,8 @@ static const char * const gcc_parent_names_6[] = { | |||
| 115 | "core_bi_pll_test_se", | 115 | "core_bi_pll_test_se", |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | static const char * const gcc_parent_names_7[] = { | 118 | static const char * const gcc_parent_names_7_ao[] = { |
| 119 | "bi_tcxo", | 119 | "bi_tcxo_ao", |
| 120 | "gpll0", | 120 | "gpll0", |
| 121 | "gpll0_out_even", | 121 | "gpll0_out_even", |
| 122 | "core_bi_pll_test_se", | 122 | "core_bi_pll_test_se", |
| @@ -128,6 +128,12 @@ static const char * const gcc_parent_names_8[] = { | |||
| 128 | "core_bi_pll_test_se", | 128 | "core_bi_pll_test_se", |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static const char * const gcc_parent_names_8_ao[] = { | ||
| 132 | "bi_tcxo_ao", | ||
| 133 | "gpll0", | ||
| 134 | "core_bi_pll_test_se", | ||
| 135 | }; | ||
| 136 | |||
| 131 | static const struct parent_map gcc_parent_map_10[] = { | 137 | static const struct parent_map gcc_parent_map_10[] = { |
| 132 | { P_BI_TCXO, 0 }, | 138 | { P_BI_TCXO, 0 }, |
| 133 | { P_GPLL0_OUT_MAIN, 1 }, | 139 | { P_GPLL0_OUT_MAIN, 1 }, |
| @@ -210,7 +216,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { | |||
| 210 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, | 216 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, |
| 211 | .clkr.hw.init = &(struct clk_init_data){ | 217 | .clkr.hw.init = &(struct clk_init_data){ |
| 212 | .name = "gcc_cpuss_ahb_clk_src", | 218 | .name = "gcc_cpuss_ahb_clk_src", |
| 213 | .parent_names = gcc_parent_names_7, | 219 | .parent_names = gcc_parent_names_7_ao, |
| 214 | .num_parents = 4, | 220 | .num_parents = 4, |
| 215 | .ops = &clk_rcg2_ops, | 221 | .ops = &clk_rcg2_ops, |
| 216 | }, | 222 | }, |
| @@ -229,7 +235,7 @@ static struct clk_rcg2 gcc_cpuss_rbcpr_clk_src = { | |||
| 229 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, | 235 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, |
| 230 | .clkr.hw.init = &(struct clk_init_data){ | 236 | .clkr.hw.init = &(struct clk_init_data){ |
| 231 | .name = "gcc_cpuss_rbcpr_clk_src", | 237 | .name = "gcc_cpuss_rbcpr_clk_src", |
| 232 | .parent_names = gcc_parent_names_8, | 238 | .parent_names = gcc_parent_names_8_ao, |
| 233 | .num_parents = 3, | 239 | .num_parents = 3, |
| 234 | .ops = &clk_rcg2_ops, | 240 | .ops = &clk_rcg2_ops, |
| 235 | }, | 241 | }, |
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index 8d77090ad94a..0241450f3eb3 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
| @@ -403,8 +403,10 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, | |||
| 403 | num_dividers = i; | 403 | num_dividers = i; |
| 404 | 404 | ||
| 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); | 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); |
| 406 | if (!tmp) | 406 | if (!tmp) { |
| 407 | *table = ERR_PTR(-ENOMEM); | ||
| 407 | return -ENOMEM; | 408 | return -ENOMEM; |
| 409 | } | ||
| 408 | 410 | ||
| 409 | valid_div = 0; | 411 | valid_div = 0; |
| 410 | *width = 0; | 412 | *width = 0; |
| @@ -439,6 +441,7 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) | |||
| 439 | { | 441 | { |
| 440 | struct clk_omap_divider *div; | 442 | struct clk_omap_divider *div; |
| 441 | struct clk_omap_reg *reg; | 443 | struct clk_omap_reg *reg; |
| 444 | int ret; | ||
| 442 | 445 | ||
| 443 | if (!setup) | 446 | if (!setup) |
| 444 | return NULL; | 447 | return NULL; |
| @@ -458,6 +461,12 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) | |||
| 458 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; | 461 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; |
| 459 | 462 | ||
| 460 | div->table = _get_div_table_from_setup(setup, &div->width); | 463 | div->table = _get_div_table_from_setup(setup, &div->width); |
| 464 | if (IS_ERR(div->table)) { | ||
| 465 | ret = PTR_ERR(div->table); | ||
| 466 | kfree(div); | ||
| 467 | return ERR_PTR(ret); | ||
| 468 | } | ||
| 469 | |||
| 461 | 470 | ||
| 462 | div->shift = setup->bit_shift; | 471 | div->shift = setup->bit_shift; |
| 463 | div->latch = -EINVAL; | 472 | div->latch = -EINVAL; |
diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index b17d153e724f..23a1b27579a5 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c | |||
| @@ -21,7 +21,7 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, | |||
| 21 | local_irq_enable(); | 21 | local_irq_enable(); |
| 22 | if (!current_set_polling_and_test()) { | 22 | if (!current_set_polling_and_test()) { |
| 23 | unsigned int loop_count = 0; | 23 | unsigned int loop_count = 0; |
| 24 | u64 limit = TICK_USEC; | 24 | u64 limit = TICK_NSEC; |
| 25 | int i; | 25 | int i; |
| 26 | 26 | ||
| 27 | for (i = 1; i < drv->state_count; i++) { | 27 | for (i = 1; i < drv->state_count; i++) { |
diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c index fe070d75c842..4c97478d44bd 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | |||
| @@ -537,6 +537,8 @@ static void process_response_list(struct nitrox_cmdq *cmdq) | |||
| 537 | struct nitrox_device *ndev = cmdq->ndev; | 537 | struct nitrox_device *ndev = cmdq->ndev; |
| 538 | struct nitrox_softreq *sr; | 538 | struct nitrox_softreq *sr; |
| 539 | int req_completed = 0, err = 0, budget; | 539 | int req_completed = 0, err = 0, budget; |
| 540 | completion_t callback; | ||
| 541 | void *cb_arg; | ||
| 540 | 542 | ||
| 541 | /* check all pending requests */ | 543 | /* check all pending requests */ |
| 542 | budget = atomic_read(&cmdq->pending_count); | 544 | budget = atomic_read(&cmdq->pending_count); |
| @@ -564,13 +566,13 @@ static void process_response_list(struct nitrox_cmdq *cmdq) | |||
| 564 | smp_mb__after_atomic(); | 566 | smp_mb__after_atomic(); |
| 565 | /* remove from response list */ | 567 | /* remove from response list */ |
| 566 | response_list_del(sr, cmdq); | 568 | response_list_del(sr, cmdq); |
| 567 | |||
| 568 | /* ORH error code */ | 569 | /* ORH error code */ |
| 569 | err = READ_ONCE(*sr->resp.orh) & 0xff; | 570 | err = READ_ONCE(*sr->resp.orh) & 0xff; |
| 570 | 571 | callback = sr->callback; | |
| 571 | if (sr->callback) | 572 | cb_arg = sr->cb_arg; |
| 572 | sr->callback(sr->cb_arg, err); | ||
| 573 | softreq_destroy(sr); | 573 | softreq_destroy(sr); |
| 574 | if (callback) | ||
| 575 | callback(cb_arg, err); | ||
| 574 | 576 | ||
| 575 | req_completed++; | 577 | req_completed++; |
| 576 | } | 578 | } |
diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c index 6b11f1314248..7f9e0304b510 100644 --- a/drivers/gpio/gpio-altera-a10sr.c +++ b/drivers/gpio/gpio-altera-a10sr.c | |||
| @@ -66,8 +66,10 @@ static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc, | |||
| 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, | 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, |
| 67 | unsigned int nr, int value) | 67 | unsigned int nr, int value) |
| 68 | { | 68 | { |
| 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) | 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { |
| 70 | altr_a10sr_gpio_set(gc, nr, value); | ||
| 70 | return 0; | 71 | return 0; |
| 72 | } | ||
| 71 | return -EINVAL; | 73 | return -EINVAL; |
| 72 | } | 74 | } |
| 73 | 75 | ||
diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index e0d6a0a7bc69..e41223c05f6e 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c | |||
| @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) | |||
| 180 | 180 | ||
| 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) | 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) |
| 182 | { | 182 | { |
| 183 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | 183 | struct sprd_eic *sprd_eic = gpiochip_get_data(chip); |
| 184 | |||
| 185 | switch (sprd_eic->type) { | ||
| 186 | case SPRD_EIC_DEBOUNCE: | ||
| 187 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | ||
| 188 | case SPRD_EIC_ASYNC: | ||
| 189 | return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); | ||
| 190 | case SPRD_EIC_SYNC: | ||
| 191 | return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); | ||
| 192 | default: | ||
| 193 | return -ENOTSUPP; | ||
| 194 | } | ||
| 184 | } | 195 | } |
| 185 | 196 | ||
| 186 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) | 197 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) |
| @@ -368,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) | |||
| 368 | irq_set_handler_locked(data, handle_edge_irq); | 379 | irq_set_handler_locked(data, handle_edge_irq); |
| 369 | break; | 380 | break; |
| 370 | case IRQ_TYPE_EDGE_BOTH: | 381 | case IRQ_TYPE_EDGE_BOTH: |
| 382 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); | ||
| 371 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); | 383 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); |
| 372 | irq_set_handler_locked(data, handle_edge_irq); | 384 | irq_set_handler_locked(data, handle_edge_irq); |
| 373 | break; | 385 | break; |
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index adf72dda25a2..68a35b65925a 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
| @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table); | |||
| 84 | */ | 84 | */ |
| 85 | struct pcf857x { | 85 | struct pcf857x { |
| 86 | struct gpio_chip chip; | 86 | struct gpio_chip chip; |
| 87 | struct irq_chip irqchip; | ||
| 87 | struct i2c_client *client; | 88 | struct i2c_client *client; |
| 88 | struct mutex lock; /* protect 'out' */ | 89 | struct mutex lock; /* protect 'out' */ |
| 89 | unsigned out; /* software latch */ | 90 | unsigned out; /* software latch */ |
| @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock(struct irq_data *data) | |||
| 252 | mutex_unlock(&gpio->lock); | 253 | mutex_unlock(&gpio->lock); |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static struct irq_chip pcf857x_irq_chip = { | ||
| 256 | .name = "pcf857x", | ||
| 257 | .irq_enable = pcf857x_irq_enable, | ||
| 258 | .irq_disable = pcf857x_irq_disable, | ||
| 259 | .irq_ack = noop, | ||
| 260 | .irq_mask = noop, | ||
| 261 | .irq_unmask = noop, | ||
| 262 | .irq_set_wake = pcf857x_irq_set_wake, | ||
| 263 | .irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 264 | .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 265 | }; | ||
| 266 | |||
| 267 | /*-------------------------------------------------------------------------*/ | 256 | /*-------------------------------------------------------------------------*/ |
| 268 | 257 | ||
| 269 | static int pcf857x_probe(struct i2c_client *client, | 258 | static int pcf857x_probe(struct i2c_client *client, |
| @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 376 | 365 | ||
| 377 | /* Enable irqchip if we have an interrupt */ | 366 | /* Enable irqchip if we have an interrupt */ |
| 378 | if (client->irq) { | 367 | if (client->irq) { |
| 368 | gpio->irqchip.name = "pcf857x", | ||
| 369 | gpio->irqchip.irq_enable = pcf857x_irq_enable, | ||
| 370 | gpio->irqchip.irq_disable = pcf857x_irq_disable, | ||
| 371 | gpio->irqchip.irq_ack = noop, | ||
| 372 | gpio->irqchip.irq_mask = noop, | ||
| 373 | gpio->irqchip.irq_unmask = noop, | ||
| 374 | gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, | ||
| 375 | gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 376 | gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 379 | status = gpiochip_irqchip_add_nested(&gpio->chip, | 377 | status = gpiochip_irqchip_add_nested(&gpio->chip, |
| 380 | &pcf857x_irq_chip, | 378 | &gpio->irqchip, |
| 381 | 0, handle_level_irq, | 379 | 0, handle_level_irq, |
| 382 | IRQ_TYPE_NONE); | 380 | IRQ_TYPE_NONE); |
| 383 | if (status) { | 381 | if (status) { |
| @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 392 | if (status) | 390 | if (status) |
| 393 | goto fail; | 391 | goto fail; |
| 394 | 392 | ||
| 395 | gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, | 393 | gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, |
| 396 | client->irq); | 394 | client->irq); |
| 397 | gpio->irq_parent = client->irq; | 395 | gpio->irq_parent = client->irq; |
| 398 | } | 396 | } |
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 1b79ebcfce3e..541fa6ac399d 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c | |||
| @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 253 | struct vf610_gpio_port *port; | 253 | struct vf610_gpio_port *port; |
| 254 | struct resource *iores; | 254 | struct resource *iores; |
| 255 | struct gpio_chip *gc; | 255 | struct gpio_chip *gc; |
| 256 | int i; | ||
| 256 | int ret; | 257 | int ret; |
| 257 | 258 | ||
| 258 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); | 259 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
| @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 319 | if (ret < 0) | 320 | if (ret < 0) |
| 320 | return ret; | 321 | return ret; |
| 321 | 322 | ||
| 323 | /* Mask all GPIO interrupts */ | ||
| 324 | for (i = 0; i < gc->ngpio; i++) | ||
| 325 | vf610_gpio_writel(0, port->base + PORT_PCR(i)); | ||
| 326 | |||
| 322 | /* Clear the interrupt status register for all GPIO's */ | 327 | /* Clear the interrupt status register for all GPIO's */ |
| 323 | vf610_gpio_writel(~0, port->base + PORT_ISFR); | 328 | vf610_gpio_writel(~0, port->base + PORT_ISFR); |
| 324 | 329 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1651d7f0a303..d1adfdf50fb3 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -828,7 +828,14 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) | |||
| 828 | /* Do not leak kernel stack to userspace */ | 828 | /* Do not leak kernel stack to userspace */ |
| 829 | memset(&ge, 0, sizeof(ge)); | 829 | memset(&ge, 0, sizeof(ge)); |
| 830 | 830 | ||
| 831 | ge.timestamp = le->timestamp; | 831 | /* |
| 832 | * We may be running from a nested threaded interrupt in which case | ||
| 833 | * we didn't get the timestamp from lineevent_irq_handler(). | ||
| 834 | */ | ||
| 835 | if (!le->timestamp) | ||
| 836 | ge.timestamp = ktime_get_real_ns(); | ||
| 837 | else | ||
| 838 | ge.timestamp = le->timestamp; | ||
| 832 | 839 | ||
| 833 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE | 840 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE |
| 834 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { | 841 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { |
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c39f89d2deba..2dc628d4f1ae 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c | |||
| @@ -1828,7 +1828,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, | |||
| 1828 | 1828 | ||
| 1829 | ret = i3c_master_retrieve_dev_info(newdev); | 1829 | ret = i3c_master_retrieve_dev_info(newdev); |
| 1830 | if (ret) | 1830 | if (ret) |
| 1831 | goto err_free_dev; | 1831 | goto err_detach_dev; |
| 1832 | 1832 | ||
| 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); | 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); |
| 1834 | if (olddev) { | 1834 | if (olddev) { |
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index f8c00b94817f..bb03079fbade 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c | |||
| @@ -419,12 +419,9 @@ static void dw_i3c_master_enqueue_xfer(struct dw_i3c_master *master, | |||
| 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | 422 | static void dw_i3c_master_dequeue_xfer_locked(struct dw_i3c_master *master, |
| 423 | struct dw_i3c_xfer *xfer) | 423 | struct dw_i3c_xfer *xfer) |
| 424 | { | 424 | { |
| 425 | unsigned long flags; | ||
| 426 | |||
| 427 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 428 | if (master->xferqueue.cur == xfer) { | 425 | if (master->xferqueue.cur == xfer) { |
| 429 | u32 status; | 426 | u32 status; |
| 430 | 427 | ||
| @@ -439,6 +436,15 @@ static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | |||
| 439 | } else { | 436 | } else { |
| 440 | list_del_init(&xfer->node); | 437 | list_del_init(&xfer->node); |
| 441 | } | 438 | } |
| 439 | } | ||
| 440 | |||
| 441 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | ||
| 442 | struct dw_i3c_xfer *xfer) | ||
| 443 | { | ||
| 444 | unsigned long flags; | ||
| 445 | |||
| 446 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 447 | dw_i3c_master_dequeue_xfer_locked(master, xfer); | ||
| 442 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 448 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 443 | } | 449 | } |
| 444 | 450 | ||
| @@ -494,7 +500,7 @@ static void dw_i3c_master_end_xfer_locked(struct dw_i3c_master *master, u32 isr) | |||
| 494 | complete(&xfer->comp); | 500 | complete(&xfer->comp); |
| 495 | 501 | ||
| 496 | if (ret < 0) { | 502 | if (ret < 0) { |
| 497 | dw_i3c_master_dequeue_xfer(master, xfer); | 503 | dw_i3c_master_dequeue_xfer_locked(master, xfer); |
| 498 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, | 504 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, |
| 499 | master->regs + DEVICE_CTRL); | 505 | master->regs + DEVICE_CTRL); |
| 500 | } | 506 | } |
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 3cd830d52967..616734313f0c 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h | |||
| @@ -267,7 +267,6 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, | |||
| 267 | #endif | 267 | #endif |
| 268 | 268 | ||
| 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); | 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
| 270 | void ib_device_put(struct ib_device *device); | ||
| 271 | /* RDMA device netlink */ | 270 | /* RDMA device netlink */ |
| 272 | void nldev_init(void); | 271 | void nldev_init(void); |
| 273 | void nldev_exit(void); | 272 | void nldev_exit(void); |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 8872453e26c0..238ec42778ef 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
| @@ -156,19 +156,26 @@ struct ib_device *ib_device_get_by_index(u32 index) | |||
| 156 | down_read(&lists_rwsem); | 156 | down_read(&lists_rwsem); |
| 157 | device = __ib_device_get_by_index(index); | 157 | device = __ib_device_get_by_index(index); |
| 158 | if (device) { | 158 | if (device) { |
| 159 | /* Do not return a device if unregistration has started. */ | 159 | if (!ib_device_try_get(device)) |
| 160 | if (!refcount_inc_not_zero(&device->refcount)) | ||
| 161 | device = NULL; | 160 | device = NULL; |
| 162 | } | 161 | } |
| 163 | up_read(&lists_rwsem); | 162 | up_read(&lists_rwsem); |
| 164 | return device; | 163 | return device; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 166 | /** | ||
| 167 | * ib_device_put - Release IB device reference | ||
| 168 | * @device: device whose reference to be released | ||
| 169 | * | ||
| 170 | * ib_device_put() releases reference to the IB device to allow it to be | ||
| 171 | * unregistered and eventually free. | ||
| 172 | */ | ||
| 167 | void ib_device_put(struct ib_device *device) | 173 | void ib_device_put(struct ib_device *device) |
| 168 | { | 174 | { |
| 169 | if (refcount_dec_and_test(&device->refcount)) | 175 | if (refcount_dec_and_test(&device->refcount)) |
| 170 | complete(&device->unreg_completion); | 176 | complete(&device->unreg_completion); |
| 171 | } | 177 | } |
| 178 | EXPORT_SYMBOL(ib_device_put); | ||
| 172 | 179 | ||
| 173 | static struct ib_device *__ib_device_get_by_name(const char *name) | 180 | static struct ib_device *__ib_device_get_by_name(const char *name) |
| 174 | { | 181 | { |
| @@ -303,7 +310,6 @@ struct ib_device *ib_alloc_device(size_t size) | |||
| 303 | rwlock_init(&device->client_data_lock); | 310 | rwlock_init(&device->client_data_lock); |
| 304 | INIT_LIST_HEAD(&device->client_data_list); | 311 | INIT_LIST_HEAD(&device->client_data_list); |
| 305 | INIT_LIST_HEAD(&device->port_list); | 312 | INIT_LIST_HEAD(&device->port_list); |
| 306 | refcount_set(&device->refcount, 1); | ||
| 307 | init_completion(&device->unreg_completion); | 313 | init_completion(&device->unreg_completion); |
| 308 | 314 | ||
| 309 | return device; | 315 | return device; |
| @@ -620,6 +626,7 @@ int ib_register_device(struct ib_device *device, const char *name, | |||
| 620 | goto cg_cleanup; | 626 | goto cg_cleanup; |
| 621 | } | 627 | } |
| 622 | 628 | ||
| 629 | refcount_set(&device->refcount, 1); | ||
| 623 | device->reg_state = IB_DEV_REGISTERED; | 630 | device->reg_state = IB_DEV_REGISTERED; |
| 624 | 631 | ||
| 625 | list_for_each_entry(client, &client_list, list) | 632 | list_for_each_entry(client, &client_list, list) |
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index a4ec43093cb3..acb882f279cb 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c | |||
| @@ -352,6 +352,8 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 352 | umem->writable = 1; | 352 | umem->writable = 1; |
| 353 | umem->is_odp = 1; | 353 | umem->is_odp = 1; |
| 354 | odp_data->per_mm = per_mm; | 354 | odp_data->per_mm = per_mm; |
| 355 | umem->owning_mm = per_mm->mm; | ||
| 356 | mmgrab(umem->owning_mm); | ||
| 355 | 357 | ||
| 356 | mutex_init(&odp_data->umem_mutex); | 358 | mutex_init(&odp_data->umem_mutex); |
| 357 | init_completion(&odp_data->notifier_completion); | 359 | init_completion(&odp_data->notifier_completion); |
| @@ -384,6 +386,7 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 384 | out_page_list: | 386 | out_page_list: |
| 385 | vfree(odp_data->page_list); | 387 | vfree(odp_data->page_list); |
| 386 | out_odp_data: | 388 | out_odp_data: |
| 389 | mmdrop(umem->owning_mm); | ||
| 387 | kfree(odp_data); | 390 | kfree(odp_data); |
| 388 | return ERR_PTR(ret); | 391 | return ERR_PTR(ret); |
| 389 | } | 392 | } |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 2890a77339e1..5f366838b7ff 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
| @@ -204,6 +204,9 @@ void ib_uverbs_release_file(struct kref *ref) | |||
| 204 | if (atomic_dec_and_test(&file->device->refcount)) | 204 | if (atomic_dec_and_test(&file->device->refcount)) |
| 205 | ib_uverbs_comp_dev(file->device); | 205 | ib_uverbs_comp_dev(file->device); |
| 206 | 206 | ||
| 207 | if (file->async_file) | ||
| 208 | kref_put(&file->async_file->ref, | ||
| 209 | ib_uverbs_release_async_event_file); | ||
| 207 | put_device(&file->device->dev); | 210 | put_device(&file->device->dev); |
| 208 | kfree(file); | 211 | kfree(file); |
| 209 | } | 212 | } |
| @@ -964,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 964 | 967 | ||
| 965 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ | 968 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ |
| 966 | mutex_lock(&ufile->umap_lock); | 969 | mutex_lock(&ufile->umap_lock); |
| 967 | if (!list_empty(&ufile->umaps)) { | 970 | while (!list_empty(&ufile->umaps)) { |
| 968 | mm = list_first_entry(&ufile->umaps, | 971 | int ret; |
| 969 | struct rdma_umap_priv, list) | 972 | |
| 970 | ->vma->vm_mm; | 973 | priv = list_first_entry(&ufile->umaps, |
| 971 | mmget(mm); | 974 | struct rdma_umap_priv, list); |
| 975 | mm = priv->vma->vm_mm; | ||
| 976 | ret = mmget_not_zero(mm); | ||
| 977 | if (!ret) { | ||
| 978 | list_del_init(&priv->list); | ||
| 979 | mm = NULL; | ||
| 980 | continue; | ||
| 981 | } | ||
| 982 | break; | ||
| 972 | } | 983 | } |
| 973 | mutex_unlock(&ufile->umap_lock); | 984 | mutex_unlock(&ufile->umap_lock); |
| 974 | if (!mm) | 985 | if (!mm) |
| @@ -1096,10 +1107,6 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) | |||
| 1096 | list_del_init(&file->list); | 1107 | list_del_init(&file->list); |
| 1097 | mutex_unlock(&file->device->lists_mutex); | 1108 | mutex_unlock(&file->device->lists_mutex); |
| 1098 | 1109 | ||
| 1099 | if (file->async_file) | ||
| 1100 | kref_put(&file->async_file->ref, | ||
| 1101 | ib_uverbs_release_async_event_file); | ||
| 1102 | |||
| 1103 | kref_put(&file->ref, ib_uverbs_release_file); | 1110 | kref_put(&file->ref, ib_uverbs_release_file); |
| 1104 | 1111 | ||
| 1105 | return 0; | 1112 | return 0; |
diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c index 5030ec480370..2a3f2f01028d 100644 --- a/drivers/infiniband/core/uverbs_std_types_device.c +++ b/drivers/infiniband/core/uverbs_std_types_device.c | |||
| @@ -168,12 +168,18 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr, | |||
| 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( | 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( |
| 169 | struct uverbs_attr_bundle *attrs) | 169 | struct uverbs_attr_bundle *attrs) |
| 170 | { | 170 | { |
| 171 | struct ib_device *ib_dev = attrs->ufile->device->ib_dev; | 171 | struct ib_device *ib_dev; |
| 172 | struct ib_port_attr attr = {}; | 172 | struct ib_port_attr attr = {}; |
| 173 | struct ib_uverbs_query_port_resp_ex resp = {}; | 173 | struct ib_uverbs_query_port_resp_ex resp = {}; |
| 174 | struct ib_ucontext *ucontext; | ||
| 174 | int ret; | 175 | int ret; |
| 175 | u8 port_num; | 176 | u8 port_num; |
| 176 | 177 | ||
| 178 | ucontext = ib_uverbs_get_ucontext(attrs); | ||
| 179 | if (IS_ERR(ucontext)) | ||
| 180 | return PTR_ERR(ucontext); | ||
| 181 | ib_dev = ucontext->device; | ||
| 182 | |||
| 177 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ | 183 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ |
| 178 | if (!ib_dev->ops.query_port) | 184 | if (!ib_dev->ops.query_port) |
| 179 | return -EOPNOTSUPP; | 185 | return -EOPNOTSUPP; |
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index c22ebc774a6a..f9a7e9d29c8b 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c | |||
| @@ -488,7 +488,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 488 | vmf = 1; | 488 | vmf = 1; |
| 489 | break; | 489 | break; |
| 490 | case STATUS: | 490 | case STATUS: |
| 491 | if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) { | 491 | if (flags & VM_WRITE) { |
| 492 | ret = -EPERM; | 492 | ret = -EPERM; |
| 493 | goto done; | 493 | goto done; |
| 494 | } | 494 | } |
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index 88242fe95eaa..bf96067876c9 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c | |||
| @@ -987,7 +987,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; | 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; |
| 989 | wc.wc_flags = IB_WC_WITH_IMM; | 989 | wc.wc_flags = IB_WC_WITH_IMM; |
| 990 | tlen -= sizeof(u32); | ||
| 991 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 990 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 992 | wc.ex.imm_data = 0; | 991 | wc.ex.imm_data = 0; |
| 993 | wc.wc_flags = 0; | 992 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index 960b1946c365..12deacf442cf 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c | |||
| @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 210 | struct ib_udata *udata) | 210 | struct ib_udata *udata) |
| 211 | { | 211 | { |
| 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); | 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); |
| 213 | struct hns_roce_ib_create_srq_resp resp = {}; | ||
| 213 | struct hns_roce_srq *srq; | 214 | struct hns_roce_srq *srq; |
| 214 | int srq_desc_size; | 215 | int srq_desc_size; |
| 215 | int srq_buf_size; | 216 | int srq_buf_size; |
| @@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 378 | 379 | ||
| 379 | srq->event = hns_roce_ib_srq_event; | 380 | srq->event = hns_roce_ib_srq_event; |
| 380 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; | 381 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; |
| 382 | resp.srqn = srq->srqn; | ||
| 381 | 383 | ||
| 382 | if (udata) { | 384 | if (udata) { |
| 383 | if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { | 385 | if (ib_copy_to_udata(udata, &resp, |
| 386 | min(udata->outlen, sizeof(resp)))) { | ||
| 384 | ret = -EFAULT; | 387 | ret = -EFAULT; |
| 385 | goto err_wrid; | 388 | goto err_srqc_alloc; |
| 386 | } | 389 | } |
| 387 | } | 390 | } |
| 388 | 391 | ||
| 389 | return &srq->ibsrq; | 392 | return &srq->ibsrq; |
| 390 | 393 | ||
| 394 | err_srqc_alloc: | ||
| 395 | hns_roce_srq_free(hr_dev, srq); | ||
| 396 | |||
| 391 | err_wrid: | 397 | err_wrid: |
| 392 | kvfree(srq->wrid); | 398 | kvfree(srq->wrid); |
| 393 | 399 | ||
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 25439da8976c..936ee1314bcd 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
| @@ -1411,7 +1411,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
| 1411 | 1411 | ||
| 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); | 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); |
| 1413 | if (sqp->tx_ring[wire_tx_ix].ah) | 1413 | if (sqp->tx_ring[wire_tx_ix].ah) |
| 1414 | rdma_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | 1414 | mlx4_ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); |
| 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; | 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; |
| 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, | 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, |
| 1417 | sqp->tx_ring[wire_tx_ix].buf.map, | 1417 | sqp->tx_ring[wire_tx_ix].buf.map, |
| @@ -1902,7 +1902,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1902 | if (wc.status == IB_WC_SUCCESS) { | 1902 | if (wc.status == IB_WC_SUCCESS) { |
| 1903 | switch (wc.opcode) { | 1903 | switch (wc.opcode) { |
| 1904 | case IB_WC_SEND: | 1904 | case IB_WC_SEND: |
| 1905 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1905 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1908 | = NULL; | 1908 | = NULL; |
| @@ -1931,7 +1931,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1931 | " status = %d, wrid = 0x%llx\n", | 1931 | " status = %d, wrid = 0x%llx\n", |
| 1932 | ctx->slave, wc.status, wc.wr_id); | 1932 | ctx->slave, wc.status, wc.wr_id); |
| 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { | 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { |
| 1934 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1934 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1937 | = NULL; | 1937 | = NULL; |
diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index e8a1e4498e3f..798591a18484 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c | |||
| @@ -630,8 +630,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = { | |||
| 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), |
| 631 | UAPI_DEF_CHAIN_OBJ_TREE( | 631 | UAPI_DEF_CHAIN_OBJ_TREE( |
| 632 | UVERBS_OBJECT_FLOW, | 632 | UVERBS_OBJECT_FLOW, |
| 633 | &mlx5_ib_fs, | 633 | &mlx5_ib_fs), |
| 634 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | ||
| 635 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, | 634 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, |
| 636 | &mlx5_ib_flow_actions), | 635 | &mlx5_ib_flow_actions), |
| 637 | {}, | 636 | {}, |
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index 01e0f6200631..4ee32964e1dd 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
| @@ -1595,10 +1595,12 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) | |||
| 1595 | struct prefetch_mr_work *w = | 1595 | struct prefetch_mr_work *w = |
| 1596 | container_of(work, struct prefetch_mr_work, work); | 1596 | container_of(work, struct prefetch_mr_work, work); |
| 1597 | 1597 | ||
| 1598 | if (w->dev->ib_dev.reg_state == IB_DEV_REGISTERED) | 1598 | if (ib_device_try_get(&w->dev->ib_dev)) { |
| 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, | 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, |
| 1600 | w->num_sge); | 1600 | w->num_sge); |
| 1601 | 1601 | ib_device_put(&w->dev->ib_dev); | |
| 1602 | } | ||
| 1603 | put_device(&w->dev->ib_dev.dev); | ||
| 1602 | kfree(w); | 1604 | kfree(w); |
| 1603 | } | 1605 | } |
| 1604 | 1606 | ||
| @@ -1617,15 +1619,13 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, | |||
| 1617 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, | 1619 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, |
| 1618 | num_sge); | 1620 | num_sge); |
| 1619 | 1621 | ||
| 1620 | if (dev->ib_dev.reg_state != IB_DEV_REGISTERED) | ||
| 1621 | return -ENODEV; | ||
| 1622 | |||
| 1623 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); | 1622 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); |
| 1624 | if (!work) | 1623 | if (!work) |
| 1625 | return -ENOMEM; | 1624 | return -ENOMEM; |
| 1626 | 1625 | ||
| 1627 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); | 1626 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); |
| 1628 | 1627 | ||
| 1628 | get_device(&dev->ib_dev.dev); | ||
| 1629 | work->dev = dev; | 1629 | work->dev = dev; |
| 1630 | work->pf_flags = pf_flags; | 1630 | work->pf_flags = pf_flags; |
| 1631 | work->num_sge = num_sge; | 1631 | work->num_sge = num_sge; |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index dd2ae640bc84..7db778d96ef5 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -1912,14 +1912,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, | |||
| 1912 | } | 1912 | } |
| 1913 | 1913 | ||
| 1914 | if (!check_flags_mask(ucmd.flags, | 1914 | if (!check_flags_mask(ucmd.flags, |
| 1915 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1916 | MLX5_QP_FLAG_BFREG_INDEX | | ||
| 1917 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE | | ||
| 1918 | MLX5_QP_FLAG_SCATTER_CQE | | ||
| 1915 | MLX5_QP_FLAG_SIGNATURE | | 1919 | MLX5_QP_FLAG_SIGNATURE | |
| 1916 | MLX5_QP_FLAG_SCATTER_CQE | | 1920 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC | |
| 1917 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | | 1921 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC | |
| 1918 | MLX5_QP_FLAG_BFREG_INDEX | | 1922 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | |
| 1919 | MLX5_QP_FLAG_TYPE_DCT | | 1923 | MLX5_QP_FLAG_TYPE_DCI | |
| 1920 | MLX5_QP_FLAG_TYPE_DCI | | 1924 | MLX5_QP_FLAG_TYPE_DCT)) |
| 1921 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1922 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE)) | ||
| 1923 | return -EINVAL; | 1925 | return -EINVAL; |
| 1924 | 1926 | ||
| 1925 | err = get_qp_user_index(to_mucontext(pd->uobject->context), | 1927 | err = get_qp_user_index(to_mucontext(pd->uobject->context), |
diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c index 868da0ece7ba..445ea19a2ec8 100644 --- a/drivers/infiniband/hw/qib/qib_ud.c +++ b/drivers/infiniband/hw/qib/qib_ud.c | |||
| @@ -512,7 +512,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, | |||
| 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; | 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; |
| 514 | wc.wc_flags = IB_WC_WITH_IMM; | 514 | wc.wc_flags = IB_WC_WITH_IMM; |
| 515 | tlen -= sizeof(u32); | ||
| 516 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 515 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 517 | wc.ex.imm_data = 0; | 516 | wc.ex.imm_data = 0; |
| 518 | wc.wc_flags = 0; | 517 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index a1bd8cfc2c25..c6cc3e4ab71d 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c | |||
| @@ -2910,6 +2910,8 @@ send: | |||
| 2910 | goto op_err; | 2910 | goto op_err; |
| 2911 | if (!ret) | 2911 | if (!ret) |
| 2912 | goto rnr_nak; | 2912 | goto rnr_nak; |
| 2913 | if (wqe->length > qp->r_len) | ||
| 2914 | goto inv_err; | ||
| 2913 | break; | 2915 | break; |
| 2914 | 2916 | ||
| 2915 | case IB_WR_RDMA_WRITE_WITH_IMM: | 2917 | case IB_WR_RDMA_WRITE_WITH_IMM: |
| @@ -3078,7 +3080,10 @@ op_err: | |||
| 3078 | goto err; | 3080 | goto err; |
| 3079 | 3081 | ||
| 3080 | inv_err: | 3082 | inv_err: |
| 3081 | send_status = IB_WC_REM_INV_REQ_ERR; | 3083 | send_status = |
| 3084 | sqp->ibqp.qp_type == IB_QPT_RC ? | ||
| 3085 | IB_WC_REM_INV_REQ_ERR : | ||
| 3086 | IB_WC_SUCCESS; | ||
| 3082 | wc.status = IB_WC_LOC_QP_OP_ERR; | 3087 | wc.status = IB_WC_LOC_QP_OP_ERR; |
| 3083 | goto err; | 3088 | goto err; |
| 3084 | 3089 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 1da119d901a9..73e808c1e6ad 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -248,7 +248,6 @@ struct ipoib_cm_tx { | |||
| 248 | struct list_head list; | 248 | struct list_head list; |
| 249 | struct net_device *dev; | 249 | struct net_device *dev; |
| 250 | struct ipoib_neigh *neigh; | 250 | struct ipoib_neigh *neigh; |
| 251 | struct ipoib_path *path; | ||
| 252 | struct ipoib_tx_buf *tx_ring; | 251 | struct ipoib_tx_buf *tx_ring; |
| 253 | unsigned int tx_head; | 252 | unsigned int tx_head; |
| 254 | unsigned int tx_tail; | 253 | unsigned int tx_tail; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 0428e01e8f69..aa9dcfc36cd3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
| @@ -1312,7 +1312,6 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path | |||
| 1312 | 1312 | ||
| 1313 | neigh->cm = tx; | 1313 | neigh->cm = tx; |
| 1314 | tx->neigh = neigh; | 1314 | tx->neigh = neigh; |
| 1315 | tx->path = path; | ||
| 1316 | tx->dev = dev; | 1315 | tx->dev = dev; |
| 1317 | list_add(&tx->list, &priv->cm.start_list); | 1316 | list_add(&tx->list, &priv->cm.start_list); |
| 1318 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); | 1317 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); |
| @@ -1371,7 +1370,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
| 1371 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | 1370 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); |
| 1372 | goto free_neigh; | 1371 | goto free_neigh; |
| 1373 | } | 1372 | } |
| 1374 | memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec)); | 1373 | memcpy(&pathrec, &path->pathrec, sizeof(pathrec)); |
| 1375 | 1374 | ||
| 1376 | spin_unlock_irqrestore(&priv->lock, flags); | 1375 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1377 | netif_tx_unlock_bh(dev); | 1376 | netif_tx_unlock_bh(dev); |
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index bae08226e3d9..a7cfab3db9ee 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/clk.h> | ||
| 27 | 26 | ||
| 28 | /* | 27 | /* |
| 29 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. | 28 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. |
| @@ -75,7 +74,6 @@ struct olpc_apsp { | |||
| 75 | struct serio *kbio; | 74 | struct serio *kbio; |
| 76 | struct serio *padio; | 75 | struct serio *padio; |
| 77 | void __iomem *base; | 76 | void __iomem *base; |
| 78 | struct clk *clk; | ||
| 79 | int open_count; | 77 | int open_count; |
| 80 | int irq; | 78 | int irq; |
| 81 | }; | 79 | }; |
| @@ -148,17 +146,11 @@ static int olpc_apsp_open(struct serio *port) | |||
| 148 | struct olpc_apsp *priv = port->port_data; | 146 | struct olpc_apsp *priv = port->port_data; |
| 149 | unsigned int tmp; | 147 | unsigned int tmp; |
| 150 | unsigned long l; | 148 | unsigned long l; |
| 151 | int error; | ||
| 152 | 149 | ||
| 153 | if (priv->open_count++ == 0) { | 150 | if (priv->open_count++ == 0) { |
| 154 | error = clk_prepare_enable(priv->clk); | ||
| 155 | if (error) | ||
| 156 | return error; | ||
| 157 | |||
| 158 | l = readl(priv->base + COMMAND_FIFO_STATUS); | 151 | l = readl(priv->base + COMMAND_FIFO_STATUS); |
| 159 | if (!(l & CMD_STS_MASK)) { | 152 | if (!(l & CMD_STS_MASK)) { |
| 160 | dev_err(priv->dev, "SP cannot accept commands.\n"); | 153 | dev_err(priv->dev, "SP cannot accept commands.\n"); |
| 161 | clk_disable_unprepare(priv->clk); | ||
| 162 | return -EIO; | 154 | return -EIO; |
| 163 | } | 155 | } |
| 164 | 156 | ||
| @@ -179,8 +171,6 @@ static void olpc_apsp_close(struct serio *port) | |||
| 179 | /* Disable interrupt 0 */ | 171 | /* Disable interrupt 0 */ |
| 180 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); | 172 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); |
| 181 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); | 173 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); |
| 182 | |||
| 183 | clk_disable_unprepare(priv->clk); | ||
| 184 | } | 174 | } |
| 185 | } | 175 | } |
| 186 | 176 | ||
| @@ -208,10 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) | |||
| 208 | if (priv->irq < 0) | 198 | if (priv->irq < 0) |
| 209 | return priv->irq; | 199 | return priv->irq; |
| 210 | 200 | ||
| 211 | priv->clk = devm_clk_get(&pdev->dev, "sp"); | ||
| 212 | if (IS_ERR(priv->clk)) | ||
| 213 | return PTR_ERR(priv->clk); | ||
| 214 | |||
| 215 | /* KEYBOARD */ | 201 | /* KEYBOARD */ |
| 216 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); | 202 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
| 217 | if (!kb_serio) | 203 | if (!kb_serio) |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 87ba23a75b38..2a7b78bb98b4 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -1991,16 +1991,13 @@ static void do_attach(struct iommu_dev_data *dev_data, | |||
| 1991 | 1991 | ||
| 1992 | static void do_detach(struct iommu_dev_data *dev_data) | 1992 | static void do_detach(struct iommu_dev_data *dev_data) |
| 1993 | { | 1993 | { |
| 1994 | struct protection_domain *domain = dev_data->domain; | ||
| 1994 | struct amd_iommu *iommu; | 1995 | struct amd_iommu *iommu; |
| 1995 | u16 alias; | 1996 | u16 alias; |
| 1996 | 1997 | ||
| 1997 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 1998 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 1998 | alias = dev_data->alias; | 1999 | alias = dev_data->alias; |
| 1999 | 2000 | ||
| 2000 | /* decrease reference counters */ | ||
| 2001 | dev_data->domain->dev_iommu[iommu->index] -= 1; | ||
| 2002 | dev_data->domain->dev_cnt -= 1; | ||
| 2003 | |||
| 2004 | /* Update data structures */ | 2001 | /* Update data structures */ |
| 2005 | dev_data->domain = NULL; | 2002 | dev_data->domain = NULL; |
| 2006 | list_del(&dev_data->list); | 2003 | list_del(&dev_data->list); |
| @@ -2010,6 +2007,16 @@ static void do_detach(struct iommu_dev_data *dev_data) | |||
| 2010 | 2007 | ||
| 2011 | /* Flush the DTE entry */ | 2008 | /* Flush the DTE entry */ |
| 2012 | device_flush_dte(dev_data); | 2009 | device_flush_dte(dev_data); |
| 2010 | |||
| 2011 | /* Flush IOTLB */ | ||
| 2012 | domain_flush_tlb_pde(domain); | ||
| 2013 | |||
| 2014 | /* Wait for the flushes to finish */ | ||
| 2015 | domain_flush_complete(domain); | ||
| 2016 | |||
| 2017 | /* decrease reference counters - needs to happen after the flushes */ | ||
| 2018 | domain->dev_iommu[iommu->index] -= 1; | ||
| 2019 | domain->dev_cnt -= 1; | ||
| 2013 | } | 2020 | } |
| 2014 | 2021 | ||
| 2015 | /* | 2022 | /* |
| @@ -2617,13 +2624,13 @@ out_unmap: | |||
| 2617 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); | 2624 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
| 2618 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); | 2625 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
| 2619 | 2626 | ||
| 2620 | if (--mapped_pages) | 2627 | if (--mapped_pages == 0) |
| 2621 | goto out_free_iova; | 2628 | goto out_free_iova; |
| 2622 | } | 2629 | } |
| 2623 | } | 2630 | } |
| 2624 | 2631 | ||
| 2625 | out_free_iova: | 2632 | out_free_iova: |
| 2626 | free_iova_fast(&dma_dom->iovad, address, npages); | 2633 | free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); |
| 2627 | 2634 | ||
| 2628 | out_err: | 2635 | out_err: |
| 2629 | return 0; | 2636 | return 0; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 2bd9ac285c0d..1457f931218e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -5294,7 +5294,7 @@ static void intel_iommu_put_resv_regions(struct device *dev, | |||
| 5294 | struct iommu_resv_region *entry, *next; | 5294 | struct iommu_resv_region *entry, *next; |
| 5295 | 5295 | ||
| 5296 | list_for_each_entry_safe(entry, next, head, list) { | 5296 | list_for_each_entry_safe(entry, next, head, list) { |
| 5297 | if (entry->type == IOMMU_RESV_RESERVED) | 5297 | if (entry->type == IOMMU_RESV_MSI) |
| 5298 | kfree(entry); | 5298 | kfree(entry); |
| 5299 | } | 5299 | } |
| 5300 | } | 5300 | } |
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 730f7dabcf37..7e0df67bd3e9 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c | |||
| @@ -441,6 +441,10 @@ static int mtk_iommu_add_device(struct device *dev) | |||
| 441 | iommu_spec.args_count = count; | 441 | iommu_spec.args_count = count; |
| 442 | 442 | ||
| 443 | mtk_iommu_create_mapping(dev, &iommu_spec); | 443 | mtk_iommu_create_mapping(dev, &iommu_spec); |
| 444 | |||
| 445 | /* dev->iommu_fwspec might have changed */ | ||
| 446 | fwspec = dev_iommu_fwspec_get(dev); | ||
| 447 | |||
| 444 | of_node_put(iommu_spec.np); | 448 | of_node_put(iommu_spec.np); |
| 445 | } | 449 | } |
| 446 | 450 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f461460a2aeb..76f9909cf396 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -1419,7 +1419,7 @@ config MFD_TPS65217 | |||
| 1419 | 1419 | ||
| 1420 | config MFD_TPS68470 | 1420 | config MFD_TPS68470 |
| 1421 | bool "TI TPS68470 Power Management / LED chips" | 1421 | bool "TI TPS68470 Power Management / LED chips" |
| 1422 | depends on ACPI && I2C=y | 1422 | depends on ACPI && PCI && I2C=y |
| 1423 | select MFD_CORE | 1423 | select MFD_CORE |
| 1424 | select REGMAP_I2C | 1424 | select REGMAP_I2C |
| 1425 | select I2C_DESIGNWARE_PLATFORM | 1425 | select I2C_DESIGNWARE_PLATFORM |
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 50293529d6de..c9e7aa50bb0a 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c | |||
| @@ -1431,6 +1431,8 @@ static int bcm2835_probe(struct platform_device *pdev) | |||
| 1431 | 1431 | ||
| 1432 | err: | 1432 | err: |
| 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); | 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); |
| 1434 | if (host->dma_chan_rxtx) | ||
| 1435 | dma_release_channel(host->dma_chan_rxtx); | ||
| 1434 | mmc_free_host(mmc); | 1436 | mmc_free_host(mmc); |
| 1435 | 1437 | ||
| 1436 | return ret; | 1438 | return ret; |
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 8afeaf81ae66..833ef0590af8 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c | |||
| @@ -846,7 +846,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) | |||
| 846 | 846 | ||
| 847 | if (timing == MMC_TIMING_MMC_HS400 && | 847 | if (timing == MMC_TIMING_MMC_HS400 && |
| 848 | host->dev_comp->hs400_tune) | 848 | host->dev_comp->hs400_tune) |
| 849 | sdr_set_field(host->base + PAD_CMD_TUNE, | 849 | sdr_set_field(host->base + tune_reg, |
| 850 | MSDC_PAD_TUNE_CMDRRDLY, | 850 | MSDC_PAD_TUNE_CMDRRDLY, |
| 851 | host->hs400_cmd_int_delay); | 851 | host->hs400_cmd_int_delay); |
| 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, | 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, |
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index a0f954f36c09..44e6c7b1b222 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
| @@ -257,10 +257,7 @@ static int handle_tx(struct ser_device *ser) | |||
| 257 | if (skb->len == 0) { | 257 | if (skb->len == 0) { |
| 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); | 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); |
| 259 | WARN_ON(tmp != skb); | 259 | WARN_ON(tmp != skb); |
| 260 | if (in_interrupt()) | 260 | dev_consume_skb_any(skb); |
| 261 | dev_kfree_skb_irq(skb); | ||
| 262 | else | ||
| 263 | kfree_skb(skb); | ||
| 264 | } | 261 | } |
| 265 | } | 262 | } |
| 266 | /* Send flow off if queue is empty */ | 263 | /* Send flow off if queue is empty */ |
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 2caa8c8b4b55..1bfc5ff8d81d 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c | |||
| @@ -664,7 +664,7 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) | |||
| 664 | if (port < 9) | 664 | if (port < 9) |
| 665 | return 0; | 665 | return 0; |
| 666 | 666 | ||
| 667 | return mv88e6390_serdes_irq_setup(chip, port); | 667 | return mv88e6390x_serdes_irq_setup(chip, port); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) | 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) |
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 4f11f98347ed..1827ef1f6d55 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c | |||
| @@ -2059,7 +2059,7 @@ static inline void ace_tx_int(struct net_device *dev, | |||
| 2059 | if (skb) { | 2059 | if (skb) { |
| 2060 | dev->stats.tx_packets++; | 2060 | dev->stats.tx_packets++; |
| 2061 | dev->stats.tx_bytes += skb->len; | 2061 | dev->stats.tx_bytes += skb->len; |
| 2062 | dev_kfree_skb_irq(skb); | 2062 | dev_consume_skb_irq(skb); |
| 2063 | info->skb = NULL; | 2063 | info->skb = NULL; |
| 2064 | } | 2064 | } |
| 2065 | 2065 | ||
diff --git a/drivers/net/ethernet/altera/altera_msgdma.c b/drivers/net/ethernet/altera/altera_msgdma.c index 0fb986ba3290..0ae723f75341 100644 --- a/drivers/net/ethernet/altera/altera_msgdma.c +++ b/drivers/net/ethernet/altera/altera_msgdma.c | |||
| @@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) | |||
| 145 | & 0xffff; | 145 | & 0xffff; |
| 146 | 146 | ||
| 147 | if (inuse) { /* Tx FIFO is not empty */ | 147 | if (inuse) { /* Tx FIFO is not empty */ |
| 148 | ready = priv->tx_prod - priv->tx_cons - inuse - 1; | 148 | ready = max_t(int, |
| 149 | priv->tx_prod - priv->tx_cons - inuse - 1, 0); | ||
| 149 | } else { | 150 | } else { |
| 150 | /* Check for buffered last packet */ | 151 | /* Check for buffered last packet */ |
| 151 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); | 152 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c index a90080f12e67..e548c0ae2e00 100644 --- a/drivers/net/ethernet/amd/amd8111e.c +++ b/drivers/net/ethernet/amd/amd8111e.c | |||
| @@ -666,7 +666,7 @@ static int amd8111e_tx(struct net_device *dev) | |||
| 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], | 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], |
| 667 | lp->tx_skbuff[tx_index]->len, | 667 | lp->tx_skbuff[tx_index]->len, |
| 668 | PCI_DMA_TODEVICE); | 668 | PCI_DMA_TODEVICE); |
| 669 | dev_kfree_skb_irq (lp->tx_skbuff[tx_index]); | 669 | dev_consume_skb_irq(lp->tx_skbuff[tx_index]); |
| 670 | lp->tx_skbuff[tx_index] = NULL; | 670 | lp->tx_skbuff[tx_index] = NULL; |
| 671 | lp->tx_dma_addr[tx_index] = 0; | 671 | lp->tx_dma_addr[tx_index] = 0; |
| 672 | } | 672 | } |
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index 6a8e2567f2bd..4d3855ceb500 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c | |||
| @@ -777,7 +777,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id) | |||
| 777 | 777 | ||
| 778 | if (bp->tx_bufs[bp->tx_empty]) { | 778 | if (bp->tx_bufs[bp->tx_empty]) { |
| 779 | ++dev->stats.tx_packets; | 779 | ++dev->stats.tx_packets; |
| 780 | dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); | 780 | dev_consume_skb_irq(bp->tx_bufs[bp->tx_empty]); |
| 781 | } | 781 | } |
| 782 | bp->tx_bufs[bp->tx_empty] = NULL; | 782 | bp->tx_bufs[bp->tx_empty] = NULL; |
| 783 | bp->tx_fullup = 0; | 783 | bp->tx_fullup = 0; |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index f44808959ff3..97ab0dd25552 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
| @@ -638,7 +638,7 @@ static void b44_tx(struct b44 *bp) | |||
| 638 | bytes_compl += skb->len; | 638 | bytes_compl += skb->len; |
| 639 | pkts_compl++; | 639 | pkts_compl++; |
| 640 | 640 | ||
| 641 | dev_kfree_skb_irq(skb); | 641 | dev_consume_skb_irq(skb); |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); | 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); |
| @@ -1012,7 +1012,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); | 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); |
| 1015 | dev_kfree_skb_any(skb); | 1015 | dev_consume_skb_any(skb); |
| 1016 | skb = bounce_skb; | 1016 | skb = bounce_skb; |
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 3d45f4c92cf6..9bbaad9f3d63 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
| @@ -643,6 +643,7 @@ | |||
| 643 | #define MACB_CAPS_JUMBO 0x00000020 | 643 | #define MACB_CAPS_JUMBO 0x00000020 |
| 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 | 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 |
| 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 | 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 |
| 646 | #define MACB_CAPS_NEEDS_RSTONUBR 0x00000100 | ||
| 646 | #define MACB_CAPS_FIFO_MODE 0x10000000 | 647 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
| 647 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 | 648 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
| 648 | #define MACB_CAPS_SG_DISABLED 0x40000000 | 649 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
| @@ -1214,6 +1215,8 @@ struct macb { | |||
| 1214 | 1215 | ||
| 1215 | int rx_bd_rd_prefetch; | 1216 | int rx_bd_rd_prefetch; |
| 1216 | int tx_bd_rd_prefetch; | 1217 | int tx_bd_rd_prefetch; |
| 1218 | |||
| 1219 | u32 rx_intr_mask; | ||
| 1217 | }; | 1220 | }; |
| 1218 | 1221 | ||
| 1219 | #ifdef CONFIG_MACB_USE_HWSTAMP | 1222 | #ifdef CONFIG_MACB_USE_HWSTAMP |
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 66cc7927061a..2b2882615e8b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
| @@ -56,8 +56,7 @@ | |||
| 56 | /* level of occupied TX descriptors under which we wake up TX process */ | 56 | /* level of occupied TX descriptors under which we wake up TX process */ |
| 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) | 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) |
| 58 | 58 | ||
| 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(ISR_ROVR)) |
| 60 | | MACB_BIT(ISR_ROVR)) | ||
| 61 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ | 60 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ |
| 62 | | MACB_BIT(ISR_RLE) \ | 61 | | MACB_BIT(ISR_RLE) \ |
| 63 | | MACB_BIT(TXERR)) | 62 | | MACB_BIT(TXERR)) |
| @@ -1270,7 +1269,7 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
| 1270 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1269 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1271 | napi_reschedule(napi); | 1270 | napi_reschedule(napi); |
| 1272 | } else { | 1271 | } else { |
| 1273 | queue_writel(queue, IER, MACB_RX_INT_FLAGS); | 1272 | queue_writel(queue, IER, bp->rx_intr_mask); |
| 1274 | } | 1273 | } |
| 1275 | } | 1274 | } |
| 1276 | 1275 | ||
| @@ -1288,7 +1287,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1288 | u32 ctrl; | 1287 | u32 ctrl; |
| 1289 | 1288 | ||
| 1290 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { | 1289 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { |
| 1291 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS | | 1290 | queue_writel(queue, IDR, bp->rx_intr_mask | |
| 1292 | MACB_TX_INT_FLAGS | | 1291 | MACB_TX_INT_FLAGS | |
| 1293 | MACB_BIT(HRESP)); | 1292 | MACB_BIT(HRESP)); |
| 1294 | } | 1293 | } |
| @@ -1318,7 +1317,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1318 | 1317 | ||
| 1319 | /* Enable interrupts */ | 1318 | /* Enable interrupts */ |
| 1320 | queue_writel(queue, IER, | 1319 | queue_writel(queue, IER, |
| 1321 | MACB_RX_INT_FLAGS | | 1320 | bp->rx_intr_mask | |
| 1322 | MACB_TX_INT_FLAGS | | 1321 | MACB_TX_INT_FLAGS | |
| 1323 | MACB_BIT(HRESP)); | 1322 | MACB_BIT(HRESP)); |
| 1324 | } | 1323 | } |
| @@ -1372,14 +1371,14 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1372 | (unsigned int)(queue - bp->queues), | 1371 | (unsigned int)(queue - bp->queues), |
| 1373 | (unsigned long)status); | 1372 | (unsigned long)status); |
| 1374 | 1373 | ||
| 1375 | if (status & MACB_RX_INT_FLAGS) { | 1374 | if (status & bp->rx_intr_mask) { |
| 1376 | /* There's no point taking any more interrupts | 1375 | /* There's no point taking any more interrupts |
| 1377 | * until we have processed the buffers. The | 1376 | * until we have processed the buffers. The |
| 1378 | * scheduling call may fail if the poll routine | 1377 | * scheduling call may fail if the poll routine |
| 1379 | * is already scheduled, so disable interrupts | 1378 | * is already scheduled, so disable interrupts |
| 1380 | * now. | 1379 | * now. |
| 1381 | */ | 1380 | */ |
| 1382 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS); | 1381 | queue_writel(queue, IDR, bp->rx_intr_mask); |
| 1383 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) | 1382 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
| 1384 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1383 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1385 | 1384 | ||
| @@ -1412,8 +1411,9 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1412 | /* There is a hardware issue under heavy load where DMA can | 1411 | /* There is a hardware issue under heavy load where DMA can |
| 1413 | * stop, this causes endless "used buffer descriptor read" | 1412 | * stop, this causes endless "used buffer descriptor read" |
| 1414 | * interrupts but it can be cleared by re-enabling RX. See | 1413 | * interrupts but it can be cleared by re-enabling RX. See |
| 1415 | * the at91 manual, section 41.3.1 or the Zynq manual | 1414 | * the at91rm9200 manual, section 41.3.1 or the Zynq manual |
| 1416 | * section 16.7.4 for details. | 1415 | * section 16.7.4 for details. RXUBR is only enabled for |
| 1416 | * these two versions. | ||
| 1417 | */ | 1417 | */ |
| 1418 | if (status & MACB_BIT(RXUBR)) { | 1418 | if (status & MACB_BIT(RXUBR)) { |
| 1419 | ctrl = macb_readl(bp, NCR); | 1419 | ctrl = macb_readl(bp, NCR); |
| @@ -2259,7 +2259,7 @@ static void macb_init_hw(struct macb *bp) | |||
| 2259 | 2259 | ||
| 2260 | /* Enable interrupts */ | 2260 | /* Enable interrupts */ |
| 2261 | queue_writel(queue, IER, | 2261 | queue_writel(queue, IER, |
| 2262 | MACB_RX_INT_FLAGS | | 2262 | bp->rx_intr_mask | |
| 2263 | MACB_TX_INT_FLAGS | | 2263 | MACB_TX_INT_FLAGS | |
| 2264 | MACB_BIT(HRESP)); | 2264 | MACB_BIT(HRESP)); |
| 2265 | } | 2265 | } |
| @@ -3907,6 +3907,7 @@ static const struct macb_config sama5d4_config = { | |||
| 3907 | }; | 3907 | }; |
| 3908 | 3908 | ||
| 3909 | static const struct macb_config emac_config = { | 3909 | static const struct macb_config emac_config = { |
| 3910 | .caps = MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3910 | .clk_init = at91ether_clk_init, | 3911 | .clk_init = at91ether_clk_init, |
| 3911 | .init = at91ether_init, | 3912 | .init = at91ether_init, |
| 3912 | }; | 3913 | }; |
| @@ -3928,7 +3929,8 @@ static const struct macb_config zynqmp_config = { | |||
| 3928 | }; | 3929 | }; |
| 3929 | 3930 | ||
| 3930 | static const struct macb_config zynq_config = { | 3931 | static const struct macb_config zynq_config = { |
| 3931 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF, | 3932 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF | |
| 3933 | MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3932 | .dma_burst_length = 16, | 3934 | .dma_burst_length = 16, |
| 3933 | .clk_init = macb_clk_init, | 3935 | .clk_init = macb_clk_init, |
| 3934 | .init = macb_init, | 3936 | .init = macb_init, |
| @@ -4083,6 +4085,10 @@ static int macb_probe(struct platform_device *pdev) | |||
| 4083 | macb_dma_desc_get_size(bp); | 4085 | macb_dma_desc_get_size(bp); |
| 4084 | } | 4086 | } |
| 4085 | 4087 | ||
| 4088 | bp->rx_intr_mask = MACB_RX_INT_FLAGS; | ||
| 4089 | if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR) | ||
| 4090 | bp->rx_intr_mask |= MACB_BIT(RXUBR); | ||
| 4091 | |||
| 4086 | mac = of_get_mac_address(np); | 4092 | mac = of_get_mac_address(np); |
| 4087 | if (mac) { | 4093 | if (mac) { |
| 4088 | ether_addr_copy(bp->dev->dev_addr, mac); | 4094 | ether_addr_copy(bp->dev->dev_addr, mac); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 5b33238c6680..60e7d7ae3787 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
| @@ -2418,6 +2418,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) | |||
| 2418 | out_notify_fail: | 2418 | out_notify_fail: |
| 2419 | (void)cancel_work_sync(&priv->service_task); | 2419 | (void)cancel_work_sync(&priv->service_task); |
| 2420 | out_read_prop_fail: | 2420 | out_read_prop_fail: |
| 2421 | /* safe for ACPI FW */ | ||
| 2422 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2421 | free_netdev(ndev); | 2423 | free_netdev(ndev); |
| 2422 | return ret; | 2424 | return ret; |
| 2423 | } | 2425 | } |
| @@ -2447,6 +2449,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) | |||
| 2447 | set_bit(NIC_STATE_REMOVING, &priv->state); | 2449 | set_bit(NIC_STATE_REMOVING, &priv->state); |
| 2448 | (void)cancel_work_sync(&priv->service_task); | 2450 | (void)cancel_work_sync(&priv->service_task); |
| 2449 | 2451 | ||
| 2452 | /* safe for ACPI FW */ | ||
| 2453 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2454 | |||
| 2450 | free_netdev(ndev); | 2455 | free_netdev(ndev); |
| 2451 | return 0; | 2456 | return 0; |
| 2452 | } | 2457 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 8e9b95871d30..ce15d2350db9 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | |||
| @@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev) | |||
| 1157 | */ | 1157 | */ |
| 1158 | static int hns_nic_nway_reset(struct net_device *netdev) | 1158 | static int hns_nic_nway_reset(struct net_device *netdev) |
| 1159 | { | 1159 | { |
| 1160 | int ret = 0; | ||
| 1161 | struct phy_device *phy = netdev->phydev; | 1160 | struct phy_device *phy = netdev->phydev; |
| 1162 | 1161 | ||
| 1163 | if (netif_running(netdev)) { | 1162 | if (!netif_running(netdev)) |
| 1164 | /* if autoneg is disabled, don't restart auto-negotiation */ | 1163 | return 0; |
| 1165 | if (phy && phy->autoneg == AUTONEG_ENABLE) | ||
| 1166 | ret = genphy_restart_aneg(phy); | ||
| 1167 | } | ||
| 1168 | 1164 | ||
| 1169 | return ret; | 1165 | if (!phy) |
| 1166 | return -EOPNOTSUPP; | ||
| 1167 | |||
| 1168 | if (phy->autoneg != AUTONEG_ENABLE) | ||
| 1169 | return -EINVAL; | ||
| 1170 | |||
| 1171 | return genphy_restart_aneg(phy); | ||
| 1170 | } | 1172 | } |
| 1171 | 1173 | ||
| 1172 | static u32 | 1174 | static u32 |
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c index 017e08452d8c..baf5cc251f32 100644 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c | |||
| @@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) | |||
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | hns_mdio_cmd_write(mdio_dev, is_c45, | 323 | hns_mdio_cmd_write(mdio_dev, is_c45, |
| 324 | MDIO_C45_WRITE_ADDR, phy_id, devad); | 324 | MDIO_C45_READ, phy_id, devad); |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ | 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c index d719668a6684..92929750f832 100644 --- a/drivers/net/ethernet/i825xx/82596.c +++ b/drivers/net/ethernet/i825xx/82596.c | |||
| @@ -1310,7 +1310,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
| 1310 | dev->stats.tx_aborted_errors++; | 1310 | dev->stats.tx_aborted_errors++; |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | dev_kfree_skb_irq(skb); | 1313 | dev_consume_skb_irq(skb); |
| 1314 | 1314 | ||
| 1315 | tx_cmd->cmd.command = 0; /* Mark free */ | 1315 | tx_cmd->cmd.command = 0; /* Mark free */ |
| 1316 | break; | 1316 | break; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 8cfd2ec7c0a2..01819e5c9975 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
| @@ -950,7 +950,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, | |||
| 950 | if (params->rx_dim_enabled) | 950 | if (params->rx_dim_enabled) |
| 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); | 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 952 | 952 | ||
| 953 | if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) | 953 | if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)) |
| 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); | 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
| 955 | 955 | ||
| 956 | return 0; | 956 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 04736212a21c..f2573c2d2b5c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |||
| @@ -1126,9 +1126,17 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev, | |||
| 1126 | struct mlx5e_priv *priv = netdev_priv(dev); | 1126 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 1127 | struct mlx5e_rep_priv *rpriv = priv->ppriv; | 1127 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1128 | struct mlx5_eswitch_rep *rep = rpriv->rep; | 1128 | struct mlx5_eswitch_rep *rep = rpriv->rep; |
| 1129 | int ret; | 1129 | int ret, pf_num; |
| 1130 | |||
| 1131 | ret = mlx5_lag_get_pf_num(priv->mdev, &pf_num); | ||
| 1132 | if (ret) | ||
| 1133 | return ret; | ||
| 1134 | |||
| 1135 | if (rep->vport == FDB_UPLINK_VPORT) | ||
| 1136 | ret = snprintf(buf, len, "p%d", pf_num); | ||
| 1137 | else | ||
| 1138 | ret = snprintf(buf, len, "pf%dvf%d", pf_num, rep->vport - 1); | ||
| 1130 | 1139 | ||
| 1131 | ret = snprintf(buf, len, "%d", rep->vport - 1); | ||
| 1132 | if (ret >= len) | 1140 | if (ret >= len) |
| 1133 | return -EOPNOTSUPP; | 1141 | return -EOPNOTSUPP; |
| 1134 | 1142 | ||
| @@ -1285,6 +1293,18 @@ static int mlx5e_uplink_rep_set_mac(struct net_device *netdev, void *addr) | |||
| 1285 | return 0; | 1293 | return 0; |
| 1286 | } | 1294 | } |
| 1287 | 1295 | ||
| 1296 | static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos, | ||
| 1297 | __be16 vlan_proto) | ||
| 1298 | { | ||
| 1299 | netdev_warn_once(dev, "legacy vf vlan setting isn't supported in switchdev mode\n"); | ||
| 1300 | |||
| 1301 | if (vlan != 0) | ||
| 1302 | return -EOPNOTSUPP; | ||
| 1303 | |||
| 1304 | /* allow setting 0-vid for compatibility with libvirt */ | ||
| 1305 | return 0; | ||
| 1306 | } | ||
| 1307 | |||
| 1288 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { | 1308 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { |
| 1289 | .switchdev_port_attr_get = mlx5e_attr_get, | 1309 | .switchdev_port_attr_get = mlx5e_attr_get, |
| 1290 | }; | 1310 | }; |
| @@ -1319,6 +1339,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { | |||
| 1319 | .ndo_set_vf_rate = mlx5e_set_vf_rate, | 1339 | .ndo_set_vf_rate = mlx5e_set_vf_rate, |
| 1320 | .ndo_get_vf_config = mlx5e_get_vf_config, | 1340 | .ndo_get_vf_config = mlx5e_get_vf_config, |
| 1321 | .ndo_get_vf_stats = mlx5e_get_vf_stats, | 1341 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
| 1342 | .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, | ||
| 1322 | }; | 1343 | }; |
| 1323 | 1344 | ||
| 1324 | bool mlx5e_eswitch_rep(struct net_device *netdev) | 1345 | bool mlx5e_eswitch_rep(struct net_device *netdev) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index a44ea7b85614..5b492b67f4e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
| @@ -1134,13 +1134,6 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, | |||
| 1134 | int err = 0; | 1134 | int err = 0; |
| 1135 | u8 *smac_v; | 1135 | u8 *smac_v; |
| 1136 | 1136 | ||
| 1137 | if (vport->info.spoofchk && !is_valid_ether_addr(vport->info.mac)) { | ||
| 1138 | mlx5_core_warn(esw->dev, | ||
| 1139 | "vport[%d] configure ingress rules failed, illegal mac with spoofchk\n", | ||
| 1140 | vport->vport); | ||
| 1141 | return -EPERM; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | esw_vport_cleanup_ingress_rules(esw, vport); | 1137 | esw_vport_cleanup_ingress_rules(esw, vport); |
| 1145 | 1138 | ||
| 1146 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { | 1139 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { |
| @@ -1728,7 +1721,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) | |||
| 1728 | int vport_num; | 1721 | int vport_num; |
| 1729 | int err; | 1722 | int err; |
| 1730 | 1723 | ||
| 1731 | if (!MLX5_ESWITCH_MANAGER(dev)) | 1724 | if (!MLX5_VPORT_MANAGER(dev)) |
| 1732 | return 0; | 1725 | return 0; |
| 1733 | 1726 | ||
| 1734 | esw_info(dev, | 1727 | esw_info(dev, |
| @@ -1797,7 +1790,7 @@ abort: | |||
| 1797 | 1790 | ||
| 1798 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) | 1791 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) |
| 1799 | { | 1792 | { |
| 1800 | if (!esw || !MLX5_ESWITCH_MANAGER(esw->dev)) | 1793 | if (!esw || !MLX5_VPORT_MANAGER(esw->dev)) |
| 1801 | return; | 1794 | return; |
| 1802 | 1795 | ||
| 1803 | esw_info(esw->dev, "cleanup\n"); | 1796 | esw_info(esw->dev, "cleanup\n"); |
| @@ -1827,13 +1820,10 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | |||
| 1827 | mutex_lock(&esw->state_lock); | 1820 | mutex_lock(&esw->state_lock); |
| 1828 | evport = &esw->vports[vport]; | 1821 | evport = &esw->vports[vport]; |
| 1829 | 1822 | ||
| 1830 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) { | 1823 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) |
| 1831 | mlx5_core_warn(esw->dev, | 1824 | mlx5_core_warn(esw->dev, |
| 1832 | "MAC invalidation is not allowed when spoofchk is on, vport(%d)\n", | 1825 | "Set invalid MAC while spoofchk is on, vport(%d)\n", |
| 1833 | vport); | 1826 | vport); |
| 1834 | err = -EPERM; | ||
| 1835 | goto unlock; | ||
| 1836 | } | ||
| 1837 | 1827 | ||
| 1838 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); | 1828 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); |
| 1839 | if (err) { | 1829 | if (err) { |
| @@ -1979,6 +1969,10 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, | |||
| 1979 | evport = &esw->vports[vport]; | 1969 | evport = &esw->vports[vport]; |
| 1980 | pschk = evport->info.spoofchk; | 1970 | pschk = evport->info.spoofchk; |
| 1981 | evport->info.spoofchk = spoofchk; | 1971 | evport->info.spoofchk = spoofchk; |
| 1972 | if (pschk && !is_valid_ether_addr(evport->info.mac)) | ||
| 1973 | mlx5_core_warn(esw->dev, | ||
| 1974 | "Spoofchk in set while MAC is invalid, vport(%d)\n", | ||
| 1975 | evport->vport); | ||
| 1982 | if (evport->enabled && esw->mode == SRIOV_LEGACY) | 1976 | if (evport->enabled && esw->mode == SRIOV_LEGACY) |
| 1983 | err = esw_vport_ingress_config(esw, evport); | 1977 | err = esw_vport_ingress_config(esw, evport); |
| 1984 | if (err) | 1978 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index 3a6baed722d8..2d223385dc81 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c | |||
| @@ -616,6 +616,27 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev) | |||
| 616 | } | 616 | } |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num) | ||
| 620 | { | ||
| 621 | struct mlx5_lag *ldev; | ||
| 622 | int n; | ||
| 623 | |||
| 624 | ldev = mlx5_lag_dev_get(dev); | ||
| 625 | if (!ldev) { | ||
| 626 | mlx5_core_warn(dev, "no lag device, can't get pf num\n"); | ||
| 627 | return -EINVAL; | ||
| 628 | } | ||
| 629 | |||
| 630 | for (n = 0; n < MLX5_MAX_PORTS; n++) | ||
| 631 | if (ldev->pf[n].dev == dev) { | ||
| 632 | *pf_num = n; | ||
| 633 | return 0; | ||
| 634 | } | ||
| 635 | |||
| 636 | mlx5_core_warn(dev, "wasn't able to locate pf in the lag device\n"); | ||
| 637 | return -EINVAL; | ||
| 638 | } | ||
| 639 | |||
| 619 | /* Must be called with intf_mutex held */ | 640 | /* Must be called with intf_mutex held */ |
| 620 | void mlx5_lag_remove(struct mlx5_core_dev *dev) | 641 | void mlx5_lag_remove(struct mlx5_core_dev *dev) |
| 621 | { | 642 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index c68dcea5985b..5300b0b6d836 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
| @@ -187,6 +187,8 @@ static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev) | |||
| 187 | MLX5_CAP_GEN(dev, lag_master); | 187 | MLX5_CAP_GEN(dev, lag_master); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num); | ||
| 191 | |||
| 190 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); | 192 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); |
| 191 | void mlx5_lag_update(struct mlx5_core_dev *dev); | 193 | void mlx5_lag_update(struct mlx5_core_dev *dev); |
| 192 | 194 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index 388f205a497f..370ca94b6775 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c | |||
| @@ -44,14 +44,15 @@ static struct mlx5_core_rsc_common * | |||
| 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) | 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) |
| 45 | { | 45 | { |
| 46 | struct mlx5_core_rsc_common *common; | 46 | struct mlx5_core_rsc_common *common; |
| 47 | unsigned long flags; | ||
| 47 | 48 | ||
| 48 | spin_lock(&table->lock); | 49 | spin_lock_irqsave(&table->lock, flags); |
| 49 | 50 | ||
| 50 | common = radix_tree_lookup(&table->tree, rsn); | 51 | common = radix_tree_lookup(&table->tree, rsn); |
| 51 | if (common) | 52 | if (common) |
| 52 | atomic_inc(&common->refcount); | 53 | atomic_inc(&common->refcount); |
| 53 | 54 | ||
| 54 | spin_unlock(&table->lock); | 55 | spin_unlock_irqrestore(&table->lock, flags); |
| 55 | 56 | ||
| 56 | return common; | 57 | return common; |
| 57 | } | 58 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 8f6551421945..2ecaaaa4469a 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | |||
| @@ -795,19 +795,19 @@ static void qed_init_qm_pq(struct qed_hwfn *p_hwfn, | |||
| 795 | 795 | ||
| 796 | /* get pq index according to PQ_FLAGS */ | 796 | /* get pq index according to PQ_FLAGS */ |
| 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, | 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, |
| 798 | u32 pq_flags) | 798 | unsigned long pq_flags) |
| 799 | { | 799 | { |
| 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; | 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; |
| 801 | 801 | ||
| 802 | /* Can't have multiple flags set here */ | 802 | /* Can't have multiple flags set here */ |
| 803 | if (bitmap_weight((unsigned long *)&pq_flags, | 803 | if (bitmap_weight(&pq_flags, |
| 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { | 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { |
| 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); | 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); |
| 806 | goto err; | 806 | goto err; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { | 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { |
| 810 | DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); | 810 | DP_ERR(p_hwfn, "pq flag 0x%lx is not set\n", pq_flags); |
| 811 | goto err; | 811 | goto err; |
| 812 | } | 812 | } |
| 813 | 813 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c index 67c02ea93906..e68ca83ae915 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c | |||
| @@ -609,6 +609,10 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, | |||
| 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && | 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && |
| 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); | 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); |
| 611 | 611 | ||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, | ||
| 613 | (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && | ||
| 614 | !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); | ||
| 615 | |||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, | 616 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, |
| 613 | !!(accept_filter & QED_ACCEPT_BCAST)); | 617 | !!(accept_filter & QED_ACCEPT_BCAST)); |
| 614 | 618 | ||
| @@ -744,6 +748,11 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | |||
| 744 | return rc; | 748 | return rc; |
| 745 | } | 749 | } |
| 746 | 750 | ||
| 751 | if (p_params->update_ctl_frame_check) { | ||
| 752 | p_cmn->ctl_frame_mac_check_en = p_params->mac_chk_en; | ||
| 753 | p_cmn->ctl_frame_ethtype_check_en = p_params->ethtype_chk_en; | ||
| 754 | } | ||
| 755 | |||
| 747 | /* Update mcast bins for VFs, PF doesn't use this functionality */ | 756 | /* Update mcast bins for VFs, PF doesn't use this functionality */ |
| 748 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); | 757 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); |
| 749 | 758 | ||
| @@ -2688,7 +2697,8 @@ static int qed_configure_filter_rx_mode(struct qed_dev *cdev, | |||
| 2688 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { | 2697 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { |
| 2689 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | | 2698 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2690 | QED_ACCEPT_MCAST_UNMATCHED; | 2699 | QED_ACCEPT_MCAST_UNMATCHED; |
| 2691 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2700 | accept_flags.tx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2701 | QED_ACCEPT_MCAST_UNMATCHED; | ||
| 2692 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { | 2702 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { |
| 2693 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2703 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| 2694 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2704 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.h b/drivers/net/ethernet/qlogic/qed/qed_l2.h index 8d80f1095d17..7127d5aaac42 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.h +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h | |||
| @@ -219,6 +219,9 @@ struct qed_sp_vport_update_params { | |||
| 219 | struct qed_rss_params *rss_params; | 219 | struct qed_rss_params *rss_params; |
| 220 | struct qed_filter_accept_flags accept_flags; | 220 | struct qed_filter_accept_flags accept_flags; |
| 221 | struct qed_sge_tpa_params *sge_tpa_params; | 221 | struct qed_sge_tpa_params *sge_tpa_params; |
| 222 | u8 update_ctl_frame_check; | ||
| 223 | u8 mac_chk_en; | ||
| 224 | u8 ethtype_chk_en; | ||
| 222 | }; | 225 | }; |
| 223 | 226 | ||
| 224 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | 227 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c index d9237c65a838..b5f419b71287 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c | |||
| @@ -2451,19 +2451,24 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2451 | { | 2451 | { |
| 2452 | struct qed_ll2_tx_pkt_info pkt; | 2452 | struct qed_ll2_tx_pkt_info pkt; |
| 2453 | const skb_frag_t *frag; | 2453 | const skb_frag_t *frag; |
| 2454 | u8 flags = 0, nr_frags; | ||
| 2454 | int rc = -EINVAL, i; | 2455 | int rc = -EINVAL, i; |
| 2455 | dma_addr_t mapping; | 2456 | dma_addr_t mapping; |
| 2456 | u16 vlan = 0; | 2457 | u16 vlan = 0; |
| 2457 | u8 flags = 0; | ||
| 2458 | 2458 | ||
| 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { | 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { |
| 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); | 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); |
| 2461 | return -EINVAL; | 2461 | return -EINVAL; |
| 2462 | } | 2462 | } |
| 2463 | 2463 | ||
| 2464 | if (1 + skb_shinfo(skb)->nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | 2464 | /* Cache number of fragments from SKB since SKB may be freed by |
| 2465 | * the completion routine after calling qed_ll2_prepare_tx_packet() | ||
| 2466 | */ | ||
| 2467 | nr_frags = skb_shinfo(skb)->nr_frags; | ||
| 2468 | |||
| 2469 | if (1 + nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | ||
| 2465 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", | 2470 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", |
| 2466 | 1 + skb_shinfo(skb)->nr_frags); | 2471 | 1 + nr_frags); |
| 2467 | return -EINVAL; | 2472 | return -EINVAL; |
| 2468 | } | 2473 | } |
| 2469 | 2474 | ||
| @@ -2485,7 +2490,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2485 | } | 2490 | } |
| 2486 | 2491 | ||
| 2487 | memset(&pkt, 0, sizeof(pkt)); | 2492 | memset(&pkt, 0, sizeof(pkt)); |
| 2488 | pkt.num_of_bds = 1 + skb_shinfo(skb)->nr_frags; | 2493 | pkt.num_of_bds = 1 + nr_frags; |
| 2489 | pkt.vlan = vlan; | 2494 | pkt.vlan = vlan; |
| 2490 | pkt.bd_flags = flags; | 2495 | pkt.bd_flags = flags; |
| 2491 | pkt.tx_dest = QED_LL2_TX_DEST_NW; | 2496 | pkt.tx_dest = QED_LL2_TX_DEST_NW; |
| @@ -2496,12 +2501,17 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2496 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) | 2501 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) |
| 2497 | pkt.remove_stag = true; | 2502 | pkt.remove_stag = true; |
| 2498 | 2503 | ||
| 2504 | /* qed_ll2_prepare_tx_packet() may actually send the packet if | ||
| 2505 | * there are no fragments in the skb and subsequently the completion | ||
| 2506 | * routine may run and free the SKB, so no dereferencing the SKB | ||
| 2507 | * beyond this point unless skb has any fragments. | ||
| 2508 | */ | ||
| 2499 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, | 2509 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, |
| 2500 | &pkt, 1); | 2510 | &pkt, 1); |
| 2501 | if (rc) | 2511 | if (rc) |
| 2502 | goto err; | 2512 | goto err; |
| 2503 | 2513 | ||
| 2504 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2514 | for (i = 0; i < nr_frags; i++) { |
| 2505 | frag = &skb_shinfo(skb)->frags[i]; | 2515 | frag = &skb_shinfo(skb)->frags[i]; |
| 2506 | 2516 | ||
| 2507 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, | 2517 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c index ca6290fa0f30..71a7af134dd8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c | |||
| @@ -1969,7 +1969,9 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn, | |||
| 1969 | params.vport_id = vf->vport_id; | 1969 | params.vport_id = vf->vport_id; |
| 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; | 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; |
| 1971 | params.mtu = vf->mtu; | 1971 | params.mtu = vf->mtu; |
| 1972 | params.check_mac = true; | 1972 | |
| 1973 | /* Non trusted VFs should enable control frame filtering */ | ||
| 1974 | params.check_mac = !vf->p_vf_info.is_trusted_configured; | ||
| 1973 | 1975 | ||
| 1974 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); | 1976 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); |
| 1975 | if (rc) { | 1977 | if (rc) { |
| @@ -5130,6 +5132,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5130 | params.opaque_fid = vf->opaque_fid; | 5132 | params.opaque_fid = vf->opaque_fid; |
| 5131 | params.vport_id = vf->vport_id; | 5133 | params.vport_id = vf->vport_id; |
| 5132 | 5134 | ||
| 5135 | params.update_ctl_frame_check = 1; | ||
| 5136 | params.mac_chk_en = !vf_info->is_trusted_configured; | ||
| 5137 | |||
| 5133 | if (vf_info->rx_accept_mode & mask) { | 5138 | if (vf_info->rx_accept_mode & mask) { |
| 5134 | flags->update_rx_mode_config = 1; | 5139 | flags->update_rx_mode_config = 1; |
| 5135 | flags->rx_accept_filter = vf_info->rx_accept_mode; | 5140 | flags->rx_accept_filter = vf_info->rx_accept_mode; |
| @@ -5147,7 +5152,8 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5147 | } | 5152 | } |
| 5148 | 5153 | ||
| 5149 | if (flags->update_rx_mode_config || | 5154 | if (flags->update_rx_mode_config || |
| 5150 | flags->update_tx_mode_config) | 5155 | flags->update_tx_mode_config || |
| 5156 | params.update_ctl_frame_check) | ||
| 5151 | qed_sp_vport_update(hwfn, ¶ms, | 5157 | qed_sp_vport_update(hwfn, ¶ms, |
| 5152 | QED_SPQ_MODE_EBLOCK, NULL); | 5158 | QED_SPQ_MODE_EBLOCK, NULL); |
| 5153 | } | 5159 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c index b6cccf44bf40..5dda547772c1 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c | |||
| @@ -261,6 +261,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; | 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
| 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; | 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
| 263 | struct vf_pf_resc_request *p_resc; | 263 | struct vf_pf_resc_request *p_resc; |
| 264 | u8 retry_cnt = VF_ACQUIRE_THRESH; | ||
| 264 | bool resources_acquired = false; | 265 | bool resources_acquired = false; |
| 265 | struct vfpf_acquire_tlv *req; | 266 | struct vfpf_acquire_tlv *req; |
| 266 | int rc = 0, attempts = 0; | 267 | int rc = 0, attempts = 0; |
| @@ -314,6 +315,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 314 | 315 | ||
| 315 | /* send acquire request */ | 316 | /* send acquire request */ |
| 316 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); | 317 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
| 318 | |||
| 319 | /* Re-try acquire in case of vf-pf hw channel timeout */ | ||
| 320 | if (retry_cnt && rc == -EBUSY) { | ||
| 321 | DP_VERBOSE(p_hwfn, QED_MSG_IOV, | ||
| 322 | "VF retrying to acquire due to VPC timeout\n"); | ||
| 323 | retry_cnt--; | ||
| 324 | continue; | ||
| 325 | } | ||
| 326 | |||
| 317 | if (rc) | 327 | if (rc) |
| 318 | goto exit; | 328 | goto exit; |
| 319 | 329 | ||
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 44f6e4873aad..4f910c4f67b0 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -691,7 +691,7 @@ static void cp_tx (struct cp_private *cp) | |||
| 691 | } | 691 | } |
| 692 | bytes_compl += skb->len; | 692 | bytes_compl += skb->len; |
| 693 | pkts_compl++; | 693 | pkts_compl++; |
| 694 | dev_kfree_skb_irq(skb); | 694 | dev_consume_skb_irq(skb); |
| 695 | } | 695 | } |
| 696 | 696 | ||
| 697 | cp->tx_skb[tx_tail] = NULL; | 697 | cp->tx_skb[tx_tail] = NULL; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 7b923362ee55..3b174eae77c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | |||
| @@ -1342,8 +1342,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) | |||
| 1342 | } | 1342 | } |
| 1343 | 1343 | ||
| 1344 | ret = phy_power_on(bsp_priv, true); | 1344 | ret = phy_power_on(bsp_priv, true); |
| 1345 | if (ret) | 1345 | if (ret) { |
| 1346 | gmac_clk_enable(bsp_priv, false); | ||
| 1346 | return ret; | 1347 | return ret; |
| 1348 | } | ||
| 1347 | 1349 | ||
| 1348 | pm_runtime_enable(dev); | 1350 | pm_runtime_enable(dev); |
| 1349 | pm_runtime_get_sync(dev); | 1351 | pm_runtime_get_sync(dev); |
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index 810dfc7de1f9..e2d47b24a869 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c | |||
| @@ -608,7 +608,7 @@ static void cpmac_end_xmit(struct net_device *dev, int queue) | |||
| 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", | 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", |
| 609 | desc->skb, desc->skb->len); | 609 | desc->skb, desc->skb->len); |
| 610 | 610 | ||
| 611 | dev_kfree_skb_irq(desc->skb); | 611 | dev_consume_skb_irq(desc->skb); |
| 612 | desc->skb = NULL; | 612 | desc->skb = NULL; |
| 613 | if (__netif_subqueue_stopped(dev, queue)) | 613 | if (__netif_subqueue_stopped(dev, queue)) |
| 614 | netif_wake_subqueue(dev, queue); | 614 | netif_wake_subqueue(dev, queue); |
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 52e47dac028f..80f843030e36 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c | |||
| @@ -310,6 +310,9 @@ static int imx6_pcie_attach_pd(struct device *dev) | |||
| 310 | imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); | 310 | imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); |
| 311 | if (IS_ERR(imx6_pcie->pd_pcie)) | 311 | if (IS_ERR(imx6_pcie->pd_pcie)) |
| 312 | return PTR_ERR(imx6_pcie->pd_pcie); | 312 | return PTR_ERR(imx6_pcie->pd_pcie); |
| 313 | /* Do nothing when power domain missing */ | ||
| 314 | if (!imx6_pcie->pd_pcie) | ||
| 315 | return 0; | ||
| 313 | link = device_link_add(dev, imx6_pcie->pd_pcie, | 316 | link = device_link_add(dev, imx6_pcie->pd_pcie, |
| 314 | DL_FLAG_STATELESS | | 317 | DL_FLAG_STATELESS | |
| 315 | DL_FLAG_PM_RUNTIME | | 318 | DL_FLAG_PM_RUNTIME | |
| @@ -323,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev) | |||
| 323 | if (IS_ERR(imx6_pcie->pd_pcie_phy)) | 326 | if (IS_ERR(imx6_pcie->pd_pcie_phy)) |
| 324 | return PTR_ERR(imx6_pcie->pd_pcie_phy); | 327 | return PTR_ERR(imx6_pcie->pd_pcie_phy); |
| 325 | 328 | ||
| 326 | device_link_add(dev, imx6_pcie->pd_pcie_phy, | 329 | link = device_link_add(dev, imx6_pcie->pd_pcie_phy, |
| 327 | DL_FLAG_STATELESS | | 330 | DL_FLAG_STATELESS | |
| 328 | DL_FLAG_PM_RUNTIME | | 331 | DL_FLAG_PM_RUNTIME | |
| 329 | DL_FLAG_RPM_ACTIVE); | 332 | DL_FLAG_RPM_ACTIVE); |
| 330 | if (IS_ERR(link)) { | 333 | if (!link) { |
| 331 | dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link)); | 334 | dev_err(dev, "Failed to add device_link to pcie_phy pd.\n"); |
| 332 | return PTR_ERR(link); | 335 | return -EINVAL; |
| 333 | } | 336 | } |
| 334 | 337 | ||
| 335 | return 0; | 338 | return 0; |
diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c index b171b6bc15c8..0c389a30ef5d 100644 --- a/drivers/pci/controller/dwc/pcie-armada8k.c +++ b/drivers/pci/controller/dwc/pcie-armada8k.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/resource.h> | 22 | #include <linux/resource.h> |
| 23 | #include <linux/of_pci.h> | 23 | #include <linux/of_pci.h> |
| 24 | #include <linux/of_irq.h> | 24 | #include <linux/of_irq.h> |
| 25 | #include <linux/gpio/consumer.h> | ||
| 26 | 25 | ||
| 27 | #include "pcie-designware.h" | 26 | #include "pcie-designware.h" |
| 28 | 27 | ||
| @@ -30,7 +29,6 @@ struct armada8k_pcie { | |||
| 30 | struct dw_pcie *pci; | 29 | struct dw_pcie *pci; |
| 31 | struct clk *clk; | 30 | struct clk *clk; |
| 32 | struct clk *clk_reg; | 31 | struct clk *clk_reg; |
| 33 | struct gpio_desc *reset_gpio; | ||
| 34 | }; | 32 | }; |
| 35 | 33 | ||
| 36 | #define PCIE_VENDOR_REGS_OFFSET 0x8000 | 34 | #define PCIE_VENDOR_REGS_OFFSET 0x8000 |
| @@ -139,12 +137,6 @@ static int armada8k_pcie_host_init(struct pcie_port *pp) | |||
| 139 | struct dw_pcie *pci = to_dw_pcie_from_pp(pp); | 137 | struct dw_pcie *pci = to_dw_pcie_from_pp(pp); |
| 140 | struct armada8k_pcie *pcie = to_armada8k_pcie(pci); | 138 | struct armada8k_pcie *pcie = to_armada8k_pcie(pci); |
| 141 | 139 | ||
| 142 | if (pcie->reset_gpio) { | ||
| 143 | /* assert and then deassert the reset signal */ | ||
| 144 | gpiod_set_value_cansleep(pcie->reset_gpio, 1); | ||
| 145 | msleep(100); | ||
| 146 | gpiod_set_value_cansleep(pcie->reset_gpio, 0); | ||
| 147 | } | ||
| 148 | dw_pcie_setup_rc(pp); | 140 | dw_pcie_setup_rc(pp); |
| 149 | armada8k_pcie_establish_link(pcie); | 141 | armada8k_pcie_establish_link(pcie); |
| 150 | 142 | ||
| @@ -257,14 +249,6 @@ static int armada8k_pcie_probe(struct platform_device *pdev) | |||
| 257 | goto fail_clkreg; | 249 | goto fail_clkreg; |
| 258 | } | 250 | } |
| 259 | 251 | ||
| 260 | /* Get reset gpio signal and hold asserted (logically high) */ | ||
| 261 | pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", | ||
| 262 | GPIOD_OUT_HIGH); | ||
| 263 | if (IS_ERR(pcie->reset_gpio)) { | ||
| 264 | ret = PTR_ERR(pcie->reset_gpio); | ||
| 265 | goto fail_clkreg; | ||
| 266 | } | ||
| 267 | |||
| 268 | platform_set_drvdata(pdev, pcie); | 252 | platform_set_drvdata(pdev, pcie); |
| 269 | 253 | ||
| 270 | ret = armada8k_add_pcie_port(pcie, pdev); | 254 | ret = armada8k_add_pcie_port(pcie, pdev); |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 5e2109c54c7c..b5e9db85e881 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -905,6 +905,7 @@ config TOSHIBA_WMI | |||
| 905 | config ACPI_CMPC | 905 | config ACPI_CMPC |
| 906 | tristate "CMPC Laptop Extras" | 906 | tristate "CMPC Laptop Extras" |
| 907 | depends on ACPI && INPUT | 907 | depends on ACPI && INPUT |
| 908 | depends on BACKLIGHT_LCD_SUPPORT | ||
| 908 | depends on RFKILL || RFKILL=n | 909 | depends on RFKILL || RFKILL=n |
| 909 | select BACKLIGHT_CLASS_DEVICE | 910 | select BACKLIGHT_CLASS_DEVICE |
| 910 | help | 911 | help |
| @@ -1128,6 +1129,7 @@ config INTEL_OAKTRAIL | |||
| 1128 | config SAMSUNG_Q10 | 1129 | config SAMSUNG_Q10 |
| 1129 | tristate "Samsung Q10 Extras" | 1130 | tristate "Samsung Q10 Extras" |
| 1130 | depends on ACPI | 1131 | depends on ACPI |
| 1132 | depends on BACKLIGHT_LCD_SUPPORT | ||
| 1131 | select BACKLIGHT_CLASS_DEVICE | 1133 | select BACKLIGHT_CLASS_DEVICE |
| 1132 | ---help--- | 1134 | ---help--- |
| 1133 | This driver provides support for backlight control on Samsung Q10 | 1135 | This driver provides support for backlight control on Samsung Q10 |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index bca86bf7189f..df51a35cf537 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -1337,7 +1337,8 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
| 1337 | n->vqs[i].rx_ring = NULL; | 1337 | n->vqs[i].rx_ring = NULL; |
| 1338 | vhost_net_buf_init(&n->vqs[i].rxq); | 1338 | vhost_net_buf_init(&n->vqs[i].rxq); |
| 1339 | } | 1339 | } |
| 1340 | vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX); | 1340 | vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, |
| 1341 | UIO_MAXIOV + VHOST_NET_BATCH); | ||
| 1341 | 1342 | ||
| 1342 | vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); | 1343 | vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); |
| 1343 | vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, EPOLLIN, dev); | 1344 | vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, EPOLLIN, dev); |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 344684f3e2e4..23593cb23dd0 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -1627,7 +1627,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
| 1627 | vqs[i] = &vs->vqs[i].vq; | 1627 | vqs[i] = &vs->vqs[i].vq; |
| 1628 | vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick; | 1628 | vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick; |
| 1629 | } | 1629 | } |
| 1630 | vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ); | 1630 | vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ, UIO_MAXIOV); |
| 1631 | 1631 | ||
| 1632 | vhost_scsi_init_inflight(vs, NULL); | 1632 | vhost_scsi_init_inflight(vs, NULL); |
| 1633 | 1633 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 15a216cdd507..24a129fcdd61 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -390,9 +390,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) | |||
| 390 | vq->indirect = kmalloc_array(UIO_MAXIOV, | 390 | vq->indirect = kmalloc_array(UIO_MAXIOV, |
| 391 | sizeof(*vq->indirect), | 391 | sizeof(*vq->indirect), |
| 392 | GFP_KERNEL); | 392 | GFP_KERNEL); |
| 393 | vq->log = kmalloc_array(UIO_MAXIOV, sizeof(*vq->log), | 393 | vq->log = kmalloc_array(dev->iov_limit, sizeof(*vq->log), |
| 394 | GFP_KERNEL); | 394 | GFP_KERNEL); |
| 395 | vq->heads = kmalloc_array(UIO_MAXIOV, sizeof(*vq->heads), | 395 | vq->heads = kmalloc_array(dev->iov_limit, sizeof(*vq->heads), |
| 396 | GFP_KERNEL); | 396 | GFP_KERNEL); |
| 397 | if (!vq->indirect || !vq->log || !vq->heads) | 397 | if (!vq->indirect || !vq->log || !vq->heads) |
| 398 | goto err_nomem; | 398 | goto err_nomem; |
| @@ -414,7 +414,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) | |||
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | void vhost_dev_init(struct vhost_dev *dev, | 416 | void vhost_dev_init(struct vhost_dev *dev, |
| 417 | struct vhost_virtqueue **vqs, int nvqs) | 417 | struct vhost_virtqueue **vqs, int nvqs, int iov_limit) |
| 418 | { | 418 | { |
| 419 | struct vhost_virtqueue *vq; | 419 | struct vhost_virtqueue *vq; |
| 420 | int i; | 420 | int i; |
| @@ -427,6 +427,7 @@ void vhost_dev_init(struct vhost_dev *dev, | |||
| 427 | dev->iotlb = NULL; | 427 | dev->iotlb = NULL; |
| 428 | dev->mm = NULL; | 428 | dev->mm = NULL; |
| 429 | dev->worker = NULL; | 429 | dev->worker = NULL; |
| 430 | dev->iov_limit = iov_limit; | ||
| 430 | init_llist_head(&dev->work_list); | 431 | init_llist_head(&dev->work_list); |
| 431 | init_waitqueue_head(&dev->wait); | 432 | init_waitqueue_head(&dev->wait); |
| 432 | INIT_LIST_HEAD(&dev->read_list); | 433 | INIT_LIST_HEAD(&dev->read_list); |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 1b675dad5e05..9490e7ddb340 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
| @@ -170,9 +170,11 @@ struct vhost_dev { | |||
| 170 | struct list_head read_list; | 170 | struct list_head read_list; |
| 171 | struct list_head pending_list; | 171 | struct list_head pending_list; |
| 172 | wait_queue_head_t wait; | 172 | wait_queue_head_t wait; |
| 173 | int iov_limit; | ||
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| 175 | void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); | 176 | void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, |
| 177 | int nvqs, int iov_limit); | ||
| 176 | long vhost_dev_set_owner(struct vhost_dev *dev); | 178 | long vhost_dev_set_owner(struct vhost_dev *dev); |
| 177 | bool vhost_dev_has_owner(struct vhost_dev *dev); | 179 | bool vhost_dev_has_owner(struct vhost_dev *dev); |
| 178 | long vhost_dev_check_owner(struct vhost_dev *); | 180 | long vhost_dev_check_owner(struct vhost_dev *); |
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 3fbc068eaa9b..bb5fc0e9fbc2 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c | |||
| @@ -531,7 +531,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) | |||
| 531 | vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; | 531 | vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; |
| 532 | vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; | 532 | vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; |
| 533 | 533 | ||
| 534 | vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs)); | 534 | vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs), UIO_MAXIOV); |
| 535 | 535 | ||
| 536 | file->private_data = vsock; | 536 | file->private_data = vsock; |
| 537 | spin_lock_init(&vsock->send_pkt_list_lock); | 537 | spin_lock_init(&vsock->send_pkt_list_lock); |
diff --git a/fs/dcache.c b/fs/dcache.c index 2593153471cf..aac41adf4743 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -119,6 +119,7 @@ struct dentry_stat_t dentry_stat = { | |||
| 119 | 119 | ||
| 120 | static DEFINE_PER_CPU(long, nr_dentry); | 120 | static DEFINE_PER_CPU(long, nr_dentry); |
| 121 | static DEFINE_PER_CPU(long, nr_dentry_unused); | 121 | static DEFINE_PER_CPU(long, nr_dentry_unused); |
| 122 | static DEFINE_PER_CPU(long, nr_dentry_negative); | ||
| 122 | 123 | ||
| 123 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) | 124 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) |
| 124 | 125 | ||
| @@ -152,11 +153,22 @@ static long get_nr_dentry_unused(void) | |||
| 152 | return sum < 0 ? 0 : sum; | 153 | return sum < 0 ? 0 : sum; |
| 153 | } | 154 | } |
| 154 | 155 | ||
| 156 | static long get_nr_dentry_negative(void) | ||
| 157 | { | ||
| 158 | int i; | ||
| 159 | long sum = 0; | ||
| 160 | |||
| 161 | for_each_possible_cpu(i) | ||
| 162 | sum += per_cpu(nr_dentry_negative, i); | ||
| 163 | return sum < 0 ? 0 : sum; | ||
| 164 | } | ||
| 165 | |||
| 155 | int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer, | 166 | int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer, |
| 156 | size_t *lenp, loff_t *ppos) | 167 | size_t *lenp, loff_t *ppos) |
| 157 | { | 168 | { |
| 158 | dentry_stat.nr_dentry = get_nr_dentry(); | 169 | dentry_stat.nr_dentry = get_nr_dentry(); |
| 159 | dentry_stat.nr_unused = get_nr_dentry_unused(); | 170 | dentry_stat.nr_unused = get_nr_dentry_unused(); |
| 171 | dentry_stat.nr_negative = get_nr_dentry_negative(); | ||
| 160 | return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); | 172 | return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
| 161 | } | 173 | } |
| 162 | #endif | 174 | #endif |
| @@ -317,6 +329,8 @@ static inline void __d_clear_type_and_inode(struct dentry *dentry) | |||
| 317 | flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU); | 329 | flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU); |
| 318 | WRITE_ONCE(dentry->d_flags, flags); | 330 | WRITE_ONCE(dentry->d_flags, flags); |
| 319 | dentry->d_inode = NULL; | 331 | dentry->d_inode = NULL; |
| 332 | if (dentry->d_flags & DCACHE_LRU_LIST) | ||
| 333 | this_cpu_inc(nr_dentry_negative); | ||
| 320 | } | 334 | } |
| 321 | 335 | ||
| 322 | static void dentry_free(struct dentry *dentry) | 336 | static void dentry_free(struct dentry *dentry) |
| @@ -371,6 +385,11 @@ static void dentry_unlink_inode(struct dentry * dentry) | |||
| 371 | * The per-cpu "nr_dentry_unused" counters are updated with | 385 | * The per-cpu "nr_dentry_unused" counters are updated with |
| 372 | * the DCACHE_LRU_LIST bit. | 386 | * the DCACHE_LRU_LIST bit. |
| 373 | * | 387 | * |
| 388 | * The per-cpu "nr_dentry_negative" counters are only updated | ||
| 389 | * when deleted from or added to the per-superblock LRU list, not | ||
| 390 | * from/to the shrink list. That is to avoid an unneeded dec/inc | ||
| 391 | * pair when moving from LRU to shrink list in select_collect(). | ||
| 392 | * | ||
| 374 | * These helper functions make sure we always follow the | 393 | * These helper functions make sure we always follow the |
| 375 | * rules. d_lock must be held by the caller. | 394 | * rules. d_lock must be held by the caller. |
| 376 | */ | 395 | */ |
| @@ -380,6 +399,8 @@ static void d_lru_add(struct dentry *dentry) | |||
| 380 | D_FLAG_VERIFY(dentry, 0); | 399 | D_FLAG_VERIFY(dentry, 0); |
| 381 | dentry->d_flags |= DCACHE_LRU_LIST; | 400 | dentry->d_flags |= DCACHE_LRU_LIST; |
| 382 | this_cpu_inc(nr_dentry_unused); | 401 | this_cpu_inc(nr_dentry_unused); |
| 402 | if (d_is_negative(dentry)) | ||
| 403 | this_cpu_inc(nr_dentry_negative); | ||
| 383 | WARN_ON_ONCE(!list_lru_add(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); | 404 | WARN_ON_ONCE(!list_lru_add(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); |
| 384 | } | 405 | } |
| 385 | 406 | ||
| @@ -388,6 +409,8 @@ static void d_lru_del(struct dentry *dentry) | |||
| 388 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); | 409 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 389 | dentry->d_flags &= ~DCACHE_LRU_LIST; | 410 | dentry->d_flags &= ~DCACHE_LRU_LIST; |
| 390 | this_cpu_dec(nr_dentry_unused); | 411 | this_cpu_dec(nr_dentry_unused); |
| 412 | if (d_is_negative(dentry)) | ||
| 413 | this_cpu_dec(nr_dentry_negative); | ||
| 391 | WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); | 414 | WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); |
| 392 | } | 415 | } |
| 393 | 416 | ||
| @@ -418,6 +441,8 @@ static void d_lru_isolate(struct list_lru_one *lru, struct dentry *dentry) | |||
| 418 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); | 441 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 419 | dentry->d_flags &= ~DCACHE_LRU_LIST; | 442 | dentry->d_flags &= ~DCACHE_LRU_LIST; |
| 420 | this_cpu_dec(nr_dentry_unused); | 443 | this_cpu_dec(nr_dentry_unused); |
| 444 | if (d_is_negative(dentry)) | ||
| 445 | this_cpu_dec(nr_dentry_negative); | ||
| 421 | list_lru_isolate(lru, &dentry->d_lru); | 446 | list_lru_isolate(lru, &dentry->d_lru); |
| 422 | } | 447 | } |
| 423 | 448 | ||
| @@ -426,6 +451,8 @@ static void d_lru_shrink_move(struct list_lru_one *lru, struct dentry *dentry, | |||
| 426 | { | 451 | { |
| 427 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); | 452 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 428 | dentry->d_flags |= DCACHE_SHRINK_LIST; | 453 | dentry->d_flags |= DCACHE_SHRINK_LIST; |
| 454 | if (d_is_negative(dentry)) | ||
| 455 | this_cpu_dec(nr_dentry_negative); | ||
| 429 | list_lru_isolate_move(lru, &dentry->d_lru, list); | 456 | list_lru_isolate_move(lru, &dentry->d_lru, list); |
| 430 | } | 457 | } |
| 431 | 458 | ||
| @@ -1188,15 +1215,11 @@ static enum lru_status dentry_lru_isolate_shrink(struct list_head *item, | |||
| 1188 | */ | 1215 | */ |
| 1189 | void shrink_dcache_sb(struct super_block *sb) | 1216 | void shrink_dcache_sb(struct super_block *sb) |
| 1190 | { | 1217 | { |
| 1191 | long freed; | ||
| 1192 | |||
| 1193 | do { | 1218 | do { |
| 1194 | LIST_HEAD(dispose); | 1219 | LIST_HEAD(dispose); |
| 1195 | 1220 | ||
| 1196 | freed = list_lru_walk(&sb->s_dentry_lru, | 1221 | list_lru_walk(&sb->s_dentry_lru, |
| 1197 | dentry_lru_isolate_shrink, &dispose, 1024); | 1222 | dentry_lru_isolate_shrink, &dispose, 1024); |
| 1198 | |||
| 1199 | this_cpu_sub(nr_dentry_unused, freed); | ||
| 1200 | shrink_dentry_list(&dispose); | 1223 | shrink_dentry_list(&dispose); |
| 1201 | } while (list_lru_count(&sb->s_dentry_lru) > 0); | 1224 | } while (list_lru_count(&sb->s_dentry_lru) > 0); |
| 1202 | } | 1225 | } |
| @@ -1820,6 +1843,11 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) | |||
| 1820 | WARN_ON(d_in_lookup(dentry)); | 1843 | WARN_ON(d_in_lookup(dentry)); |
| 1821 | 1844 | ||
| 1822 | spin_lock(&dentry->d_lock); | 1845 | spin_lock(&dentry->d_lock); |
| 1846 | /* | ||
| 1847 | * Decrement negative dentry count if it was in the LRU list. | ||
| 1848 | */ | ||
| 1849 | if (dentry->d_flags & DCACHE_LRU_LIST) | ||
| 1850 | this_cpu_dec(nr_dentry_negative); | ||
| 1823 | hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); | 1851 | hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); |
| 1824 | raw_write_seqcount_begin(&dentry->d_seq); | 1852 | raw_write_seqcount_begin(&dentry->d_seq); |
| 1825 | __d_set_inode_and_type(dentry, inode, add_flags); | 1853 | __d_set_inode_and_type(dentry, inode, add_flags); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 831d7cb5a49c..17a8d3b43990 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
| @@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, | |||
| 1780 | goto next_iter; | 1780 | goto next_iter; |
| 1781 | } | 1781 | } |
| 1782 | if (ret == -E2BIG) { | 1782 | if (ret == -E2BIG) { |
| 1783 | n += rbm->bii - initial_bii; | ||
| 1784 | rbm->bii = 0; | 1783 | rbm->bii = 0; |
| 1785 | rbm->offset = 0; | 1784 | rbm->offset = 0; |
| 1785 | n += (rbm->bii - initial_bii); | ||
| 1786 | goto res_covered_end_of_rgrp; | 1786 | goto res_covered_end_of_rgrp; |
| 1787 | } | 1787 | } |
| 1788 | return ret; | 1788 | return ret; |
diff --git a/fs/iomap.c b/fs/iomap.c index a3088fae567b..897c60215dd1 100644 --- a/fs/iomap.c +++ b/fs/iomap.c | |||
| @@ -116,6 +116,12 @@ iomap_page_create(struct inode *inode, struct page *page) | |||
| 116 | atomic_set(&iop->read_count, 0); | 116 | atomic_set(&iop->read_count, 0); |
| 117 | atomic_set(&iop->write_count, 0); | 117 | atomic_set(&iop->write_count, 0); |
| 118 | bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE); | 118 | bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE); |
| 119 | |||
| 120 | /* | ||
| 121 | * migrate_page_move_mapping() assumes that pages with private data have | ||
| 122 | * their count elevated by 1. | ||
| 123 | */ | ||
| 124 | get_page(page); | ||
| 119 | set_page_private(page, (unsigned long)iop); | 125 | set_page_private(page, (unsigned long)iop); |
| 120 | SetPagePrivate(page); | 126 | SetPagePrivate(page); |
| 121 | return iop; | 127 | return iop; |
| @@ -132,6 +138,7 @@ iomap_page_release(struct page *page) | |||
| 132 | WARN_ON_ONCE(atomic_read(&iop->write_count)); | 138 | WARN_ON_ONCE(atomic_read(&iop->write_count)); |
| 133 | ClearPagePrivate(page); | 139 | ClearPagePrivate(page); |
| 134 | set_page_private(page, 0); | 140 | set_page_private(page, 0); |
| 141 | put_page(page); | ||
| 135 | kfree(iop); | 142 | kfree(iop); |
| 136 | } | 143 | } |
| 137 | 144 | ||
| @@ -569,8 +576,10 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage, | |||
| 569 | 576 | ||
| 570 | if (page_has_private(page)) { | 577 | if (page_has_private(page)) { |
| 571 | ClearPagePrivate(page); | 578 | ClearPagePrivate(page); |
| 579 | get_page(newpage); | ||
| 572 | set_page_private(newpage, page_private(page)); | 580 | set_page_private(newpage, page_private(page)); |
| 573 | set_page_private(page, 0); | 581 | set_page_private(page, 0); |
| 582 | put_page(page); | ||
| 574 | SetPagePrivate(newpage); | 583 | SetPagePrivate(newpage); |
| 575 | } | 584 | } |
| 576 | 585 | ||
| @@ -1804,6 +1813,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1804 | loff_t pos = iocb->ki_pos, start = pos; | 1813 | loff_t pos = iocb->ki_pos, start = pos; |
| 1805 | loff_t end = iocb->ki_pos + count - 1, ret = 0; | 1814 | loff_t end = iocb->ki_pos + count - 1, ret = 0; |
| 1806 | unsigned int flags = IOMAP_DIRECT; | 1815 | unsigned int flags = IOMAP_DIRECT; |
| 1816 | bool wait_for_completion = is_sync_kiocb(iocb); | ||
| 1807 | struct blk_plug plug; | 1817 | struct blk_plug plug; |
| 1808 | struct iomap_dio *dio; | 1818 | struct iomap_dio *dio; |
| 1809 | 1819 | ||
| @@ -1823,7 +1833,6 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1823 | dio->end_io = end_io; | 1833 | dio->end_io = end_io; |
| 1824 | dio->error = 0; | 1834 | dio->error = 0; |
| 1825 | dio->flags = 0; | 1835 | dio->flags = 0; |
| 1826 | dio->wait_for_completion = is_sync_kiocb(iocb); | ||
| 1827 | 1836 | ||
| 1828 | dio->submit.iter = iter; | 1837 | dio->submit.iter = iter; |
| 1829 | dio->submit.waiter = current; | 1838 | dio->submit.waiter = current; |
| @@ -1878,7 +1887,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1878 | dio_warn_stale_pagecache(iocb->ki_filp); | 1887 | dio_warn_stale_pagecache(iocb->ki_filp); |
| 1879 | ret = 0; | 1888 | ret = 0; |
| 1880 | 1889 | ||
| 1881 | if (iov_iter_rw(iter) == WRITE && !dio->wait_for_completion && | 1890 | if (iov_iter_rw(iter) == WRITE && !wait_for_completion && |
| 1882 | !inode->i_sb->s_dio_done_wq) { | 1891 | !inode->i_sb->s_dio_done_wq) { |
| 1883 | ret = sb_init_dio_done_wq(inode->i_sb); | 1892 | ret = sb_init_dio_done_wq(inode->i_sb); |
| 1884 | if (ret < 0) | 1893 | if (ret < 0) |
| @@ -1894,7 +1903,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1894 | if (ret <= 0) { | 1903 | if (ret <= 0) { |
| 1895 | /* magic error code to fall back to buffered I/O */ | 1904 | /* magic error code to fall back to buffered I/O */ |
| 1896 | if (ret == -ENOTBLK) { | 1905 | if (ret == -ENOTBLK) { |
| 1897 | dio->wait_for_completion = true; | 1906 | wait_for_completion = true; |
| 1898 | ret = 0; | 1907 | ret = 0; |
| 1899 | } | 1908 | } |
| 1900 | break; | 1909 | break; |
| @@ -1916,8 +1925,24 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1916 | if (dio->flags & IOMAP_DIO_WRITE_FUA) | 1925 | if (dio->flags & IOMAP_DIO_WRITE_FUA) |
| 1917 | dio->flags &= ~IOMAP_DIO_NEED_SYNC; | 1926 | dio->flags &= ~IOMAP_DIO_NEED_SYNC; |
| 1918 | 1927 | ||
| 1928 | /* | ||
| 1929 | * We are about to drop our additional submission reference, which | ||
| 1930 | * might be the last reference to the dio. There are three three | ||
| 1931 | * different ways we can progress here: | ||
| 1932 | * | ||
| 1933 | * (a) If this is the last reference we will always complete and free | ||
| 1934 | * the dio ourselves. | ||
| 1935 | * (b) If this is not the last reference, and we serve an asynchronous | ||
| 1936 | * iocb, we must never touch the dio after the decrement, the | ||
| 1937 | * I/O completion handler will complete and free it. | ||
| 1938 | * (c) If this is not the last reference, but we serve a synchronous | ||
| 1939 | * iocb, the I/O completion handler will wake us up on the drop | ||
| 1940 | * of the final reference, and we will complete and free it here | ||
| 1941 | * after we got woken by the I/O completion handler. | ||
| 1942 | */ | ||
| 1943 | dio->wait_for_completion = wait_for_completion; | ||
| 1919 | if (!atomic_dec_and_test(&dio->ref)) { | 1944 | if (!atomic_dec_and_test(&dio->ref)) { |
| 1920 | if (!dio->wait_for_completion) | 1945 | if (!wait_for_completion) |
| 1921 | return -EIOCBQUEUED; | 1946 | return -EIOCBQUEUED; |
| 1922 | 1947 | ||
| 1923 | for (;;) { | 1948 | for (;;) { |
| @@ -1934,9 +1959,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, | |||
| 1934 | __set_current_state(TASK_RUNNING); | 1959 | __set_current_state(TASK_RUNNING); |
| 1935 | } | 1960 | } |
| 1936 | 1961 | ||
| 1937 | ret = iomap_dio_complete(dio); | 1962 | return iomap_dio_complete(dio); |
| 1938 | |||
| 1939 | return ret; | ||
| 1940 | 1963 | ||
| 1941 | out_free_dio: | 1964 | out_free_dio: |
| 1942 | kfree(dio); | 1965 | kfree(dio); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 22ce3c8a2f46..0570391eaa16 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name, | |||
| 1895 | size_t len; | 1895 | size_t len; |
| 1896 | char *end; | 1896 | char *end; |
| 1897 | 1897 | ||
| 1898 | if (unlikely(!dev_name || !*dev_name)) { | ||
| 1899 | dfprintk(MOUNT, "NFS: device name not specified\n"); | ||
| 1900 | return -EINVAL; | ||
| 1901 | } | ||
| 1902 | |||
| 1898 | /* Is the host name protected with square brakcets? */ | 1903 | /* Is the host name protected with square brakcets? */ |
| 1899 | if (*dev_name == '[') { | 1904 | if (*dev_name == '[') { |
| 1900 | end = strchr(++dev_name, ']'); | 1905 | end = strchr(++dev_name, ']'); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5a0bbf917a32..f12cb31a41e5 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, | |||
| 621 | nfs_set_page_writeback(page); | 621 | nfs_set_page_writeback(page); |
| 622 | WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); | 622 | WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); |
| 623 | 623 | ||
| 624 | ret = 0; | 624 | ret = req->wb_context->error; |
| 625 | /* If there is a fatal error that covers this write, just exit */ | 625 | /* If there is a fatal error that covers this write, just exit */ |
| 626 | if (nfs_error_is_fatal_on_server(req->wb_context->error)) | 626 | if (nfs_error_is_fatal_on_server(ret)) |
| 627 | goto out_launder; | 627 | goto out_launder; |
| 628 | 628 | ||
| 629 | ret = 0; | ||
| 629 | if (!nfs_pageio_add_request(pgio, req)) { | 630 | if (!nfs_pageio_add_request(pgio, req)) { |
| 630 | ret = pgio->pg_error; | 631 | ret = pgio->pg_error; |
| 631 | /* | 632 | /* |
| @@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, | |||
| 635 | nfs_context_set_write_error(req->wb_context, ret); | 636 | nfs_context_set_write_error(req->wb_context, ret); |
| 636 | if (nfs_error_is_fatal_on_server(ret)) | 637 | if (nfs_error_is_fatal_on_server(ret)) |
| 637 | goto out_launder; | 638 | goto out_launder; |
| 638 | } | 639 | } else |
| 640 | ret = -EAGAIN; | ||
| 639 | nfs_redirty_request(req); | 641 | nfs_redirty_request(req); |
| 640 | ret = -EAGAIN; | ||
| 641 | } else | 642 | } else |
| 642 | nfs_add_stats(page_file_mapping(page)->host, | 643 | nfs_add_stats(page_file_mapping(page)->host, |
| 643 | NFSIOS_WRITEPAGES, 1); | 644 | NFSIOS_WRITEPAGES, 1); |
diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h index 7b24fc791146..228a5e234af0 100644 --- a/include/dt-bindings/clock/marvell,mmp2.h +++ b/include/dt-bindings/clock/marvell,mmp2.h | |||
| @@ -71,7 +71,6 @@ | |||
| 71 | #define MMP2_CLK_CCIC1_MIX 117 | 71 | #define MMP2_CLK_CCIC1_MIX 117 |
| 72 | #define MMP2_CLK_CCIC1_PHY 118 | 72 | #define MMP2_CLK_CCIC1_PHY 118 |
| 73 | #define MMP2_CLK_CCIC1_SPHY 119 | 73 | #define MMP2_CLK_CCIC1_SPHY 119 |
| 74 | #define MMP2_CLK_SP 120 | ||
| 75 | 74 | ||
| 76 | #define MMP2_NR_CLKS 200 | 75 | #define MMP2_NR_CLKS 200 |
| 77 | #endif | 76 | #endif |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ef4b70f64f33..60996e64c579 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -62,9 +62,10 @@ extern const struct qstr slash_name; | |||
| 62 | struct dentry_stat_t { | 62 | struct dentry_stat_t { |
| 63 | long nr_dentry; | 63 | long nr_dentry; |
| 64 | long nr_unused; | 64 | long nr_unused; |
| 65 | long age_limit; /* age in seconds */ | 65 | long age_limit; /* age in seconds */ |
| 66 | long want_pages; /* pages requested by system */ | 66 | long want_pages; /* pages requested by system */ |
| 67 | long dummy[2]; | 67 | long nr_negative; /* # of unused negative dentries */ |
| 68 | long dummy; /* Reserved for future use */ | ||
| 68 | }; | 69 | }; |
| 69 | extern struct dentry_stat_t dentry_stat; | 70 | extern struct dentry_stat_t dentry_stat; |
| 70 | 71 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 811c77743dad..29d8e2cfed0e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1479,11 +1479,12 @@ struct super_block { | |||
| 1479 | struct user_namespace *s_user_ns; | 1479 | struct user_namespace *s_user_ns; |
| 1480 | 1480 | ||
| 1481 | /* | 1481 | /* |
| 1482 | * Keep the lru lists last in the structure so they always sit on their | 1482 | * The list_lru structure is essentially just a pointer to a table |
| 1483 | * own individual cachelines. | 1483 | * of per-node lru lists, each of which has its own spinlock. |
| 1484 | * There is no need to put them into separate cachelines. | ||
| 1484 | */ | 1485 | */ |
| 1485 | struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; | 1486 | struct list_lru s_dentry_lru; |
| 1486 | struct list_lru s_inode_lru ____cacheline_aligned_in_smp; | 1487 | struct list_lru s_inode_lru; |
| 1487 | struct rcu_head rcu; | 1488 | struct rcu_head rcu; |
| 1488 | struct work_struct destroy_work; | 1489 | struct work_struct destroy_work; |
| 1489 | 1490 | ||
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 54af4eef169f..fed5be706bc9 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -105,7 +105,7 @@ static inline bool pm_runtime_callbacks_present(struct device *dev) | |||
| 105 | 105 | ||
| 106 | static inline void pm_runtime_mark_last_busy(struct device *dev) | 106 | static inline void pm_runtime_mark_last_busy(struct device *dev) |
| 107 | { | 107 | { |
| 108 | WRITE_ONCE(dev->power.last_busy, ktime_to_ns(ktime_get())); | 108 | WRITE_ONCE(dev->power.last_busy, ktime_get_mono_fast_ns()); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static inline bool pm_runtime_is_irq_safe(struct device *dev) | 111 | static inline bool pm_runtime_is_irq_safe(struct device *dev) |
diff --git a/include/net/tls.h b/include/net/tls.h index 2a6ac8d642af..1486b60c4de8 100644 --- a/include/net/tls.h +++ b/include/net/tls.h | |||
| @@ -120,6 +120,8 @@ struct tls_rec { | |||
| 120 | struct scatterlist sg_aead_out[2]; | 120 | struct scatterlist sg_aead_out[2]; |
| 121 | 121 | ||
| 122 | char aad_space[TLS_AAD_SPACE_SIZE]; | 122 | char aad_space[TLS_AAD_SPACE_SIZE]; |
| 123 | u8 iv_data[TLS_CIPHER_AES_GCM_128_IV_SIZE + | ||
| 124 | TLS_CIPHER_AES_GCM_128_SALT_SIZE]; | ||
| 123 | struct aead_request aead_req; | 125 | struct aead_request aead_req; |
| 124 | u8 aead_req_ctx[]; | 126 | u8 aead_req_ctx[]; |
| 125 | }; | 127 | }; |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index a3ceed3a040a..80debf5982ac 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
| @@ -2579,9 +2579,10 @@ struct ib_device { | |||
| 2579 | 2579 | ||
| 2580 | const struct uapi_definition *driver_def; | 2580 | const struct uapi_definition *driver_def; |
| 2581 | enum rdma_driver_id driver_id; | 2581 | enum rdma_driver_id driver_id; |
| 2582 | |||
| 2582 | /* | 2583 | /* |
| 2583 | * Provides synchronization between device unregistration and netlink | 2584 | * Positive refcount indicates that the device is currently |
| 2584 | * commands on a device. To be used only by core. | 2585 | * registered and cannot be unregistered. |
| 2585 | */ | 2586 | */ |
| 2586 | refcount_t refcount; | 2587 | refcount_t refcount; |
| 2587 | struct completion unreg_completion; | 2588 | struct completion unreg_completion; |
| @@ -3926,6 +3927,25 @@ static inline bool ib_access_writable(int access_flags) | |||
| 3926 | int ib_check_mr_status(struct ib_mr *mr, u32 check_mask, | 3927 | int ib_check_mr_status(struct ib_mr *mr, u32 check_mask, |
| 3927 | struct ib_mr_status *mr_status); | 3928 | struct ib_mr_status *mr_status); |
| 3928 | 3929 | ||
| 3930 | /** | ||
| 3931 | * ib_device_try_get: Hold a registration lock | ||
| 3932 | * device: The device to lock | ||
| 3933 | * | ||
| 3934 | * A device under an active registration lock cannot become unregistered. It | ||
| 3935 | * is only possible to obtain a registration lock on a device that is fully | ||
| 3936 | * registered, otherwise this function returns false. | ||
| 3937 | * | ||
| 3938 | * The registration lock is only necessary for actions which require the | ||
| 3939 | * device to still be registered. Uses that only require the device pointer to | ||
| 3940 | * be valid should use get_device(&ibdev->dev) to hold the memory. | ||
| 3941 | * | ||
| 3942 | */ | ||
| 3943 | static inline bool ib_device_try_get(struct ib_device *dev) | ||
| 3944 | { | ||
| 3945 | return refcount_inc_not_zero(&dev->refcount); | ||
| 3946 | } | ||
| 3947 | |||
| 3948 | void ib_device_put(struct ib_device *device); | ||
| 3929 | struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port, | 3949 | struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port, |
| 3930 | u16 pkey, const union ib_gid *gid, | 3950 | u16 pkey, const union ib_gid *gid, |
| 3931 | const struct sockaddr *addr); | 3951 | const struct sockaddr *addr); |
diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h index ef3c7ec793a7..eb76b38a00d4 100644 --- a/include/uapi/rdma/hns-abi.h +++ b/include/uapi/rdma/hns-abi.h | |||
| @@ -52,6 +52,11 @@ struct hns_roce_ib_create_srq { | |||
| 52 | __aligned_u64 que_addr; | 52 | __aligned_u64 que_addr; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | struct hns_roce_ib_create_srq_resp { | ||
| 56 | __u32 srqn; | ||
| 57 | __u32 reserved; | ||
| 58 | }; | ||
| 59 | |||
| 55 | struct hns_roce_ib_create_qp { | 60 | struct hns_roce_ib_create_qp { |
| 56 | __aligned_u64 buf_addr; | 61 | __aligned_u64 buf_addr; |
| 57 | __aligned_u64 db_addr; | 62 | __aligned_u64 db_addr; |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 5e55cef0cec3..6693e209efe8 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
| @@ -2293,9 +2293,12 @@ static int compat_do_replace(struct net *net, void __user *user, | |||
| 2293 | 2293 | ||
| 2294 | xt_compat_lock(NFPROTO_BRIDGE); | 2294 | xt_compat_lock(NFPROTO_BRIDGE); |
| 2295 | 2295 | ||
| 2296 | ret = xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); | 2296 | if (tmp.nentries) { |
| 2297 | if (ret < 0) | 2297 | ret = xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries); |
| 2298 | goto out_unlock; | 2298 | if (ret < 0) |
| 2299 | goto out_unlock; | ||
| 2300 | } | ||
| 2301 | |||
| 2299 | ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); | 2302 | ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); |
| 2300 | if (ret < 0) | 2303 | if (ret < 0) |
| 2301 | goto out_unlock; | 2304 | goto out_unlock; |
diff --git a/net/core/dev.c b/net/core/dev.c index 82f20022259d..8e276e0192a1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -8712,6 +8712,9 @@ int init_dummy_netdev(struct net_device *dev) | |||
| 8712 | set_bit(__LINK_STATE_PRESENT, &dev->state); | 8712 | set_bit(__LINK_STATE_PRESENT, &dev->state); |
| 8713 | set_bit(__LINK_STATE_START, &dev->state); | 8713 | set_bit(__LINK_STATE_START, &dev->state); |
| 8714 | 8714 | ||
| 8715 | /* napi_busy_loop stats accounting wants this */ | ||
| 8716 | dev_net_set(dev, &init_net); | ||
| 8717 | |||
| 8715 | /* Note : We dont allocate pcpu_refcnt for dummy devices, | 8718 | /* Note : We dont allocate pcpu_refcnt for dummy devices, |
| 8716 | * because users of this 'device' dont need to change | 8719 | * because users of this 'device' dont need to change |
| 8717 | * its refcount. | 8720 | * its refcount. |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index d0b3e69c6b39..0962f9201baa 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <net/dn_neigh.h> | 56 | #include <net/dn_neigh.h> |
| 57 | #include <net/dn_fib.h> | 57 | #include <net/dn_fib.h> |
| 58 | 58 | ||
| 59 | #define DN_IFREQ_SIZE (sizeof(struct ifreq) - sizeof(struct sockaddr) + sizeof(struct sockaddr_dn)) | 59 | #define DN_IFREQ_SIZE (offsetof(struct ifreq, ifr_ifru) + sizeof(struct sockaddr_dn)) |
| 60 | 60 | ||
| 61 | static char dn_rt_all_end_mcast[ETH_ALEN] = {0xAB,0x00,0x00,0x04,0x00,0x00}; | 61 | static char dn_rt_all_end_mcast[ETH_ALEN] = {0xAB,0x00,0x00,0x04,0x00,0x00}; |
| 62 | static char dn_rt_all_rt_mcast[ETH_ALEN] = {0xAB,0x00,0x00,0x03,0x00,0x00}; | 62 | static char dn_rt_all_rt_mcast[ETH_ALEN] = {0xAB,0x00,0x00,0x03,0x00,0x00}; |
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index d7b43e700023..68a21bf75dd0 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
| @@ -74,6 +74,33 @@ drop: | |||
| 74 | return 0; | 74 | return 0; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static int vti_input_ipip(struct sk_buff *skb, int nexthdr, __be32 spi, | ||
| 78 | int encap_type) | ||
| 79 | { | ||
| 80 | struct ip_tunnel *tunnel; | ||
| 81 | const struct iphdr *iph = ip_hdr(skb); | ||
| 82 | struct net *net = dev_net(skb->dev); | ||
| 83 | struct ip_tunnel_net *itn = net_generic(net, vti_net_id); | ||
| 84 | |||
| 85 | tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, | ||
| 86 | iph->saddr, iph->daddr, 0); | ||
| 87 | if (tunnel) { | ||
| 88 | if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) | ||
| 89 | goto drop; | ||
| 90 | |||
| 91 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; | ||
| 92 | |||
| 93 | skb->dev = tunnel->dev; | ||
| 94 | |||
| 95 | return xfrm_input(skb, nexthdr, spi, encap_type); | ||
| 96 | } | ||
| 97 | |||
| 98 | return -EINVAL; | ||
| 99 | drop: | ||
| 100 | kfree_skb(skb); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | |||
| 77 | static int vti_rcv(struct sk_buff *skb) | 104 | static int vti_rcv(struct sk_buff *skb) |
| 78 | { | 105 | { |
| 79 | XFRM_SPI_SKB_CB(skb)->family = AF_INET; | 106 | XFRM_SPI_SKB_CB(skb)->family = AF_INET; |
| @@ -82,6 +109,14 @@ static int vti_rcv(struct sk_buff *skb) | |||
| 82 | return vti_input(skb, ip_hdr(skb)->protocol, 0, 0); | 109 | return vti_input(skb, ip_hdr(skb)->protocol, 0, 0); |
| 83 | } | 110 | } |
| 84 | 111 | ||
| 112 | static int vti_rcv_ipip(struct sk_buff *skb) | ||
| 113 | { | ||
| 114 | XFRM_SPI_SKB_CB(skb)->family = AF_INET; | ||
| 115 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); | ||
| 116 | |||
| 117 | return vti_input_ipip(skb, ip_hdr(skb)->protocol, ip_hdr(skb)->saddr, 0); | ||
| 118 | } | ||
| 119 | |||
| 85 | static int vti_rcv_cb(struct sk_buff *skb, int err) | 120 | static int vti_rcv_cb(struct sk_buff *skb, int err) |
| 86 | { | 121 | { |
| 87 | unsigned short family; | 122 | unsigned short family; |
| @@ -435,6 +470,12 @@ static struct xfrm4_protocol vti_ipcomp4_protocol __read_mostly = { | |||
| 435 | .priority = 100, | 470 | .priority = 100, |
| 436 | }; | 471 | }; |
| 437 | 472 | ||
| 473 | static struct xfrm_tunnel ipip_handler __read_mostly = { | ||
| 474 | .handler = vti_rcv_ipip, | ||
| 475 | .err_handler = vti4_err, | ||
| 476 | .priority = 0, | ||
| 477 | }; | ||
| 478 | |||
| 438 | static int __net_init vti_init_net(struct net *net) | 479 | static int __net_init vti_init_net(struct net *net) |
| 439 | { | 480 | { |
| 440 | int err; | 481 | int err; |
| @@ -603,6 +644,13 @@ static int __init vti_init(void) | |||
| 603 | if (err < 0) | 644 | if (err < 0) |
| 604 | goto xfrm_proto_comp_failed; | 645 | goto xfrm_proto_comp_failed; |
| 605 | 646 | ||
| 647 | msg = "ipip tunnel"; | ||
| 648 | err = xfrm4_tunnel_register(&ipip_handler, AF_INET); | ||
| 649 | if (err < 0) { | ||
| 650 | pr_info("%s: cant't register tunnel\n",__func__); | ||
| 651 | goto xfrm_tunnel_failed; | ||
| 652 | } | ||
| 653 | |||
| 606 | msg = "netlink interface"; | 654 | msg = "netlink interface"; |
| 607 | err = rtnl_link_register(&vti_link_ops); | 655 | err = rtnl_link_register(&vti_link_ops); |
| 608 | if (err < 0) | 656 | if (err < 0) |
| @@ -612,6 +660,8 @@ static int __init vti_init(void) | |||
| 612 | 660 | ||
| 613 | rtnl_link_failed: | 661 | rtnl_link_failed: |
| 614 | xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); | 662 | xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP); |
| 663 | xfrm_tunnel_failed: | ||
| 664 | xfrm4_tunnel_deregister(&ipip_handler, AF_INET); | ||
| 615 | xfrm_proto_comp_failed: | 665 | xfrm_proto_comp_failed: |
| 616 | xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); | 666 | xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH); |
| 617 | xfrm_proto_ah_failed: | 667 | xfrm_proto_ah_failed: |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index b61977db9b7f..2a909e5f9ba0 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
| @@ -846,9 +846,9 @@ static int clusterip_net_init(struct net *net) | |||
| 846 | 846 | ||
| 847 | static void clusterip_net_exit(struct net *net) | 847 | static void clusterip_net_exit(struct net *net) |
| 848 | { | 848 | { |
| 849 | #ifdef CONFIG_PROC_FS | ||
| 849 | struct clusterip_net *cn = clusterip_pernet(net); | 850 | struct clusterip_net *cn = clusterip_pernet(net); |
| 850 | 851 | ||
| 851 | #ifdef CONFIG_PROC_FS | ||
| 852 | mutex_lock(&cn->mutex); | 852 | mutex_lock(&cn->mutex); |
| 853 | proc_remove(cn->procdir); | 853 | proc_remove(cn->procdir); |
| 854 | cn->procdir = NULL; | 854 | cn->procdir = NULL; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 30337b38274b..cc01aa3f2b5e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
| @@ -1516,6 +1516,9 @@ static void mroute_clean_tables(struct mr_table *mrt, bool all) | |||
| 1516 | continue; | 1516 | continue; |
| 1517 | rhltable_remove(&mrt->mfc_hash, &c->mnode, ip6mr_rht_params); | 1517 | rhltable_remove(&mrt->mfc_hash, &c->mnode, ip6mr_rht_params); |
| 1518 | list_del_rcu(&c->list); | 1518 | list_del_rcu(&c->list); |
| 1519 | call_ip6mr_mfc_entry_notifiers(read_pnet(&mrt->net), | ||
| 1520 | FIB_EVENT_ENTRY_DEL, | ||
| 1521 | (struct mfc6_cache *)c, mrt->id); | ||
| 1519 | mr6_netlink_event(mrt, (struct mfc6_cache *)c, RTM_DELROUTE); | 1522 | mr6_netlink_event(mrt, (struct mfc6_cache *)c, RTM_DELROUTE); |
| 1520 | mr_cache_put(c); | 1523 | mr_cache_put(c); |
| 1521 | } | 1524 | } |
| @@ -1524,10 +1527,6 @@ static void mroute_clean_tables(struct mr_table *mrt, bool all) | |||
| 1524 | spin_lock_bh(&mfc_unres_lock); | 1527 | spin_lock_bh(&mfc_unres_lock); |
| 1525 | list_for_each_entry_safe(c, tmp, &mrt->mfc_unres_queue, list) { | 1528 | list_for_each_entry_safe(c, tmp, &mrt->mfc_unres_queue, list) { |
| 1526 | list_del(&c->list); | 1529 | list_del(&c->list); |
| 1527 | call_ip6mr_mfc_entry_notifiers(read_pnet(&mrt->net), | ||
| 1528 | FIB_EVENT_ENTRY_DEL, | ||
| 1529 | (struct mfc6_cache *)c, | ||
| 1530 | mrt->id); | ||
| 1531 | mr6_netlink_event(mrt, (struct mfc6_cache *)c, | 1530 | mr6_netlink_event(mrt, (struct mfc6_cache *)c, |
| 1532 | RTM_DELROUTE); | 1531 | RTM_DELROUTE); |
| 1533 | ip6mr_destroy_unres(mrt, (struct mfc6_cache *)c); | 1532 | ip6mr_destroy_unres(mrt, (struct mfc6_cache *)c); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 432141f04af3..7d6318664eb2 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -2221,6 +2221,18 @@ static int ip_vs_set_timeout(struct netns_ipvs *ipvs, struct ip_vs_timeout_user | |||
| 2221 | u->udp_timeout); | 2221 | u->udp_timeout); |
| 2222 | 2222 | ||
| 2223 | #ifdef CONFIG_IP_VS_PROTO_TCP | 2223 | #ifdef CONFIG_IP_VS_PROTO_TCP |
| 2224 | if (u->tcp_timeout < 0 || u->tcp_timeout > (INT_MAX / HZ) || | ||
| 2225 | u->tcp_fin_timeout < 0 || u->tcp_fin_timeout > (INT_MAX / HZ)) { | ||
| 2226 | return -EINVAL; | ||
| 2227 | } | ||
| 2228 | #endif | ||
| 2229 | |||
| 2230 | #ifdef CONFIG_IP_VS_PROTO_UDP | ||
| 2231 | if (u->udp_timeout < 0 || u->udp_timeout > (INT_MAX / HZ)) | ||
| 2232 | return -EINVAL; | ||
| 2233 | #endif | ||
| 2234 | |||
| 2235 | #ifdef CONFIG_IP_VS_PROTO_TCP | ||
| 2224 | if (u->tcp_timeout) { | 2236 | if (u->tcp_timeout) { |
| 2225 | pd = ip_vs_proto_data_get(ipvs, IPPROTO_TCP); | 2237 | pd = ip_vs_proto_data_get(ipvs, IPPROTO_TCP); |
| 2226 | pd->timeout_table[IP_VS_TCP_S_ESTABLISHED] | 2238 | pd->timeout_table[IP_VS_TCP_S_ESTABLISHED] |
diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index 6f41dd74729d..1f1d90c1716b 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c | |||
| @@ -66,6 +66,7 @@ static bool nf_osf_match_one(const struct sk_buff *skb, | |||
| 66 | int ttl_check, | 66 | int ttl_check, |
| 67 | struct nf_osf_hdr_ctx *ctx) | 67 | struct nf_osf_hdr_ctx *ctx) |
| 68 | { | 68 | { |
| 69 | const __u8 *optpinit = ctx->optp; | ||
| 69 | unsigned int check_WSS = 0; | 70 | unsigned int check_WSS = 0; |
| 70 | int fmatch = FMATCH_WRONG; | 71 | int fmatch = FMATCH_WRONG; |
| 71 | int foptsize, optnum; | 72 | int foptsize, optnum; |
| @@ -155,6 +156,9 @@ static bool nf_osf_match_one(const struct sk_buff *skb, | |||
| 155 | } | 156 | } |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 159 | if (fmatch != FMATCH_OK) | ||
| 160 | ctx->optp = optpinit; | ||
| 161 | |||
| 158 | return fmatch == FMATCH_OK; | 162 | return fmatch == FMATCH_OK; |
| 159 | } | 163 | } |
| 160 | 164 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 7334e0b80a5e..5eb269428832 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
| @@ -22,11 +22,15 @@ | |||
| 22 | #include <linux/netfilter_bridge/ebtables.h> | 22 | #include <linux/netfilter_bridge/ebtables.h> |
| 23 | #include <linux/netfilter_arp/arp_tables.h> | 23 | #include <linux/netfilter_arp/arp_tables.h> |
| 24 | #include <net/netfilter/nf_tables.h> | 24 | #include <net/netfilter/nf_tables.h> |
| 25 | #include <net/netns/generic.h> | ||
| 25 | 26 | ||
| 26 | struct nft_xt { | 27 | struct nft_xt { |
| 27 | struct list_head head; | 28 | struct list_head head; |
| 28 | struct nft_expr_ops ops; | 29 | struct nft_expr_ops ops; |
| 29 | unsigned int refcnt; | 30 | refcount_t refcnt; |
| 31 | |||
| 32 | /* used only when transaction mutex is locked */ | ||
| 33 | unsigned int listcnt; | ||
| 30 | 34 | ||
| 31 | /* Unlike other expressions, ops doesn't have static storage duration. | 35 | /* Unlike other expressions, ops doesn't have static storage duration. |
| 32 | * nft core assumes they do. We use kfree_rcu so that nft core can | 36 | * nft core assumes they do. We use kfree_rcu so that nft core can |
| @@ -43,10 +47,24 @@ struct nft_xt_match_priv { | |||
| 43 | void *info; | 47 | void *info; |
| 44 | }; | 48 | }; |
| 45 | 49 | ||
| 50 | struct nft_compat_net { | ||
| 51 | struct list_head nft_target_list; | ||
| 52 | struct list_head nft_match_list; | ||
| 53 | }; | ||
| 54 | |||
| 55 | static unsigned int nft_compat_net_id __read_mostly; | ||
| 56 | static struct nft_expr_type nft_match_type; | ||
| 57 | static struct nft_expr_type nft_target_type; | ||
| 58 | |||
| 59 | static struct nft_compat_net *nft_compat_pernet(struct net *net) | ||
| 60 | { | ||
| 61 | return net_generic(net, nft_compat_net_id); | ||
| 62 | } | ||
| 63 | |||
| 46 | static bool nft_xt_put(struct nft_xt *xt) | 64 | static bool nft_xt_put(struct nft_xt *xt) |
| 47 | { | 65 | { |
| 48 | if (--xt->refcnt == 0) { | 66 | if (refcount_dec_and_test(&xt->refcnt)) { |
| 49 | list_del(&xt->head); | 67 | WARN_ON_ONCE(!list_empty(&xt->head)); |
| 50 | kfree_rcu(xt, rcu_head); | 68 | kfree_rcu(xt, rcu_head); |
| 51 | return true; | 69 | return true; |
| 52 | } | 70 | } |
| @@ -273,7 +291,7 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 273 | return -EINVAL; | 291 | return -EINVAL; |
| 274 | 292 | ||
| 275 | nft_xt = container_of(expr->ops, struct nft_xt, ops); | 293 | nft_xt = container_of(expr->ops, struct nft_xt, ops); |
| 276 | nft_xt->refcnt++; | 294 | refcount_inc(&nft_xt->refcnt); |
| 277 | return 0; | 295 | return 0; |
| 278 | } | 296 | } |
| 279 | 297 | ||
| @@ -486,7 +504,7 @@ __nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 486 | return ret; | 504 | return ret; |
| 487 | 505 | ||
| 488 | nft_xt = container_of(expr->ops, struct nft_xt, ops); | 506 | nft_xt = container_of(expr->ops, struct nft_xt, ops); |
| 489 | nft_xt->refcnt++; | 507 | refcount_inc(&nft_xt->refcnt); |
| 490 | return 0; | 508 | return 0; |
| 491 | } | 509 | } |
| 492 | 510 | ||
| @@ -540,6 +558,43 @@ nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | |||
| 540 | __nft_match_destroy(ctx, expr, nft_expr_priv(expr)); | 558 | __nft_match_destroy(ctx, expr, nft_expr_priv(expr)); |
| 541 | } | 559 | } |
| 542 | 560 | ||
| 561 | static void nft_compat_activate(const struct nft_ctx *ctx, | ||
| 562 | const struct nft_expr *expr, | ||
| 563 | struct list_head *h) | ||
| 564 | { | ||
| 565 | struct nft_xt *xt = container_of(expr->ops, struct nft_xt, ops); | ||
| 566 | |||
| 567 | if (xt->listcnt == 0) | ||
| 568 | list_add(&xt->head, h); | ||
| 569 | |||
| 570 | xt->listcnt++; | ||
| 571 | } | ||
| 572 | |||
| 573 | static void nft_compat_activate_mt(const struct nft_ctx *ctx, | ||
| 574 | const struct nft_expr *expr) | ||
| 575 | { | ||
| 576 | struct nft_compat_net *cn = nft_compat_pernet(ctx->net); | ||
| 577 | |||
| 578 | nft_compat_activate(ctx, expr, &cn->nft_match_list); | ||
| 579 | } | ||
| 580 | |||
| 581 | static void nft_compat_activate_tg(const struct nft_ctx *ctx, | ||
| 582 | const struct nft_expr *expr) | ||
| 583 | { | ||
| 584 | struct nft_compat_net *cn = nft_compat_pernet(ctx->net); | ||
| 585 | |||
| 586 | nft_compat_activate(ctx, expr, &cn->nft_target_list); | ||
| 587 | } | ||
| 588 | |||
| 589 | static void nft_compat_deactivate(const struct nft_ctx *ctx, | ||
| 590 | const struct nft_expr *expr) | ||
| 591 | { | ||
| 592 | struct nft_xt *xt = container_of(expr->ops, struct nft_xt, ops); | ||
| 593 | |||
| 594 | if (--xt->listcnt == 0) | ||
| 595 | list_del_init(&xt->head); | ||
| 596 | } | ||
| 597 | |||
| 543 | static void | 598 | static void |
| 544 | nft_match_large_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | 599 | nft_match_large_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
| 545 | { | 600 | { |
| @@ -734,10 +789,6 @@ static const struct nfnetlink_subsystem nfnl_compat_subsys = { | |||
| 734 | .cb = nfnl_nft_compat_cb, | 789 | .cb = nfnl_nft_compat_cb, |
| 735 | }; | 790 | }; |
| 736 | 791 | ||
| 737 | static LIST_HEAD(nft_match_list); | ||
| 738 | |||
| 739 | static struct nft_expr_type nft_match_type; | ||
| 740 | |||
| 741 | static bool nft_match_cmp(const struct xt_match *match, | 792 | static bool nft_match_cmp(const struct xt_match *match, |
| 742 | const char *name, u32 rev, u32 family) | 793 | const char *name, u32 rev, u32 family) |
| 743 | { | 794 | { |
| @@ -749,6 +800,7 @@ static const struct nft_expr_ops * | |||
| 749 | nft_match_select_ops(const struct nft_ctx *ctx, | 800 | nft_match_select_ops(const struct nft_ctx *ctx, |
| 750 | const struct nlattr * const tb[]) | 801 | const struct nlattr * const tb[]) |
| 751 | { | 802 | { |
| 803 | struct nft_compat_net *cn; | ||
| 752 | struct nft_xt *nft_match; | 804 | struct nft_xt *nft_match; |
| 753 | struct xt_match *match; | 805 | struct xt_match *match; |
| 754 | unsigned int matchsize; | 806 | unsigned int matchsize; |
| @@ -765,8 +817,10 @@ nft_match_select_ops(const struct nft_ctx *ctx, | |||
| 765 | rev = ntohl(nla_get_be32(tb[NFTA_MATCH_REV])); | 817 | rev = ntohl(nla_get_be32(tb[NFTA_MATCH_REV])); |
| 766 | family = ctx->family; | 818 | family = ctx->family; |
| 767 | 819 | ||
| 820 | cn = nft_compat_pernet(ctx->net); | ||
| 821 | |||
| 768 | /* Re-use the existing match if it's already loaded. */ | 822 | /* Re-use the existing match if it's already loaded. */ |
| 769 | list_for_each_entry(nft_match, &nft_match_list, head) { | 823 | list_for_each_entry(nft_match, &cn->nft_match_list, head) { |
| 770 | struct xt_match *match = nft_match->ops.data; | 824 | struct xt_match *match = nft_match->ops.data; |
| 771 | 825 | ||
| 772 | if (nft_match_cmp(match, mt_name, rev, family)) | 826 | if (nft_match_cmp(match, mt_name, rev, family)) |
| @@ -789,11 +843,13 @@ nft_match_select_ops(const struct nft_ctx *ctx, | |||
| 789 | goto err; | 843 | goto err; |
| 790 | } | 844 | } |
| 791 | 845 | ||
| 792 | nft_match->refcnt = 0; | 846 | refcount_set(&nft_match->refcnt, 0); |
| 793 | nft_match->ops.type = &nft_match_type; | 847 | nft_match->ops.type = &nft_match_type; |
| 794 | nft_match->ops.eval = nft_match_eval; | 848 | nft_match->ops.eval = nft_match_eval; |
| 795 | nft_match->ops.init = nft_match_init; | 849 | nft_match->ops.init = nft_match_init; |
| 796 | nft_match->ops.destroy = nft_match_destroy; | 850 | nft_match->ops.destroy = nft_match_destroy; |
| 851 | nft_match->ops.activate = nft_compat_activate_mt; | ||
| 852 | nft_match->ops.deactivate = nft_compat_deactivate; | ||
| 797 | nft_match->ops.dump = nft_match_dump; | 853 | nft_match->ops.dump = nft_match_dump; |
| 798 | nft_match->ops.validate = nft_match_validate; | 854 | nft_match->ops.validate = nft_match_validate; |
| 799 | nft_match->ops.data = match; | 855 | nft_match->ops.data = match; |
| @@ -810,7 +866,8 @@ nft_match_select_ops(const struct nft_ctx *ctx, | |||
| 810 | 866 | ||
| 811 | nft_match->ops.size = matchsize; | 867 | nft_match->ops.size = matchsize; |
| 812 | 868 | ||
| 813 | list_add(&nft_match->head, &nft_match_list); | 869 | nft_match->listcnt = 1; |
| 870 | list_add(&nft_match->head, &cn->nft_match_list); | ||
| 814 | 871 | ||
| 815 | return &nft_match->ops; | 872 | return &nft_match->ops; |
| 816 | err: | 873 | err: |
| @@ -826,10 +883,6 @@ static struct nft_expr_type nft_match_type __read_mostly = { | |||
| 826 | .owner = THIS_MODULE, | 883 | .owner = THIS_MODULE, |
| 827 | }; | 884 | }; |
| 828 | 885 | ||
| 829 | static LIST_HEAD(nft_target_list); | ||
| 830 | |||
| 831 | static struct nft_expr_type nft_target_type; | ||
| 832 | |||
| 833 | static bool nft_target_cmp(const struct xt_target *tg, | 886 | static bool nft_target_cmp(const struct xt_target *tg, |
| 834 | const char *name, u32 rev, u32 family) | 887 | const char *name, u32 rev, u32 family) |
| 835 | { | 888 | { |
| @@ -841,6 +894,7 @@ static const struct nft_expr_ops * | |||
| 841 | nft_target_select_ops(const struct nft_ctx *ctx, | 894 | nft_target_select_ops(const struct nft_ctx *ctx, |
| 842 | const struct nlattr * const tb[]) | 895 | const struct nlattr * const tb[]) |
| 843 | { | 896 | { |
| 897 | struct nft_compat_net *cn; | ||
| 844 | struct nft_xt *nft_target; | 898 | struct nft_xt *nft_target; |
| 845 | struct xt_target *target; | 899 | struct xt_target *target; |
| 846 | char *tg_name; | 900 | char *tg_name; |
| @@ -861,8 +915,9 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
| 861 | strcmp(tg_name, "standard") == 0) | 915 | strcmp(tg_name, "standard") == 0) |
| 862 | return ERR_PTR(-EINVAL); | 916 | return ERR_PTR(-EINVAL); |
| 863 | 917 | ||
| 918 | cn = nft_compat_pernet(ctx->net); | ||
| 864 | /* Re-use the existing target if it's already loaded. */ | 919 | /* Re-use the existing target if it's already loaded. */ |
| 865 | list_for_each_entry(nft_target, &nft_target_list, head) { | 920 | list_for_each_entry(nft_target, &cn->nft_target_list, head) { |
| 866 | struct xt_target *target = nft_target->ops.data; | 921 | struct xt_target *target = nft_target->ops.data; |
| 867 | 922 | ||
| 868 | if (!target->target) | 923 | if (!target->target) |
| @@ -893,11 +948,13 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
| 893 | goto err; | 948 | goto err; |
| 894 | } | 949 | } |
| 895 | 950 | ||
| 896 | nft_target->refcnt = 0; | 951 | refcount_set(&nft_target->refcnt, 0); |
| 897 | nft_target->ops.type = &nft_target_type; | 952 | nft_target->ops.type = &nft_target_type; |
| 898 | nft_target->ops.size = NFT_EXPR_SIZE(XT_ALIGN(target->targetsize)); | 953 | nft_target->ops.size = NFT_EXPR_SIZE(XT_ALIGN(target->targetsize)); |
| 899 | nft_target->ops.init = nft_target_init; | 954 | nft_target->ops.init = nft_target_init; |
| 900 | nft_target->ops.destroy = nft_target_destroy; | 955 | nft_target->ops.destroy = nft_target_destroy; |
| 956 | nft_target->ops.activate = nft_compat_activate_tg; | ||
| 957 | nft_target->ops.deactivate = nft_compat_deactivate; | ||
| 901 | nft_target->ops.dump = nft_target_dump; | 958 | nft_target->ops.dump = nft_target_dump; |
| 902 | nft_target->ops.validate = nft_target_validate; | 959 | nft_target->ops.validate = nft_target_validate; |
| 903 | nft_target->ops.data = target; | 960 | nft_target->ops.data = target; |
| @@ -907,7 +964,8 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
| 907 | else | 964 | else |
| 908 | nft_target->ops.eval = nft_target_eval_xt; | 965 | nft_target->ops.eval = nft_target_eval_xt; |
| 909 | 966 | ||
| 910 | list_add(&nft_target->head, &nft_target_list); | 967 | nft_target->listcnt = 1; |
| 968 | list_add(&nft_target->head, &cn->nft_target_list); | ||
| 911 | 969 | ||
| 912 | return &nft_target->ops; | 970 | return &nft_target->ops; |
| 913 | err: | 971 | err: |
| @@ -923,13 +981,74 @@ static struct nft_expr_type nft_target_type __read_mostly = { | |||
| 923 | .owner = THIS_MODULE, | 981 | .owner = THIS_MODULE, |
| 924 | }; | 982 | }; |
| 925 | 983 | ||
| 984 | static int __net_init nft_compat_init_net(struct net *net) | ||
| 985 | { | ||
| 986 | struct nft_compat_net *cn = nft_compat_pernet(net); | ||
| 987 | |||
| 988 | INIT_LIST_HEAD(&cn->nft_target_list); | ||
| 989 | INIT_LIST_HEAD(&cn->nft_match_list); | ||
| 990 | |||
| 991 | return 0; | ||
| 992 | } | ||
| 993 | |||
| 994 | static void __net_exit nft_compat_exit_net(struct net *net) | ||
| 995 | { | ||
| 996 | struct nft_compat_net *cn = nft_compat_pernet(net); | ||
| 997 | struct nft_xt *xt, *next; | ||
| 998 | |||
| 999 | if (list_empty(&cn->nft_match_list) && | ||
| 1000 | list_empty(&cn->nft_target_list)) | ||
| 1001 | return; | ||
| 1002 | |||
| 1003 | /* If there was an error that caused nft_xt expr to not be initialized | ||
| 1004 | * fully and noone else requested the same expression later, the lists | ||
| 1005 | * contain 0-refcount entries that still hold module reference. | ||
| 1006 | * | ||
| 1007 | * Clean them here. | ||
| 1008 | */ | ||
| 1009 | mutex_lock(&net->nft.commit_mutex); | ||
| 1010 | list_for_each_entry_safe(xt, next, &cn->nft_target_list, head) { | ||
| 1011 | struct xt_target *target = xt->ops.data; | ||
| 1012 | |||
| 1013 | list_del_init(&xt->head); | ||
| 1014 | |||
| 1015 | if (refcount_read(&xt->refcnt)) | ||
| 1016 | continue; | ||
| 1017 | module_put(target->me); | ||
| 1018 | kfree(xt); | ||
| 1019 | } | ||
| 1020 | |||
| 1021 | list_for_each_entry_safe(xt, next, &cn->nft_match_list, head) { | ||
| 1022 | struct xt_match *match = xt->ops.data; | ||
| 1023 | |||
| 1024 | list_del_init(&xt->head); | ||
| 1025 | |||
| 1026 | if (refcount_read(&xt->refcnt)) | ||
| 1027 | continue; | ||
| 1028 | module_put(match->me); | ||
| 1029 | kfree(xt); | ||
| 1030 | } | ||
| 1031 | mutex_unlock(&net->nft.commit_mutex); | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | static struct pernet_operations nft_compat_net_ops = { | ||
| 1035 | .init = nft_compat_init_net, | ||
| 1036 | .exit = nft_compat_exit_net, | ||
| 1037 | .id = &nft_compat_net_id, | ||
| 1038 | .size = sizeof(struct nft_compat_net), | ||
| 1039 | }; | ||
| 1040 | |||
| 926 | static int __init nft_compat_module_init(void) | 1041 | static int __init nft_compat_module_init(void) |
| 927 | { | 1042 | { |
| 928 | int ret; | 1043 | int ret; |
| 929 | 1044 | ||
| 1045 | ret = register_pernet_subsys(&nft_compat_net_ops); | ||
| 1046 | if (ret < 0) | ||
| 1047 | goto err_target; | ||
| 1048 | |||
| 930 | ret = nft_register_expr(&nft_match_type); | 1049 | ret = nft_register_expr(&nft_match_type); |
| 931 | if (ret < 0) | 1050 | if (ret < 0) |
| 932 | return ret; | 1051 | goto err_pernet; |
| 933 | 1052 | ||
| 934 | ret = nft_register_expr(&nft_target_type); | 1053 | ret = nft_register_expr(&nft_target_type); |
| 935 | if (ret < 0) | 1054 | if (ret < 0) |
| @@ -942,45 +1061,21 @@ static int __init nft_compat_module_init(void) | |||
| 942 | } | 1061 | } |
| 943 | 1062 | ||
| 944 | return ret; | 1063 | return ret; |
| 945 | |||
| 946 | err_target: | 1064 | err_target: |
| 947 | nft_unregister_expr(&nft_target_type); | 1065 | nft_unregister_expr(&nft_target_type); |
| 948 | err_match: | 1066 | err_match: |
| 949 | nft_unregister_expr(&nft_match_type); | 1067 | nft_unregister_expr(&nft_match_type); |
| 1068 | err_pernet: | ||
| 1069 | unregister_pernet_subsys(&nft_compat_net_ops); | ||
| 950 | return ret; | 1070 | return ret; |
| 951 | } | 1071 | } |
| 952 | 1072 | ||
| 953 | static void __exit nft_compat_module_exit(void) | 1073 | static void __exit nft_compat_module_exit(void) |
| 954 | { | 1074 | { |
| 955 | struct nft_xt *xt, *next; | ||
| 956 | |||
| 957 | /* list should be empty here, it can be non-empty only in case there | ||
| 958 | * was an error that caused nft_xt expr to not be initialized fully | ||
| 959 | * and noone else requested the same expression later. | ||
| 960 | * | ||
| 961 | * In this case, the lists contain 0-refcount entries that still | ||
| 962 | * hold module reference. | ||
| 963 | */ | ||
| 964 | list_for_each_entry_safe(xt, next, &nft_target_list, head) { | ||
| 965 | struct xt_target *target = xt->ops.data; | ||
| 966 | |||
| 967 | if (WARN_ON_ONCE(xt->refcnt)) | ||
| 968 | continue; | ||
| 969 | module_put(target->me); | ||
| 970 | kfree(xt); | ||
| 971 | } | ||
| 972 | |||
| 973 | list_for_each_entry_safe(xt, next, &nft_match_list, head) { | ||
| 974 | struct xt_match *match = xt->ops.data; | ||
| 975 | |||
| 976 | if (WARN_ON_ONCE(xt->refcnt)) | ||
| 977 | continue; | ||
| 978 | module_put(match->me); | ||
| 979 | kfree(xt); | ||
| 980 | } | ||
| 981 | nfnetlink_subsys_unregister(&nfnl_compat_subsys); | 1075 | nfnetlink_subsys_unregister(&nfnl_compat_subsys); |
| 982 | nft_unregister_expr(&nft_target_type); | 1076 | nft_unregister_expr(&nft_target_type); |
| 983 | nft_unregister_expr(&nft_match_type); | 1077 | nft_unregister_expr(&nft_match_type); |
| 1078 | unregister_pernet_subsys(&nft_compat_net_ops); | ||
| 984 | } | 1079 | } |
| 985 | 1080 | ||
| 986 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT); | 1081 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFT_COMPAT); |
diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c index cbd51ed5a2d7..908e53ab47a4 100644 --- a/net/netrom/nr_timer.c +++ b/net/netrom/nr_timer.c | |||
| @@ -52,21 +52,21 @@ void nr_start_t1timer(struct sock *sk) | |||
| 52 | { | 52 | { |
| 53 | struct nr_sock *nr = nr_sk(sk); | 53 | struct nr_sock *nr = nr_sk(sk); |
| 54 | 54 | ||
| 55 | mod_timer(&nr->t1timer, jiffies + nr->t1); | 55 | sk_reset_timer(sk, &nr->t1timer, jiffies + nr->t1); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | void nr_start_t2timer(struct sock *sk) | 58 | void nr_start_t2timer(struct sock *sk) |
| 59 | { | 59 | { |
| 60 | struct nr_sock *nr = nr_sk(sk); | 60 | struct nr_sock *nr = nr_sk(sk); |
| 61 | 61 | ||
| 62 | mod_timer(&nr->t2timer, jiffies + nr->t2); | 62 | sk_reset_timer(sk, &nr->t2timer, jiffies + nr->t2); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void nr_start_t4timer(struct sock *sk) | 65 | void nr_start_t4timer(struct sock *sk) |
| 66 | { | 66 | { |
| 67 | struct nr_sock *nr = nr_sk(sk); | 67 | struct nr_sock *nr = nr_sk(sk); |
| 68 | 68 | ||
| 69 | mod_timer(&nr->t4timer, jiffies + nr->t4); | 69 | sk_reset_timer(sk, &nr->t4timer, jiffies + nr->t4); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | void nr_start_idletimer(struct sock *sk) | 72 | void nr_start_idletimer(struct sock *sk) |
| @@ -74,37 +74,37 @@ void nr_start_idletimer(struct sock *sk) | |||
| 74 | struct nr_sock *nr = nr_sk(sk); | 74 | struct nr_sock *nr = nr_sk(sk); |
| 75 | 75 | ||
| 76 | if (nr->idle > 0) | 76 | if (nr->idle > 0) |
| 77 | mod_timer(&nr->idletimer, jiffies + nr->idle); | 77 | sk_reset_timer(sk, &nr->idletimer, jiffies + nr->idle); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void nr_start_heartbeat(struct sock *sk) | 80 | void nr_start_heartbeat(struct sock *sk) |
| 81 | { | 81 | { |
| 82 | mod_timer(&sk->sk_timer, jiffies + 5 * HZ); | 82 | sk_reset_timer(sk, &sk->sk_timer, jiffies + 5 * HZ); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void nr_stop_t1timer(struct sock *sk) | 85 | void nr_stop_t1timer(struct sock *sk) |
| 86 | { | 86 | { |
| 87 | del_timer(&nr_sk(sk)->t1timer); | 87 | sk_stop_timer(sk, &nr_sk(sk)->t1timer); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | void nr_stop_t2timer(struct sock *sk) | 90 | void nr_stop_t2timer(struct sock *sk) |
| 91 | { | 91 | { |
| 92 | del_timer(&nr_sk(sk)->t2timer); | 92 | sk_stop_timer(sk, &nr_sk(sk)->t2timer); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void nr_stop_t4timer(struct sock *sk) | 95 | void nr_stop_t4timer(struct sock *sk) |
| 96 | { | 96 | { |
| 97 | del_timer(&nr_sk(sk)->t4timer); | 97 | sk_stop_timer(sk, &nr_sk(sk)->t4timer); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void nr_stop_idletimer(struct sock *sk) | 100 | void nr_stop_idletimer(struct sock *sk) |
| 101 | { | 101 | { |
| 102 | del_timer(&nr_sk(sk)->idletimer); | 102 | sk_stop_timer(sk, &nr_sk(sk)->idletimer); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | void nr_stop_heartbeat(struct sock *sk) | 105 | void nr_stop_heartbeat(struct sock *sk) |
| 106 | { | 106 | { |
| 107 | del_timer(&sk->sk_timer); | 107 | sk_stop_timer(sk, &sk->sk_timer); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | int nr_t1timer_running(struct sock *sk) | 110 | int nr_t1timer_running(struct sock *sk) |
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 77e9f85a2c92..f2ff21d7df08 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c | |||
| @@ -850,6 +850,7 @@ void rose_link_device_down(struct net_device *dev) | |||
| 850 | 850 | ||
| 851 | /* | 851 | /* |
| 852 | * Route a frame to an appropriate AX.25 connection. | 852 | * Route a frame to an appropriate AX.25 connection. |
| 853 | * A NULL ax25_cb indicates an internally generated frame. | ||
| 853 | */ | 854 | */ |
| 854 | int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) | 855 | int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) |
| 855 | { | 856 | { |
| @@ -867,6 +868,10 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) | |||
| 867 | 868 | ||
| 868 | if (skb->len < ROSE_MIN_LEN) | 869 | if (skb->len < ROSE_MIN_LEN) |
| 869 | return res; | 870 | return res; |
| 871 | |||
| 872 | if (!ax25) | ||
| 873 | return rose_loopback_queue(skb, NULL); | ||
| 874 | |||
| 870 | frametype = skb->data[2]; | 875 | frametype = skb->data[2]; |
| 871 | lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); | 876 | lci = ((skb->data[0] << 8) & 0xF00) + ((skb->data[1] << 0) & 0x0FF); |
| 872 | if (frametype == ROSE_CALL_REQUEST && | 877 | if (frametype == ROSE_CALL_REQUEST && |
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 11cdc8f7db63..bf5b54b513bc 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c | |||
| @@ -439,6 +439,8 @@ static int tls_do_encryption(struct sock *sk, | |||
| 439 | struct scatterlist *sge = sk_msg_elem(msg_en, start); | 439 | struct scatterlist *sge = sk_msg_elem(msg_en, start); |
| 440 | int rc; | 440 | int rc; |
| 441 | 441 | ||
| 442 | memcpy(rec->iv_data, tls_ctx->tx.iv, sizeof(rec->iv_data)); | ||
| 443 | |||
| 442 | sge->offset += tls_ctx->tx.prepend_size; | 444 | sge->offset += tls_ctx->tx.prepend_size; |
| 443 | sge->length -= tls_ctx->tx.prepend_size; | 445 | sge->length -= tls_ctx->tx.prepend_size; |
| 444 | 446 | ||
| @@ -448,7 +450,7 @@ static int tls_do_encryption(struct sock *sk, | |||
| 448 | aead_request_set_ad(aead_req, TLS_AAD_SPACE_SIZE); | 450 | aead_request_set_ad(aead_req, TLS_AAD_SPACE_SIZE); |
| 449 | aead_request_set_crypt(aead_req, rec->sg_aead_in, | 451 | aead_request_set_crypt(aead_req, rec->sg_aead_in, |
| 450 | rec->sg_aead_out, | 452 | rec->sg_aead_out, |
| 451 | data_len, tls_ctx->tx.iv); | 453 | data_len, rec->iv_data); |
| 452 | 454 | ||
| 453 | aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG, | 455 | aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_BACKLOG, |
| 454 | tls_encrypt_done, sk); | 456 | tls_encrypt_done, sk); |
| @@ -1792,7 +1794,9 @@ void tls_sw_free_resources_tx(struct sock *sk) | |||
| 1792 | if (atomic_read(&ctx->encrypt_pending)) | 1794 | if (atomic_read(&ctx->encrypt_pending)) |
| 1793 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | 1795 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); |
| 1794 | 1796 | ||
| 1797 | release_sock(sk); | ||
| 1795 | cancel_delayed_work_sync(&ctx->tx_work.work); | 1798 | cancel_delayed_work_sync(&ctx->tx_work.work); |
| 1799 | lock_sock(sk); | ||
| 1796 | 1800 | ||
| 1797 | /* Tx whatever records we can transmit and abandon the rest */ | 1801 | /* Tx whatever records we can transmit and abandon the rest */ |
| 1798 | tls_tx_records(sk, -1); | 1802 | tls_tx_records(sk, -1); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 934492bad8e0..ba0a4048c846 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -680,16 +680,6 @@ static void xfrm_hash_resize(struct work_struct *work) | |||
| 680 | mutex_unlock(&hash_resize_mutex); | 680 | mutex_unlock(&hash_resize_mutex); |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | static void xfrm_hash_reset_inexact_table(struct net *net) | ||
| 684 | { | ||
| 685 | struct xfrm_pol_inexact_bin *b; | ||
| 686 | |||
| 687 | lockdep_assert_held(&net->xfrm.xfrm_policy_lock); | ||
| 688 | |||
| 689 | list_for_each_entry(b, &net->xfrm.inexact_bins, inexact_bins) | ||
| 690 | INIT_HLIST_HEAD(&b->hhead); | ||
| 691 | } | ||
| 692 | |||
| 693 | /* Make sure *pol can be inserted into fastbin. | 683 | /* Make sure *pol can be inserted into fastbin. |
| 694 | * Useful to check that later insert requests will be sucessful | 684 | * Useful to check that later insert requests will be sucessful |
| 695 | * (provided xfrm_policy_lock is held throughout). | 685 | * (provided xfrm_policy_lock is held throughout). |
| @@ -833,13 +823,13 @@ static void xfrm_policy_inexact_list_reinsert(struct net *net, | |||
| 833 | u16 family) | 823 | u16 family) |
| 834 | { | 824 | { |
| 835 | unsigned int matched_s, matched_d; | 825 | unsigned int matched_s, matched_d; |
| 836 | struct hlist_node *newpos = NULL; | ||
| 837 | struct xfrm_policy *policy, *p; | 826 | struct xfrm_policy *policy, *p; |
| 838 | 827 | ||
| 839 | matched_s = 0; | 828 | matched_s = 0; |
| 840 | matched_d = 0; | 829 | matched_d = 0; |
| 841 | 830 | ||
| 842 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { | 831 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { |
| 832 | struct hlist_node *newpos = NULL; | ||
| 843 | bool matches_s, matches_d; | 833 | bool matches_s, matches_d; |
| 844 | 834 | ||
| 845 | if (!policy->bydst_reinsert) | 835 | if (!policy->bydst_reinsert) |
| @@ -849,16 +839,19 @@ static void xfrm_policy_inexact_list_reinsert(struct net *net, | |||
| 849 | 839 | ||
| 850 | policy->bydst_reinsert = false; | 840 | policy->bydst_reinsert = false; |
| 851 | hlist_for_each_entry(p, &n->hhead, bydst) { | 841 | hlist_for_each_entry(p, &n->hhead, bydst) { |
| 852 | if (policy->priority >= p->priority) | 842 | if (policy->priority > p->priority) |
| 843 | newpos = &p->bydst; | ||
| 844 | else if (policy->priority == p->priority && | ||
| 845 | policy->pos > p->pos) | ||
| 853 | newpos = &p->bydst; | 846 | newpos = &p->bydst; |
| 854 | else | 847 | else |
| 855 | break; | 848 | break; |
| 856 | } | 849 | } |
| 857 | 850 | ||
| 858 | if (newpos) | 851 | if (newpos) |
| 859 | hlist_add_behind(&policy->bydst, newpos); | 852 | hlist_add_behind_rcu(&policy->bydst, newpos); |
| 860 | else | 853 | else |
| 861 | hlist_add_head(&policy->bydst, &n->hhead); | 854 | hlist_add_head_rcu(&policy->bydst, &n->hhead); |
| 862 | 855 | ||
| 863 | /* paranoia checks follow. | 856 | /* paranoia checks follow. |
| 864 | * Check that the reinserted policy matches at least | 857 | * Check that the reinserted policy matches at least |
| @@ -893,12 +886,13 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net, | |||
| 893 | struct rb_root *new, | 886 | struct rb_root *new, |
| 894 | u16 family) | 887 | u16 family) |
| 895 | { | 888 | { |
| 896 | struct rb_node **p, *parent = NULL; | ||
| 897 | struct xfrm_pol_inexact_node *node; | 889 | struct xfrm_pol_inexact_node *node; |
| 890 | struct rb_node **p, *parent; | ||
| 898 | 891 | ||
| 899 | /* we should not have another subtree here */ | 892 | /* we should not have another subtree here */ |
| 900 | WARN_ON_ONCE(!RB_EMPTY_ROOT(&n->root)); | 893 | WARN_ON_ONCE(!RB_EMPTY_ROOT(&n->root)); |
| 901 | 894 | restart: | |
| 895 | parent = NULL; | ||
| 902 | p = &new->rb_node; | 896 | p = &new->rb_node; |
| 903 | while (*p) { | 897 | while (*p) { |
| 904 | u8 prefixlen; | 898 | u8 prefixlen; |
| @@ -918,12 +912,11 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net, | |||
| 918 | } else { | 912 | } else { |
| 919 | struct xfrm_policy *tmp; | 913 | struct xfrm_policy *tmp; |
| 920 | 914 | ||
| 921 | hlist_for_each_entry(tmp, &node->hhead, bydst) | 915 | hlist_for_each_entry(tmp, &n->hhead, bydst) { |
| 922 | tmp->bydst_reinsert = true; | ||
| 923 | hlist_for_each_entry(tmp, &n->hhead, bydst) | ||
| 924 | tmp->bydst_reinsert = true; | 916 | tmp->bydst_reinsert = true; |
| 917 | hlist_del_rcu(&tmp->bydst); | ||
| 918 | } | ||
| 925 | 919 | ||
| 926 | INIT_HLIST_HEAD(&node->hhead); | ||
| 927 | xfrm_policy_inexact_list_reinsert(net, node, family); | 920 | xfrm_policy_inexact_list_reinsert(net, node, family); |
| 928 | 921 | ||
| 929 | if (node->prefixlen == n->prefixlen) { | 922 | if (node->prefixlen == n->prefixlen) { |
| @@ -935,8 +928,7 @@ static void xfrm_policy_inexact_node_reinsert(struct net *net, | |||
| 935 | kfree_rcu(n, rcu); | 928 | kfree_rcu(n, rcu); |
| 936 | n = node; | 929 | n = node; |
| 937 | n->prefixlen = prefixlen; | 930 | n->prefixlen = prefixlen; |
| 938 | *p = new->rb_node; | 931 | goto restart; |
| 939 | parent = NULL; | ||
| 940 | } | 932 | } |
| 941 | } | 933 | } |
| 942 | 934 | ||
| @@ -965,12 +957,11 @@ static void xfrm_policy_inexact_node_merge(struct net *net, | |||
| 965 | family); | 957 | family); |
| 966 | } | 958 | } |
| 967 | 959 | ||
| 968 | hlist_for_each_entry(tmp, &v->hhead, bydst) | 960 | hlist_for_each_entry(tmp, &v->hhead, bydst) { |
| 969 | tmp->bydst_reinsert = true; | ||
| 970 | hlist_for_each_entry(tmp, &n->hhead, bydst) | ||
| 971 | tmp->bydst_reinsert = true; | 961 | tmp->bydst_reinsert = true; |
| 962 | hlist_del_rcu(&tmp->bydst); | ||
| 963 | } | ||
| 972 | 964 | ||
| 973 | INIT_HLIST_HEAD(&n->hhead); | ||
| 974 | xfrm_policy_inexact_list_reinsert(net, n, family); | 965 | xfrm_policy_inexact_list_reinsert(net, n, family); |
| 975 | } | 966 | } |
| 976 | 967 | ||
| @@ -1235,6 +1226,7 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
| 1235 | } while (read_seqretry(&net->xfrm.policy_hthresh.lock, seq)); | 1226 | } while (read_seqretry(&net->xfrm.policy_hthresh.lock, seq)); |
| 1236 | 1227 | ||
| 1237 | spin_lock_bh(&net->xfrm.xfrm_policy_lock); | 1228 | spin_lock_bh(&net->xfrm.xfrm_policy_lock); |
| 1229 | write_seqcount_begin(&xfrm_policy_hash_generation); | ||
| 1238 | 1230 | ||
| 1239 | /* make sure that we can insert the indirect policies again before | 1231 | /* make sure that we can insert the indirect policies again before |
| 1240 | * we start with destructive action. | 1232 | * we start with destructive action. |
| @@ -1278,10 +1270,14 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
| 1278 | } | 1270 | } |
| 1279 | 1271 | ||
| 1280 | /* reset the bydst and inexact table in all directions */ | 1272 | /* reset the bydst and inexact table in all directions */ |
| 1281 | xfrm_hash_reset_inexact_table(net); | ||
| 1282 | |||
| 1283 | for (dir = 0; dir < XFRM_POLICY_MAX; dir++) { | 1273 | for (dir = 0; dir < XFRM_POLICY_MAX; dir++) { |
| 1284 | INIT_HLIST_HEAD(&net->xfrm.policy_inexact[dir]); | 1274 | struct hlist_node *n; |
| 1275 | |||
| 1276 | hlist_for_each_entry_safe(policy, n, | ||
| 1277 | &net->xfrm.policy_inexact[dir], | ||
| 1278 | bydst_inexact_list) | ||
| 1279 | hlist_del_init(&policy->bydst_inexact_list); | ||
| 1280 | |||
| 1285 | hmask = net->xfrm.policy_bydst[dir].hmask; | 1281 | hmask = net->xfrm.policy_bydst[dir].hmask; |
| 1286 | odst = net->xfrm.policy_bydst[dir].table; | 1282 | odst = net->xfrm.policy_bydst[dir].table; |
| 1287 | for (i = hmask; i >= 0; i--) | 1283 | for (i = hmask; i >= 0; i--) |
| @@ -1313,6 +1309,9 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
| 1313 | newpos = NULL; | 1309 | newpos = NULL; |
| 1314 | chain = policy_hash_bysel(net, &policy->selector, | 1310 | chain = policy_hash_bysel(net, &policy->selector, |
| 1315 | policy->family, dir); | 1311 | policy->family, dir); |
| 1312 | |||
| 1313 | hlist_del_rcu(&policy->bydst); | ||
| 1314 | |||
| 1316 | if (!chain) { | 1315 | if (!chain) { |
| 1317 | void *p = xfrm_policy_inexact_insert(policy, dir, 0); | 1316 | void *p = xfrm_policy_inexact_insert(policy, dir, 0); |
| 1318 | 1317 | ||
| @@ -1334,6 +1333,7 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
| 1334 | 1333 | ||
| 1335 | out_unlock: | 1334 | out_unlock: |
| 1336 | __xfrm_policy_inexact_flush(net); | 1335 | __xfrm_policy_inexact_flush(net); |
| 1336 | write_seqcount_end(&xfrm_policy_hash_generation); | ||
| 1337 | spin_unlock_bh(&net->xfrm.xfrm_policy_lock); | 1337 | spin_unlock_bh(&net->xfrm.xfrm_policy_lock); |
| 1338 | 1338 | ||
| 1339 | mutex_unlock(&hash_resize_mutex); | 1339 | mutex_unlock(&hash_resize_mutex); |
| @@ -2600,7 +2600,10 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
| 2600 | dst_copy_metrics(dst1, dst); | 2600 | dst_copy_metrics(dst1, dst); |
| 2601 | 2601 | ||
| 2602 | if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { | 2602 | if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { |
| 2603 | __u32 mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); | 2603 | __u32 mark = 0; |
| 2604 | |||
| 2605 | if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) | ||
| 2606 | mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); | ||
| 2604 | 2607 | ||
| 2605 | family = xfrm[i]->props.family; | 2608 | family = xfrm[i]->props.family; |
| 2606 | dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif, | 2609 | dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif, |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 277c1c46fe94..c6d26afcf89d 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
| @@ -1488,10 +1488,15 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family) | |||
| 1488 | if (!ut[i].family) | 1488 | if (!ut[i].family) |
| 1489 | ut[i].family = family; | 1489 | ut[i].family = family; |
| 1490 | 1490 | ||
| 1491 | if ((ut[i].mode == XFRM_MODE_TRANSPORT) && | 1491 | switch (ut[i].mode) { |
| 1492 | (ut[i].family != prev_family)) | 1492 | case XFRM_MODE_TUNNEL: |
| 1493 | return -EINVAL; | 1493 | case XFRM_MODE_BEET: |
| 1494 | 1494 | break; | |
| 1495 | default: | ||
| 1496 | if (ut[i].family != prev_family) | ||
| 1497 | return -EINVAL; | ||
| 1498 | break; | ||
| 1499 | } | ||
| 1495 | if (ut[i].mode >= XFRM_MODE_MAX) | 1500 | if (ut[i].mode >= XFRM_MODE_MAX) |
| 1496 | return -EINVAL; | 1501 | return -EINVAL; |
| 1497 | 1502 | ||
diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c index 08c88de0ffda..11975ec8d566 100644 --- a/security/apparmor/domain.c +++ b/security/apparmor/domain.c | |||
| @@ -1444,7 +1444,10 @@ check: | |||
| 1444 | new = aa_label_merge(label, target, GFP_KERNEL); | 1444 | new = aa_label_merge(label, target, GFP_KERNEL); |
| 1445 | if (IS_ERR_OR_NULL(new)) { | 1445 | if (IS_ERR_OR_NULL(new)) { |
| 1446 | info = "failed to build target label"; | 1446 | info = "failed to build target label"; |
| 1447 | error = PTR_ERR(new); | 1447 | if (!new) |
| 1448 | error = -ENOMEM; | ||
| 1449 | else | ||
| 1450 | error = PTR_ERR(new); | ||
| 1448 | new = NULL; | 1451 | new = NULL; |
| 1449 | perms.allow = 0; | 1452 | perms.allow = 0; |
| 1450 | goto audit; | 1453 | goto audit; |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 2c010874329f..8db1731d046a 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
| @@ -1599,12 +1599,14 @@ static unsigned int apparmor_ipv4_postroute(void *priv, | |||
| 1599 | return apparmor_ip_postroute(priv, skb, state); | 1599 | return apparmor_ip_postroute(priv, skb, state); |
| 1600 | } | 1600 | } |
| 1601 | 1601 | ||
| 1602 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 1602 | static unsigned int apparmor_ipv6_postroute(void *priv, | 1603 | static unsigned int apparmor_ipv6_postroute(void *priv, |
| 1603 | struct sk_buff *skb, | 1604 | struct sk_buff *skb, |
| 1604 | const struct nf_hook_state *state) | 1605 | const struct nf_hook_state *state) |
| 1605 | { | 1606 | { |
| 1606 | return apparmor_ip_postroute(priv, skb, state); | 1607 | return apparmor_ip_postroute(priv, skb, state); |
| 1607 | } | 1608 | } |
| 1609 | #endif | ||
| 1608 | 1610 | ||
| 1609 | static const struct nf_hook_ops apparmor_nf_ops[] = { | 1611 | static const struct nf_hook_ops apparmor_nf_ops[] = { |
| 1610 | { | 1612 | { |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 40013b26f671..6c99fa8ac5fa 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
| @@ -2112,6 +2112,13 @@ int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream, | |||
| 2112 | return 0; | 2112 | return 0; |
| 2113 | } | 2113 | } |
| 2114 | 2114 | ||
| 2115 | /* allow waiting for a capture stream that hasn't been started */ | ||
| 2116 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) | ||
| 2117 | #define wait_capture_start(substream) ((substream)->oss.oss) | ||
| 2118 | #else | ||
| 2119 | #define wait_capture_start(substream) false | ||
| 2120 | #endif | ||
| 2121 | |||
| 2115 | /* the common loop for read/write data */ | 2122 | /* the common loop for read/write data */ |
| 2116 | snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | 2123 | snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
| 2117 | void *data, bool interleaved, | 2124 | void *data, bool interleaved, |
| @@ -2182,7 +2189,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, | |||
| 2182 | err = snd_pcm_start(substream); | 2189 | err = snd_pcm_start(substream); |
| 2183 | if (err < 0) | 2190 | if (err < 0) |
| 2184 | goto _end_unlock; | 2191 | goto _end_unlock; |
| 2185 | } else { | 2192 | } else if (!wait_capture_start(substream)) { |
| 2186 | /* nothing to do */ | 2193 | /* nothing to do */ |
| 2187 | err = 0; | 2194 | err = 0; |
| 2188 | goto _end_unlock; | 2195 | goto _end_unlock; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b4f472157ebd..4139aced63f8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -117,6 +117,7 @@ struct alc_spec { | |||
| 117 | int codec_variant; /* flag for other variants */ | 117 | int codec_variant; /* flag for other variants */ |
| 118 | unsigned int has_alc5505_dsp:1; | 118 | unsigned int has_alc5505_dsp:1; |
| 119 | unsigned int no_depop_delay:1; | 119 | unsigned int no_depop_delay:1; |
| 120 | unsigned int done_hp_init:1; | ||
| 120 | 121 | ||
| 121 | /* for PLL fix */ | 122 | /* for PLL fix */ |
| 122 | hda_nid_t pll_nid; | 123 | hda_nid_t pll_nid; |
| @@ -3372,6 +3373,48 @@ static void alc_default_shutup(struct hda_codec *codec) | |||
| 3372 | snd_hda_shutup_pins(codec); | 3373 | snd_hda_shutup_pins(codec); |
| 3373 | } | 3374 | } |
| 3374 | 3375 | ||
| 3376 | static void alc294_hp_init(struct hda_codec *codec) | ||
| 3377 | { | ||
| 3378 | struct alc_spec *spec = codec->spec; | ||
| 3379 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | ||
| 3380 | int i, val; | ||
| 3381 | |||
| 3382 | if (!hp_pin) | ||
| 3383 | return; | ||
| 3384 | |||
| 3385 | snd_hda_codec_write(codec, hp_pin, 0, | ||
| 3386 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | ||
| 3387 | |||
| 3388 | msleep(100); | ||
| 3389 | |||
| 3390 | snd_hda_codec_write(codec, hp_pin, 0, | ||
| 3391 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
| 3392 | |||
| 3393 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ | ||
| 3394 | alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ | ||
| 3395 | |||
| 3396 | /* Wait for depop procedure finish */ | ||
| 3397 | val = alc_read_coefex_idx(codec, 0x58, 0x01); | ||
| 3398 | for (i = 0; i < 20 && val & 0x0080; i++) { | ||
| 3399 | msleep(50); | ||
| 3400 | val = alc_read_coefex_idx(codec, 0x58, 0x01); | ||
| 3401 | } | ||
| 3402 | /* Set HP depop to auto mode */ | ||
| 3403 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); | ||
| 3404 | msleep(50); | ||
| 3405 | } | ||
| 3406 | |||
| 3407 | static void alc294_init(struct hda_codec *codec) | ||
| 3408 | { | ||
| 3409 | struct alc_spec *spec = codec->spec; | ||
| 3410 | |||
| 3411 | if (!spec->done_hp_init) { | ||
| 3412 | alc294_hp_init(codec); | ||
| 3413 | spec->done_hp_init = true; | ||
| 3414 | } | ||
| 3415 | alc_default_init(codec); | ||
| 3416 | } | ||
| 3417 | |||
| 3375 | static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, | 3418 | static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, |
| 3376 | unsigned int val) | 3419 | unsigned int val) |
| 3377 | { | 3420 | { |
| @@ -7373,37 +7416,6 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
| 7373 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); | 7416 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); |
| 7374 | } | 7417 | } |
| 7375 | 7418 | ||
| 7376 | static void alc294_hp_init(struct hda_codec *codec) | ||
| 7377 | { | ||
| 7378 | struct alc_spec *spec = codec->spec; | ||
| 7379 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | ||
| 7380 | int i, val; | ||
| 7381 | |||
| 7382 | if (!hp_pin) | ||
| 7383 | return; | ||
| 7384 | |||
| 7385 | snd_hda_codec_write(codec, hp_pin, 0, | ||
| 7386 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | ||
| 7387 | |||
| 7388 | msleep(100); | ||
| 7389 | |||
| 7390 | snd_hda_codec_write(codec, hp_pin, 0, | ||
| 7391 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | ||
| 7392 | |||
| 7393 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ | ||
| 7394 | alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ | ||
| 7395 | |||
| 7396 | /* Wait for depop procedure finish */ | ||
| 7397 | val = alc_read_coefex_idx(codec, 0x58, 0x01); | ||
| 7398 | for (i = 0; i < 20 && val & 0x0080; i++) { | ||
| 7399 | msleep(50); | ||
| 7400 | val = alc_read_coefex_idx(codec, 0x58, 0x01); | ||
| 7401 | } | ||
| 7402 | /* Set HP depop to auto mode */ | ||
| 7403 | alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); | ||
| 7404 | msleep(50); | ||
| 7405 | } | ||
| 7406 | |||
| 7407 | /* | 7419 | /* |
| 7408 | */ | 7420 | */ |
| 7409 | static int patch_alc269(struct hda_codec *codec) | 7421 | static int patch_alc269(struct hda_codec *codec) |
| @@ -7529,7 +7541,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 7529 | spec->codec_variant = ALC269_TYPE_ALC294; | 7541 | spec->codec_variant = ALC269_TYPE_ALC294; |
| 7530 | spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ | 7542 | spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ |
| 7531 | alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ | 7543 | alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ |
| 7532 | alc294_hp_init(codec); | 7544 | spec->init_hook = alc294_init; |
| 7533 | break; | 7545 | break; |
| 7534 | case 0x10ec0300: | 7546 | case 0x10ec0300: |
| 7535 | spec->codec_variant = ALC269_TYPE_ALC300; | 7547 | spec->codec_variant = ALC269_TYPE_ALC300; |
| @@ -7541,7 +7553,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 7541 | spec->codec_variant = ALC269_TYPE_ALC700; | 7553 | spec->codec_variant = ALC269_TYPE_ALC700; |
| 7542 | spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ | 7554 | spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ |
| 7543 | alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ | 7555 | alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ |
| 7544 | alc294_hp_init(codec); | 7556 | spec->init_hook = alc294_init; |
| 7545 | break; | 7557 | break; |
| 7546 | 7558 | ||
| 7547 | } | 7559 | } |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index ebbadb3a7094..bb8372833fc2 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
| @@ -1492,6 +1492,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
| 1492 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; | 1492 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
| 1493 | break; | 1493 | break; |
| 1494 | 1494 | ||
| 1495 | case USB_ID(0x10cb, 0x0103): /* The Bit Opus #3; with fp->dsd_raw */ | ||
| 1495 | case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */ | 1496 | case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */ |
| 1496 | case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ | 1497 | case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ |
| 1497 | case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ | 1498 | case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ |
diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh index bab13dd025a6..0d26b5e3f966 100755 --- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh | |||
| @@ -37,6 +37,10 @@ prerequisite() | |||
| 37 | exit $ksft_skip | 37 | exit $ksft_skip |
| 38 | fi | 38 | fi |
| 39 | 39 | ||
| 40 | present_cpus=`cat $SYSFS/devices/system/cpu/present` | ||
| 41 | present_max=${present_cpus##*-} | ||
| 42 | echo "present_cpus = $present_cpus present_max = $present_max" | ||
| 43 | |||
| 40 | echo -e "\t Cpus in online state: $online_cpus" | 44 | echo -e "\t Cpus in online state: $online_cpus" |
| 41 | 45 | ||
| 42 | offline_cpus=`cat $SYSFS/devices/system/cpu/offline` | 46 | offline_cpus=`cat $SYSFS/devices/system/cpu/offline` |
| @@ -151,6 +155,8 @@ online_cpus=0 | |||
| 151 | online_max=0 | 155 | online_max=0 |
| 152 | offline_cpus=0 | 156 | offline_cpus=0 |
| 153 | offline_max=0 | 157 | offline_max=0 |
| 158 | present_cpus=0 | ||
| 159 | present_max=0 | ||
| 154 | 160 | ||
| 155 | while getopts e:ahp: opt; do | 161 | while getopts e:ahp: opt; do |
| 156 | case $opt in | 162 | case $opt in |
| @@ -190,9 +196,10 @@ if [ $allcpus -eq 0 ]; then | |||
| 190 | online_cpu_expect_success $online_max | 196 | online_cpu_expect_success $online_max |
| 191 | 197 | ||
| 192 | if [[ $offline_cpus -gt 0 ]]; then | 198 | if [[ $offline_cpus -gt 0 ]]; then |
| 193 | echo -e "\t offline to online to offline: cpu $offline_max" | 199 | echo -e "\t offline to online to offline: cpu $present_max" |
| 194 | online_cpu_expect_success $offline_max | 200 | online_cpu_expect_success $present_max |
| 195 | offline_cpu_expect_success $offline_max | 201 | offline_cpu_expect_success $present_max |
| 202 | online_cpu $present_max | ||
| 196 | fi | 203 | fi |
| 197 | exit 0 | 204 | exit 0 |
| 198 | else | 205 | else |
diff --git a/tools/testing/selftests/ir/Makefile b/tools/testing/selftests/ir/Makefile index f4ba8eb84b95..ad06489c22a5 100644 --- a/tools/testing/selftests/ir/Makefile +++ b/tools/testing/selftests/ir/Makefile | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | TEST_PROGS := ir_loopback.sh | 2 | TEST_PROGS := ir_loopback.sh |
| 3 | TEST_GEN_PROGS_EXTENDED := ir_loopback | 3 | TEST_GEN_PROGS_EXTENDED := ir_loopback |
| 4 | APIDIR := ../../../include/uapi | ||
| 5 | CFLAGS += -Wall -O2 -I$(APIDIR) | ||
| 4 | 6 | ||
| 5 | include ../lib.mk | 7 | include ../lib.mk |
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index f8f3e90700c0..1e6d14d2825c 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile | |||
| @@ -21,6 +21,6 @@ TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls | |||
| 21 | KSFT_KHDR_INSTALL := 1 | 21 | KSFT_KHDR_INSTALL := 1 |
| 22 | include ../lib.mk | 22 | include ../lib.mk |
| 23 | 23 | ||
| 24 | $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma | 24 | $(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma |
| 25 | $(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread | 25 | $(OUTPUT)/tcp_mmap: LDFLAGS += -lpthread |
| 26 | $(OUTPUT)/tcp_inq: LDFLAGS += -lpthread | 26 | $(OUTPUT)/tcp_inq: LDFLAGS += -lpthread |
diff --git a/tools/testing/selftests/net/xfrm_policy.sh b/tools/testing/selftests/net/xfrm_policy.sh index 8db35b99457c..71d7fdc513c1 100755 --- a/tools/testing/selftests/net/xfrm_policy.sh +++ b/tools/testing/selftests/net/xfrm_policy.sh | |||
| @@ -28,6 +28,19 @@ KEY_AES=0x0123456789abcdef0123456789012345 | |||
| 28 | SPI1=0x1 | 28 | SPI1=0x1 |
| 29 | SPI2=0x2 | 29 | SPI2=0x2 |
| 30 | 30 | ||
| 31 | do_esp_policy() { | ||
| 32 | local ns=$1 | ||
| 33 | local me=$2 | ||
| 34 | local remote=$3 | ||
| 35 | local lnet=$4 | ||
| 36 | local rnet=$5 | ||
| 37 | |||
| 38 | # to encrypt packets as they go out (includes forwarded packets that need encapsulation) | ||
| 39 | ip -net $ns xfrm policy add src $lnet dst $rnet dir out tmpl src $me dst $remote proto esp mode tunnel priority 100 action allow | ||
| 40 | # to fwd decrypted packets after esp processing: | ||
| 41 | ip -net $ns xfrm policy add src $rnet dst $lnet dir fwd tmpl src $remote dst $me proto esp mode tunnel priority 100 action allow | ||
| 42 | } | ||
| 43 | |||
| 31 | do_esp() { | 44 | do_esp() { |
| 32 | local ns=$1 | 45 | local ns=$1 |
| 33 | local me=$2 | 46 | local me=$2 |
| @@ -40,10 +53,59 @@ do_esp() { | |||
| 40 | ip -net $ns xfrm state add src $remote dst $me proto esp spi $spi_in enc aes $KEY_AES auth sha1 $KEY_SHA mode tunnel sel src $rnet dst $lnet | 53 | ip -net $ns xfrm state add src $remote dst $me proto esp spi $spi_in enc aes $KEY_AES auth sha1 $KEY_SHA mode tunnel sel src $rnet dst $lnet |
| 41 | ip -net $ns xfrm state add src $me dst $remote proto esp spi $spi_out enc aes $KEY_AES auth sha1 $KEY_SHA mode tunnel sel src $lnet dst $rnet | 54 | ip -net $ns xfrm state add src $me dst $remote proto esp spi $spi_out enc aes $KEY_AES auth sha1 $KEY_SHA mode tunnel sel src $lnet dst $rnet |
| 42 | 55 | ||
| 43 | # to encrypt packets as they go out (includes forwarded packets that need encapsulation) | 56 | do_esp_policy $ns $me $remote $lnet $rnet |
| 44 | ip -net $ns xfrm policy add src $lnet dst $rnet dir out tmpl src $me dst $remote proto esp mode tunnel priority 100 action allow | 57 | } |
| 45 | # to fwd decrypted packets after esp processing: | 58 | |
| 46 | ip -net $ns xfrm policy add src $rnet dst $lnet dir fwd tmpl src $remote dst $me proto esp mode tunnel priority 100 action allow | 59 | # add policies with different netmasks, to make sure kernel carries |
| 60 | # the policies contained within new netmask over when search tree is | ||
| 61 | # re-built. | ||
| 62 | # peer netns that are supposed to be encapsulated via esp have addresses | ||
| 63 | # in the 10.0.1.0/24 and 10.0.2.0/24 subnets, respectively. | ||
| 64 | # | ||
| 65 | # Adding a policy for '10.0.1.0/23' will make it necessary to | ||
| 66 | # alter the prefix of 10.0.1.0 subnet. | ||
| 67 | # In case new prefix overlaps with existing node, the node and all | ||
| 68 | # policies it carries need to be merged with the existing one(s). | ||
| 69 | # | ||
| 70 | # Do that here. | ||
| 71 | do_overlap() | ||
| 72 | { | ||
| 73 | local ns=$1 | ||
| 74 | |||
| 75 | # adds new nodes to tree (neither network exists yet in policy database). | ||
| 76 | ip -net $ns xfrm policy add src 10.1.0.0/24 dst 10.0.0.0/24 dir fwd priority 200 action block | ||
| 77 | |||
| 78 | # adds a new node in the 10.0.0.0/24 tree (dst node exists). | ||
| 79 | ip -net $ns xfrm policy add src 10.2.0.0/24 dst 10.0.0.0/24 dir fwd priority 200 action block | ||
| 80 | |||
| 81 | # adds a 10.2.0.0/23 node, but for different dst. | ||
| 82 | ip -net $ns xfrm policy add src 10.2.0.0/23 dst 10.0.1.0/24 dir fwd priority 200 action block | ||
| 83 | |||
| 84 | # dst now overlaps with the 10.0.1.0/24 ESP policy in fwd. | ||
| 85 | # kernel must 'promote' existing one (10.0.0.0/24) to 10.0.0.0/23. | ||
| 86 | # But 10.0.0.0/23 also includes existing 10.0.1.0/24, so that node | ||
| 87 | # also has to be merged too, including source-sorted subtrees. | ||
| 88 | # old: | ||
| 89 | # 10.0.0.0/24 (node 1 in dst tree of the bin) | ||
| 90 | # 10.1.0.0/24 (node in src tree of dst node 1) | ||
| 91 | # 10.2.0.0/24 (node in src tree of dst node 1) | ||
| 92 | # 10.0.1.0/24 (node 2 in dst tree of the bin) | ||
| 93 | # 10.0.2.0/24 (node in src tree of dst node 2) | ||
| 94 | # 10.2.0.0/24 (node in src tree of dst node 2) | ||
| 95 | # | ||
| 96 | # The next 'policy add' adds dst '10.0.0.0/23', which means | ||
| 97 | # that dst node 1 and dst node 2 have to be merged including | ||
| 98 | # the sub-tree. As no duplicates are allowed, policies in | ||
| 99 | # the two '10.0.2.0/24' are also merged. | ||
| 100 | # | ||
| 101 | # after the 'add', internal search tree should look like this: | ||
| 102 | # 10.0.0.0/23 (node in dst tree of bin) | ||
| 103 | # 10.0.2.0/24 (node in src tree of dst node) | ||
| 104 | # 10.1.0.0/24 (node in src tree of dst node) | ||
| 105 | # 10.2.0.0/24 (node in src tree of dst node) | ||
| 106 | # | ||
| 107 | # 10.0.0.0/24 and 10.0.1.0/24 nodes have been merged as 10.0.0.0/23. | ||
| 108 | ip -net $ns xfrm policy add src 10.1.0.0/24 dst 10.0.0.0/23 dir fwd priority 200 action block | ||
| 47 | } | 109 | } |
| 48 | 110 | ||
| 49 | do_esp_policy_get_check() { | 111 | do_esp_policy_get_check() { |
| @@ -160,6 +222,41 @@ check_xfrm() { | |||
| 160 | return $lret | 222 | return $lret |
| 161 | } | 223 | } |
| 162 | 224 | ||
| 225 | check_exceptions() | ||
| 226 | { | ||
| 227 | logpostfix="$1" | ||
| 228 | local lret=0 | ||
| 229 | |||
| 230 | # ping to .254 should be excluded from the tunnel (exception is in place). | ||
| 231 | check_xfrm 0 254 | ||
| 232 | if [ $? -ne 0 ]; then | ||
| 233 | echo "FAIL: expected ping to .254 to fail ($logpostfix)" | ||
| 234 | lret=1 | ||
| 235 | else | ||
| 236 | echo "PASS: ping to .254 bypassed ipsec tunnel ($logpostfix)" | ||
| 237 | fi | ||
| 238 | |||
| 239 | # ping to .253 should use use ipsec due to direct policy exception. | ||
| 240 | check_xfrm 1 253 | ||
| 241 | if [ $? -ne 0 ]; then | ||
| 242 | echo "FAIL: expected ping to .253 to use ipsec tunnel ($logpostfix)" | ||
| 243 | lret=1 | ||
| 244 | else | ||
| 245 | echo "PASS: direct policy matches ($logpostfix)" | ||
| 246 | fi | ||
| 247 | |||
| 248 | # ping to .2 should use ipsec. | ||
| 249 | check_xfrm 1 2 | ||
| 250 | if [ $? -ne 0 ]; then | ||
| 251 | echo "FAIL: expected ping to .2 to use ipsec tunnel ($logpostfix)" | ||
| 252 | lret=1 | ||
| 253 | else | ||
| 254 | echo "PASS: policy matches ($logpostfix)" | ||
| 255 | fi | ||
| 256 | |||
| 257 | return $lret | ||
| 258 | } | ||
| 259 | |||
| 163 | #check for needed privileges | 260 | #check for needed privileges |
| 164 | if [ "$(id -u)" -ne 0 ];then | 261 | if [ "$(id -u)" -ne 0 ];then |
| 165 | echo "SKIP: Need root privileges" | 262 | echo "SKIP: Need root privileges" |
| @@ -270,33 +367,45 @@ do_exception ns4 10.0.3.10 10.0.3.1 10.0.1.253 10.0.1.240/28 | |||
| 270 | do_exception ns3 dead:3::1 dead:3::10 dead:2::fd dead:2:f0::/96 | 367 | do_exception ns3 dead:3::1 dead:3::10 dead:2::fd dead:2:f0::/96 |
| 271 | do_exception ns4 dead:3::10 dead:3::1 dead:1::fd dead:1:f0::/96 | 368 | do_exception ns4 dead:3::10 dead:3::1 dead:1::fd dead:1:f0::/96 |
| 272 | 369 | ||
| 273 | # ping to .254 should now be excluded from the tunnel | 370 | check_exceptions "exceptions" |
| 274 | check_xfrm 0 254 | ||
| 275 | if [ $? -ne 0 ]; then | 371 | if [ $? -ne 0 ]; then |
| 276 | echo "FAIL: expected ping to .254 to fail" | ||
| 277 | ret=1 | 372 | ret=1 |
| 278 | else | ||
| 279 | echo "PASS: ping to .254 bypassed ipsec tunnel" | ||
| 280 | fi | 373 | fi |
| 281 | 374 | ||
| 282 | # ping to .253 should use use ipsec due to direct policy exception. | 375 | # insert block policies with adjacent/overlapping netmasks |
| 283 | check_xfrm 1 253 | 376 | do_overlap ns3 |
| 284 | if [ $? -ne 0 ]; then | ||
| 285 | echo "FAIL: expected ping to .253 to use ipsec tunnel" | ||
| 286 | ret=1 | ||
| 287 | else | ||
| 288 | echo "PASS: direct policy matches" | ||
| 289 | fi | ||
| 290 | 377 | ||
| 291 | # ping to .2 should use ipsec. | 378 | check_exceptions "exceptions and block policies" |
| 292 | check_xfrm 1 2 | ||
| 293 | if [ $? -ne 0 ]; then | 379 | if [ $? -ne 0 ]; then |
| 294 | echo "FAIL: expected ping to .2 to use ipsec tunnel" | ||
| 295 | ret=1 | 380 | ret=1 |
| 296 | else | ||
| 297 | echo "PASS: policy matches" | ||
| 298 | fi | 381 | fi |
| 299 | 382 | ||
| 383 | for n in ns3 ns4;do | ||
| 384 | ip -net $n xfrm policy set hthresh4 28 24 hthresh6 126 125 | ||
| 385 | sleep $((RANDOM%5)) | ||
| 386 | done | ||
| 387 | |||
| 388 | check_exceptions "exceptions and block policies after hresh changes" | ||
| 389 | |||
| 390 | # full flush of policy db, check everything gets freed incl. internal meta data | ||
| 391 | ip -net ns3 xfrm policy flush | ||
| 392 | |||
| 393 | do_esp_policy ns3 10.0.3.1 10.0.3.10 10.0.1.0/24 10.0.2.0/24 | ||
| 394 | do_exception ns3 10.0.3.1 10.0.3.10 10.0.2.253 10.0.2.240/28 | ||
| 395 | |||
| 396 | # move inexact policies to hash table | ||
| 397 | ip -net ns3 xfrm policy set hthresh4 16 16 | ||
| 398 | |||
| 399 | sleep $((RANDOM%5)) | ||
| 400 | check_exceptions "exceptions and block policies after hthresh change in ns3" | ||
| 401 | |||
| 402 | # restore original hthresh settings -- move policies back to tables | ||
| 403 | for n in ns3 ns4;do | ||
| 404 | ip -net $n xfrm policy set hthresh4 32 32 hthresh6 128 128 | ||
| 405 | sleep $((RANDOM%5)) | ||
| 406 | done | ||
| 407 | check_exceptions "exceptions and block policies after hresh change to normal" | ||
| 408 | |||
| 300 | for i in 1 2 3 4;do ip netns del ns$i;done | 409 | for i in 1 2 3 4;do ip netns del ns$i;done |
| 301 | 410 | ||
| 302 | exit $ret | 411 | exit $ret |
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 496a9a8c773a..7e632b465ab4 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c | |||
| @@ -1608,7 +1608,16 @@ TEST_F(TRACE_poke, getpid_runs_normally) | |||
| 1608 | #ifdef SYSCALL_NUM_RET_SHARE_REG | 1608 | #ifdef SYSCALL_NUM_RET_SHARE_REG |
| 1609 | # define EXPECT_SYSCALL_RETURN(val, action) EXPECT_EQ(-1, action) | 1609 | # define EXPECT_SYSCALL_RETURN(val, action) EXPECT_EQ(-1, action) |
| 1610 | #else | 1610 | #else |
| 1611 | # define EXPECT_SYSCALL_RETURN(val, action) EXPECT_EQ(val, action) | 1611 | # define EXPECT_SYSCALL_RETURN(val, action) \ |
| 1612 | do { \ | ||
| 1613 | errno = 0; \ | ||
| 1614 | if (val < 0) { \ | ||
| 1615 | EXPECT_EQ(-1, action); \ | ||
| 1616 | EXPECT_EQ(-(val), errno); \ | ||
| 1617 | } else { \ | ||
| 1618 | EXPECT_EQ(val, action); \ | ||
| 1619 | } \ | ||
| 1620 | } while (0) | ||
| 1612 | #endif | 1621 | #endif |
| 1613 | 1622 | ||
| 1614 | /* Use PTRACE_GETREGS and PTRACE_SETREGS when available. This is useful for | 1623 | /* Use PTRACE_GETREGS and PTRACE_SETREGS when available. This is useful for |
| @@ -1647,7 +1656,7 @@ int get_syscall(struct __test_metadata *_metadata, pid_t tracee) | |||
| 1647 | 1656 | ||
| 1648 | /* Architecture-specific syscall changing routine. */ | 1657 | /* Architecture-specific syscall changing routine. */ |
| 1649 | void change_syscall(struct __test_metadata *_metadata, | 1658 | void change_syscall(struct __test_metadata *_metadata, |
| 1650 | pid_t tracee, int syscall) | 1659 | pid_t tracee, int syscall, int result) |
| 1651 | { | 1660 | { |
| 1652 | int ret; | 1661 | int ret; |
| 1653 | ARCH_REGS regs; | 1662 | ARCH_REGS regs; |
| @@ -1706,7 +1715,7 @@ void change_syscall(struct __test_metadata *_metadata, | |||
| 1706 | #ifdef SYSCALL_NUM_RET_SHARE_REG | 1715 | #ifdef SYSCALL_NUM_RET_SHARE_REG |
| 1707 | TH_LOG("Can't modify syscall return on this architecture"); | 1716 | TH_LOG("Can't modify syscall return on this architecture"); |
| 1708 | #else | 1717 | #else |
| 1709 | regs.SYSCALL_RET = EPERM; | 1718 | regs.SYSCALL_RET = result; |
| 1710 | #endif | 1719 | #endif |
| 1711 | 1720 | ||
| 1712 | #ifdef HAVE_GETREGS | 1721 | #ifdef HAVE_GETREGS |
| @@ -1734,14 +1743,19 @@ void tracer_syscall(struct __test_metadata *_metadata, pid_t tracee, | |||
| 1734 | case 0x1002: | 1743 | case 0x1002: |
| 1735 | /* change getpid to getppid. */ | 1744 | /* change getpid to getppid. */ |
| 1736 | EXPECT_EQ(__NR_getpid, get_syscall(_metadata, tracee)); | 1745 | EXPECT_EQ(__NR_getpid, get_syscall(_metadata, tracee)); |
| 1737 | change_syscall(_metadata, tracee, __NR_getppid); | 1746 | change_syscall(_metadata, tracee, __NR_getppid, 0); |
| 1738 | break; | 1747 | break; |
| 1739 | case 0x1003: | 1748 | case 0x1003: |
| 1740 | /* skip gettid. */ | 1749 | /* skip gettid with valid return code. */ |
| 1741 | EXPECT_EQ(__NR_gettid, get_syscall(_metadata, tracee)); | 1750 | EXPECT_EQ(__NR_gettid, get_syscall(_metadata, tracee)); |
| 1742 | change_syscall(_metadata, tracee, -1); | 1751 | change_syscall(_metadata, tracee, -1, 45000); |
| 1743 | break; | 1752 | break; |
| 1744 | case 0x1004: | 1753 | case 0x1004: |
| 1754 | /* skip openat with error. */ | ||
| 1755 | EXPECT_EQ(__NR_openat, get_syscall(_metadata, tracee)); | ||
| 1756 | change_syscall(_metadata, tracee, -1, -ESRCH); | ||
| 1757 | break; | ||
| 1758 | case 0x1005: | ||
| 1745 | /* do nothing (allow getppid) */ | 1759 | /* do nothing (allow getppid) */ |
| 1746 | EXPECT_EQ(__NR_getppid, get_syscall(_metadata, tracee)); | 1760 | EXPECT_EQ(__NR_getppid, get_syscall(_metadata, tracee)); |
| 1747 | break; | 1761 | break; |
| @@ -1774,9 +1788,11 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee, | |||
| 1774 | nr = get_syscall(_metadata, tracee); | 1788 | nr = get_syscall(_metadata, tracee); |
| 1775 | 1789 | ||
| 1776 | if (nr == __NR_getpid) | 1790 | if (nr == __NR_getpid) |
| 1777 | change_syscall(_metadata, tracee, __NR_getppid); | 1791 | change_syscall(_metadata, tracee, __NR_getppid, 0); |
| 1792 | if (nr == __NR_gettid) | ||
| 1793 | change_syscall(_metadata, tracee, -1, 45000); | ||
| 1778 | if (nr == __NR_openat) | 1794 | if (nr == __NR_openat) |
| 1779 | change_syscall(_metadata, tracee, -1); | 1795 | change_syscall(_metadata, tracee, -1, -ESRCH); |
| 1780 | } | 1796 | } |
| 1781 | 1797 | ||
| 1782 | FIXTURE_DATA(TRACE_syscall) { | 1798 | FIXTURE_DATA(TRACE_syscall) { |
| @@ -1793,8 +1809,10 @@ FIXTURE_SETUP(TRACE_syscall) | |||
| 1793 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1002), | 1809 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1002), |
| 1794 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_gettid, 0, 1), | 1810 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_gettid, 0, 1), |
| 1795 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1003), | 1811 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1003), |
| 1796 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_getppid, 0, 1), | 1812 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_openat, 0, 1), |
| 1797 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1004), | 1813 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1004), |
| 1814 | BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_getppid, 0, 1), | ||
| 1815 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_TRACE | 0x1005), | ||
| 1798 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), | 1816 | BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), |
| 1799 | }; | 1817 | }; |
| 1800 | 1818 | ||
| @@ -1842,15 +1860,26 @@ TEST_F(TRACE_syscall, ptrace_syscall_redirected) | |||
| 1842 | EXPECT_NE(self->mypid, syscall(__NR_getpid)); | 1860 | EXPECT_NE(self->mypid, syscall(__NR_getpid)); |
| 1843 | } | 1861 | } |
| 1844 | 1862 | ||
| 1845 | TEST_F(TRACE_syscall, ptrace_syscall_dropped) | 1863 | TEST_F(TRACE_syscall, ptrace_syscall_errno) |
| 1864 | { | ||
| 1865 | /* Swap SECCOMP_RET_TRACE tracer for PTRACE_SYSCALL tracer. */ | ||
| 1866 | teardown_trace_fixture(_metadata, self->tracer); | ||
| 1867 | self->tracer = setup_trace_fixture(_metadata, tracer_ptrace, NULL, | ||
| 1868 | true); | ||
| 1869 | |||
| 1870 | /* Tracer should skip the open syscall, resulting in ESRCH. */ | ||
| 1871 | EXPECT_SYSCALL_RETURN(-ESRCH, syscall(__NR_openat)); | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | TEST_F(TRACE_syscall, ptrace_syscall_faked) | ||
| 1846 | { | 1875 | { |
| 1847 | /* Swap SECCOMP_RET_TRACE tracer for PTRACE_SYSCALL tracer. */ | 1876 | /* Swap SECCOMP_RET_TRACE tracer for PTRACE_SYSCALL tracer. */ |
| 1848 | teardown_trace_fixture(_metadata, self->tracer); | 1877 | teardown_trace_fixture(_metadata, self->tracer); |
| 1849 | self->tracer = setup_trace_fixture(_metadata, tracer_ptrace, NULL, | 1878 | self->tracer = setup_trace_fixture(_metadata, tracer_ptrace, NULL, |
| 1850 | true); | 1879 | true); |
| 1851 | 1880 | ||
| 1852 | /* Tracer should skip the open syscall, resulting in EPERM. */ | 1881 | /* Tracer should skip the gettid syscall, resulting fake pid. */ |
| 1853 | EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat)); | 1882 | EXPECT_SYSCALL_RETURN(45000, syscall(__NR_gettid)); |
| 1854 | } | 1883 | } |
| 1855 | 1884 | ||
| 1856 | TEST_F(TRACE_syscall, syscall_allowed) | 1885 | TEST_F(TRACE_syscall, syscall_allowed) |
| @@ -1883,7 +1912,21 @@ TEST_F(TRACE_syscall, syscall_redirected) | |||
| 1883 | EXPECT_NE(self->mypid, syscall(__NR_getpid)); | 1912 | EXPECT_NE(self->mypid, syscall(__NR_getpid)); |
| 1884 | } | 1913 | } |
| 1885 | 1914 | ||
| 1886 | TEST_F(TRACE_syscall, syscall_dropped) | 1915 | TEST_F(TRACE_syscall, syscall_errno) |
| 1916 | { | ||
| 1917 | long ret; | ||
| 1918 | |||
| 1919 | ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); | ||
| 1920 | ASSERT_EQ(0, ret); | ||
| 1921 | |||
| 1922 | ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &self->prog, 0, 0); | ||
| 1923 | ASSERT_EQ(0, ret); | ||
| 1924 | |||
| 1925 | /* openat has been skipped and an errno return. */ | ||
| 1926 | EXPECT_SYSCALL_RETURN(-ESRCH, syscall(__NR_openat)); | ||
| 1927 | } | ||
| 1928 | |||
| 1929 | TEST_F(TRACE_syscall, syscall_faked) | ||
| 1887 | { | 1930 | { |
| 1888 | long ret; | 1931 | long ret; |
| 1889 | 1932 | ||
| @@ -1894,8 +1937,7 @@ TEST_F(TRACE_syscall, syscall_dropped) | |||
| 1894 | ASSERT_EQ(0, ret); | 1937 | ASSERT_EQ(0, ret); |
| 1895 | 1938 | ||
| 1896 | /* gettid has been skipped and an altered return value stored. */ | 1939 | /* gettid has been skipped and an altered return value stored. */ |
| 1897 | EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_gettid)); | 1940 | EXPECT_SYSCALL_RETURN(45000, syscall(__NR_gettid)); |
| 1898 | EXPECT_NE(self->mytid, syscall(__NR_gettid)); | ||
| 1899 | } | 1941 | } |
| 1900 | 1942 | ||
| 1901 | TEST_F(TRACE_syscall, skip_after_RET_TRACE) | 1943 | TEST_F(TRACE_syscall, skip_after_RET_TRACE) |
diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile index c02683cfb6c9..7656c7ce79d9 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | CFLAGS += -O3 -Wl,-no-as-needed -Wall | 2 | CFLAGS += -O3 -Wl,-no-as-needed -Wall |
| 3 | LDFLAGS += -lrt -lpthread -lm | 3 | LDLIBS += -lrt -lpthread -lm |
| 4 | 4 | ||
| 5 | # these are all "safe" tests that don't modify | 5 | # these are all "safe" tests that don't modify |
| 6 | # system time or require escalated privileges | 6 | # system time or require escalated privileges |
