From: Christian Hoffmann Date: Sun, 12 Feb 2023 08:08:38 +0000 (+0100) Subject: Merge android.googlesource.com/kernel/common X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0b7a24d1132390ade66503cd78ebe7c43fa4dffc;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Merge android.googlesource.com/kernel/common * Branch: android-4.9-q * SHA1: e7f15a9ebb2885905683dce8e287ada8f8aca0f2 * Version: 4.9.269 --- 0b7a24d1132390ade66503cd78ebe7c43fa4dffc diff --cc Makefile index de110035e661,7d4e1b08f394..bbd1dc4fe4e3 --- a/Makefile +++ b/Makefile @@@ -1221,13 -1220,17 +1237,17 @@@ endi # needs to be updated, so this check is forced on all builds uts_len := 64 + ifneq (,$(BUILD_NUMBER)) + UTS_RELEASE=$(KERNELRELEASE)-ab$(BUILD_NUMBER) + else + UTS_RELEASE=$(KERNELRELEASE) + endif define filechk_utsrelease.h - if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ - echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ - exit 1; \ - fi; \ - (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; echo \#define UTS_RELEASE_FULL \"$(KERNELRELEASE_FULL)\";\ - echo \#define UTS_RELEASEY \"$(basename $(KERNELRELEASE)).y\";) + if [ `echo -n "$(UTS_RELEASE)" | wc -c ` -gt $(uts_len) ]; then \ + echo '"$(UTS_RELEASE)" exceeds $(uts_len) characters' >&2; \ + exit 1; \ + fi; \ - (echo \#define UTS_RELEASE \"$(UTS_RELEASE)\";) ++ (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; echo \#define UTS_RELEASE_FULL \"$(KERNELRELEASE_FULL)\";) endef define filechk_version.h diff --cc arch/arm/kernel/sleep.S index 28e7b0d0014b,c8569390e7e7..39836df6e2cf --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@@ -138,14 -142,10 +146,15 @@@ ARM_BE8(setend be) @ ensure we are i bl __hyp_stub_install_secondary #endif safe_svcmode_maskall r1 + no_hyp: mov r1, #0 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) + ALT_SMP(and r2, r0, #1<<24) + ALT_SMP(cmp r2, #0) + ALT_SMP(beq 2f) + ALT_SMP(lsr r0, r0, #8) ALT_UP_B(1f) +2: adr r2, mpidr_hash_ptr ldr r3, [r2] add r2, r2, r3 @ r2 = struct mpidr_hash phys address diff --cc arch/arm/mm/mmu.c index c7e41d4e11e7,7edc6c3f4bd9..eb38ce905760 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@@ -1175,12 -1166,24 +1175,28 @@@ void __init adjust_lowmem_bounds(void * and may itself be outside the valid range for which phys_addr_t * and therefore __pa() is defined. */ +#ifdef CONFIG_AMLOGIC_KASAN32 + vmalloc_limit = (u64)(KMEM_END - PAGE_OFFSET + PHYS_OFFSET); +#else vmalloc_limit = (u64)(uintptr_t)vmalloc_min - PAGE_OFFSET + PHYS_OFFSET; +#endif + /* + * The first usable region must be PMD aligned. Mark its start + * as MEMBLOCK_NOMAP if it isn't + */ + for_each_memblock(memory, reg) { + if (!memblock_is_nomap(reg)) { + if (!IS_ALIGNED(reg->base, PMD_SIZE)) { + phys_addr_t len; + + len = round_up(reg->base, PMD_SIZE) - reg->base; + memblock_mark_nomap(reg->base, len); + } + break; + } + } + for_each_memblock(memory, reg) { phys_addr_t block_start = reg->base; phys_addr_t block_end = reg->base + reg->size; diff --cc arch/arm64/mm/mmu.c index 5a463e22ab71,f1022a873c8a..300f7542186e --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@@ -28,12 -28,7 +28,10 @@@ #include #include #include - #include - #include #include +#ifdef CONFIG_AMLOGIC_MODIFY +#include +#endif /* CONFIG_AMLOGIC_MODIFY */ #include #include @@@ -640,14 -612,9 +656,14 @@@ int __meminit vmemmap_populate(unsigne if (!p) return -ENOMEM; - set_pmd(pmd, __pmd(__pa(p) | PROT_SECT_NORMAL)); + pmd_set_huge(pmd, __pa(p), __pgprot(PROT_SECT_NORMAL)); } else vmemmap_verify((pte_t *)pmd, node, addr, next); + + #ifdef CONFIG_AMLOGIC_MODIFY + if (in_vmap && check_pfn_overflow(page_to_pfn(page))) + break; + #endif /* CONFIG_AMLOGIC_MODIFY */ } while (addr = next, addr != end); return 0; diff --cc drivers/base/Kconfig index 4fe2d754d32a,c9f6bae0acec..97e9c47776e5 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@@ -246,8 -246,6 +246,7 @@@ source "drivers/base/regmap/Kconfig config DMA_SHARED_BUFFER bool default n - select ANON_INODES + select IRQ_WORK help This option enables the framework for buffer-sharing between multiple drivers. A buffer is associated with a file using driver diff --cc drivers/media/dvb-core/dvb_frontend.c index ebe1307fd5b2,cd45b3894661..d9a820257b4e --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@@ -1811,40 -1787,35 +1822,40 @@@ static int dtv_property_process_set(str r = dtv_set_frontend(fe); break; case DTV_FREQUENCY: - c->frequency = tvp->u.data; + c->frequency = data; break; case DTV_MODULATION: - c->modulation = tvp->u.data; + c->modulation = data; break; case DTV_BANDWIDTH_HZ: - c->bandwidth_hz = tvp->u.data; + c->bandwidth_hz = data; break; case DTV_INVERSION: - c->inversion = tvp->u.data; + c->inversion = data; break; case DTV_SYMBOL_RATE: - c->symbol_rate = tvp->u.data; + c->symbol_rate = data; break; case DTV_INNER_FEC: - c->fec_inner = tvp->u.data; + c->fec_inner = data; break; case DTV_PILOT: - c->pilot = tvp->u.data; + c->pilot = data; break; case DTV_ROLLOFF: - c->rolloff = tvp->u.data; + c->rolloff = data; break; case DTV_DELIVERY_SYSTEM: - r = dvbv5_set_delivery_system(fe, tvp->u.data); + r = dvbv5_set_delivery_system(fe, data); break; +#ifdef CONFIG_AMLOGIC_DVB_COMPAT + case DTV_DELIVERY_SUB_SYSTEM: + r = 0; + break; +#endif case DTV_VOLTAGE: - c->voltage = tvp->u.data; - r = dvb_frontend_ioctl_legacy(file, FE_SET_VOLTAGE, + c->voltage = data; + r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE, (void *)c->voltage); break; case DTV_TONE: diff --cc drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 5cdb94c26392,4216c0a5eaf5..c5d6180b399a --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@@ -184,13 -181,15 +184,19 @@@ static void dwmac4_set_filter(struct ma dwmac4_set_umac_addr(hw, ha->addr, reg); reg++; } + + while (reg <= GMAC_MAX_PERFECT_ADDRESSES) { + writel(0, ioaddr + GMAC_ADDR_HIGH(reg)); + writel(0, ioaddr + GMAC_ADDR_LOW(reg)); + reg++; + } } - +#ifdef CONFIG_AMLOGIC_ETH_PRIVE + /*patch to support 5.1a*/ + writel(value | 0x80000000, ioaddr + GMAC_PACKET_FILTER); +#else writel(value, ioaddr + GMAC_PACKET_FILTER); +#endif } static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, diff --cc drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 978ce54d9230,dbd56fefa2f3..d8c456481f2b --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@@ -55,14 -54,8 +55,14 @@@ #include #include #include "dwmac1000.h" +#ifdef CONFIG_AMLOGIC_ETH_PRIVE +#include "stmmac_platform.h" +#endif +#ifdef CONFIG_DWMAC_MESON +#include +#endif - #define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) + #define STMMAC_ALIGN(x) ALIGN(ALIGN(x, SMP_CACHE_BYTES), 16) #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) /* Module parameters */ @@@ -3579,17 -3503,13 +3583,22 @@@ int stmmac_suspend(struct device *dev netif_device_detach(ndev); netif_stop_queue(ndev); + /** + *napi_disable call might_sleep,if not irq restore + *It will warning bug + */ + spin_unlock_irqrestore(&priv->lock, flags); napi_disable(&priv->napi); + spin_lock_irqsave(&priv->lock, flags); +#ifdef CONFIG_AMLOGIC_ETH_PRIVE + del_timer_sync(&priv->txtimer); +#endif + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA */ priv->hw->dma->stop_tx(priv->ioaddr); priv->hw->dma->stop_rx(priv->ioaddr); diff --cc drivers/staging/android/Makefile index af30a2e066c8,3482d43c1aa5..e4c09e6f1055 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@@ -1,9 -1,7 +1,8 @@@ ccflags-y += -I$(src) # needed for trace events obj-y += ion/ - obj-$(CONFIG_FIQ_DEBUGGER) += fiq_debugger/ obj-$(CONFIG_ASHMEM) += ashmem.o +obj-$(CONFIG_ANDROID_LOGGER) += logger.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o obj-$(CONFIG_ANDROID_VSOC) += vsoc.o diff --cc drivers/staging/android/lowmemorykiller.c index 694637b9852b,8894a5f9820f..62bd666ab7c1 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@@ -45,11 -45,8 +45,12 @@@ #include #include #include + #include +#ifdef CONFIG_AMLOGIC_CMA +#include +#endif + #define CREATE_TRACE_POINTS #include "trace/lowmemorykiller.h" @@@ -398,26 -323,9 +382,26 @@@ static unsigned long lowmem_scan(struc cache_size, cache_limit, min_score_adj, free); + #ifdef CONFIG_AMLOGIC_CMA + if (cma_forbid) { + /* kill quickly if can't use cma */ + lowmem_deathpending_timeout = jiffies + HZ / 2; + pr_info(" Free cma:%ldkB, file cma:%ldkB\n", + free_cma * (long)(PAGE_SIZE / 1024), + file_cma * (long)(PAGE_SIZE / 1024)); + } else { + lowmem_deathpending_timeout = jiffies + HZ; + } + #else lowmem_deathpending_timeout = jiffies + HZ; + #endif /* CONFIG_AMLOGIC_CMA */ rem += selected_tasksize; + get_task_struct(selected); ++ + #ifdef CONFIG_AMLOGIC_MEMORY_EXTEND + if (!selected_oom_score_adj) /* forgeround task killed */ + show_task_adj(); + #endif /* CONFIG_AMLOGIC_MEMORY_EXTEND */ - - handle_lmk_event(selected, min_score_adj); } lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n", diff --cc drivers/usb/core/quirks.c index de86d1aea2d9,3dfd584a1ef3..3b01306722c3 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@@ -285,8 -332,8 +332,10 @@@ static const struct usb_device_id usb_q /* INTEL VALUE SSD */ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x1fc9, 0x0011), .driver_info = + USB_QUIRK_DEVICE_QUALIFIER }, + /* novation SoundControl XL */ + { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME }, { } /* terminating entry must be last */ }; diff --cc drivers/usb/dwc3/core.c index 9fa2ae9181e4,66254500e7a9..bb756f9865aa --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@@ -330,10 -227,7 +330,9 @@@ static void dwc3_frame_length_adjustmen reg = dwc3_readl(dwc->regs, DWC3_GFLADJ); dft = reg & DWC3_GFLADJ_30MHZ_MASK; +#ifndef CONFIG_AMLOGIC_USB - if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj, - "request value same as default, ignoring\n")) { + if (dft != dwc->fladj) { +#endif reg &= ~DWC3_GFLADJ_30MHZ_MASK; reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj; dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); diff --cc drivers/usb/gadget/configfs.c index 5774c02860ec,32940b8e76f0..f8d5eb0ac453 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@@ -1295,18 -1290,12 +1313,19 @@@ static int configfs_composite_bind(stru int ret; /* the gi->lock is hold by the caller */ + gi->unbind = 0; cdev->gadget = gadget; set_gadget_data(gadget, cdev); +#ifdef CONFIG_AMLOGIC_USB + wakeup_source_init(&Gadget_Lock.wakesrc, "gadget-connect"); +#endif ret = composite_dev_prepare(composite, cdev); - if (ret) + if (ret) { +#ifdef CONFIG_AMLOGIC_USB + wakeup_source_trash(&Gadget_Lock.wakesrc); +#endif return ret; + } /* and now the gadget bind */ ret = -EINVAL; @@@ -1508,11 -1492,101 +1531,104 @@@ static void configfs_composite_unbind(s purge_configs_funcs(gi); composite_dev_cleanup(cdev); usb_ep_autoconfig_reset(cdev->gadget); +#ifdef CONFIG_AMLOGIC_USB + wakeup_source_trash(&Gadget_Lock.wakesrc); +#endif + spin_lock_irqsave(&gi->spinlock, flags); cdev->gadget = NULL; set_gadget_data(gadget, NULL); + spin_unlock_irqrestore(&gi->spinlock, flags); + } + + static int configfs_composite_setup(struct usb_gadget *gadget, + const struct usb_ctrlrequest *ctrl) + { + struct usb_composite_dev *cdev; + struct gadget_info *gi; + unsigned long flags; + int ret; + + cdev = get_gadget_data(gadget); + if (!cdev) + return 0; + + gi = container_of(cdev, struct gadget_info, cdev); + spin_lock_irqsave(&gi->spinlock, flags); + cdev = get_gadget_data(gadget); + if (!cdev || gi->unbind) { + spin_unlock_irqrestore(&gi->spinlock, flags); + return 0; + } + + ret = composite_setup(gadget, ctrl); + spin_unlock_irqrestore(&gi->spinlock, flags); + return ret; + } + + static void configfs_composite_disconnect(struct usb_gadget *gadget) + { + struct usb_composite_dev *cdev; + struct gadget_info *gi; + unsigned long flags; + + cdev = get_gadget_data(gadget); + if (!cdev) + return; + + gi = container_of(cdev, struct gadget_info, cdev); + spin_lock_irqsave(&gi->spinlock, flags); + cdev = get_gadget_data(gadget); + if (!cdev || gi->unbind) { + spin_unlock_irqrestore(&gi->spinlock, flags); + return; + } + + composite_disconnect(gadget); + spin_unlock_irqrestore(&gi->spinlock, flags); + } + + static void configfs_composite_suspend(struct usb_gadget *gadget) + { + struct usb_composite_dev *cdev; + struct gadget_info *gi; + unsigned long flags; + + cdev = get_gadget_data(gadget); + if (!cdev) + return; + + gi = container_of(cdev, struct gadget_info, cdev); + spin_lock_irqsave(&gi->spinlock, flags); + cdev = get_gadget_data(gadget); + if (!cdev || gi->unbind) { + spin_unlock_irqrestore(&gi->spinlock, flags); + return; + } + + composite_suspend(gadget); + spin_unlock_irqrestore(&gi->spinlock, flags); + } + + static void configfs_composite_resume(struct usb_gadget *gadget) + { + struct usb_composite_dev *cdev; + struct gadget_info *gi; + unsigned long flags; + + cdev = get_gadget_data(gadget); + if (!cdev) + return; + + gi = container_of(cdev, struct gadget_info, cdev); + spin_lock_irqsave(&gi->spinlock, flags); + cdev = get_gadget_data(gadget); + if (!cdev || gi->unbind) { + spin_unlock_irqrestore(&gi->spinlock, flags); + return; + } + + composite_resume(gadget); + spin_unlock_irqrestore(&gi->spinlock, flags); } #ifdef CONFIG_USB_CONFIGFS_UEVENT diff --cc fs/ext4/dir.c index 4ffc5edbdf7d,6b3a32f75dad..022d67f5424f --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@@ -106,10 -111,9 +111,9 @@@ static int ext4_readdir(struct file *fi struct inode *inode = file_inode(file); struct super_block *sb = inode->i_sb; struct buffer_head *bh = NULL; - int dir_has_error = 0; struct fscrypt_str fstr = FSTR_INIT(NULL, 0); - if (ext4_encrypted_inode(inode)) { + if (IS_ENCRYPTED(inode)) { err = fscrypt_get_encryption_info(inode); if (err && err != -ENOKEY) return err; diff --cc fs/ext4/namei.c index 6817a897df6d,021d6a313c97..7791eceba65a --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@@ -3148,10 -3195,9 +3195,10 @@@ static int ext4_link(struct dentry *old if (inode->i_nlink >= EXT4_LINK_MAX) return -EMLINK; + - err = fscrypt_prepare_link(old_dentry, dir, dentry); - if (err) - return err; + if (ext4_encrypted_inode(dir) && + !fscrypt_has_permitted_context(dir, inode)) + return -EXDEV; if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) && (!projid_eq(EXT4_I(dir)->i_projid, diff --cc fs/ext4/page-io.c index a7684d39c318,d68032bda4bf..906dc63ddc0c --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@@ -464,9 -464,17 +464,16 @@@ int ext4_bio_write_page(struct ext4_io_ bh = head = page_buffers(page); - if (ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode) && - nr_to_submit) { + if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode) && nr_to_submit) { gfp_t gfp_flags = GFP_NOFS; + /* + * Since bounce page allocation uses a mempool, we can only use + * a waiting mask (i.e. request guaranteed allocation) on the + * first page of the bio. Otherwise it can deadlock. + */ + if (io->io_bio) + gfp_flags = GFP_NOWAIT | __GFP_NOWARN; retry_encrypt: data_page = fscrypt_encrypt_page(inode, page, PAGE_SIZE, 0, page->index, gfp_flags); diff --cc include/uapi/linux/dvb/frontend.h index f02e87e7ab61,b653754ee9cf..87a3583db127 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@@ -27,25 -27,50 +27,53 @@@ #define _DVBFRONTEND_H_ #include +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +#include +#endif - enum fe_type { - FE_QPSK, - FE_QAM, - FE_OFDM, - FE_ATSC, - #ifdef CONFIG_AMLOGIC_DVB_COMPAT - FE_ANALOG, - FE_DTMB, - FE_ISDBT - #endif - }; - + /** + * enum fe_caps - Frontend capabilities + * + * @FE_IS_STUPID: There's something wrong at the + * frontend, and it can't report its + * capabilities. + * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral + * band inversion + * @FE_CAN_FEC_1_2: Supports FEC 1/2 + * @FE_CAN_FEC_2_3: Supports FEC 2/3 + * @FE_CAN_FEC_3_4: Supports FEC 3/4 + * @FE_CAN_FEC_4_5: Supports FEC 4/5 + * @FE_CAN_FEC_5_6: Supports FEC 5/6 + * @FE_CAN_FEC_6_7: Supports FEC 6/7 + * @FE_CAN_FEC_7_8: Supports FEC 7/8 + * @FE_CAN_FEC_8_9: Supports FEC 8/9 + * @FE_CAN_FEC_AUTO: Can auto-detect FEC + * @FE_CAN_QPSK: Supports QPSK modulation + * @FE_CAN_QAM_16: Supports 16-QAM modulation + * @FE_CAN_QAM_32: Supports 32-QAM modulation + * @FE_CAN_QAM_64: Supports 64-QAM modulation + * @FE_CAN_QAM_128: Supports 128-QAM modulation + * @FE_CAN_QAM_256: Supports 256-QAM modulation + * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation + * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode + * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth + * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval + * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy + * @FE_CAN_8VSB: Supports 8-VSB modulation + * @FE_CAN_16VSB: Supporta 16-VSB modulation + * @FE_HAS_EXTENDED_CAPS: Unused + * @FE_CAN_MULTISTREAM: Supports multistream filtering + * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation + * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation, + * e. g. DVB-S2, DVB-T2, DVB-C2 + * @FE_NEEDS_BENDING: Unused + * @FE_CAN_RECOVER: Can recover from a cable unplug + * automatically + * @FE_CAN_MUTE_TS: Can stop spurious TS data output + */ enum fe_caps { FE_IS_STUPID = 0, - FE_CAN_INVERSION_AUTO = 0x1, + FE_CAN_INVERSION_AUTO = 0x1, FE_CAN_FEC_1_2 = 0x2, FE_CAN_FEC_2_3 = 0x4, FE_CAN_FEC_3_4 = 0x8, @@@ -68,19 -93,55 +96,64 @@@ FE_CAN_HIERARCHY_AUTO = 0x100000, FE_CAN_8VSB = 0x200000, FE_CAN_16VSB = 0x400000, - /* We need more bitspace for newer APIs, indicate this. */ - FE_HAS_EXTENDED_CAPS = 0x800000, - FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */ - FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ - /* frontend supports "2nd generation modulation" (DVB-S2) */ - FE_CAN_2G_MODULATION = 0x10000000, - FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ - FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ - FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ + FE_HAS_EXTENDED_CAPS = 0x800000, + FE_CAN_MULTISTREAM = 0x4000000, + FE_CAN_TURBO_FEC = 0x8000000, + FE_CAN_2G_MODULATION = 0x10000000, + FE_NEEDS_BENDING = 0x20000000, + FE_CAN_RECOVER = 0x40000000, + FE_CAN_MUTE_TS = 0x80000000 }; + +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +#define FE_CAN_3_LAYER FE_CAN_MULTISTREAM +#endif ++ + /* + * DEPRECATED: Should be kept just due to backward compatibility. + */ + enum fe_type { + FE_QPSK, + FE_QAM, + FE_OFDM, + FE_ATSC ++#ifdef CONFIG_AMLOGIC_DVB_COMPAT ++ FE_ANALOG, ++ FE_DTMB, ++ FE_ISDBT ++#endif + }; + + /** + * struct dvb_frontend_info - Frontend properties and capabilities + * + * @name: Name of the frontend + * @type: **DEPRECATED**. + * Should not be used on modern programs, + * as a frontend may have more than one type. + * In order to get the support types of a given + * frontend, use :c:type:`DTV_ENUM_DELSYS` + * instead. + * @frequency_min: Minimal frequency supported by the frontend. + * @frequency_max: Minimal frequency supported by the frontend. + * @frequency_stepsize: All frequencies are multiple of this value. + * @frequency_tolerance: Frequency tolerance. + * @symbol_rate_min: Minimal symbol rate, in bauds + * (for Cable/Satellite systems). + * @symbol_rate_max: Maximal symbol rate, in bauds + * (for Cable/Satellite systems). + * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm + * (for Cable/Satellite systems). + * @notifier_delay: **DEPRECATED**. Not used by any driver. + * @caps: Capabilities supported by the frontend, + * as specified in &enum fe_caps. + * + * .. note: + * + * #. The frequencies are specified in Hz for Terrestrial and Cable + * systems. + * #. The frequencies are specified in kHz for Satellite systems. + */ struct dvb_frontend_info { char name[128]; enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ @@@ -128,33 -235,43 +247,49 @@@ enum fe_sec_mini_cmd }; /** - * enum fe_status - enumerates the possible frontend status - * @FE_HAS_SIGNAL: found something above the noise level - * @FE_HAS_CARRIER: found a DVB signal - * @FE_HAS_VITERBI: FEC is stable - * @FE_HAS_SYNC: found sync bytes - * @FE_HAS_LOCK: everything's working - * @FE_TIMEDOUT: no lock within the last ~2 seconds - * @FE_REINIT: frontend was reinitialized, application is recommended - * to reset DiSEqC, tone and parameters + * enum fe_status - Enumerates the possible frontend status. + * @FE_NONE: The frontend doesn't have any kind of lock. + * That's the initial frontend status + * @FE_HAS_SIGNAL: Has found something above the noise level. + * @FE_HAS_CARRIER: Has found a DVB signal. + * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code). + * is stable. + * @FE_HAS_SYNC: Synchronization bytes was found. + * @FE_HAS_LOCK: DVB were locked and everything is working. + * @FE_TIMEDOUT: Fo lock within the last about 2 seconds. + * @FE_REINIT: Frontend was reinitialized, application is recommended + * to reset DiSEqC, tone and parameters. */ enum fe_status { - FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ - FE_HAS_CARRIER = 0x02, /* found a DVB signal */ - FE_HAS_VITERBI = 0x04, /* FEC is stable */ - FE_HAS_SYNC = 0x08, /* found sync bytes */ - FE_HAS_LOCK = 0x10, /* everything's working... */ - FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ - FE_REINIT = 0x40, /* frontend was reinitialized, */ + FE_NONE = 0x00, + FE_HAS_SIGNAL = 0x01, + FE_HAS_CARRIER = 0x02, + FE_HAS_VITERBI = 0x04, + FE_HAS_SYNC = 0x08, + FE_HAS_LOCK = 0x10, + FE_TIMEDOUT = 0x20, + FE_REINIT = 0x40, +#ifdef CONFIG_AMLOGIC_DVB_COMPAT + BLINDSCAN_NONEDO = 0x80, /* not blind scan */ + BLINDSCAN_UPDATESTARTFREQ = 0x100, /* blind scan update start freq */ + BLINDSCAN_UPDATEPROCESS = 0x200, /* blind scan update process */ + BLINDSCAN_UPDATERESULTFREQ = 0x400/* blind scan update result */ +#endif - }; /* application is recommended to reset */ - /* DiSEqC, tone and parameters */ + }; + /** + * enum fe_spectral_inversion - Type of inversion band + * + * @INVERSION_OFF: Don't do spectral band inversion. + * @INVERSION_ON: Do spectral band inversion. + * @INVERSION_AUTO: Autodetect spectral band inversion. + * + * This parameter indicates if spectral inversion should be presumed or + * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try + * to figure out the correct setting by itself. If the hardware doesn't + * support, the DVB core will try to lock at the carrier first with + * inversion off. If it fails, it will try to enable inversion. + */ enum fe_spectral_inversion { INVERSION_OFF, INVERSION_ON, @@@ -235,26 -454,8 +472,27 @@@ enum fe_interleaving INTERLEAVING_720, }; +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +struct fe_blind_scan_parameters { + /* minimum tuner frequency in kHz */ + __u32 min_frequency; + /* maximum tuner frequency in kHz */ + __u32 max_frequency; + /* minimum symbol rate in sym/sec */ + __u32 min_symbol_rate; + /* maximum symbol rate in sym/sec */ + __u32 max_symbol_rate; + /* search range in kHz. freq -/+freqRange will be searched */ + __u32 frequency_range; + /* tuner step frequency in kHz */ + __u32 frequency_step; + /* blindscan event timeout */ + __s32 timeout; +}; +#endif + - /* S2API Commands */ + /* DVBv5 property Commands */ + #define DTV_UNDEFINED 0 #define DTV_TUNE 1 #define DTV_CLEAR 2 @@@ -347,31 -546,15 +585,37 @@@ #define DTV_STAT_ERROR_BLOCK_COUNT 68 #define DTV_STAT_TOTAL_BLOCK_COUNT 69 +#ifdef CONFIG_AMLOGIC_DVB_COMPAT + +/* Get tne TS input of the frontend */ +#define DTV_TS_INPUT 100 +/* Blind scan */ +#define DTV_START_BLIND_SCAN 101 +#define DTV_CANCEL_BLIND_SCAN 102 +#define DTV_BLIND_SCAN_MIN_FRE 103 +#define DTV_BLIND_SCAN_MAX_FRE 104 +#define DTV_BLIND_SCAN_MIN_SRATE 105 +#define DTV_BLIND_SCAN_MAX_SRATE 106 +#define DTV_BLIND_SCAN_FRE_RANGE 107 +#define DTV_BLIND_SCAN_FRE_STEP 108 +#define DTV_BLIND_SCAN_TIMEOUT 109 +/* Blind scan end*/ +#define DTV_DELIVERY_SUB_SYSTEM 110 +#define DTV_MAX_COMMAND DTV_DELIVERY_SUB_SYSTEM + +#else /*!defined(CONFIG_AMLOGIC_DVB_COMPAT)*/ + #define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT +#endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ + - + /** + * enum fe_pilot - Type of pilot tone + * + * @PILOT_ON: Pilot tones enabled + * @PILOT_OFF: Pilot tones disabled + * @PILOT_AUTO: Autodetect pilot tones + */ enum fe_pilot { PILOT_ON, PILOT_OFF, @@@ -405,17 -641,27 +702,30 @@@ enum fe_delivery_system SYS_DVBT2, SYS_TURBO, SYS_DVBC_ANNEX_C, +#ifdef CONFIG_AMLOGIC_DVB_COMPAT + SYS_ANALOG +#endif }; - /* backward compatibility */ + /* backward compatibility definitions for delivery systems */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A - #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ + #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */ - /* ATSC-MH */ + /* ATSC-MH specific parameters */ + /** + * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional + * Code Block Mode. + * + * @ATSCMH_SCCC_BLK_SEP: + * Separate SCCC: the SCCC outer code mode shall be set independently + * for each Group Region (A, B, C, D) + * @ATSCMH_SCCC_BLK_COMB: + * Combined SCCC: all four Regions shall have the same SCCC outer + * code mode. + * @ATSCMH_SCCC_BLK_RES: + * Reserved. Shouldn't be used. + */ enum atscmh_sccc_block_mode { ATSCMH_SCCC_BLK_SEP = 0, ATSCMH_SCCC_BLK_COMB = 1, @@@ -555,18 -860,53 +924,66 @@@ struct dtv_property /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ #define DTV_IOCTL_MAX_MSGS 64 + /** + * struct dtv_properties - a set of command/value pairs. + * + * @num: amount of commands stored at the struct. + * @props: a pointer to &struct dtv_property. + */ struct dtv_properties { __u32 num; - #if 0 && defined(CONFIG_AMLOGIC_DVB_COMPAT) - union { - struct dtv_property *props; - __u64 reserved; - }; - #else struct dtv_property *props; - #endif }; + /* + * When set, this flag will disable any zigzagging or other "normal" tuning + * behavior. Additionally, there will be no automatic monitoring of the lock + * status, and hence no frontend events will be generated. If a frontend device + * is closed, this flag will be automatically turned off when the device is + * reopened read-write. + */ + #define FE_TUNE_MODE_ONESHOT 0x01 + + /* Digital TV Frontend API calls */ + + #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) + + #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) + #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) + #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) + #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ + + #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ + #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ + #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ + + #define FE_READ_STATUS _IOR('o', 69, fe_status_t) + #define FE_READ_BER _IOR('o', 70, __u32) + #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) + #define FE_READ_SNR _IOR('o', 72, __u16) + #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) + + #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ + #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) + + #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ + + #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) + #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) + ++#ifdef CONFIG_AMLOGIC_DVB_COMPAT ++/*need del this ioctl, used set PROPERTY instead*/ ++#define FE_SET_DELAY _IO('o', 100) ++#define FE_READ_AFC _IOR('o', 91, __u32) ++#define FE_FINE_TUNE _IOW('o', 92, __u32) ++#define FE_READ_TUNER_STATUS _IOR('o', 93, struct tuner_status_s) ++#define FE_READ_ANALOG_STATUS _IOR('o', 94, struct atv_status_s) ++#define FE_READ_SD_STATUS _IOR('o', 95, struct sound_status_s) ++/*set & get the tuner parameters only atv*/ ++#define FE_SET_PARAM_BOX _IOWR('o', 97, struct tuner_param_s) ++#define FE_SET_AFC _IOW('o', 98, __u32) ++#endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ ++ #if defined(__DVB_CORE__) || !defined (__KERNEL__) /* @@@ -603,13 -954,8 +1031,15 @@@ typedef enum fe_pilot fe_pilot_t typedef enum fe_rolloff fe_rolloff_t; typedef enum fe_delivery_system fe_delivery_system_t; +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +enum fe_ofdm_mode { + OFDM_DVBT, + OFDM_DVBT2, +}; +#endif + + /* DVBv3 structs */ + struct dvb_qpsk_parameters { __u32 symbol_rate; /* symbol rate in Symbols per second */ fe_code_rate_t fec_inner; /* forward error correction (see above) */ @@@ -635,25 -981,9 +1065,24 @@@ struct dvb_ofdm_parameters fe_hierarchy_t hierarchy_information; }; +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +#define ANALOG_FLAG_ENABLE_AFC 0X00000001 +#define ANALOG_FLAG_MANUL_SCAN 0x00000011 +struct dvb_analog_parameters { + /*V4L2_TUNER_MODE_MONO,V4L2_TUNER_MODE_STEREO,*/ + /*V4L2_TUNER_MODE_LANG2,V4L2_TUNER_MODE_SAP,*/ + /*V4L2_TUNER_MODE_LANG1,V4L2_TUNER_MODE_LANG1_LANG2 */ + unsigned int audmode; + unsigned int soundsys; /*A2,BTSC,EIAJ,NICAM */ + v4l2_std_id std; + unsigned int flag; + unsigned int afc_range; +}; +#endif + struct dvb_frontend_parameters { - /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ - __u32 frequency; - /* intermediate frequency in kHz for DVB-S */ + __u32 frequency; /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ + /* intermediate frequency in kHz for DVB-S */ fe_spectral_inversion_t inversion; union { struct dvb_qpsk_parameters qpsk; /* DVB-S */ @@@ -695,163 -997,12 +1121,122 @@@ struct dvb_frontend_event fe_status_t status; struct dvb_frontend_parameters parameters; }; + +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +/* Satellite blind scan event */ +struct dvbsx_blindscanevent { + enum fe_status status; + union { + /* The percentage completion of the*/ + /*blind scan procedure. A value of*/ + /*100 indicates that the blind scan*/ + /*is finished. */ + __u16 m_uiprogress; + /*The start scan frequency in units of kHz.*/ + /*The minimum value depends on the tuner*/ + /*specification.*/ + __u32 m_uistartfreq_khz; + /* Blind scan channel info. */ + struct dvb_frontend_parameters parameters; + } u; +}; +#endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ - #endif + - #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) - #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) + /* DVBv3 API calls */ + + #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) + #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) + + #endif +#ifdef CONFIG_AMLOGIC_DVB_COMPAT +/*for atv*/ +struct tuner_status_s { + unsigned int frequency; + unsigned int rssi; + unsigned char mode;/*dtv:0 or atv:1*/ + unsigned char tuner_locked;/*notlocked:0,locked:1*/ + union { + void *ressrved; + __u64 reserved1; + }; +}; + + +struct atv_status_s { + unsigned char atv_lock;/*notlocked:0,locked 1*/ + v4l2_std_id std; + unsigned int audmode; + int snr; + int afc; + union { + void *resrvred; + __u64 reserved1; + }; +}; + +struct sound_status_s { + unsigned short sound_sys;/*A2DK/A2BG/NICAM BG/NICAM DK/BTSC/EIAJ*/ + unsigned short sound_mode;/*SETERO/DUAL/MONO/SAP*/ + union { + void *resrvred; + __u64 reserved1; + }; +}; + + +enum tuner_param_cmd_e { + TUNER_CMD_AUDIO_MUTE = 0x0000, + TUNER_CMD_AUDIO_ON, + TUNER_CMD_TUNER_POWER_ON, + TUNER_CMD_TUNER_POWER_DOWN, + TUNER_CMD_SET_VOLUME, + TUNER_CMD_SET_LEAP_SETP_SIZE, + TUNER_CMD_GET_MONO_MODE, + TUNER_CMD_SET_BEST_LOCK_RANGE, + TUNER_CMD_GET_BEST_LOCK_RANGE, + TUNER_CMD_SET_CVBS_AMP_OUT, + TUNER_CMD_GET_CVBS_AMP_OUT, + TUNER_CMD_NULL, +}; + + +/*parameter for set param box*/ +struct tuner_param_s { + enum tuner_param_cmd_e cmd; + unsigned int parm; + unsigned int resvred; +}; + + +enum fe_layer { + Layer_A_B_C, + Layer_A, + Layer_B, + Layer_C, +}; + +// typedef struct dvb_analog_parameters dvb_analog_parameters_t; +// typedef struct tuner_status_s tuner_status_t; +// typedef struct atv_status_s atv_status_t; +// typedef struct sound_status_s sound_status_t; +// typedef enum tuner_param_cmd_e tuner_param_cmd_t; +// typedef struct tuner_param_s tuner_param_t; +// typedef enum fe_layer fe_layer_t; +// typedef enum fe_ofdm_mode fe_ofdm_mode_t; + + +/* Satellite blind scan settings */ +struct dvbsx_blindscanpara { + __u32 minfrequency;/* minimum tuner frequency in kHz */ + __u32 maxfrequency;/* maximum tuner frequency in kHz */ + __u32 minSymbolRate;/* minimum symbol rate in sym/sec */ + __u32 maxSymbolRate;/* maximum symbol rate in sym/sec */ + /*search range in kHz. freq -/+freqRange will be searched */ + __u32 frequencyRange; + __u32 frequencyStep;/* tuner step frequency in kHz */ + __s32 timeout;/* blindscan event timeout*/ +}; +#endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ - /** - * When set, this flag will disable any zigzagging or other "normal" tuning - * behaviour. Additionally, there will be no automatic monitoring of the lock - * status, and hence no frontend events will be generated. If a frontend device - * is closed, this flag will be automatically turned off when the device is - * reopened read-write. - */ - #define FE_TUNE_MODE_ONESHOT 0x01 - - #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) - - #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) - #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) - #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) - #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ - - #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ - #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ - #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ - - #define FE_READ_STATUS _IOR('o', 69, fe_status_t) - #define FE_READ_BER _IOR('o', 70, __u32) - #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) - #define FE_READ_SNR _IOR('o', 72, __u16) - #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) - - #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) - #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) - #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ - #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) - - #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ - - #ifdef CONFIG_AMLOGIC_DVB_COMPAT - /*need del this ioctl, used set PROPERTY instead*/ - #define FE_SET_DELAY _IO('o', 100) - #define FE_READ_AFC _IOR('o', 91, __u32) - #define FE_FINE_TUNE _IOW('o', 92, __u32) - #define FE_READ_TUNER_STATUS _IOR('o', 93, struct tuner_status_s) - #define FE_READ_ANALOG_STATUS _IOR('o', 94, struct atv_status_s) - #define FE_READ_SD_STATUS _IOR('o', 95, struct sound_status_s) - /*set & get the tuner parameters only atv*/ - #define FE_SET_PARAM_BOX _IOWR('o', 97, struct tuner_param_s) - #define FE_SET_AFC _IOW('o', 98, __u32) - #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ + #endif /*_DVBFRONTEND_H_*/ diff --cc mm/page_alloc.c index 2628585df933,d30ba08120f1..101bdd9ef7da --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@@ -64,10 -64,8 +64,11 @@@ #include #include #include + #include #include +#ifdef CONFIG_AMLOGIC_PAGE_TRACE +#include +#endif /* CONFIG_AMLOGIC_PAGE_TRACE */ #include #include diff --cc mm/slub.c index f1827060b18f,20cb89548ea2..4567b0aaae84 --- a/mm/slub.c +++ b/mm/slub.c @@@ -2949,11 -2969,10 +2984,13 @@@ redo /* Same with comment on barrier() in slab_alloc_node() */ barrier(); +#ifdef CONFIG_AMLOGIC_SLAB_TRACE + slab_trace_remove_object(head, s); +#endif if (likely(page == c->page)) { - set_freepointer(s, tail_obj, c->freelist); + void **freelist = READ_ONCE(c->freelist); + + set_freepointer(s, tail_obj, freelist); if (unlikely(!this_cpu_cmpxchg_double( s->cpu_slab->freelist, s->cpu_slab->tid, diff --cc net/ipv4/tcp_input.c index 555a3e75fbae,e6470074019f..22de7d809434 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@@ -4511,9 -4535,14 +4535,13 @@@ static void tcp_data_queue_ofo(struct s /* In the typical case, we are adding an skb to the end of the list. * Use of ooo_last_skb avoids the O(Log(N)) rbtree lookup. */ - if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb, - skb, &fragstolen)) { + if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb, skb, &fragstolen)) { coalesce_done: - tcp_grow_window(sk, skb); + /* For non sack flows, do not grow window to force DUPACK + * and trigger fast retransmit. + */ + if (tcp_is_sack(tp)) + tcp_grow_window(sk, skb); kfree_skb_partial(skb, fragstolen); skb = NULL; goto add_sack; diff --cc net/wireless/util.c index 82b6eba1c73d,262922cf6a0c..8efc074fa8fb --- a/net/wireless/util.c +++ b/net/wireless/util.c @@@ -1938,57 -1795,47 +1939,101 @@@ const unsigned char bridge_tunnel_heade { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; EXPORT_SYMBOL(bridge_tunnel_header); +#ifdef CONFIG_AMLOGIC_MODIFY +bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb) +{ + const struct ethhdr *eth = (void *)skb->data; + + const struct { + struct arphdr hdr; + u8 ar_sha[ETH_ALEN]; + u8 ar_sip[4]; + u8 ar_tha[ETH_ALEN]; + u8 ar_tip[4]; + } __packed * arp; + const struct ipv6hdr *ipv6; + const struct icmp6hdr *icmpv6; + + switch (eth->h_proto) { + case cpu_to_be16(ETH_P_ARP): + /* can't say - but will probably be dropped later anyway */ + if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*arp))) + return false; + + arp = (void *)(eth + 1); + + if ((arp->hdr.ar_op == cpu_to_be16(ARPOP_REPLY) || + arp->hdr.ar_op == cpu_to_be16(ARPOP_REQUEST)) && + !memcmp(arp->ar_sip, arp->ar_tip, sizeof(arp->ar_sip))) + return true; + break; + case cpu_to_be16(ETH_P_IPV6): + /* can't say - but will probably be dropped later anyway */ + if (!pskb_may_pull(skb, sizeof(*eth) + sizeof(*ipv6) + + sizeof(*icmpv6))) + return false; + + ipv6 = (void *)(eth + 1); + icmpv6 = (void *)(ipv6 + 1); + + if (icmpv6->icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT && + !memcmp(&ipv6->saddr, &ipv6->daddr, + sizeof(ipv6->saddr))) + return true; + break; + default: + /* no need to support other protocols, proxy service isn't + * specified for any others + */ + break; + } + + return false; +} +EXPORT_SYMBOL(cfg80211_is_gratuitous_arp_unsolicited_na); +#endif + + /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ + struct iapp_layer2_update { + u8 da[ETH_ALEN]; /* broadcast */ + u8 sa[ETH_ALEN]; /* STA addr */ + __be16 len; /* 6 */ + u8 dsap; /* 0 */ + u8 ssap; /* 0 */ + u8 control; + u8 xid_info[3]; + } __packed; + + void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr) + { + struct iapp_layer2_update *msg; + struct sk_buff *skb; + + /* Send Level 2 Update Frame to update forwarding tables in layer 2 + * bridge devices */ + + skb = dev_alloc_skb(sizeof(*msg)); + if (!skb) + return; + msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); + + /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) + * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ + + eth_broadcast_addr(msg->da); + ether_addr_copy(msg->sa, addr); + msg->len = htons(6); + msg->dsap = 0; + msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ + msg->control = 0xaf; /* XID response lsb.1111F101. + * F=0 (no poll command; unsolicited frame) */ + msg->xid_info[0] = 0x81; /* XID format identifier */ + msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ + msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ + + skb->dev = dev; + skb->protocol = eth_type_trans(skb, dev); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_rx_ni(skb); + } + EXPORT_SYMBOL(cfg80211_send_layer2_update);