0cc34620e8
* refs/heads/tmp-204dd19: UPSTREAM: driver core: Avoid deferred probe due to fw_devlink_pause/resume() UPSTREAM: driver core: Rename dev_links_info.defer_sync to defer_hook UPSTREAM: driver core: Don't do deferred probe in parallel with kernel_init thread Restore sdcardfs feature Revert rpmh and usb changes Linux 4.19.136 regmap: debugfs: check count when read regmap file rtnetlink: Fix memory(net_device) leak when ->newlink fails udp: Improve load balancing for SO_REUSEPORT. udp: Copy has_conns in reuseport_grow(). sctp: shrink stream outq when fails to do addstream reconf sctp: shrink stream outq only when new outcnt < old outcnt AX.25: Prevent integer overflows in connect and sendmsg tcp: allow at most one TLP probe per flight rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA qrtr: orphan socket in qrtr_release() net: udp: Fix wrong clean up for IS_UDPLITE macro net-sysfs: add a newline when printing 'tx_timeout' by sysfs ip6_gre: fix null-ptr-deref in ip6gre_init_net() drivers/net/wan/x25_asy: Fix to make it work dev: Defer free of skbs in flush_backlog AX.25: Prevent out-of-bounds read in ax25_sendmsg() AX.25: Fix out-of-bounds read in ax25_connect() Linux 4.19.135 ath9k: Fix regression with Atheros 9271 ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb dm integrity: fix integrity recalculation that is improperly skipped ASoC: qcom: Drop HAS_DMA dependency to fix link failure ASoC: rt5670: Add new gpio1_is_ext_spk_en quirk and enable it on the Lenovo Miix 2 10 x86, vmlinux.lds: Page-align end of ..page_aligned sections parisc: Add atomic64_set_release() define to avoid CPU soft lockups drm/amd/powerplay: fix a crash when overclocking Vega M drm/amdgpu: Fix NULL dereference in dpm sysfs handlers io-mapping: indicate mapping failure mm: memcg/slab: fix memory leak at non-root kmem_cache destroy mm: memcg/slab: synchronize access to kmem_cache dying flag using a spinlock mm/memcg: fix refcount error while moving and swapping Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation vt: Reject zero-sized screen buffer size. fbdev: Detect integer underflow at "struct fbcon_ops"->clear_margins. serial: 8250_mtk: Fix high-speed baud rates clamping serial: 8250: fix null-ptr-deref in serial8250_start_tx() staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift staging: comedi: addi_apci_1500: check INSN_CONFIG_DIGITAL_TRIG shift staging: comedi: ni_6527: fix INSN_CONFIG_DIGITAL_TRIG support staging: comedi: addi_apci_1032: check INSN_CONFIG_DIGITAL_TRIG shift staging: wlan-ng: properly check endpoint types Revert "cifs: Fix the target file was deleted when rename failed." usb: xhci: Fix ASM2142/ASM3142 DMA addressing usb: xhci-mtk: fix the failure of bandwidth allocation binder: Don't use mmput() from shrinker function. RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw x86: math-emu: Fix up 'cmp' insn for clang ias arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP hwmon: (scmi) Fix potential buffer overflow in scmi_hwmon_probe() hwmon: (adm1275) Make sure we are reading enough data for different chips usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init() Input: synaptics - enable InterTouch for ThinkPad X1E 1st gen dmaengine: ioat setting ioat timeout as module parameter hwmon: (aspeed-pwm-tacho) Avoid possible buffer overflow regmap: dev_get_regmap_match(): fix string comparison spi: mediatek: use correct SPI_CFG2_REG MACRO Input: add `SW_MACHINE_COVER` dmaengine: tegra210-adma: Fix runtime PM imbalance on error HID: apple: Disable Fn-key key-re-mapping on clone keyboards HID: steam: fixes race in handling device list. HID: alps: support devices with report id 2 HID: i2c-hid: add Mediacom FlexBook edge13 to descriptor override scripts/gdb: fix lx-symbols 'gdb.error' while loading modules scripts/decode_stacktrace: strip basepath from all paths serial: exar: Fix GPIO configuration for Sealevel cards based on XR17V35X bonding: check return value of register_netdevice() in bond_newlink() i2c: rcar: always clear ICSAR to avoid side effects net: ethernet: ave: Fix error returns in ave_init ipvs: fix the connection sync failed in some cases qed: suppress "don't support RoCE & iWARP" flooding on HW init mlxsw: destroy workqueue when trap_register in mlxsw_emad_init bonding: check error value of register_netdevice() immediately net: smc91x: Fix possible memory leak in smc_drv_probe() drm: sun4i: hdmi: Fix inverted HPD result ieee802154: fix one possible memleak in adf7242_probe net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration ax88172a: fix ax88172a_unbind() failures hippi: Fix a size used in a 'pci_free_consistent()' in an error handling path fpga: dfl: fix bug in port reset handshake bnxt_en: Fix race when modifying pause settings. btrfs: fix page leaks after failure to lock page for delalloc btrfs: fix mount failure caused by race with umount btrfs: fix double free on ulist after backref resolution failure ASoC: rt5670: Correct RT5670_LDO_SEL_MASK ALSA: info: Drop WARN_ON() from buffer NULL sanity check uprobes: Change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL, to fix GDB regression IB/umem: fix reference count leak in ib_umem_odp_get() tipc: clean up skb list lock handling on send path spi: spi-fsl-dspi: Exit the ISR with IRQ_NONE when it's not ours SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion") irqdomain/treewide: Keep firmware node unconditionally allocated fuse: fix weird page warning drivers/firmware/psci: Fix memory leakage in alloc_init_cpu_groups() drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout net: sky2: initialize return of gm_phy_read drivers/net/wan/lapbether: Fixed the value of hard_header_len xtensa: update *pos in cpuinfo_op.next xtensa: fix __sync_fetch_and_{and,or}_4 declarations scsi: scsi_transport_spi: Fix function pointer check mac80211: allow rx of mesh eapol frames with default rx key pinctrl: amd: fix npins for uart0 in kerncz_groups gpio: arizona: put pm_runtime in case of failure gpio: arizona: handle pm_runtime_get_sync failure case soc: qcom: rpmh: Dirt can only make you dirtier, not cleaner ANDROID: build: update ABI definitions ANDROID: update the kernel release format for GKI ANDROID: Incremental fs: magic number compatible 32-bit ANDROID: kbuild: don't merge .*..compoundliteral in modules ANDROID: GKI: preserve ABI for struct sock_cgroup_data Revert "genetlink: remove genl_bind" Revert "arm64/alternatives: use subsections for replacement sequences" Linux 4.19.134 spi: sprd: switch the sequence of setting WDG_LOAD_LOW and _HIGH rxrpc: Fix trace string libceph: don't omit recovery_deletes in target_copy() printk: queue wake_up_klogd irq_work only if per-CPU areas are ready genirq/affinity: Handle affinity setting on inactive interrupts correctly sched/fair: handle case of task_h_load() returning 0 sched: Fix unreliable rseq cpu_id for new tasks arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return arm64: ptrace: Consistently use pseudo-singlestep exceptions arm64: ptrace: Override SPSR.SS when single-stepping is enabled thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power misc: atmel-ssc: lock with mutex instead of spinlock dmaengine: fsl-edma: Fix NULL pointer exception in fsl_edma_tx_handler intel_th: Fix a NULL dereference when hub driver is not loaded intel_th: pci: Add Emmitsburg PCH support intel_th: pci: Add Tiger Lake PCH-H support intel_th: pci: Add Jasper Lake CPU support powerpc/book3s64/pkeys: Fix pkey_access_permitted() for execute disable pkey hwmon: (emc2103) fix unable to change fan pwm1_enable attribute riscv: use 16KB kernel stack on 64-bit MIPS: Fix build for LTS kernel caused by backporting lpj adjustment timer: Fix wheel index calculation on last level timer: Prevent base->clk from moving backward uio_pdrv_genirq: fix use without device tree and no interrupt Input: i8042 - add Lenovo XiaoXin Air 12 to i8042 nomux list mei: bus: don't clean driver pointer Revert "zram: convert remaining CLASS_ATTR() to CLASS_ATTR_RO()" fuse: Fix parameter for FS_IOC_{GET,SET}FLAGS ovl: fix unneeded call to ovl_change_flags() ovl: relax WARN_ON() when decoding lower directory file handle ovl: inode reference leak in ovl_is_inuse true case. serial: mxs-auart: add missed iounmap() in probe failure and remove virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial virt: vbox: Fix guest capabilities mask check virt: vbox: Fix VBGL_IOCTL_VMMDEV_REQUEST_BIG and _LOG req numbers to match upstream USB: serial: option: add Quectel EG95 LTE modem USB: serial: option: add GosunCn GM500 series USB: serial: ch341: add new Product ID for CH340 USB: serial: cypress_m8: enable Simply Automated UPB PIM USB: serial: iuu_phoenix: fix memory corruption usb: gadget: function: fix missing spinlock in f_uac1_legacy usb: chipidea: core: add wakeup support for extcon usb: dwc2: Fix shutdown callback in platform USB: c67x00: fix use after free in c67x00_giveback_urb ALSA: hda/realtek - Enable Speaker for ASUS UX533 and UX534 ALSA: hda/realtek - change to suitable link model for ASUS platform ALSA: usb-audio: Fix race against the error recovery URB submission ALSA: line6: Sync the pending work cancel at disconnection ALSA: line6: Perform sanity check for each URB creation HID: quirks: Ignore Simply Automated UPB PIM HID: quirks: Always poll Obins Anne Pro 2 keyboard HID: magicmouse: do not set up autorepeat slimbus: core: Fix mismatch in of_node_get/put mtd: rawnand: oxnas: Release all devices in the _remove() path mtd: rawnand: oxnas: Unregister all devices on error mtd: rawnand: oxnas: Keep track of registered devices mtd: rawnand: brcmnand: fix CS0 layout mtd: rawnand: timings: Fix default tR_max and tCCS_min timings mtd: rawnand: marvell: Fix probe error path mtd: rawnand: marvell: Use nand_cleanup() when the device is not yet registered soc: qcom: rpmh-rsc: Allow using free WAKE TCS for active request soc: qcom: rpmh-rsc: Clear active mode configuration for wake TCS soc: qcom: rpmh: Invalidate SLEEP and WAKE TCSes before flushing new data soc: qcom: rpmh: Update dirty flag only when data changes perf stat: Zero all the 'ena' and 'run' array slot stats for interval mode apparmor: ensure that dfa state tables have entries copy_xstate_to_kernel: Fix typo which caused GDB regression regmap: debugfs: Don't sleep while atomic for fast_io regmaps ARM: dts: socfpga: Align L2 cache-controller nodename with dtschema Revert "thermal: mediatek: fix register index error" staging: comedi: verify array index is correct before using it usb: gadget: udc: atmel: fix uninitialized read in debug printk spi: spi-sun6i: sun6i_spi_transfer_one(): fix setting of clock rate arm64: dts: meson: add missing gxl rng clock phy: sun4i-usb: fix dereference of pointer phy0 before it is null checked iio:health:afe4404 Fix timestamp alignment and prevent data leak. ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Flight S ACPI: video: Use native backlight on Acer TravelMate 5735Z Input: mms114 - add extra compatible for mms345l ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Alpha S ACPI: video: Use native backlight on Acer Aspire 5783z ALSA: usb-audio: Rewrite registration quirk handling mmc: sdhci: do not enable card detect interrupt for gpio cd type doc: dt: bindings: usb: dwc3: Update entries for disabling SS instances in park mode ALSA: usb-audio: Create a registration quirk for Kingston HyperX Amp (0951:16d8) scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled ARM: at91: pm: add quirk for sam9x60's ulp1 HID: quirks: Remove ITE 8595 entry from hid_have_special_driver net: sfp: add some quirks for GPON modules net: sfp: add support for module quirks Revert "usb/ehci-platform: Set PM runtime as active on resume" Revert "usb/xhci-plat: Set PM runtime as active on resume" Revert "usb/ohci-platform: Fix a warning when hibernating" of: of_mdio: Correct loop scanning logic net: dsa: bcm_sf2: Fix node reference count spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer spi: fix initial SPI_SR value in spi-fsl-dspi iio:health:afe4403 Fix timestamp alignment and prevent data leak. iio:pressure:ms5611 Fix buffer element alignment iio:humidity:hts221 Fix alignment and data leak issues iio: pressure: zpa2326: handle pm_runtime_get_sync failure iio: mma8452: Add missed iio_device_unregister() call in mma8452_probe() iio: magnetometer: ak8974: Fix runtime PM imbalance on error iio:humidity:hdc100x Fix alignment and data leak issues iio:magnetometer:ak8974: Fix alignment and data leak issues arm64/alternatives: don't patch up internal branches i2c: eg20t: Load module automatically if ID matches gfs2: read-only mounts should grab the sd_freeze_gl glock tpm_tis: extra chip->ops check on error path in tpm_tis_core_init arm64/alternatives: use subsections for replacement sequences m68k: mm: fix node memblock init m68k: nommu: register start of the memory with memblock drm/exynos: fix ref count leak in mic_pre_enable drm/msm: fix potential memleak in error branch vlan: consolidate VLAN parsing code and limit max parsing depth sched: consistently handle layer3 header accesses in the presence of VLANs cgroup: Fix sock_cgroup_data on big-endian. cgroup: fix cgroup_sk_alloc() for sk_clone_lock() tcp: md5: allow changing MD5 keys in all socket states tcp: md5: refine tcp_md5_do_add()/tcp_md5_hash_key() barriers tcp: md5: do not send silly options in SYNCOOKIES tcp: md5: add missing memory barriers in tcp_md5_do_add()/tcp_md5_hash_key() tcp: make sure listeners don't initialize congestion-control state tcp: fix SO_RCVLOWAT possible hangs under high mem pressure net: usb: qmi_wwan: add support for Quectel EG95 LTE modem net_sched: fix a memory leak in atm_tc_init() net: Added pointer check for dst->ops->neigh_lookup in dst_neigh_lookup_skb llc: make sure applications use ARPHRD_ETHER l2tp: remove skb_dst_set() from l2tp_xmit_skb() ipv4: fill fl4_icmp_{type,code} in ping_v4_sendmsg genetlink: remove genl_bind net: rmnet: fix lower interface leak perf: Make perf able to build with latest libbfd UPSTREAM: media: v4l2-ctrl: Add H264 profile and levels UPSTREAM: media: v4l2-ctrl: Add control for h.264 chroma qp offset ANDROID: GKI: ASoC: compress: revert some code to avoid race condition ANDROID: GKI: Update the ABI xml representation. ANDROID: GKI: kernel: tick-sched: Add an API for wakeup callbacks ANDROID: ASoC: Compress: Check and set pcm_new driver op Revert "ANDROID: GKI: arm64: gki_defconfig: Disable CONFIG_ARM64_TAGGED_ADDR_ABI" ANDROID: arm64: configs: enabe CONFIG_TMPFS Revert "ALSA: compress: fix partial_drain completion state" ANDROID: GKI: enable CONFIG_EXT4_FS_POSIX_ACL. ANDROID: GKI: set CONFIG_STATIC_USERMODEHELPER_PATH Linux 4.19.133 s390/mm: fix huge pte soft dirty copying ARC: elf: use right ELF_ARCH ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE dm: use noio when sending kobject event drm/radeon: fix double free btrfs: fix fatal extent_buffer readahead vs releasepage race Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb" bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok() kprobes: Do not expose probe addresses to non-CAP_SYSLOG module: Do not expose section addresses to non-CAP_SYSLOG module: Refactor section attr into bin attribute kernel: module: Use struct_size() helper kallsyms: Refactor kallsyms_show_value() to take cred KVM: x86: Mark CR4.TSD as being possibly owned by the guest KVM: x86: Inject #GP if guest attempts to toggle CR4.LA57 in 64-bit mode KVM: x86: bit 8 of non-leaf PDPEs is not reserved KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART KVM: arm64: Fix definition of PAGE_HYP_DEVICE ALSA: usb-audio: add quirk for MacroSilicon MS2109 ALSA: hda - let hs_mic be picked ahead of hp_mic ALSA: opl3: fix infoleak in opl3 mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON() net: macb: mark device wake capable when "magic-packet" property present bnxt_en: fix NULL dereference in case SR-IOV configuration fails cxgb4: fix all-mask IP address comparison nbd: Fix memory leak in nbd_add_socket arm64: kgdb: Fix single-step exception handling oops ALSA: compress: fix partial_drain completion state net: hns3: fix use-after-free when doing self test smsc95xx: avoid memory leak in smsc95xx_bind smsc95xx: check return value of smsc95xx_reset net: cxgb4: fix return error value in t4_prep_fw drm/mediatek: Check plane visibility in atomic_update net: qrtr: Fix an out of bounds read qrtr_endpoint_post() x86/entry: Increase entry_stack size to a full page nvme-rdma: assign completion vector correctly block: release bip in a right way in error path usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work scsi: mptscsih: Fix read sense data size ARM: imx6: add missing put_device() call in imx6q_suspend_init() cifs: update ctime and mtime during truncate s390/kasan: fix early pgm check handler execution drm: panel-orientation-quirks: Use generic orientation-data for Acer S1003 drm: panel-orientation-quirks: Add quirk for Asus T101HA panel i40e: protect ring accesses with READ- and WRITE_ONCE ixgbe: protect ring accesses with READ- and WRITE_ONCE spi: spidev: fix a potential use-after-free in spidev_release() spi: spidev: fix a race between spidev_release and spidev_remove gpu: host1x: Detach driver on unregister drm/tegra: hub: Do not enable orphaned window group ARM: dts: omap4-droid4: Fix spi configuration and increase rate regmap: fix alignment issue spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths spi: spi-fsl-dspi: use IRQF_SHARED mode to request IRQ spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer spi: spi-fsl-dspi: Adding shutdown hook KVM: s390: reduce number of IO pins to 1 ANDROID: GKI: update abi based on padding fields being added ANDROID: GKI: USB: Gadget: add Android ABI padding to struct usb_gadget ANDROID: GKI: sound/usb/card.h: add Android ABI padding to struct snd_usb_endpoint ANDROID: fscrypt: fix DUN contiguity with inline encryption + IV_INO_LBLK_32 policies ANDROID: f2fs: add back compress inode check Linux 4.19.132 efi: Make it possible to disable efivar_ssdt entirely dm zoned: assign max_io_len correctly irqchip/gic: Atomically update affinity MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen cifs: Fix the target file was deleted when rename failed. SMB3: Honor lease disabling for multiuser mounts SMB3: Honor persistent/resilient handle flags for multiuser mounts SMB3: Honor 'seal' flag for multiuser mounts Revert "ALSA: usb-audio: Improve frames size computation" nfsd: apply umask on fs without ACL support i2c: mlxcpld: check correct size of maximum RECV_LEN packet i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665 nvme: fix a crash in nvme_mpath_add_disk SMB3: Honor 'posix' flag for multiuser mounts virtio-blk: free vblk-vqs in error path of virtblk_probe() drm: sun4i: hdmi: Remove extra HPD polling hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add() hwmon: (max6697) Make sure the OVERT mask is set correctly cxgb4: fix SGE queue dump destination buffer context cxgb4: use correct type for all-mask IP address comparison cxgb4: parse TC-U32 key values and masks natively cxgb4: use unaligned conversion for fetching timestamp drm/msm/dpu: fix error return code in dpu_encoder_init crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock() kgdb: Avoid suspicious RCU usage warning nvme-multipath: fix deadlock between ana_work and scan_work nvme-multipath: set bdi capabilities once s390/debug: avoid kernel warning on too large number of pages usb: usbtest: fix missing kfree(dev->buf) in usbtest_disconnect mm/slub: fix stack overruns with SLUB_STATS mm/slub.c: fix corrupted freechain in deactivate_slab() usbnet: smsc95xx: Fix use-after-free after removal EDAC/amd64: Read back the scrub rate PCI register on F15h mm: fix swap cache node allocation mask btrfs: fix a block group ref counter leak after failure to remove block group ANDROID: Update ABI representation for libabigail update ANDROID: Update the ABI representation ANDROID: Update the ABI xml representation ANDROID: GKI: fix ABI diffs caused by GPU heap and pool vmstat additions ANDROID: sched: consider stune boost margin when computing energy ANDROID: GKI: move abi files to android/ ANDROID: GKI: drop unneeded "_whitelist" off of symbol filenames UPSTREAM: binder: fix null deref of proc->context ANDROID: cpufreq: schedutil: maintain raw cache when next_f is not changed UPSTREAM: net: bpf: Make bpf_ktime_get_ns() available to non GPL programs UPSTREAM: usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle ANDROID: GKI: scripts: Makefile: update the lz4 command (#2) ANDROID: Update the ABI xml representation Revert "drm/dsi: Fix byte order of DCS set/get brightness" Linux 4.19.131 Revert "tty: hvc: Fix data abort due to race in hvc_open" xfs: add agf freeblocks verify in xfs_agf_verify dm writecache: add cond_resched to loop in persistent_memory_claim() dm writecache: correct uncommitted_block when discarding uncommitted entry NFSv4 fix CLOSE not waiting for direct IO compeletion pNFS/flexfiles: Fix list corruption if the mirror count changes SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment() sunrpc: fixed rollback in rpc_gssd_dummy_populate() Staging: rtl8723bs: prevent buffer overflow in update_sta_support_rate() drm/radeon: fix fb_div check in ni_init_smc_spll_table() drm: rcar-du: Fix build error ring-buffer: Zero out time extend if it is nested and not absolute tracing: Fix event trigger to accept redundant spaces arm64: perf: Report the PC value in REGS_ABI_32 mode ocfs2: fix panic on nfs server over ocfs2 ocfs2: fix value of OCFS2_INVALID_SLOT ocfs2: load global_inode_alloc ocfs2: avoid inode removal while nfsd is accessing it mm/slab: use memzero_explicit() in kzfree() btrfs: fix failure of RWF_NOWAIT write into prealloc extent beyond eof btrfs: fix data block group relocation failure due to concurrent scrub x86/asm/64: Align start of __clear_user() loop to 16-bytes KVM: nVMX: Plumb L2 GPA through to PML emulation KVM: X86: Fix MSR range of APIC registers in X2APIC mode erofs: fix partially uninitialized misuse in z_erofs_onlinepage_fixup ACPI: sysfs: Fix pm_profile_attr type ALSA: hda/realtek - Add quirk for MSI GE63 laptop ALSA: hda: Add NVIDIA codec IDs 9a & 9d through a0 to patch table RISC-V: Don't allow write+exec only page mapping request in mmap blktrace: break out of blktrace setup on concurrent calls kbuild: improve cc-option to clean up all temporary files arm64: sve: Fix build failure when ARM64_SVE=y and SYSCTL=n s390/vdso: fix vDSO clock_getres() s390/ptrace: fix setting syscall number net: alx: fix race condition in alx_remove ibmvnic: Harden device login requests hwrng: ks-sa - Fix runtime PM imbalance on error riscv/atomic: Fix sign extension for RV64I drm/amd/display: Use kfree() to free rgb_user in calculate_user_regamma_ramp() ata/libata: Fix usage of page address by page_address in ata_scsi_mode_select_xlat function sata_rcar: handle pm_runtime_get_sync failure cases sched/core: Fix PI boosting between RT and DEADLINE tasks sched/deadline: Initialize ->dl_boosted i2c: core: check returned size of emulated smbus block read i2c: fsi: Fix the port number field in status register net: bcmgenet: use hardware padding of runt frames netfilter: ipset: fix unaligned atomic access usb: gadget: udc: Potential Oops in error handling code ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram() cxgb4: move handling L2T ARP failures to caller net: qed: fix excessive QM ILT lines consumption net: qed: fix NVMe login fails over VFs net: qed: fix left elements count calculation RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() ASoC: rockchip: Fix a reference count leak. RDMA/cma: Protect bind_list and listen_list while finding matching cm id RDMA/qedr: Fix KASAN: use-after-free in ucma_event_handler+0x532 rxrpc: Fix handling of rwind from an ACK packet ARM: dts: NSP: Correct FA2 mailbox node regmap: Fix memory leak from regmap_register_patch x86/resctrl: Fix a NULL vs IS_ERR() static checker warning in rdt_cdp_peer_get() ARM: dts: Fix duovero smsc interrupt for suspend ASoC: fsl_ssi: Fix bclk calculation for mono channel regualtor: pfuze100: correct sw1a/sw2 on pfuze3000 efi/esrt: Fix reference count leak in esre_create_sysfs_entry. ASoC: q6asm: handle EOS correctly xfrm: Fix double ESP trailer insertion in IPsec crypto offload. cifs/smb3: Fix data inconsistent when zero file range cifs/smb3: Fix data inconsistent when punch hole IB/mad: Fix use after free when destroying MAD agent loop: replace kill_bdev with invalidate_bdev cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip xhci: Return if xHCI doesn't support LPM xhci: Fix enumeration issue when setting max packet size for FS devices. xhci: Fix incorrect EP_STATE_MASK scsi: zfcp: Fix panic on ERP timeout for previously dismissed ERP action ALSA: usb-audio: Fix OOB access of mixer element list ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG) ALSA: usb-audio: add quirk for Denon DCD-1500RE usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() xhci: Poll for U0 after disabling USB2 LPM usb: host: xhci-mtk: avoid runtime suspend when removing hcd USB: ehci: reopen solution for Synopsys HC bug usb: add USB_QUIRK_DELAY_INIT for Logitech C922 usb: dwc2: Postponed gadget registration to the udc class driver USB: ohci-sm501: Add missed iounmap() in remove net: core: reduce recursion limit value net: Do not clear the sock TX queue in sk_set_socket() net: Fix the arp error in some cases sch_cake: don't call diffserv parsing code when it is not needed tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT sch_cake: fix a few style nits sch_cake: don't try to reallocate or unshare skb unconditionally ip_tunnel: fix use-after-free in ip_tunnel_lookup() net: phy: Check harder for errors in get_phy_id() ip6_gre: fix use-after-free in ip6gre_tunnel_lookup() tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes tcp: grow window for OOO packets only for SACK flows tcp: don't ignore ECN CWR on pure ACK sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket rxrpc: Fix notification call on completion of discarded calls rocker: fix incorrect error handling in dma_rings_init net: usb: ax88179_178a: fix packet alignment padding net: increment xmit_recursion level in dev_direct_xmit() net: use correct this_cpu primitive in dev_recursion_level net: place xmit recursion in softnet data net: fix memleak in register_netdevice() net: bridge: enfore alignment for ethernet address mld: fix memory leak in ipv6_mc_destroy_dev() ibmveth: Fix max MTU limit apparmor: don't try to replace stale label in ptraceme check ALSA: hda/realtek - Enable micmute LED on and HP system ALSA: hda/realtek: Enable mute LED on an HP system ALSA: hda/realtek - Enable the headset of ASUS B9450FA with ALC294 fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()" i2c: tegra: Fix Maximum transfer size i2c: tegra: Add missing kerneldoc for some fields i2c: tegra: Cleanup kerneldoc comments EDAC/amd64: Add Family 17h Model 30h PCI IDs net: sched: export __netdev_watchdog_up() net: bcmgenet: remove HFB_CTRL access mtd: rawnand: marvell: Fix the condition on a return code fanotify: fix ignore mask logic for events on child and on dir block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed net: be more gentle about silly gso requests coming from user ANDROID: lib/vdso: do not update timespec if clock_getres() fails Revert "ANDROID: fscrypt: add key removal notifier chain" ANDROID: update the ABI xml and qcom whitelist ANDROID: fs: export vfs_{read|write} ANDROID: GKI: update abi definitions now that sdcardfs is gone Revert "ANDROID: sdcardfs: Enable modular sdcardfs" Revert "ANDROID: vfs: Add setattr2 for filesystems with per mount permissions" Revert "ANDROID: vfs: fix export symbol type" Revert "ANDROID: vfs: Add permission2 for filesystems with per mount permissions" Revert "ANDROID: vfs: fix export symbol types" Revert "ANDROID: vfs: add d_canonical_path for stacked filesystem support" Revert "ANDROID: fs: Restore vfs_path_lookup() export" ANDROID: sdcardfs: remove sdcardfs from system Revert "ALSA: usb-audio: Improve frames size computation" ANDROID: Makefile: append BUILD_NUMBER to version string when defined ANDROID: GKI: Update ABI for incremental fs ANDROID: GKI: Update cuttlefish whitelist ANDROID: GKI: Disable INCREMENTAL_FS on x86 too ANDROID: cpufreq: schedutil: drop cache when update skipped due to rate limit Linux 4.19.130 KVM: x86/mmu: Set mmio_value to '0' if reserved #PF can't be generated kvm: x86: Fix reserved bits related calculation errors caused by MKTME kvm: x86: Move kvm_set_mmio_spte_mask() from x86.c to mmu.c md: add feature flag MD_FEATURE_RAID0_LAYOUT Revert "dpaa_eth: fix usage as DSA master, try 3" net: core: device_rename: Use rwsem instead of a seqcount sched/rt, net: Use CONFIG_PREEMPTION.patch kretprobe: Prevent triggering kretprobe from within kprobe_flush_task net: octeon: mgmt: Repair filling of RX ring e1000e: Do not wake up the system via WOL if device wakeup is disabled kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex crypto: algboss - don't wait during notifier callback crypto: algif_skcipher - Cap recv SG list at ctx->used drm/i915/icl+: Fix hotplug interrupt disabling after storm detection drm/i915: Whitelist context-local timestamp in the gen9 cmdparser s390: fix syscall_get_error for compat processes mtd: rawnand: tmio: Fix the probe error path mtd: rawnand: mtk: Fix the probe error path mtd: rawnand: plat_nand: Fix the probe error path mtd: rawnand: socrates: Fix the probe error path mtd: rawnand: oxnas: Fix the probe error path mtd: rawnand: oxnas: Add of_node_put() mtd: rawnand: orion: Fix the probe error path mtd: rawnand: xway: Fix the probe error path mtd: rawnand: sharpsl: Fix the probe error path mtd: rawnand: diskonchip: Fix the probe error path mtd: rawnand: Pass a nand_chip object to nand_release() mtd: rawnand: Pass a nand_chip object to nand_scan() block: nr_sects_write(): Disable preemption on seqcount write x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld drm/dp_mst: Increase ACT retry timeout to 3s ext4: avoid race conditions when remounting with options that change dax ext4: fix partial cluster initialization when splitting extent selinux: fix double free drm/amdgpu: Replace invalid device ID with a valid device ID drm/qxl: Use correct notify port address when creating cursor ring drm/dp_mst: Reformat drm_dp_check_act_status() a bit drm: encoder_slave: fix refcouting error for modules libata: Use per port sync for detach arm64: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints block: Fix use-after-free in blkdev_get() afs: afs_write_end() should change i_size under the right lock afs: Fix non-setting of mtime when writing into mmap bcache: fix potential deadlock problem in btree_gc_coalesce ext4: stop overwrite the errcode in ext4_setup_super perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() usb/ehci-platform: Set PM runtime as active on resume usb: host: ehci-platform: add a quirk to avoid stuck usb/xhci-plat: Set PM runtime as active on resume xdp: Fix xsk_generic_xmit errno net/filter: Permit reading NET in load_bytes_relative when MAC not set x86/idt: Keep spurious entries unset in system_vectors scsi: acornscsi: Fix an error handling path in acornscsi_probe() drm/sun4i: hdmi ddc clk: Fix size of m divider ASoC: rt5645: Add platform-data for Asus T101HA ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT10-A tablet ASoC: core: only convert non DPCM link to DPCM link afs: Fix memory leak in afs_put_sysnames() selftests/net: in timestamping, strncpy needs to preserve null byte drivers/perf: hisi: Fix wrong value for all counters enable NTB: ntb_test: Fix bug when counting remote files NTB: perf: Fix race condition when run with ntb_test NTB: perf: Fix support for hardware that doesn't have port numbers NTB: perf: Don't require one more memory window than number of peers NTB: Revert the change to use the NTB device dev for DMA allocations NTB: ntb_tool: reading the link file should not end in a NULL byte ntb_tool: pass correct struct device to dma_alloc_coherent ntb_perf: pass correct struct device to dma_alloc_coherent gfs2: fix use-after-free on transaction ail lists blktrace: fix endianness for blk_log_remap() blktrace: fix endianness in get_pdu_int() blktrace: use errno instead of bi_status selftests/vm/pkeys: fix alloc_random_pkey() to make it really random elfnote: mark all .note sections SHF_ALLOC include/linux/bitops.h: avoid clang shift-count-overflow warnings lib/zlib: remove outdated and incorrect pre-increment optimization geneve: change from tx_error to tx_dropped on missing metadata crypto: omap-sham - add proper load balancing support for multicore pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' pinctrl: imxl: Fix an error handling path in 'imx1_pinctrl_core_probe()' scsi: ufs: Don't update urgent bkops level when toggling auto bkops scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj gfs2: Allow lock_nolock mount to specify jid=X openrisc: Fix issue with argument clobbering for clone/fork rxrpc: Adjust /proc/net/rxrpc/calls to display call->debug_id not user_ID vfio/mdev: Fix reference count leak in add_mdev_supported_type ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed extcon: adc-jack: Fix an error handling path in 'adc_jack_probe()' powerpc/4xx: Don't unmap NULL mbase of: Fix a refcounting bug in __of_attach_node_sysfs() NFSv4.1 fix rpc_call_done assignment for BIND_CONN_TO_SESSION net: sunrpc: Fix off-by-one issues in 'rpc_ntop6' clk: sprd: return correct type of value for _sprd_pll_recalc_rate KVM: PPC: Book3S HV: Ignore kmemleak false positives scsi: ufs-qcom: Fix scheduling while atomic issue clk: bcm2835: Fix return type of bcm2835_register_gate scsi: target: tcmu: Fix a use after free in tcmu_check_expired_queue_cmd() ASoC: fix incomplete error-handling in img_i2s_in_probe. x86/apic: Make TSC deadline timer detection message visible RDMA/iw_cxgb4: cleanup device debugfs entries on ULD remove usb: gadget: Fix issue with config_ep_by_speed function usb: gadget: fix potential double-free in m66592_probe. usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke usb: dwc2: gadget: move gadget resume after the core is in L0 state watchdog: da9062: No need to ping manually before setting timeout IB/cma: Fix ports memory leak in cma_configfs PCI: dwc: Fix inner MSI IRQ domain registration PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port dm zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone powerpc/64s/pgtable: fix an undefined behaviour arm64: tegra: Fix ethernet phy-mode for Jetson Xavier scsi: target: tcmu: Userspace must not complete queued commands clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1 fpga: dfl: afu: Corrected error handling levels tty: n_gsm: Fix bogus i++ in gsm_data_kick USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT8-A tablet drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation usb/ohci-platform: Fix a warning when hibernating vfio-pci: Mask cap zero powerpc/ps3: Fix kexec shutdown hang powerpc/pseries/ras: Fix FWNMI_VALID off by one ipmi: use vzalloc instead of kmalloc for user creation HID: Add quirks for Trust Panora Graphic Tablet tty: n_gsm: Fix waking up upper tty layer when room available tty: n_gsm: Fix SOF skipping powerpc/64: Don't initialise init_task->thread.regs PCI: Fix pci_register_host_bridge() device_register() error handling clk: ti: composite: fix memory leak dlm: remove BUG() before panic() pinctrl: rockchip: fix memleak in rockchip_dt_node_to_map scsi: mpt3sas: Fix double free warnings power: supply: smb347-charger: IRQSTAT_D is volatile power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()' scsi: qla2xxx: Fix warning after FC target reset PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges PCI: rcar: Fix incorrect programming of OB windows drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish serial: amba-pl011: Make sure we initialize the port.lock spinlock i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths staging: sm750fb: add missing case while setting FB_VISUAL usb: dwc3: gadget: Properly handle failed kick_transfer thermal/drivers/ti-soc-thermal: Avoid dereferencing ERR_PTR slimbus: ngd: get drvdata from correct device tty: hvc: Fix data abort due to race in hvc_open s390/qdio: put thinint indicator after early error ALSA: usb-audio: Fix racy list management in output queue ALSA: usb-audio: Improve frames size computation staging: gasket: Fix mapping refcnt leak when register/store fails staging: gasket: Fix mapping refcnt leak when put attribute fails firmware: qcom_scm: fix bogous abuse of dma-direct internals pinctrl: rza1: Fix wrong array assignment of rza1l_swio_entries scsi: qedf: Fix crash when MFW calls for protocol stats while function is still probing gpio: dwapb: Append MODULE_ALIAS for platform driver ARM: dts: sun8i-h2-plus-bananapi-m2-zero: Fix led polarity scsi: qedi: Do not flush offload work if ARP not resolved arm64: dts: mt8173: fix unit name warnings staging: greybus: fix a missing-check bug in gb_lights_light_config() x86/purgatory: Disable various profiling and sanitizing options apparmor: fix nnp subset test for unconfined scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM scsi: sr: Fix sr_probe() missing deallocate of device minor ASoC: meson: add missing free_irq() in error path apparmor: check/put label on apparmor_sk_clone_security() apparmor: fix introspection of of task mode for unconfined tasks mksysmap: Fix the mismatch of '.L' symbols in System.map NTB: Fix the default port and peer numbers for legacy drivers NTB: ntb_pingpong: Choose doorbells based on port number yam: fix possible memory leak in yam_init_driver pwm: img: Call pm_runtime_put() in pm_runtime_get_sync() failed case powerpc/crashkernel: Take "mem=" option into account PCI: vmd: Filter resource type bits from shadow register nfsd: Fix svc_xprt refcnt leak when setup callback client failed powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run clk: clk-flexgen: fix clock-critical handling scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event mfd: wm8994: Fix driver operation if loaded as modules gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration m68k/PCI: Fix a memory leak in an error handling path RDMA/mlx5: Add init2init as a modify command vfio/pci: fix memory leaks in alloc_perm_bits() ps3disk: use the default segment boundary PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register dm mpath: switch paths in dm_blk_ioctl() code path serial: 8250: Fix max baud limit in generic 8250 port usblp: poison URBs upon disconnect clk: samsung: Mark top ISP and CAM clocks on Exynos542x as critical i2c: pxa: clear all master action bits in i2c_pxa_stop_message() f2fs: report delalloc reserve as non-free in statfs for project quota iio: bmp280: fix compensation of humidity scsi: qla2xxx: Fix issue with adapter's stopping state PCI: Allow pci_resize_resource() for devices on root bus ALSA: isa/wavefront: prevent out of bounds write in ioctl ALSA: hda/realtek - Introduce polarity for micmute LED GPIO scsi: qedi: Check for buffer overflow in qedi_set_path() ARM: integrator: Add some Kconfig selections ASoC: davinci-mcasp: Fix dma_chan refcnt leak when getting dma type backlight: lp855x: Ensure regulators are disabled on probe failure clk: qcom: msm8916: Fix the address location of pll->config_reg remoteproc: Fix IDR initialisation in rproc_alloc() iio: pressure: bmp280: Tolerate IRQ before registering i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets ASoC: tegra: tegra_wm8903: Support nvidia, headset property clk: sunxi: Fix incorrect usage of round_down() power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select ANDROID: ext4: Optimize match for casefolded encrypted dirs ANDROID: ext4: Handle casefolding with encryption ANDROID: extcon: Remove redundant EXPORT_SYMBOL_GPL ANDROID: update the ABI xml representation ANDROID: GKI: cfg80211: add ABI changes for CONFIG_NL80211_TESTMODE ANDROID: gki_defconfig: x86: Enable KERNEL_LZ4 ANDROID: GKI: scripts: Makefile: update the lz4 command FROMLIST: f2fs: fix use-after-free when accessing bio->bi_crypt_context UPSTREAM: fdt: Update CRC check for rng-seed ANDROID: GKI: Update ABI for incremental fs ANDROID: GKI: Update whitelist and defconfig for incfs ANDROID: Use depmod from the hermetic toolchain Linux 4.19.129 perf symbols: Fix debuginfo search for Ubuntu perf probe: Check address correctness by map instead of _etext perf probe: Fix to check blacklist address correctly perf probe: Do not show the skipped events w1: omap-hdq: cleanup to add missing newline for some dev_dbg mtd: rawnand: pasemi: Fix the probe error path mtd: rawnand: brcmnand: fix hamming oob layout sunrpc: clean up properly in gss_mech_unregister() sunrpc: svcauth_gss_register_pseudoflavor must reject duplicate registrations. kbuild: force to build vmlinux if CONFIG_MODVERSION=y powerpc/64s: Save FSCR to init_task.thread.fscr after feature init powerpc/64s: Don't let DT CPU features set FSCR_DSCR drivers/macintosh: Fix memleak in windfarm_pm112 driver ARM: dts: s5pv210: Set keep-power-in-suspend for SDHCI1 on Aries ARM: dts: at91: sama5d2_ptc_ek: fix vbus pin ARM: dts: exynos: Fix GPIO polarity for thr GalaxyS3 CM36651 sensor's bus ARM: tegra: Correct PL310 Auxiliary Control Register initialization kernel/cpu_pm: Fix uninitted local in cpu_pm alpha: fix memory barriers so that they conform to the specification dm crypt: avoid truncating the logical block size sparc64: fix misuses of access_process_vm() in genregs32_[sg]et() sparc32: fix register window handling in genregs32_[gs]et() gnss: sirf: fix error return code in sirf_probe() pinctrl: samsung: Save/restore eint_mask over suspend for EINT_TYPE GPIOs pinctrl: samsung: Correct setting of eint wakeup mask on s5pv210 power: vexpress: add suppress_bind_attrs to true igb: Report speed and duplex as unknown when device is runtime suspended media: ov5640: fix use of destroyed mutex b43_legacy: Fix connection problem with WPA3 b43: Fix connection problem with WPA3 b43legacy: Fix case where channel status is corrupted Bluetooth: hci_bcm: fix freeing not-requested IRQ media: go7007: fix a miss of snd_card_free carl9170: remove P2P_GO support e1000e: Relax condition to trigger reset for ME workaround e1000e: Disable TSO for buffer overrun workaround PCI: Program MPS for RCiEP devices ima: Call ima_calc_boot_aggregate() in ima_eventdigest_init() btrfs: fix wrong file range cleanup after an error filling dealloc range btrfs: fix error handling when submitting direct I/O bio PCI: Generalize multi-function power dependency device links PCI: Unify ACS quirk desired vs provided checking PCI: Make ACS quirk implementations more uniform serial: 8250_pci: Move Pericom IDs to pci_ids.h PCI: Add Loongson vendor ID x86/amd_nb: Add Family 19h PCI IDs PCI: vmd: Add device id for VMD device 8086:9A0B PCI: Add Amazon's Annapurna Labs vendor ID PCI: Add Genesys Logic, Inc. Vendor ID ALSA: lx6464es - add support for LX6464ESe pci express variant x86/amd_nb: Add PCI device IDs for family 17h, model 70h PCI: mediatek: Add controller support for MT7629 PCI: Enable NVIDIA HDA controllers PCI: Add NVIDIA GPU multi-function power dependencies PCI: Add Synopsys endpoint EDDA Device ID misc: pci_endpoint_test: Add support to test PCI EP in AM654x misc: pci_endpoint_test: Add the layerscape EP device support PCI: Move Rohm Vendor ID to generic list PCI: Move Synopsys HAPS platform device IDs PCI: add USR vendor id and use it in r8169 and w6692 driver x86/amd_nb: Add PCI device IDs for family 17h, model 30h hwmon/k10temp, x86/amd_nb: Consolidate shared device IDs pci:ipmi: Move IPMI PCI class id defines to pci_ids.h PCI: Remove unused NFP32xx IDs PCI: Add ACS quirk for Intel Root Complex Integrated Endpoints PCI: Add ACS quirk for iProc PAXB PCI: Avoid FLR for AMD Starship USB 3.0 PCI: Avoid FLR for AMD Matisse HD Audio & USB 3.0 PCI: Avoid Pericom USB controller OHCI/EHCI PME# defect ext4: fix race between ext4_sync_parent() and rename() ext4: fix error pointer dereference ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max evm: Fix possible memory leak in evm_calc_hmac_or_hash() ima: Directly assign the ima_default_policy pointer to ima_rules ima: Fix ima digest hash table key calculation mm: initialize deferred pages with interrupts enabled mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked() btrfs: send: emit file capabilities after chown btrfs: include non-missing as a qualifier for the latest_bdev string.h: fix incompatibility between FORTIFY_SOURCE and KASAN platform/x86: intel-vbtn: Only blacklist SW_TABLET_MODE on the 9 / "Laptop" chasis-type platform/x86: intel-hid: Add a quirk to support HP Spectre X2 (2015) platform/x86: hp-wmi: Convert simple_strtoul() to kstrtou32() cpuidle: Fix three reference count leaks spi: dw: Return any value retrieved from the dma_transfer callback mmc: sdhci-esdhc-imx: fix the mask for tuning start point ixgbe: fix signed-integer-overflow warning mmc: via-sdmmc: Respect the cmd->busy_timeout from the mmc core staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core mmc: sdhci-msm: Set SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 quirk bcache: fix refcount underflow in bcache_device_free() MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe() PCI: Don't disable decoding when mmio_always_on is set macvlan: Skip loopback packets in RX handler btrfs: qgroup: mark qgroup inconsistent if we're inherting snapshot to a new qgroup m68k: mac: Don't call via_flush_cache() on Mac IIfx x86/mm: Stop printing BRK addresses crypto: stm32/crc32 - fix multi-instance crypto: stm32/crc32 - fix run-time self test issue. crypto: stm32/crc32 - fix ext4 chksum BUG_ON() mips: Add udelay lpj numbers adjustment mips: MAAR: Use more precise address mask x86/boot: Correct relocation destination on old linkers mwifiex: Fix memory corruption in dump_station rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup() net/mlx5e: IPoIB, Drop multicast packets that this interface sent veth: Adjust hard_start offset on redirect XDP frames md: don't flush workqueue unconditionally in md_open mt76: avoid rx reorder buffer overflow net: qed*: Reduce RX and TX default ring count when running inside kdump kernel wcn36xx: Fix error handling path in 'wcn36xx_probe()' ath10k: Remove msdu from idr when management pkt send fails nvme: refine the Qemu Identify CNS quirk platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types platform/x86: intel-vbtn: Do not advertise switches to userspace if they are not there platform/x86: intel-vbtn: Split keymap into buttons and switches parts platform/x86: intel-vbtn: Use acpi_evaluate_integer() xfs: fix duplicate verification from xfs_qm_dqflush() xfs: reset buffer write failure state on successful completion kgdb: Fix spurious true from in_dbg_master() mips: cm: Fix an invalid error code of INTVN_*_ERR MIPS: Truncate link address into 32bit for 32bit kernel Crypto/chcr: fix for ccm(aes) failed test xfs: clean up the error handling in xfs_swap_extents powerpc/spufs: fix copy_to_user while atomic net: allwinner: Fix use correct return type for ndo_start_xmit() media: cec: silence shift wrapping warning in __cec_s_log_addrs() net: lpc-enet: fix error return code in lpc_mii_init() drivers/perf: hisi: Fix typo in events attribute array sched/core: Fix illegal RCU from offline CPUs exit: Move preemption fixup up, move blocking operations down lib/mpi: Fix 64-bit MIPS build with Clang net: bcmgenet: set Rx mode before starting netif selftests/bpf: Fix memory leak in extract_build_id() netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported audit: fix a net reference leak in audit_list_rules_send() Bluetooth: btbcm: Add 2 missing models to subver tables MIPS: Make sparse_init() using top-down allocation media: platform: fcp: Set appropriate DMA parameters media: dvb: return -EREMOTEIO on i2c transfer failure. audit: fix a net reference leak in audit_send_reply() dt-bindings: display: mediatek: control dpi pins mode to avoid leakage e1000: Distribute switch variables for initialization tools api fs: Make xxx__mountpoint() more scalable brcmfmac: fix wrong location to get firmware feature staging: android: ion: use vmap instead of vm_map_ram net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss() x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit spi: dw: Fix Rx-only DMA transfers mmc: meson-mx-sdio: trigger a soft reset after a timeout or CRC error batman-adv: Revert "disable ethtool link speed detection when auto negotiation off" ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums clocksource: dw_apb_timer_of: Fix missing clockevent timers clocksource: dw_apb_timer: Make CPU-affiliation being optional spi: dw: Enable interrupts in accordance with DMA xfer mode kgdb: Prevent infinite recursive entries to the debugger kgdb: Disable WARN_CONSOLE_UNLOCKED for all kgdb Bluetooth: Add SCO fallback for invalid LMP parameters error MIPS: Loongson: Build ATI Radeon GPU driver as module ixgbe: Fix XDP redirect on archs with PAGE_SIZE above 4K arm64: insn: Fix two bugs in encoding 32-bit logical immediates spi: dw: Zero DMA Tx and Rx configurations on stack arm64: cacheflush: Fix KGDB trap detection efi/libstub/x86: Work around LLVM ELF quirk build regression net: ena: fix error returning in ena_com_get_hash_function() net: atlantic: make hw_get_regs optional spi: pxa2xx: Apply CS clk quirk to BXT objtool: Ignore empty alternatives media: si2157: Better check for running tuner in init crypto: ccp -- don't "select" CONFIG_DMADEVICES drm: bridge: adv7511: Extend list of audio sample rates ACPI: GED: use correct trigger type field in _Exx / _Lxx handling KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception xen/pvcalls-back: test for errors when calling backend_connect() mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card() ARM: dts: at91: sama5d2_ptc_ek: fix sdmmc0 node description mmc: sdhci-msm: Clear tuning done flag while hs400 tuning agp/intel: Reinforce the barrier after GTT updates perf: Add cond_resched() to task_function_call() fat: don't allow to mount if the FAT length == 0 mm/slub: fix a memory leak in sysfs_slab_add() drm/vkms: Hold gem object while still in-use Smack: slab-out-of-bounds in vsscanf ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb ath9k: Fix use-after-free Write in ath9k_htc_rx_msg ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx scsi: megaraid_sas: TM command refire leads to controller firmware crash KVM: arm64: Make vcpu_cp1x() work on Big Endian hosts KVM: MIPS: Fix VPN2_MASK definition for variable cpu_vmbits KVM: MIPS: Define KVM_ENTRYHI_ASID to cpu_asid_mask(&boot_cpu_data) KVM: nVMX: Consult only the "basic" exit reason when routing nested exit KVM: nSVM: leave ASID aside in copy_vmcb_control_area KVM: nSVM: fix condition for filtering async PF video: fbdev: w100fb: Fix a potential double free. proc: Use new_inode not new_inode_pseudo ovl: initialize error in ovl_copy_xattr selftests/net: in rxtimestamp getopt_long needs terminating null entry crypto: virtio: Fix dest length calculation in __virtio_crypto_skcipher_do_req() crypto: virtio: Fix src/dst scatterlist calculation in __virtio_crypto_skcipher_do_req() crypto: virtio: Fix use-after-free in virtio_crypto_skcipher_finalize_req() spi: pxa2xx: Fix runtime PM ref imbalance on probe error spi: pxa2xx: Balance runtime PM enable/disable on error spi: bcm2835: Fix controller unregister order spi: pxa2xx: Fix controller unregister order spi: Fix controller unregister order spi: No need to assign dummy value in spi_unregister_controller() x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches. x86/speculation: Avoid force-disabling IBPB based on STIBP and enhanced IBRS. x86/speculation: Add support for STIBP always-on preferred mode x86/speculation: Change misspelled STIPB to STIBP KVM: x86: only do L1TF workaround on affected processors KVM: x86/mmu: Consolidate "is MMIO SPTE" code kvm: x86: Fix L1TF mitigation for shadow MMU KVM: x86: Fix APIC page invalidation race x86/{mce,mm}: Unmap the entire page if the whole page is affected and poisoned ALSA: pcm: disallow linking stream to itself crypto: cavium/nitrox - Fix 'nitrox_get_first_device()' when ndevlist is fully iterated PM: runtime: clk: Fix clk_pm_runtime_get() error path spi: bcm-qspi: when tx/rx buffer is NULL set to 0 spi: bcm2835aux: Fix controller unregister order spi: dw: Fix controller unregister order nilfs2: fix null pointer dereference at nilfs_segctor_do_construct() cgroup, blkcg: Prepare some symbols for module and !CONFIG_CGROUP usages ACPI: PM: Avoid using power resources if there are none for D0 ACPI: GED: add support for _Exx / _Lxx handler methods ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe() ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile() ALSA: usb-audio: Add vendor, product and profile name for HP Thunderbolt Dock ALSA: usb-audio: Fix inconsistent card PM state after resume ALSA: hda/realtek - add a pintbl quirk for several Lenovo machines ALSA: es1688: Add the missed snd_card_free() efi/efivars: Add missing kobject_put() in sysfs entry creation error path x86/reboot/quirks: Add MacBook6,1 reboot quirk x86/speculation: Prevent rogue cross-process SSBD shutdown x86/PCI: Mark Intel C620 MROMs as having non-compliant BARs x86_64: Fix jiffies ODR violation btrfs: tree-checker: Check level for leaves and nodes aio: fix async fsync creds mm: add kvfree_sensitive() for freeing sensitive data objects perf probe: Accept the instance number of kretprobe event x86/cpu/amd: Make erratum #1054 a legacy erratum RDMA/uverbs: Make the event_queue fds return POLLERR when disassociated ath9k_htc: Silence undersized packet warnings powerpc/xive: Clear the page tables for the ESB IO mapping drivers/net/ibmvnic: Update VNIC protocol version reporting Input: synaptics - add a second working PNP_ID for Lenovo T470s sched/fair: Don't NUMA balance for kthreads ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook Input: mms114 - fix handling of mms345l crypto: talitos - fix ECB and CBC algs ivsize btrfs: Detect unbalanced tree with empty leaf before crashing btree operations btrfs: merge btrfs_find_device and find_device lib: Reduce user_access_begin() boundaries in strncpy_from_user() and strnlen_user() x86: uaccess: Inhibit speculation past access_ok() in user_access_begin() arch/openrisc: Fix issues with access_ok() Fix 'acccess_ok()' on alpha and SH make 'user_access_begin()' do 'access_ok()' selftests: bpf: fix use of undeclared RET_IF macro tun: correct header offsets in napi frags mode vxlan: Avoid infinite loop when suppressing NS messages with invalid options bridge: Avoid infinite loop when suppressing NS messages with invalid options net_failover: fixed rollback in net_failover_open() ipv6: fix IPV6_ADDRFORM operation logic writeback: Drop I_DIRTY_TIME_EXPIRE writeback: Fix sync livelock due to b_dirty_time processing writeback: Avoid skipping inode writeback writeback: Protect inode->i_io_list with inode->i_lock Revert "writeback: Avoid skipping inode writeback" ANDROID: gki_defconfig: increase vbus_draw to 500mA fscrypt: remove stale definition fs-verity: remove unnecessary extern keywords fs-verity: fix all kerneldoc warnings fscrypt: add support for IV_INO_LBLK_32 policies fscrypt: make test_dummy_encryption use v2 by default fscrypt: support test_dummy_encryption=v2 fscrypt: add fscrypt_add_test_dummy_key() linux/parser.h: add include guards fscrypt: remove unnecessary extern keywords fscrypt: name all function parameters fscrypt: fix all kerneldoc warnings ANDROID: Update the ABI ANDROID: GKI: power: power-supply: Add POWER_SUPPLY_PROP_CHARGER_STATUS property ANDROID: GKI: add dev to usb_gsi_request ANDROID: GKI: dma-buf: add dent_count to dma_buf ANDROID: Update the ABI xml and whitelist ANDROID: GKI: update whitelist ANDROID: extcon: Export symbol of `extcon_get_edev_name` ANDROID: kbuild: merge more sections with LTO UPSTREAM: timekeeping/vsyscall: Update VDSO data unconditionally ANDROID: GKI: Revert "genetlink: disallow subscribing to unknown mcast groups" BACKPORT: usb: musb: Add support for MediaTek musb controller UPSTREAM: usb: musb: Add musb_clearb/w() interface UPSTREAM: usb: musb: Add noirq type of dma create interface UPSTREAM: usb: musb: Add get/set toggle hooks UPSTREAM: dt-bindings: usb: musb: Add support for MediaTek musb controller FROMGIT: driver core: Remove unnecessary is_fwnode_dev variable in device_add() FROMGIT: driver core: Remove check in driver_deferred_probe_force_trigger() FROMGIT: of: platform: Batch fwnode parsing when adding all top level devices FROMGIT: BACKPORT: driver core: fw_devlink: Add support for batching fwnode parsing BACKPORT: driver core: Look for waiting consumers only for a fwnode's primary device BACKPORT: driver core: Add device links from fwnode only for the primary device Linux 4.19.128 Revert "net/mlx5: Annotate mutex destroy for root ns" uprobes: ensure that uprobe->offset and ->ref_ctr_offset are properly aligned x86/speculation: Add Ivy Bridge to affected list x86/speculation: Add SRBDS vulnerability and mitigation documentation x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation x86/cpu: Add 'table' argument to cpu_matches() x86/cpu: Add a steppings field to struct x86_cpu_id nvmem: qfprom: remove incorrect write support CDC-ACM: heed quirk also in error handling staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK tty: hvc_console, fix crashes on parallel open/close vt: keyboard: avoid signed integer overflow in k_ascii usb: musb: Fix runtime PM imbalance on error usb: musb: start session in resume for host port iio: vcnl4000: Fix i2c swapped word reading. USB: serial: option: add Telit LE910C1-EUX compositions USB: serial: usb_wwan: do not resubmit rx urb on fatal errors USB: serial: qcserial: add DW5816e QDL support net: check untrusted gso_size at kernel entry vsock: fix timeout in vsock_accept() NFC: st21nfca: add missed kfree_skb() in an error path net: usb: qmi_wwan: add Telit LE910C1-EUX composition l2tp: do not use inet_hash()/inet_unhash() l2tp: add sk_family checks to l2tp_validate_socket devinet: fix memleak in inetdev_init() Revert "ANDROID: Remove default y on BRIDGE_IGMP_SNOOPING" ANDROID: Update the ABI xml and whitelist ANDROID: GKI: update whitelist ANDROID: arch: arm64: vdso: export the symbols for time() ANDROID: Incremental fs: Remove dependency on PKCS7_MESSAGE_PARSER ANDROID: dm-bow: Add block_size option f2fs: attach IO flags to the missing cases f2fs: add node_io_flag for bio flags likewise data_io_flag f2fs: remove unused parameter of f2fs_put_rpages_mapping() f2fs: handle readonly filesystem in f2fs_ioc_shutdown() f2fs: avoid utf8_strncasecmp() with unstable name f2fs: don't return vmalloc() memory from f2fs_kmalloc() ANDROID: GKI: set CONFIG_BLK_DEV_LOOP_MIN_COUNT to 16 ANDROID: Incremental fs: Cache successful hash calculations ANDROID: Incremental fs: Fix four error-path bugs Linux 4.19.127 net: smsc911x: Fix runtime PM imbalance on error net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x net/ethernet/freescale: rework quiesce/activate for ucc_geth null_blk: return error for invalid zone size s390/mm: fix set_huge_pte_at() for empty ptes drm/edid: Add Oculus Rift S to non-desktop list net: bmac: Fix read of MAC address from ROM x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables i2c: altera: Fix race between xfer_msg and isr thread evm: Fix RCU list related warnings ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT ARC: Fix ICCM & DCCM runtime size checks s390/ftrace: save traced function caller spi: dw: use "smp_mb()" to avoid sending spi data error powerpc/powernv: Avoid re-registration of imc debugfs directory scsi: hisi_sas: Check sas_port before using it drm/i915: fix port checks for MST support on gen >= 11 airo: Fix read overflows sending packets net: dsa: mt7530: set CPU port to fallback mode scsi: ufs: Release clock if DMA map fails mmc: fix compilation of user API kernel/relay.c: handle alloc_percpu returning NULL in relay_open p54usb: add AirVasT USB stick device-id HID: i2c-hid: add Schneider SCL142ALM to descriptor override HID: sony: Fix for broken buttons on DS3 USB dongles mm: Fix mremap not considering huge pmd devmap libnvdimm: Fix endian conversion issues Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" f2fs: fix retry logic in f2fs_write_cache_pages() ANDROID: Update ABI representation Linux 4.19.126 mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap() netfilter: nf_conntrack_pptp: fix compilation warning with W=1 build bonding: Fix reference count leak in bond_sysfs_slave_add. crypto: chelsio/chtls: properly set tp->lsndtime qlcnic: fix missing release in qlcnic_83xx_interrupt_test. xsk: Add overflow check for u64 division, stored into u32 bnxt_en: Fix accumulation of bp->net_stats_prev. esp6: get the right proto for transport mode in esp6_gso_encap netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code netfilter: nfnetlink_cthelper: unbreak userspace helper support netfilter: ipset: Fix subcounter update skip netfilter: nft_reject_bridge: enable reject with bridge vlan ip_vti: receive ipip packet by calling ip_tunnel_rcv vti4: eliminated some duplicate code. xfrm: fix error in comment xfrm: fix a NULL-ptr deref in xfrm_local_error xfrm: fix a warning in xfrm_policy_insert_list xfrm interface: fix oops when deleting a x-netns interface xfrm: call xfrm_output_gso when inner_protocol is set in xfrm_output xfrm: allow to accept packets with ipv6 NEXTHDR_HOP in xfrm_input copy_xstate_to_kernel(): don't leave parts of destination uninitialized x86/dma: Fix max PFN arithmetic overflow on 32 bit systems mac80211: mesh: fix discovery timer re-arming issue / crash RDMA/core: Fix double destruction of uobject mmc: core: Fix recursive locking issue in CQE recovery path parisc: Fix kernel panic in mem_init() iommu: Fix reference count leak in iommu_group_alloc. include/asm-generic/topology.h: guard cpumask_of_node() macro argument fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() mm: remove VM_BUG_ON(PageSlab()) from page_mapcount() IB/ipoib: Fix double free of skb in case of multicast traffic in CM mode libceph: ignore pool overlay and cache logic on redirects ALSA: hda/realtek - Add new codec supported for ALC287 ALSA: usb-audio: Quirks for Gigabyte TRX40 Aorus Master onboard audio exec: Always set cap_ambient in cap_bprm_set_creds ALSA: usb-audio: mixer: volume quirk for ESS Technology Asus USB DAC ALSA: hda/realtek - Add a model for Thinkpad T570 without DAC workaround ALSA: hwdep: fix a left shifting 1 by 31 UB bug RDMA/pvrdma: Fix missing pci disable in pvrdma_pci_probe() mmc: block: Fix use-after-free issue for rpmb ARM: dts: bcm: HR2: Fix PPI interrupt types ARM: dts: bcm2835-rpi-zero-w: Fix led polarity ARM: dts/imx6q-bx50v3: Set display interface clock parents IB/qib: Call kobject_put() when kobject_init_and_add() fails gpio: exar: Fix bad handling for ida_simple_get error path ARM: uaccess: fix DACR mismatch with nested exceptions ARM: uaccess: integrate uaccess_save and uaccess_restore ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h ARM: 8843/1: use unified assembler in headers ARM: 8970/1: decompressor: increase tag size Input: synaptics-rmi4 - fix error return code in rmi_driver_probe() Input: synaptics-rmi4 - really fix attn_data use-after-free Input: i8042 - add ThinkPad S230u to i8042 reset list Input: dlink-dir685-touchkeys - fix a typo in driver name Input: xpad - add custom init packet for Xbox One S controllers Input: evdev - call input_flush_device() on release(), not flush() Input: usbtouchscreen - add support for BonXeon TP samples: bpf: Fix build error cifs: Fix null pointer check in cifs_read riscv: stacktrace: Fix undefined reference to `walk_stackframe' IB/i40iw: Remove bogus call to netdev_master_upper_dev_get() net: freescale: select CONFIG_FIXED_PHY where needed usb: gadget: legacy: fix redundant initialization warnings usb: dwc3: pci: Enable extcon driver for Intel Merrifield cachefiles: Fix race between read_waiter and read_copier involving op->to_do gfs2: move privileged user check to gfs2_quota_lock_check net: microchip: encx24j600: add missed kthread_stop ALSA: usb-audio: add mapping for ASRock TRX40 Creator gpio: tegra: mask GPIO IRQs during IRQ shutdown ARM: dts: rockchip: fix pinctrl sub nodename for spi in rk322x.dtsi ARM: dts: rockchip: swap clock-names of gpu nodes arm64: dts: rockchip: swap interrupts interrupt-names rk3399 gpu node arm64: dts: rockchip: fix status for &gmac2phy in rk3328-evb.dts ARM: dts: rockchip: fix phy nodename for rk3228-evb mlxsw: spectrum: Fix use-after-free of split/unsplit/type_set in case reload fails net/mlx4_core: fix a memory leak bug. net: sun: fix missing release regions in cas_init_one(). net/mlx5: Annotate mutex destroy for root ns net/mlx5e: Update netdev txq on completions during closure sctp: Start shutdown on association restart if in SHUTDOWN-SENT state and socket is closed sctp: Don't add the shutdown timer if its already been added r8152: support additional Microsoft Surface Ethernet Adapter variant net sched: fix reporting the first-time use timestamp net: revert "net: get rid of an signed integer overflow in ip_idents_reserve()" net: qrtr: Fix passing invalid reference to qrtr_local_enqueue() net/mlx5: Add command entry handling completion net: ipip: fix wrong address family in init error path net: inet_csk: Fix so_reuseport bind-address cache in tb->fast* __netif_receive_skb_core: pass skb by reference net: dsa: mt7530: fix roaming from DSA user ports dpaa_eth: fix usage as DSA master, try 3 ax25: fix setsockopt(SO_BINDTODEVICE) ANDROID: modules: fix lockprove warning FROMGIT: USB: dummy-hcd: use configurable endpoint naming scheme UPSTREAM: usb: raw-gadget: fix null-ptr-deref when reenabling endpoints UPSTREAM: usb: raw-gadget: documentation updates UPSTREAM: usb: raw-gadget: support stalling/halting/wedging endpoints UPSTREAM: usb: raw-gadget: fix gadget endpoint selection UPSTREAM: usb: raw-gadget: improve uapi headers comments UPSTREAM: usb: raw-gadget: fix return value of ep read ioctls UPSTREAM: usb: raw-gadget: fix raw_event_queue_fetch locking UPSTREAM: usb: raw-gadget: Fix copy_to/from_user() checks f2fs: fix wrong discard space f2fs: compress: don't compress any datas after cp stop f2fs: remove unneeded return value of __insert_discard_tree() f2fs: fix wrong value of tracepoint parameter f2fs: protect new segment allocation in expand_inode_data f2fs: code cleanup by removing ifdef macro surrounding writeback: Avoid skipping inode writeback ANDROID: GKI: Update the ABI ANDROID: GKI: update whitelist ANDROID: GKI: support mm_event for FS/IO/UFS path ANDROID: net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu FROMGIT: driver core: Update device link status correctly for SYNC_STATE_ONLY links UPSTREAM: driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links BACKPORT: driver core: Fix SYNC_STATE_ONLY device link implementation ANDROID: Bulk update the ABI xml and qcom whitelist Revert "ANDROID: Incremental fs: Avoid continually recalculating hashes" f2fs: avoid inifinite loop to wait for flushing node pages at cp_error f2fs: compress: fix zstd data corruption f2fs: add compressed/gc data read IO stat f2fs: fix potential use-after-free issue f2fs: compress: don't handle non-compressed data in workqueue f2fs: remove redundant assignment to variable err f2fs: refactor resize_fs to avoid meta updates in progress f2fs: use round_up to enhance calculation f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS f2fs: Avoid double lock for cp_rwsem during checkpoint f2fs: report delalloc reserve as non-free in statfs for project quota f2fs: Fix wrong stub helper update_sit_info f2fs: compress: let lz4 compressor handle output buffer budget properly f2fs: remove blk_plugging in block_operations f2fs: introduce F2FS_IOC_RELEASE_COMPRESS_BLOCKS f2fs: shrink spinlock coverage f2fs: correctly fix the parent inode number during fsync() f2fs: introduce mempool for {,de}compress intermediate page allocation f2fs: introduce f2fs_bmap_compress() f2fs: support fiemap on compressed inode f2fs: support partial truncation on compressed inode f2fs: remove redundant compress inode check f2fs: use strcmp() in parse_options() f2fs: Use the correct style for SPDX License Identifier Conflicts: Documentation/devicetree/bindings Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt Documentation/devicetree/bindings/usb/dwc3.txt drivers/media/v4l2-core/v4l2-ctrls.c drivers/mmc/core/queue.c drivers/mmc/host/sdhci-msm.c drivers/scsi/ufs/ufs-qcom.c drivers/slimbus/qcom-ngd-ctrl.c drivers/usb/gadget/composite.c fs/crypto/keyring.c fs/f2fs/data.c include/linux/fs.h include/linux/usb/gadget.h include/uapi/linux/v4l2-controls.h kernel/sched/cpufreq_schedutil.c kernel/sched/fair.c kernel/time/tick-sched.c mm/vmalloc.c net/netlink/genetlink.c net/qrtr/qrtr.c sound/core/compress_offload.c sound/soc/soc-compress.c Fixed errors: drivers/scsi/ufs/ufshcd.c drivers/soc/qcom/rq_stats.c Change-Id: I06ea6a6c3f239045e2947f27af617aa6f523bfdb Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
4854 lines
148 KiB
C
4854 lines
148 KiB
C
/*
|
|
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
|
* operating system. INET is implemented using the BSD Socket
|
|
* interface as the means of communication with the user level.
|
|
*
|
|
* Definitions for the Interfaces handler.
|
|
*
|
|
* Version: @(#)dev.h 1.0.10 08/12/93
|
|
*
|
|
* Authors: Ross Biro
|
|
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
|
* Corey Minyard <wf-rch!minyard@relay.EU.net>
|
|
* Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
|
|
* Alan Cox, <alan@lxorguk.ukuu.org.uk>
|
|
* Bjorn Ekwall. <bj0rn@blox.se>
|
|
* Pekka Riikonen <priikone@poseidon.pspt.fi>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*
|
|
* Moved to /usr/include/linux for NET3
|
|
*/
|
|
#ifndef _LINUX_NETDEVICE_H
|
|
#define _LINUX_NETDEVICE_H
|
|
|
|
#include <linux/timer.h>
|
|
#include <linux/bug.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/prefetch.h>
|
|
#include <asm/cache.h>
|
|
#include <asm/byteorder.h>
|
|
|
|
#include <linux/percpu.h>
|
|
#include <linux/rculist.h>
|
|
#include <linux/workqueue.h>
|
|
#include <linux/dynamic_queue_limits.h>
|
|
|
|
#include <linux/ethtool.h>
|
|
#include <net/net_namespace.h>
|
|
#ifdef CONFIG_DCB
|
|
#include <net/dcbnl.h>
|
|
#endif
|
|
#include <net/netprio_cgroup.h>
|
|
#include <net/xdp.h>
|
|
|
|
#include <linux/netdev_features.h>
|
|
#include <linux/neighbour.h>
|
|
#include <uapi/linux/netdevice.h>
|
|
#include <uapi/linux/if_bonding.h>
|
|
#include <uapi/linux/pkt_cls.h>
|
|
#include <linux/hashtable.h>
|
|
#include <linux/android_kabi.h>
|
|
|
|
struct netpoll_info;
|
|
struct device;
|
|
struct phy_device;
|
|
struct dsa_port;
|
|
|
|
struct sfp_bus;
|
|
/* 802.11 specific */
|
|
struct wireless_dev;
|
|
/* 802.15.4 specific */
|
|
struct wpan_dev;
|
|
struct mpls_dev;
|
|
/* UDP Tunnel offloads */
|
|
struct udp_tunnel_info;
|
|
struct bpf_prog;
|
|
struct xdp_buff;
|
|
|
|
void netdev_set_default_ethtool_ops(struct net_device *dev,
|
|
const struct ethtool_ops *ops);
|
|
|
|
/* Backlog congestion levels */
|
|
#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
|
|
#define NET_RX_DROP 1 /* packet dropped */
|
|
|
|
/*
|
|
* Transmit return codes: transmit return codes originate from three different
|
|
* namespaces:
|
|
*
|
|
* - qdisc return codes
|
|
* - driver transmit return codes
|
|
* - errno values
|
|
*
|
|
* Drivers are allowed to return any one of those in their hard_start_xmit()
|
|
* function. Real network devices commonly used with qdiscs should only return
|
|
* the driver transmit return codes though - when qdiscs are used, the actual
|
|
* transmission happens asynchronously, so the value is not propagated to
|
|
* higher layers. Virtual network devices transmit synchronously; in this case
|
|
* the driver transmit return codes are consumed by dev_queue_xmit(), and all
|
|
* others are propagated to higher layers.
|
|
*/
|
|
|
|
/* qdisc ->enqueue() return codes. */
|
|
#define NET_XMIT_SUCCESS 0x00
|
|
#define NET_XMIT_DROP 0x01 /* skb dropped */
|
|
#define NET_XMIT_CN 0x02 /* congestion notification */
|
|
#define NET_XMIT_MASK 0x0f /* qdisc flags in net/sch_generic.h */
|
|
|
|
/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
|
|
* indicates that the device will soon be dropping packets, or already drops
|
|
* some packets of the same priority; prompting us to send less aggressively. */
|
|
#define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e))
|
|
#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
|
|
|
|
/* Driver transmit return codes */
|
|
#define NETDEV_TX_MASK 0xf0
|
|
|
|
enum netdev_tx {
|
|
__NETDEV_TX_MIN = INT_MIN, /* make sure enum is signed */
|
|
NETDEV_TX_OK = 0x00, /* driver took care of packet */
|
|
NETDEV_TX_BUSY = 0x10, /* driver tx path was busy*/
|
|
};
|
|
typedef enum netdev_tx netdev_tx_t;
|
|
|
|
/*
|
|
* Current order: NETDEV_TX_MASK > NET_XMIT_MASK >= 0 is significant;
|
|
* hard_start_xmit() return < NET_XMIT_MASK means skb was consumed.
|
|
*/
|
|
static inline bool dev_xmit_complete(int rc)
|
|
{
|
|
/*
|
|
* Positive cases with an skb consumed by a driver:
|
|
* - successful transmission (rc == NETDEV_TX_OK)
|
|
* - error while transmitting (rc < 0)
|
|
* - error while queueing to a different device (rc & NET_XMIT_MASK)
|
|
*/
|
|
if (likely(rc < NET_XMIT_MASK))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* Compute the worst-case header length according to the protocols
|
|
* used.
|
|
*/
|
|
|
|
#if defined(CONFIG_HYPERV_NET)
|
|
# define LL_MAX_HEADER 128
|
|
#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
|
|
# if defined(CONFIG_MAC80211_MESH)
|
|
# define LL_MAX_HEADER 128
|
|
# else
|
|
# define LL_MAX_HEADER 96
|
|
# endif
|
|
#else
|
|
# define LL_MAX_HEADER 32
|
|
#endif
|
|
|
|
#if !IS_ENABLED(CONFIG_NET_IPIP) && !IS_ENABLED(CONFIG_NET_IPGRE) && \
|
|
!IS_ENABLED(CONFIG_IPV6_SIT) && !IS_ENABLED(CONFIG_IPV6_TUNNEL)
|
|
#define MAX_HEADER LL_MAX_HEADER
|
|
#else
|
|
#define MAX_HEADER (LL_MAX_HEADER + 48)
|
|
#endif
|
|
|
|
/*
|
|
* Old network device statistics. Fields are native words
|
|
* (unsigned long) so they can be read and written atomically.
|
|
*/
|
|
|
|
struct net_device_stats {
|
|
unsigned long rx_packets;
|
|
unsigned long tx_packets;
|
|
unsigned long rx_bytes;
|
|
unsigned long tx_bytes;
|
|
unsigned long rx_errors;
|
|
unsigned long tx_errors;
|
|
unsigned long rx_dropped;
|
|
unsigned long tx_dropped;
|
|
unsigned long multicast;
|
|
unsigned long collisions;
|
|
unsigned long rx_length_errors;
|
|
unsigned long rx_over_errors;
|
|
unsigned long rx_crc_errors;
|
|
unsigned long rx_frame_errors;
|
|
unsigned long rx_fifo_errors;
|
|
unsigned long rx_missed_errors;
|
|
unsigned long tx_aborted_errors;
|
|
unsigned long tx_carrier_errors;
|
|
unsigned long tx_fifo_errors;
|
|
unsigned long tx_heartbeat_errors;
|
|
unsigned long tx_window_errors;
|
|
unsigned long rx_compressed;
|
|
unsigned long tx_compressed;
|
|
};
|
|
|
|
|
|
#include <linux/cache.h>
|
|
#include <linux/skbuff.h>
|
|
|
|
#ifdef CONFIG_RPS
|
|
#include <linux/static_key.h>
|
|
extern struct static_key rps_needed;
|
|
extern struct static_key rfs_needed;
|
|
#endif
|
|
|
|
struct neighbour;
|
|
struct neigh_parms;
|
|
struct sk_buff;
|
|
|
|
struct netdev_hw_addr {
|
|
struct list_head list;
|
|
unsigned char addr[MAX_ADDR_LEN];
|
|
unsigned char type;
|
|
#define NETDEV_HW_ADDR_T_LAN 1
|
|
#define NETDEV_HW_ADDR_T_SAN 2
|
|
#define NETDEV_HW_ADDR_T_SLAVE 3
|
|
#define NETDEV_HW_ADDR_T_UNICAST 4
|
|
#define NETDEV_HW_ADDR_T_MULTICAST 5
|
|
bool global_use;
|
|
int sync_cnt;
|
|
int refcount;
|
|
int synced;
|
|
struct rcu_head rcu_head;
|
|
};
|
|
|
|
struct netdev_hw_addr_list {
|
|
struct list_head list;
|
|
int count;
|
|
};
|
|
|
|
#define netdev_hw_addr_list_count(l) ((l)->count)
|
|
#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
|
|
#define netdev_hw_addr_list_for_each(ha, l) \
|
|
list_for_each_entry(ha, &(l)->list, list)
|
|
|
|
#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
|
|
#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
|
|
#define netdev_for_each_uc_addr(ha, dev) \
|
|
netdev_hw_addr_list_for_each(ha, &(dev)->uc)
|
|
|
|
#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
|
|
#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
|
|
#define netdev_for_each_mc_addr(ha, dev) \
|
|
netdev_hw_addr_list_for_each(ha, &(dev)->mc)
|
|
|
|
struct hh_cache {
|
|
unsigned int hh_len;
|
|
seqlock_t hh_lock;
|
|
|
|
/* cached hardware header; allow for machine alignment needs. */
|
|
#define HH_DATA_MOD 16
|
|
#define HH_DATA_OFF(__len) \
|
|
(HH_DATA_MOD - (((__len - 1) & (HH_DATA_MOD - 1)) + 1))
|
|
#define HH_DATA_ALIGN(__len) \
|
|
(((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1))
|
|
unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
|
|
};
|
|
|
|
/* Reserve HH_DATA_MOD byte-aligned hard_header_len, but at least that much.
|
|
* Alternative is:
|
|
* dev->hard_header_len ? (dev->hard_header_len +
|
|
* (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0
|
|
*
|
|
* We could use other alignment values, but we must maintain the
|
|
* relationship HH alignment <= LL alignment.
|
|
*/
|
|
#define LL_RESERVED_SPACE(dev) \
|
|
((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
|
|
#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
|
|
((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
|
|
|
|
struct header_ops {
|
|
int (*create) (struct sk_buff *skb, struct net_device *dev,
|
|
unsigned short type, const void *daddr,
|
|
const void *saddr, unsigned int len);
|
|
int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
|
|
int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
|
|
void (*cache_update)(struct hh_cache *hh,
|
|
const struct net_device *dev,
|
|
const unsigned char *haddr);
|
|
bool (*validate)(const char *ll_header, unsigned int len);
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
};
|
|
|
|
/* These flag bits are private to the generic network queueing
|
|
* layer; they may not be explicitly referenced by any other
|
|
* code.
|
|
*/
|
|
|
|
enum netdev_state_t {
|
|
__LINK_STATE_START,
|
|
__LINK_STATE_PRESENT,
|
|
__LINK_STATE_NOCARRIER,
|
|
__LINK_STATE_LINKWATCH_PENDING,
|
|
__LINK_STATE_DORMANT,
|
|
};
|
|
|
|
|
|
/*
|
|
* This structure holds boot-time configured netdevice settings. They
|
|
* are then used in the device probing.
|
|
*/
|
|
struct netdev_boot_setup {
|
|
char name[IFNAMSIZ];
|
|
struct ifmap map;
|
|
};
|
|
#define NETDEV_BOOT_SETUP_MAX 8
|
|
|
|
int __init netdev_boot_setup(char *str);
|
|
|
|
struct gro_list {
|
|
struct list_head list;
|
|
int count;
|
|
};
|
|
|
|
/*
|
|
* size of gro hash buckets, must less than bit number of
|
|
* napi_struct::gro_bitmask
|
|
*/
|
|
#define GRO_HASH_BUCKETS 8
|
|
|
|
/*
|
|
* Structure for NAPI scheduling similar to tasklet but with weighting
|
|
*/
|
|
struct napi_struct {
|
|
/* The poll_list must only be managed by the entity which
|
|
* changes the state of the NAPI_STATE_SCHED bit. This means
|
|
* whoever atomically sets that bit can add this napi_struct
|
|
* to the per-CPU poll_list, and whoever clears that bit
|
|
* can remove from the list right before clearing the bit.
|
|
*/
|
|
struct list_head poll_list;
|
|
|
|
unsigned long state;
|
|
int weight;
|
|
unsigned long gro_bitmask;
|
|
int (*poll)(struct napi_struct *, int);
|
|
#ifdef CONFIG_NETPOLL
|
|
int poll_owner;
|
|
#endif
|
|
struct net_device *dev;
|
|
struct gro_list gro_hash[GRO_HASH_BUCKETS];
|
|
struct sk_buff *skb;
|
|
struct hrtimer timer;
|
|
struct list_head dev_list;
|
|
struct hlist_node napi_hash_node;
|
|
unsigned int napi_id;
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
};
|
|
|
|
enum {
|
|
NAPI_STATE_SCHED, /* Poll is scheduled */
|
|
NAPI_STATE_MISSED, /* reschedule a napi */
|
|
NAPI_STATE_DISABLE, /* Disable pending */
|
|
NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
|
|
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
|
|
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
|
|
NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
|
|
};
|
|
|
|
enum {
|
|
NAPIF_STATE_SCHED = BIT(NAPI_STATE_SCHED),
|
|
NAPIF_STATE_MISSED = BIT(NAPI_STATE_MISSED),
|
|
NAPIF_STATE_DISABLE = BIT(NAPI_STATE_DISABLE),
|
|
NAPIF_STATE_NPSVC = BIT(NAPI_STATE_NPSVC),
|
|
NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
|
|
NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
|
|
NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
|
|
};
|
|
|
|
enum gro_result {
|
|
GRO_MERGED,
|
|
GRO_MERGED_FREE,
|
|
GRO_HELD,
|
|
GRO_NORMAL,
|
|
GRO_DROP,
|
|
GRO_CONSUMED,
|
|
};
|
|
typedef enum gro_result gro_result_t;
|
|
|
|
/*
|
|
* enum rx_handler_result - Possible return values for rx_handlers.
|
|
* @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it
|
|
* further.
|
|
* @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in
|
|
* case skb->dev was changed by rx_handler.
|
|
* @RX_HANDLER_EXACT: Force exact delivery, no wildcard.
|
|
* @RX_HANDLER_PASS: Do nothing, pass the skb as if no rx_handler was called.
|
|
*
|
|
* rx_handlers are functions called from inside __netif_receive_skb(), to do
|
|
* special processing of the skb, prior to delivery to protocol handlers.
|
|
*
|
|
* Currently, a net_device can only have a single rx_handler registered. Trying
|
|
* to register a second rx_handler will return -EBUSY.
|
|
*
|
|
* To register a rx_handler on a net_device, use netdev_rx_handler_register().
|
|
* To unregister a rx_handler on a net_device, use
|
|
* netdev_rx_handler_unregister().
|
|
*
|
|
* Upon return, rx_handler is expected to tell __netif_receive_skb() what to
|
|
* do with the skb.
|
|
*
|
|
* If the rx_handler consumed the skb in some way, it should return
|
|
* RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for
|
|
* the skb to be delivered in some other way.
|
|
*
|
|
* If the rx_handler changed skb->dev, to divert the skb to another
|
|
* net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the
|
|
* new device will be called if it exists.
|
|
*
|
|
* If the rx_handler decides the skb should be ignored, it should return
|
|
* RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
|
|
* are registered on exact device (ptype->dev == skb->dev).
|
|
*
|
|
* If the rx_handler didn't change skb->dev, but wants the skb to be normally
|
|
* delivered, it should return RX_HANDLER_PASS.
|
|
*
|
|
* A device without a registered rx_handler will behave as if rx_handler
|
|
* returned RX_HANDLER_PASS.
|
|
*/
|
|
|
|
enum rx_handler_result {
|
|
RX_HANDLER_CONSUMED,
|
|
RX_HANDLER_ANOTHER,
|
|
RX_HANDLER_EXACT,
|
|
RX_HANDLER_PASS,
|
|
};
|
|
typedef enum rx_handler_result rx_handler_result_t;
|
|
typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
|
|
|
|
void __napi_schedule(struct napi_struct *n);
|
|
void __napi_schedule_irqoff(struct napi_struct *n);
|
|
|
|
static inline bool napi_disable_pending(struct napi_struct *n)
|
|
{
|
|
return test_bit(NAPI_STATE_DISABLE, &n->state);
|
|
}
|
|
|
|
bool napi_schedule_prep(struct napi_struct *n);
|
|
|
|
/**
|
|
* napi_schedule - schedule NAPI poll
|
|
* @n: NAPI context
|
|
*
|
|
* Schedule NAPI poll routine to be called if it is not already
|
|
* running.
|
|
*/
|
|
static inline void napi_schedule(struct napi_struct *n)
|
|
{
|
|
if (napi_schedule_prep(n))
|
|
__napi_schedule(n);
|
|
}
|
|
|
|
/**
|
|
* napi_schedule_irqoff - schedule NAPI poll
|
|
* @n: NAPI context
|
|
*
|
|
* Variant of napi_schedule(), assuming hard irqs are masked.
|
|
*/
|
|
static inline void napi_schedule_irqoff(struct napi_struct *n)
|
|
{
|
|
if (napi_schedule_prep(n))
|
|
__napi_schedule_irqoff(n);
|
|
}
|
|
|
|
/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
|
|
static inline bool napi_reschedule(struct napi_struct *napi)
|
|
{
|
|
if (napi_schedule_prep(napi)) {
|
|
__napi_schedule(napi);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool napi_complete_done(struct napi_struct *n, int work_done);
|
|
/**
|
|
* napi_complete - NAPI processing complete
|
|
* @n: NAPI context
|
|
*
|
|
* Mark NAPI processing as complete.
|
|
* Consider using napi_complete_done() instead.
|
|
* Return false if device should avoid rearming interrupts.
|
|
*/
|
|
static inline bool napi_complete(struct napi_struct *n)
|
|
{
|
|
return napi_complete_done(n, 0);
|
|
}
|
|
|
|
/**
|
|
* napi_hash_del - remove a NAPI from global table
|
|
* @napi: NAPI context
|
|
*
|
|
* Warning: caller must observe RCU grace period
|
|
* before freeing memory containing @napi, if
|
|
* this function returns true.
|
|
* Note: core networking stack automatically calls it
|
|
* from netif_napi_del().
|
|
* Drivers might want to call this helper to combine all
|
|
* the needed RCU grace periods into a single one.
|
|
*/
|
|
bool napi_hash_del(struct napi_struct *napi);
|
|
|
|
/**
|
|
* napi_disable - prevent NAPI from scheduling
|
|
* @n: NAPI context
|
|
*
|
|
* Stop NAPI from being scheduled on this context.
|
|
* Waits till any outstanding processing completes.
|
|
*/
|
|
void napi_disable(struct napi_struct *n);
|
|
|
|
/**
|
|
* napi_enable - enable NAPI scheduling
|
|
* @n: NAPI context
|
|
*
|
|
* Resume NAPI from being scheduled on this context.
|
|
* Must be paired with napi_disable.
|
|
*/
|
|
static inline void napi_enable(struct napi_struct *n)
|
|
{
|
|
BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
|
|
smp_mb__before_atomic();
|
|
clear_bit(NAPI_STATE_SCHED, &n->state);
|
|
clear_bit(NAPI_STATE_NPSVC, &n->state);
|
|
}
|
|
|
|
/**
|
|
* napi_synchronize - wait until NAPI is not running
|
|
* @n: NAPI context
|
|
*
|
|
* Wait until NAPI is done being scheduled on this context.
|
|
* Waits till any outstanding processing completes but
|
|
* does not disable future activations.
|
|
*/
|
|
static inline void napi_synchronize(const struct napi_struct *n)
|
|
{
|
|
if (IS_ENABLED(CONFIG_SMP))
|
|
while (test_bit(NAPI_STATE_SCHED, &n->state))
|
|
msleep(1);
|
|
else
|
|
barrier();
|
|
}
|
|
|
|
enum netdev_queue_state_t {
|
|
__QUEUE_STATE_DRV_XOFF,
|
|
__QUEUE_STATE_STACK_XOFF,
|
|
__QUEUE_STATE_FROZEN,
|
|
};
|
|
|
|
#define QUEUE_STATE_DRV_XOFF (1 << __QUEUE_STATE_DRV_XOFF)
|
|
#define QUEUE_STATE_STACK_XOFF (1 << __QUEUE_STATE_STACK_XOFF)
|
|
#define QUEUE_STATE_FROZEN (1 << __QUEUE_STATE_FROZEN)
|
|
|
|
#define QUEUE_STATE_ANY_XOFF (QUEUE_STATE_DRV_XOFF | QUEUE_STATE_STACK_XOFF)
|
|
#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
|
|
QUEUE_STATE_FROZEN)
|
|
#define QUEUE_STATE_DRV_XOFF_OR_FROZEN (QUEUE_STATE_DRV_XOFF | \
|
|
QUEUE_STATE_FROZEN)
|
|
|
|
/*
|
|
* __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
|
|
* netif_tx_* functions below are used to manipulate this flag. The
|
|
* __QUEUE_STATE_STACK_XOFF flag is used by the stack to stop the transmit
|
|
* queue independently. The netif_xmit_*stopped functions below are called
|
|
* to check if the queue has been stopped by the driver or stack (either
|
|
* of the XOFF bits are set in the state). Drivers should not need to call
|
|
* netif_xmit*stopped functions, they should only be using netif_tx_*.
|
|
*/
|
|
|
|
struct netdev_queue {
|
|
/*
|
|
* read-mostly part
|
|
*/
|
|
struct net_device *dev;
|
|
struct Qdisc __rcu *qdisc;
|
|
struct Qdisc *qdisc_sleeping;
|
|
#ifdef CONFIG_SYSFS
|
|
struct kobject kobj;
|
|
#endif
|
|
#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
|
|
int numa_node;
|
|
#endif
|
|
unsigned long tx_maxrate;
|
|
/*
|
|
* Number of TX timeouts for this queue
|
|
* (/sys/class/net/DEV/Q/trans_timeout)
|
|
*/
|
|
unsigned long trans_timeout;
|
|
|
|
/* Subordinate device that the queue has been assigned to */
|
|
struct net_device *sb_dev;
|
|
/*
|
|
* write-mostly part
|
|
*/
|
|
spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
|
|
int xmit_lock_owner;
|
|
/*
|
|
* Time (in jiffies) of last Tx
|
|
*/
|
|
unsigned long trans_start;
|
|
|
|
unsigned long state;
|
|
|
|
#ifdef CONFIG_BQL
|
|
struct dql dql;
|
|
#endif
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
} ____cacheline_aligned_in_smp;
|
|
|
|
extern int sysctl_fb_tunnels_only_for_init_net;
|
|
|
|
static inline bool net_has_fallback_tunnels(const struct net *net)
|
|
{
|
|
return net == &init_net ||
|
|
!IS_ENABLED(CONFIG_SYSCTL) ||
|
|
!sysctl_fb_tunnels_only_for_init_net;
|
|
}
|
|
|
|
static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
|
|
{
|
|
#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
|
|
return q->numa_node;
|
|
#else
|
|
return NUMA_NO_NODE;
|
|
#endif
|
|
}
|
|
|
|
static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node)
|
|
{
|
|
#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
|
|
q->numa_node = node;
|
|
#endif
|
|
}
|
|
|
|
#ifdef CONFIG_RPS
|
|
/*
|
|
* This structure holds an RPS map which can be of variable length. The
|
|
* map is an array of CPUs.
|
|
*/
|
|
struct rps_map {
|
|
unsigned int len;
|
|
struct rcu_head rcu;
|
|
u16 cpus[0];
|
|
};
|
|
#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + ((_num) * sizeof(u16)))
|
|
|
|
/*
|
|
* The rps_dev_flow structure contains the mapping of a flow to a CPU, the
|
|
* tail pointer for that CPU's input queue at the time of last enqueue, and
|
|
* a hardware filter index.
|
|
*/
|
|
struct rps_dev_flow {
|
|
u16 cpu;
|
|
u16 filter;
|
|
unsigned int last_qtail;
|
|
};
|
|
#define RPS_NO_FILTER 0xffff
|
|
|
|
/*
|
|
* The rps_dev_flow_table structure contains a table of flow mappings.
|
|
*/
|
|
struct rps_dev_flow_table {
|
|
unsigned int mask;
|
|
struct rcu_head rcu;
|
|
struct rps_dev_flow flows[0];
|
|
};
|
|
#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
|
|
((_num) * sizeof(struct rps_dev_flow)))
|
|
|
|
/*
|
|
* The rps_sock_flow_table contains mappings of flows to the last CPU
|
|
* on which they were processed by the application (set in recvmsg).
|
|
* Each entry is a 32bit value. Upper part is the high-order bits
|
|
* of flow hash, lower part is CPU number.
|
|
* rps_cpu_mask is used to partition the space, depending on number of
|
|
* possible CPUs : rps_cpu_mask = roundup_pow_of_two(nr_cpu_ids) - 1
|
|
* For example, if 64 CPUs are possible, rps_cpu_mask = 0x3f,
|
|
* meaning we use 32-6=26 bits for the hash.
|
|
*/
|
|
struct rps_sock_flow_table {
|
|
u32 mask;
|
|
|
|
u32 ents[0] ____cacheline_aligned_in_smp;
|
|
};
|
|
#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (offsetof(struct rps_sock_flow_table, ents[_num]))
|
|
|
|
#define RPS_NO_CPU 0xffff
|
|
|
|
extern u32 rps_cpu_mask;
|
|
extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
|
|
|
|
static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
|
|
u32 hash)
|
|
{
|
|
if (table && hash) {
|
|
unsigned int index = hash & table->mask;
|
|
u32 val = hash & ~rps_cpu_mask;
|
|
|
|
/* We only give a hint, preemption can change CPU under us */
|
|
val |= raw_smp_processor_id();
|
|
|
|
if (table->ents[index] != val)
|
|
table->ents[index] = val;
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_RFS_ACCEL
|
|
bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
|
|
u16 filter_id);
|
|
#endif
|
|
#endif /* CONFIG_RPS */
|
|
|
|
/* This structure contains an instance of an RX queue. */
|
|
struct netdev_rx_queue {
|
|
#ifdef CONFIG_RPS
|
|
struct rps_map __rcu *rps_map;
|
|
struct rps_dev_flow_table __rcu *rps_flow_table;
|
|
#endif
|
|
struct kobject kobj;
|
|
struct net_device *dev;
|
|
struct xdp_rxq_info xdp_rxq;
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
} ____cacheline_aligned_in_smp;
|
|
|
|
/*
|
|
* RX queue sysfs structures and functions.
|
|
*/
|
|
struct rx_queue_attribute {
|
|
struct attribute attr;
|
|
ssize_t (*show)(struct netdev_rx_queue *queue, char *buf);
|
|
ssize_t (*store)(struct netdev_rx_queue *queue,
|
|
const char *buf, size_t len);
|
|
};
|
|
|
|
#ifdef CONFIG_XPS
|
|
/*
|
|
* This structure holds an XPS map which can be of variable length. The
|
|
* map is an array of queues.
|
|
*/
|
|
struct xps_map {
|
|
unsigned int len;
|
|
unsigned int alloc_len;
|
|
struct rcu_head rcu;
|
|
u16 queues[0];
|
|
};
|
|
#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
|
|
#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
|
|
- sizeof(struct xps_map)) / sizeof(u16))
|
|
|
|
/*
|
|
* This structure holds all XPS maps for device. Maps are indexed by CPU.
|
|
*/
|
|
struct xps_dev_maps {
|
|
struct rcu_head rcu;
|
|
struct xps_map __rcu *attr_map[0]; /* Either CPUs map or RXQs map */
|
|
};
|
|
|
|
#define XPS_CPU_DEV_MAPS_SIZE(_tcs) (sizeof(struct xps_dev_maps) + \
|
|
(nr_cpu_ids * (_tcs) * sizeof(struct xps_map *)))
|
|
|
|
#define XPS_RXQ_DEV_MAPS_SIZE(_tcs, _rxqs) (sizeof(struct xps_dev_maps) +\
|
|
(_rxqs * (_tcs) * sizeof(struct xps_map *)))
|
|
|
|
#endif /* CONFIG_XPS */
|
|
|
|
#define TC_MAX_QUEUE 16
|
|
#define TC_BITMASK 15
|
|
/* HW offloaded queuing disciplines txq count and offset maps */
|
|
struct netdev_tc_txq {
|
|
u16 count;
|
|
u16 offset;
|
|
};
|
|
|
|
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
|
/*
|
|
* This structure is to hold information about the device
|
|
* configured to run FCoE protocol stack.
|
|
*/
|
|
struct netdev_fcoe_hbainfo {
|
|
char manufacturer[64];
|
|
char serial_number[64];
|
|
char hardware_version[64];
|
|
char driver_version[64];
|
|
char optionrom_version[64];
|
|
char firmware_version[64];
|
|
char model[256];
|
|
char model_description[256];
|
|
};
|
|
#endif
|
|
|
|
#define MAX_PHYS_ITEM_ID_LEN 32
|
|
|
|
/* This structure holds a unique identifier to identify some
|
|
* physical item (port for example) used by a netdevice.
|
|
*/
|
|
struct netdev_phys_item_id {
|
|
unsigned char id[MAX_PHYS_ITEM_ID_LEN];
|
|
unsigned char id_len;
|
|
};
|
|
|
|
static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a,
|
|
struct netdev_phys_item_id *b)
|
|
{
|
|
return a->id_len == b->id_len &&
|
|
memcmp(a->id, b->id, a->id_len) == 0;
|
|
}
|
|
|
|
typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
|
|
struct sk_buff *skb,
|
|
struct net_device *sb_dev);
|
|
|
|
enum tc_setup_type {
|
|
TC_SETUP_QDISC_MQPRIO,
|
|
TC_SETUP_CLSU32,
|
|
TC_SETUP_CLSFLOWER,
|
|
TC_SETUP_CLSMATCHALL,
|
|
TC_SETUP_CLSBPF,
|
|
TC_SETUP_BLOCK,
|
|
TC_SETUP_QDISC_CBS,
|
|
TC_SETUP_QDISC_RED,
|
|
TC_SETUP_QDISC_PRIO,
|
|
TC_SETUP_QDISC_MQ,
|
|
TC_SETUP_QDISC_ETF,
|
|
};
|
|
|
|
/* These structures hold the attributes of bpf state that are being passed
|
|
* to the netdevice through the bpf op.
|
|
*/
|
|
enum bpf_netdev_command {
|
|
/* Set or clear a bpf program used in the earliest stages of packet
|
|
* rx. The prog will have been loaded as BPF_PROG_TYPE_XDP. The callee
|
|
* is responsible for calling bpf_prog_put on any old progs that are
|
|
* stored. In case of error, the callee need not release the new prog
|
|
* reference, but on success it takes ownership and must bpf_prog_put
|
|
* when it is no longer used.
|
|
*/
|
|
XDP_SETUP_PROG,
|
|
XDP_SETUP_PROG_HW,
|
|
XDP_QUERY_PROG,
|
|
XDP_QUERY_PROG_HW,
|
|
/* BPF program for offload callbacks, invoked at program load time. */
|
|
BPF_OFFLOAD_VERIFIER_PREP,
|
|
BPF_OFFLOAD_TRANSLATE,
|
|
BPF_OFFLOAD_DESTROY,
|
|
BPF_OFFLOAD_MAP_ALLOC,
|
|
BPF_OFFLOAD_MAP_FREE,
|
|
XDP_QUERY_XSK_UMEM,
|
|
XDP_SETUP_XSK_UMEM,
|
|
};
|
|
|
|
struct bpf_prog_offload_ops;
|
|
struct netlink_ext_ack;
|
|
struct xdp_umem;
|
|
|
|
struct netdev_bpf {
|
|
enum bpf_netdev_command command;
|
|
union {
|
|
/* XDP_SETUP_PROG */
|
|
struct {
|
|
u32 flags;
|
|
struct bpf_prog *prog;
|
|
struct netlink_ext_ack *extack;
|
|
};
|
|
/* XDP_QUERY_PROG, XDP_QUERY_PROG_HW */
|
|
struct {
|
|
u32 prog_id;
|
|
/* flags with which program was installed */
|
|
u32 prog_flags;
|
|
};
|
|
/* BPF_OFFLOAD_VERIFIER_PREP */
|
|
struct {
|
|
struct bpf_prog *prog;
|
|
const struct bpf_prog_offload_ops *ops; /* callee set */
|
|
} verifier;
|
|
/* BPF_OFFLOAD_TRANSLATE, BPF_OFFLOAD_DESTROY */
|
|
struct {
|
|
struct bpf_prog *prog;
|
|
} offload;
|
|
/* BPF_OFFLOAD_MAP_ALLOC, BPF_OFFLOAD_MAP_FREE */
|
|
struct {
|
|
struct bpf_offloaded_map *offmap;
|
|
};
|
|
/* XDP_QUERY_XSK_UMEM, XDP_SETUP_XSK_UMEM */
|
|
struct {
|
|
struct xdp_umem *umem; /* out for query*/
|
|
u16 queue_id; /* in for query */
|
|
} xsk;
|
|
};
|
|
};
|
|
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
struct xfrmdev_ops {
|
|
int (*xdo_dev_state_add) (struct xfrm_state *x);
|
|
void (*xdo_dev_state_delete) (struct xfrm_state *x);
|
|
void (*xdo_dev_state_free) (struct xfrm_state *x);
|
|
bool (*xdo_dev_offload_ok) (struct sk_buff *skb,
|
|
struct xfrm_state *x);
|
|
void (*xdo_dev_state_advance_esn) (struct xfrm_state *x);
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
};
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_TLS_DEVICE)
|
|
enum tls_offload_ctx_dir {
|
|
TLS_OFFLOAD_CTX_DIR_RX,
|
|
TLS_OFFLOAD_CTX_DIR_TX,
|
|
};
|
|
|
|
struct tls_crypto_info;
|
|
struct tls_context;
|
|
|
|
struct tlsdev_ops {
|
|
int (*tls_dev_add)(struct net_device *netdev, struct sock *sk,
|
|
enum tls_offload_ctx_dir direction,
|
|
struct tls_crypto_info *crypto_info,
|
|
u32 start_offload_tcp_sn);
|
|
void (*tls_dev_del)(struct net_device *netdev,
|
|
struct tls_context *ctx,
|
|
enum tls_offload_ctx_dir direction);
|
|
void (*tls_dev_resync_rx)(struct net_device *netdev,
|
|
struct sock *sk, u32 seq, u64 rcd_sn);
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
};
|
|
#endif
|
|
|
|
struct dev_ifalias {
|
|
struct rcu_head rcuhead;
|
|
char ifalias[];
|
|
};
|
|
|
|
/*
|
|
* This structure defines the management hooks for network devices.
|
|
* The following hooks can be defined; unless noted otherwise, they are
|
|
* optional and can be filled with a null pointer.
|
|
*
|
|
* int (*ndo_init)(struct net_device *dev);
|
|
* This function is called once when a network device is registered.
|
|
* The network device can use this for any late stage initialization
|
|
* or semantic validation. It can fail with an error code which will
|
|
* be propagated back to register_netdev.
|
|
*
|
|
* void (*ndo_uninit)(struct net_device *dev);
|
|
* This function is called when device is unregistered or when registration
|
|
* fails. It is not called if init fails.
|
|
*
|
|
* int (*ndo_open)(struct net_device *dev);
|
|
* This function is called when a network device transitions to the up
|
|
* state.
|
|
*
|
|
* int (*ndo_stop)(struct net_device *dev);
|
|
* This function is called when a network device transitions to the down
|
|
* state.
|
|
*
|
|
* netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
|
|
* struct net_device *dev);
|
|
* Called when a packet needs to be transmitted.
|
|
* Returns NETDEV_TX_OK. Can return NETDEV_TX_BUSY, but you should stop
|
|
* the queue before that can happen; it's for obsolete devices and weird
|
|
* corner cases, but the stack really does a non-trivial amount
|
|
* of useless work if you return NETDEV_TX_BUSY.
|
|
* Required; cannot be NULL.
|
|
*
|
|
* netdev_features_t (*ndo_features_check)(struct sk_buff *skb,
|
|
* struct net_device *dev
|
|
* netdev_features_t features);
|
|
* Called by core transmit path to determine if device is capable of
|
|
* performing offload operations on a given packet. This is to give
|
|
* the device an opportunity to implement any restrictions that cannot
|
|
* be otherwise expressed by feature flags. The check is called with
|
|
* the set of features that the stack has calculated and it returns
|
|
* those the driver believes to be appropriate.
|
|
*
|
|
* u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
|
|
* struct net_device *sb_dev,
|
|
* select_queue_fallback_t fallback);
|
|
* Called to decide which queue to use when device supports multiple
|
|
* transmit queues.
|
|
*
|
|
* void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
|
|
* This function is called to allow device receiver to make
|
|
* changes to configuration when multicast or promiscuous is enabled.
|
|
*
|
|
* void (*ndo_set_rx_mode)(struct net_device *dev);
|
|
* This function is called device changes address list filtering.
|
|
* If driver handles unicast address filtering, it should set
|
|
* IFF_UNICAST_FLT in its priv_flags.
|
|
*
|
|
* int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
|
|
* This function is called when the Media Access Control address
|
|
* needs to be changed. If this interface is not defined, the
|
|
* MAC address can not be changed.
|
|
*
|
|
* int (*ndo_validate_addr)(struct net_device *dev);
|
|
* Test if Media Access Control address is valid for the device.
|
|
*
|
|
* int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
|
|
* Called when a user requests an ioctl which can't be handled by
|
|
* the generic interface code. If not defined ioctls return
|
|
* not supported error code.
|
|
*
|
|
* int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
|
|
* Used to set network devices bus interface parameters. This interface
|
|
* is retained for legacy reasons; new devices should use the bus
|
|
* interface (PCI) for low level management.
|
|
*
|
|
* int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
|
|
* Called when a user wants to change the Maximum Transfer Unit
|
|
* of a device.
|
|
*
|
|
* void (*ndo_tx_timeout)(struct net_device *dev);
|
|
* Callback used when the transmitter has not made any progress
|
|
* for dev->watchdog ticks.
|
|
*
|
|
* void (*ndo_get_stats64)(struct net_device *dev,
|
|
* struct rtnl_link_stats64 *storage);
|
|
* struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
|
* Called when a user wants to get the network device usage
|
|
* statistics. Drivers must do one of the following:
|
|
* 1. Define @ndo_get_stats64 to fill in a zero-initialised
|
|
* rtnl_link_stats64 structure passed by the caller.
|
|
* 2. Define @ndo_get_stats to update a net_device_stats structure
|
|
* (which should normally be dev->stats) and return a pointer to
|
|
* it. The structure may be changed asynchronously only if each
|
|
* field is written atomically.
|
|
* 3. Update dev->stats asynchronously and atomically, and define
|
|
* neither operation.
|
|
*
|
|
* bool (*ndo_has_offload_stats)(const struct net_device *dev, int attr_id)
|
|
* Return true if this device supports offload stats of this attr_id.
|
|
*
|
|
* int (*ndo_get_offload_stats)(int attr_id, const struct net_device *dev,
|
|
* void *attr_data)
|
|
* Get statistics for offload operations by attr_id. Write it into the
|
|
* attr_data pointer.
|
|
*
|
|
* int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid);
|
|
* If device supports VLAN filtering this function is called when a
|
|
* VLAN id is registered.
|
|
*
|
|
* int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, __be16 proto, u16 vid);
|
|
* If device supports VLAN filtering this function is called when a
|
|
* VLAN id is unregistered.
|
|
*
|
|
* void (*ndo_poll_controller)(struct net_device *dev);
|
|
*
|
|
* SR-IOV management functions.
|
|
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
|
|
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan,
|
|
* u8 qos, __be16 proto);
|
|
* int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
|
|
* int max_tx_rate);
|
|
* int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
|
|
* int (*ndo_set_vf_trust)(struct net_device *dev, int vf, bool setting);
|
|
* int (*ndo_get_vf_config)(struct net_device *dev,
|
|
* int vf, struct ifla_vf_info *ivf);
|
|
* int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
|
|
* int (*ndo_set_vf_port)(struct net_device *dev, int vf,
|
|
* struct nlattr *port[]);
|
|
*
|
|
* Enable or disable the VF ability to query its RSS Redirection Table and
|
|
* Hash Key. This is needed since on some devices VF share this information
|
|
* with PF and querying it may introduce a theoretical security risk.
|
|
* int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
|
|
* int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
|
|
* int (*ndo_setup_tc)(struct net_device *dev, enum tc_setup_type type,
|
|
* void *type_data);
|
|
* Called to setup any 'tc' scheduler, classifier or action on @dev.
|
|
* This is always called from the stack with the rtnl lock held and netif
|
|
* tx queues stopped. This allows the netdevice to perform queue
|
|
* management safely.
|
|
*
|
|
* Fiber Channel over Ethernet (FCoE) offload functions.
|
|
* int (*ndo_fcoe_enable)(struct net_device *dev);
|
|
* Called when the FCoE protocol stack wants to start using LLD for FCoE
|
|
* so the underlying device can perform whatever needed configuration or
|
|
* initialization to support acceleration of FCoE traffic.
|
|
*
|
|
* int (*ndo_fcoe_disable)(struct net_device *dev);
|
|
* Called when the FCoE protocol stack wants to stop using LLD for FCoE
|
|
* so the underlying device can perform whatever needed clean-ups to
|
|
* stop supporting acceleration of FCoE traffic.
|
|
*
|
|
* int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid,
|
|
* struct scatterlist *sgl, unsigned int sgc);
|
|
* Called when the FCoE Initiator wants to initialize an I/O that
|
|
* is a possible candidate for Direct Data Placement (DDP). The LLD can
|
|
* perform necessary setup and returns 1 to indicate the device is set up
|
|
* successfully to perform DDP on this I/O, otherwise this returns 0.
|
|
*
|
|
* int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid);
|
|
* Called when the FCoE Initiator/Target is done with the DDPed I/O as
|
|
* indicated by the FC exchange id 'xid', so the underlying device can
|
|
* clean up and reuse resources for later DDP requests.
|
|
*
|
|
* int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid,
|
|
* struct scatterlist *sgl, unsigned int sgc);
|
|
* Called when the FCoE Target wants to initialize an I/O that
|
|
* is a possible candidate for Direct Data Placement (DDP). The LLD can
|
|
* perform necessary setup and returns 1 to indicate the device is set up
|
|
* successfully to perform DDP on this I/O, otherwise this returns 0.
|
|
*
|
|
* int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
|
|
* struct netdev_fcoe_hbainfo *hbainfo);
|
|
* Called when the FCoE Protocol stack wants information on the underlying
|
|
* device. This information is utilized by the FCoE protocol stack to
|
|
* register attributes with Fiber Channel management service as per the
|
|
* FC-GS Fabric Device Management Information(FDMI) specification.
|
|
*
|
|
* int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
|
|
* Called when the underlying device wants to override default World Wide
|
|
* Name (WWN) generation mechanism in FCoE protocol stack to pass its own
|
|
* World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE
|
|
* protocol stack to use.
|
|
*
|
|
* RFS acceleration.
|
|
* int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb,
|
|
* u16 rxq_index, u32 flow_id);
|
|
* Set hardware filter for RFS. rxq_index is the target queue index;
|
|
* flow_id is a flow ID to be passed to rps_may_expire_flow() later.
|
|
* Return the filter ID on success, or a negative error code.
|
|
*
|
|
* Slave management functions (for bridge, bonding, etc).
|
|
* int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
|
|
* Called to make another netdev an underling.
|
|
*
|
|
* int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
|
|
* Called to release previously enslaved netdev.
|
|
*
|
|
* Feature/offload setting functions.
|
|
* netdev_features_t (*ndo_fix_features)(struct net_device *dev,
|
|
* netdev_features_t features);
|
|
* Adjusts the requested feature flags according to device-specific
|
|
* constraints, and returns the resulting flags. Must not modify
|
|
* the device state.
|
|
*
|
|
* int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
|
|
* Called to update device configuration to new features. Passed
|
|
* feature set might be less than what was returned by ndo_fix_features()).
|
|
* Must return >0 or -errno if it changed dev->features itself.
|
|
*
|
|
* int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
|
|
* struct net_device *dev,
|
|
* const unsigned char *addr, u16 vid, u16 flags)
|
|
* Adds an FDB entry to dev for addr.
|
|
* int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
|
|
* struct net_device *dev,
|
|
* const unsigned char *addr, u16 vid)
|
|
* Deletes the FDB entry from dev coresponding to addr.
|
|
* int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
|
|
* struct net_device *dev, struct net_device *filter_dev,
|
|
* int *idx)
|
|
* Used to add FDB entries to dump requests. Implementers should add
|
|
* entries to skb and update idx with the number of entries.
|
|
*
|
|
* int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
|
|
* u16 flags)
|
|
* int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
|
|
* struct net_device *dev, u32 filter_mask,
|
|
* int nlflags)
|
|
* int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
|
|
* u16 flags);
|
|
*
|
|
* int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
|
|
* Called to change device carrier. Soft-devices (like dummy, team, etc)
|
|
* which do not represent real hardware may define this to allow their
|
|
* userspace components to manage their virtual carrier state. Devices
|
|
* that determine carrier state from physical hardware properties (eg
|
|
* network cables) or protocol-dependent mechanisms (eg
|
|
* USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
|
|
*
|
|
* int (*ndo_get_phys_port_id)(struct net_device *dev,
|
|
* struct netdev_phys_item_id *ppid);
|
|
* Called to get ID of physical port of this device. If driver does
|
|
* not implement this, it is assumed that the hw is not able to have
|
|
* multiple net devices on single physical port.
|
|
*
|
|
* void (*ndo_udp_tunnel_add)(struct net_device *dev,
|
|
* struct udp_tunnel_info *ti);
|
|
* Called by UDP tunnel to notify a driver about the UDP port and socket
|
|
* address family that a UDP tunnel is listnening to. It is called only
|
|
* when a new port starts listening. The operation is protected by the
|
|
* RTNL.
|
|
*
|
|
* void (*ndo_udp_tunnel_del)(struct net_device *dev,
|
|
* struct udp_tunnel_info *ti);
|
|
* Called by UDP tunnel to notify the driver about a UDP port and socket
|
|
* address family that the UDP tunnel is not listening to anymore. The
|
|
* operation is protected by the RTNL.
|
|
*
|
|
* void* (*ndo_dfwd_add_station)(struct net_device *pdev,
|
|
* struct net_device *dev)
|
|
* Called by upper layer devices to accelerate switching or other
|
|
* station functionality into hardware. 'pdev is the lowerdev
|
|
* to use for the offload and 'dev' is the net device that will
|
|
* back the offload. Returns a pointer to the private structure
|
|
* the upper layer will maintain.
|
|
* void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv)
|
|
* Called by upper layer device to delete the station created
|
|
* by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
|
|
* the station and priv is the structure returned by the add
|
|
* operation.
|
|
* int (*ndo_set_tx_maxrate)(struct net_device *dev,
|
|
* int queue_index, u32 maxrate);
|
|
* Called when a user wants to set a max-rate limitation of specific
|
|
* TX queue.
|
|
* int (*ndo_get_iflink)(const struct net_device *dev);
|
|
* Called to get the iflink value of this device.
|
|
* void (*ndo_change_proto_down)(struct net_device *dev,
|
|
* bool proto_down);
|
|
* This function is used to pass protocol port error state information
|
|
* to the switch driver. The switch driver can react to the proto_down
|
|
* by doing a phys down on the associated switch port.
|
|
* int (*ndo_fill_metadata_dst)(struct net_device *dev, struct sk_buff *skb);
|
|
* This function is used to get egress tunnel information for given skb.
|
|
* This is useful for retrieving outer tunnel header parameters while
|
|
* sampling packet.
|
|
* void (*ndo_set_rx_headroom)(struct net_device *dev, int needed_headroom);
|
|
* This function is used to specify the headroom that the skb must
|
|
* consider when allocation skb during packet reception. Setting
|
|
* appropriate rx headroom value allows avoiding skb head copy on
|
|
* forward. Setting a negative value resets the rx headroom to the
|
|
* default value.
|
|
* int (*ndo_bpf)(struct net_device *dev, struct netdev_bpf *bpf);
|
|
* This function is used to set or query state related to XDP on the
|
|
* netdevice and manage BPF offload. See definition of
|
|
* enum bpf_netdev_command for details.
|
|
* int (*ndo_xdp_xmit)(struct net_device *dev, int n, struct xdp_frame **xdp,
|
|
* u32 flags);
|
|
* This function is used to submit @n XDP packets for transmit on a
|
|
* netdevice. Returns number of frames successfully transmitted, frames
|
|
* that got dropped are freed/returned via xdp_return_frame().
|
|
* Returns negative number, means general error invoking ndo, meaning
|
|
* no frames were xmit'ed and core-caller will free all frames.
|
|
*/
|
|
struct net_device_ops {
|
|
int (*ndo_init)(struct net_device *dev);
|
|
void (*ndo_uninit)(struct net_device *dev);
|
|
int (*ndo_open)(struct net_device *dev);
|
|
int (*ndo_stop)(struct net_device *dev);
|
|
netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
|
|
struct net_device *dev);
|
|
netdev_features_t (*ndo_features_check)(struct sk_buff *skb,
|
|
struct net_device *dev,
|
|
netdev_features_t features);
|
|
u16 (*ndo_select_queue)(struct net_device *dev,
|
|
struct sk_buff *skb,
|
|
struct net_device *sb_dev,
|
|
select_queue_fallback_t fallback);
|
|
void (*ndo_change_rx_flags)(struct net_device *dev,
|
|
int flags);
|
|
void (*ndo_set_rx_mode)(struct net_device *dev);
|
|
int (*ndo_set_mac_address)(struct net_device *dev,
|
|
void *addr);
|
|
int (*ndo_validate_addr)(struct net_device *dev);
|
|
int (*ndo_do_ioctl)(struct net_device *dev,
|
|
struct ifreq *ifr, int cmd);
|
|
int (*ndo_set_config)(struct net_device *dev,
|
|
struct ifmap *map);
|
|
int (*ndo_change_mtu)(struct net_device *dev,
|
|
int new_mtu);
|
|
int (*ndo_neigh_setup)(struct net_device *dev,
|
|
struct neigh_parms *);
|
|
void (*ndo_tx_timeout) (struct net_device *dev);
|
|
|
|
void (*ndo_get_stats64)(struct net_device *dev,
|
|
struct rtnl_link_stats64 *storage);
|
|
bool (*ndo_has_offload_stats)(const struct net_device *dev, int attr_id);
|
|
int (*ndo_get_offload_stats)(int attr_id,
|
|
const struct net_device *dev,
|
|
void *attr_data);
|
|
struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
|
|
|
int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
|
|
__be16 proto, u16 vid);
|
|
int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
|
|
__be16 proto, u16 vid);
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
void (*ndo_poll_controller)(struct net_device *dev);
|
|
int (*ndo_netpoll_setup)(struct net_device *dev,
|
|
struct netpoll_info *info);
|
|
void (*ndo_netpoll_cleanup)(struct net_device *dev);
|
|
#endif
|
|
int (*ndo_set_vf_mac)(struct net_device *dev,
|
|
int queue, u8 *mac);
|
|
int (*ndo_set_vf_vlan)(struct net_device *dev,
|
|
int queue, u16 vlan,
|
|
u8 qos, __be16 proto);
|
|
int (*ndo_set_vf_rate)(struct net_device *dev,
|
|
int vf, int min_tx_rate,
|
|
int max_tx_rate);
|
|
int (*ndo_set_vf_spoofchk)(struct net_device *dev,
|
|
int vf, bool setting);
|
|
int (*ndo_set_vf_trust)(struct net_device *dev,
|
|
int vf, bool setting);
|
|
int (*ndo_get_vf_config)(struct net_device *dev,
|
|
int vf,
|
|
struct ifla_vf_info *ivf);
|
|
int (*ndo_set_vf_link_state)(struct net_device *dev,
|
|
int vf, int link_state);
|
|
int (*ndo_get_vf_stats)(struct net_device *dev,
|
|
int vf,
|
|
struct ifla_vf_stats
|
|
*vf_stats);
|
|
int (*ndo_set_vf_port)(struct net_device *dev,
|
|
int vf,
|
|
struct nlattr *port[]);
|
|
int (*ndo_get_vf_port)(struct net_device *dev,
|
|
int vf, struct sk_buff *skb);
|
|
int (*ndo_set_vf_guid)(struct net_device *dev,
|
|
int vf, u64 guid,
|
|
int guid_type);
|
|
int (*ndo_set_vf_rss_query_en)(
|
|
struct net_device *dev,
|
|
int vf, bool setting);
|
|
int (*ndo_setup_tc)(struct net_device *dev,
|
|
enum tc_setup_type type,
|
|
void *type_data);
|
|
#if IS_ENABLED(CONFIG_FCOE)
|
|
int (*ndo_fcoe_enable)(struct net_device *dev);
|
|
int (*ndo_fcoe_disable)(struct net_device *dev);
|
|
int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
|
|
u16 xid,
|
|
struct scatterlist *sgl,
|
|
unsigned int sgc);
|
|
int (*ndo_fcoe_ddp_done)(struct net_device *dev,
|
|
u16 xid);
|
|
int (*ndo_fcoe_ddp_target)(struct net_device *dev,
|
|
u16 xid,
|
|
struct scatterlist *sgl,
|
|
unsigned int sgc);
|
|
int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
|
|
struct netdev_fcoe_hbainfo *hbainfo);
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_LIBFCOE)
|
|
#define NETDEV_FCOE_WWNN 0
|
|
#define NETDEV_FCOE_WWPN 1
|
|
int (*ndo_fcoe_get_wwn)(struct net_device *dev,
|
|
u64 *wwn, int type);
|
|
#endif
|
|
|
|
#ifdef CONFIG_RFS_ACCEL
|
|
int (*ndo_rx_flow_steer)(struct net_device *dev,
|
|
const struct sk_buff *skb,
|
|
u16 rxq_index,
|
|
u32 flow_id);
|
|
#endif
|
|
int (*ndo_add_slave)(struct net_device *dev,
|
|
struct net_device *slave_dev,
|
|
struct netlink_ext_ack *extack);
|
|
int (*ndo_del_slave)(struct net_device *dev,
|
|
struct net_device *slave_dev);
|
|
netdev_features_t (*ndo_fix_features)(struct net_device *dev,
|
|
netdev_features_t features);
|
|
int (*ndo_set_features)(struct net_device *dev,
|
|
netdev_features_t features);
|
|
int (*ndo_neigh_construct)(struct net_device *dev,
|
|
struct neighbour *n);
|
|
void (*ndo_neigh_destroy)(struct net_device *dev,
|
|
struct neighbour *n);
|
|
|
|
int (*ndo_fdb_add)(struct ndmsg *ndm,
|
|
struct nlattr *tb[],
|
|
struct net_device *dev,
|
|
const unsigned char *addr,
|
|
u16 vid,
|
|
u16 flags);
|
|
int (*ndo_fdb_del)(struct ndmsg *ndm,
|
|
struct nlattr *tb[],
|
|
struct net_device *dev,
|
|
const unsigned char *addr,
|
|
u16 vid);
|
|
int (*ndo_fdb_dump)(struct sk_buff *skb,
|
|
struct netlink_callback *cb,
|
|
struct net_device *dev,
|
|
struct net_device *filter_dev,
|
|
int *idx);
|
|
|
|
int (*ndo_bridge_setlink)(struct net_device *dev,
|
|
struct nlmsghdr *nlh,
|
|
u16 flags);
|
|
int (*ndo_bridge_getlink)(struct sk_buff *skb,
|
|
u32 pid, u32 seq,
|
|
struct net_device *dev,
|
|
u32 filter_mask,
|
|
int nlflags);
|
|
int (*ndo_bridge_dellink)(struct net_device *dev,
|
|
struct nlmsghdr *nlh,
|
|
u16 flags);
|
|
int (*ndo_change_carrier)(struct net_device *dev,
|
|
bool new_carrier);
|
|
int (*ndo_get_phys_port_id)(struct net_device *dev,
|
|
struct netdev_phys_item_id *ppid);
|
|
int (*ndo_get_phys_port_name)(struct net_device *dev,
|
|
char *name, size_t len);
|
|
void (*ndo_udp_tunnel_add)(struct net_device *dev,
|
|
struct udp_tunnel_info *ti);
|
|
void (*ndo_udp_tunnel_del)(struct net_device *dev,
|
|
struct udp_tunnel_info *ti);
|
|
void* (*ndo_dfwd_add_station)(struct net_device *pdev,
|
|
struct net_device *dev);
|
|
void (*ndo_dfwd_del_station)(struct net_device *pdev,
|
|
void *priv);
|
|
|
|
int (*ndo_get_lock_subclass)(struct net_device *dev);
|
|
int (*ndo_set_tx_maxrate)(struct net_device *dev,
|
|
int queue_index,
|
|
u32 maxrate);
|
|
int (*ndo_get_iflink)(const struct net_device *dev);
|
|
int (*ndo_change_proto_down)(struct net_device *dev,
|
|
bool proto_down);
|
|
int (*ndo_fill_metadata_dst)(struct net_device *dev,
|
|
struct sk_buff *skb);
|
|
void (*ndo_set_rx_headroom)(struct net_device *dev,
|
|
int needed_headroom);
|
|
int (*ndo_bpf)(struct net_device *dev,
|
|
struct netdev_bpf *bpf);
|
|
int (*ndo_xdp_xmit)(struct net_device *dev, int n,
|
|
struct xdp_frame **xdp,
|
|
u32 flags);
|
|
int (*ndo_xsk_async_xmit)(struct net_device *dev,
|
|
u32 queue_id);
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
ANDROID_KABI_RESERVE(5);
|
|
ANDROID_KABI_RESERVE(6);
|
|
ANDROID_KABI_RESERVE(7);
|
|
ANDROID_KABI_RESERVE(8);
|
|
};
|
|
|
|
/**
|
|
* enum net_device_priv_flags - &struct net_device priv_flags
|
|
*
|
|
* These are the &struct net_device, they are only set internally
|
|
* by drivers and used in the kernel. These flags are invisible to
|
|
* userspace; this means that the order of these flags can change
|
|
* during any kernel release.
|
|
*
|
|
* You should have a pretty good reason to be extending these flags.
|
|
*
|
|
* @IFF_802_1Q_VLAN: 802.1Q VLAN device
|
|
* @IFF_EBRIDGE: Ethernet bridging device
|
|
* @IFF_BONDING: bonding master or slave
|
|
* @IFF_ISATAP: ISATAP interface (RFC4214)
|
|
* @IFF_WAN_HDLC: WAN HDLC device
|
|
* @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
|
|
* release skb->dst
|
|
* @IFF_DONT_BRIDGE: disallow bridging this ether dev
|
|
* @IFF_DISABLE_NETPOLL: disable netpoll at run-time
|
|
* @IFF_MACVLAN_PORT: device used as macvlan port
|
|
* @IFF_BRIDGE_PORT: device used as bridge port
|
|
* @IFF_OVS_DATAPATH: device used as Open vSwitch datapath port
|
|
* @IFF_TX_SKB_SHARING: The interface supports sharing skbs on transmit
|
|
* @IFF_UNICAST_FLT: Supports unicast filtering
|
|
* @IFF_TEAM_PORT: device used as team port
|
|
* @IFF_SUPP_NOFCS: device supports sending custom FCS
|
|
* @IFF_LIVE_ADDR_CHANGE: device supports hardware address
|
|
* change when it's running
|
|
* @IFF_MACVLAN: Macvlan device
|
|
* @IFF_XMIT_DST_RELEASE_PERM: IFF_XMIT_DST_RELEASE not taking into account
|
|
* underlying stacked devices
|
|
* @IFF_L3MDEV_MASTER: device is an L3 master device
|
|
* @IFF_NO_QUEUE: device can run without qdisc attached
|
|
* @IFF_OPENVSWITCH: device is a Open vSwitch master
|
|
* @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device
|
|
* @IFF_TEAM: device is a team device
|
|
* @IFF_RXFH_CONFIGURED: device has had Rx Flow indirection table configured
|
|
* @IFF_PHONY_HEADROOM: the headroom value is controlled by an external
|
|
* entity (i.e. the master device for bridged veth)
|
|
* @IFF_MACSEC: device is a MACsec device
|
|
* @IFF_NO_RX_HANDLER: device doesn't support the rx_handler hook
|
|
* @IFF_FAILOVER: device is a failover master device
|
|
* @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device
|
|
* @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device
|
|
* @IFF_LIVE_RENAME_OK: rename is allowed while device is up and running
|
|
*/
|
|
enum netdev_priv_flags {
|
|
IFF_802_1Q_VLAN = 1<<0,
|
|
IFF_EBRIDGE = 1<<1,
|
|
IFF_BONDING = 1<<2,
|
|
IFF_ISATAP = 1<<3,
|
|
IFF_WAN_HDLC = 1<<4,
|
|
IFF_XMIT_DST_RELEASE = 1<<5,
|
|
IFF_DONT_BRIDGE = 1<<6,
|
|
IFF_DISABLE_NETPOLL = 1<<7,
|
|
IFF_MACVLAN_PORT = 1<<8,
|
|
IFF_BRIDGE_PORT = 1<<9,
|
|
IFF_OVS_DATAPATH = 1<<10,
|
|
IFF_TX_SKB_SHARING = 1<<11,
|
|
IFF_UNICAST_FLT = 1<<12,
|
|
IFF_TEAM_PORT = 1<<13,
|
|
IFF_SUPP_NOFCS = 1<<14,
|
|
IFF_LIVE_ADDR_CHANGE = 1<<15,
|
|
IFF_MACVLAN = 1<<16,
|
|
IFF_XMIT_DST_RELEASE_PERM = 1<<17,
|
|
IFF_L3MDEV_MASTER = 1<<18,
|
|
IFF_NO_QUEUE = 1<<19,
|
|
IFF_OPENVSWITCH = 1<<20,
|
|
IFF_L3MDEV_SLAVE = 1<<21,
|
|
IFF_TEAM = 1<<22,
|
|
IFF_RXFH_CONFIGURED = 1<<23,
|
|
IFF_PHONY_HEADROOM = 1<<24,
|
|
IFF_MACSEC = 1<<25,
|
|
IFF_NO_RX_HANDLER = 1<<26,
|
|
IFF_FAILOVER = 1<<27,
|
|
IFF_FAILOVER_SLAVE = 1<<28,
|
|
IFF_L3MDEV_RX_HANDLER = 1<<29,
|
|
IFF_LIVE_RENAME_OK = 1<<30,
|
|
};
|
|
|
|
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
|
|
#define IFF_EBRIDGE IFF_EBRIDGE
|
|
#define IFF_BONDING IFF_BONDING
|
|
#define IFF_ISATAP IFF_ISATAP
|
|
#define IFF_WAN_HDLC IFF_WAN_HDLC
|
|
#define IFF_XMIT_DST_RELEASE IFF_XMIT_DST_RELEASE
|
|
#define IFF_DONT_BRIDGE IFF_DONT_BRIDGE
|
|
#define IFF_DISABLE_NETPOLL IFF_DISABLE_NETPOLL
|
|
#define IFF_MACVLAN_PORT IFF_MACVLAN_PORT
|
|
#define IFF_BRIDGE_PORT IFF_BRIDGE_PORT
|
|
#define IFF_OVS_DATAPATH IFF_OVS_DATAPATH
|
|
#define IFF_TX_SKB_SHARING IFF_TX_SKB_SHARING
|
|
#define IFF_UNICAST_FLT IFF_UNICAST_FLT
|
|
#define IFF_TEAM_PORT IFF_TEAM_PORT
|
|
#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
|
|
#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
|
|
#define IFF_MACVLAN IFF_MACVLAN
|
|
#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
|
|
#define IFF_L3MDEV_MASTER IFF_L3MDEV_MASTER
|
|
#define IFF_NO_QUEUE IFF_NO_QUEUE
|
|
#define IFF_OPENVSWITCH IFF_OPENVSWITCH
|
|
#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
|
|
#define IFF_TEAM IFF_TEAM
|
|
#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
|
|
#define IFF_MACSEC IFF_MACSEC
|
|
#define IFF_NO_RX_HANDLER IFF_NO_RX_HANDLER
|
|
#define IFF_FAILOVER IFF_FAILOVER
|
|
#define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE
|
|
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
|
|
#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
|
|
|
|
/**
|
|
* struct net_device - The DEVICE structure.
|
|
*
|
|
* Actually, this whole structure is a big mistake. It mixes I/O
|
|
* data with strictly "high-level" data, and it has to know about
|
|
* almost every data structure used in the INET module.
|
|
*
|
|
* @name: This is the first field of the "visible" part of this structure
|
|
* (i.e. as seen by users in the "Space.c" file). It is the name
|
|
* of the interface.
|
|
*
|
|
* @name_hlist: Device name hash chain, please keep it close to name[]
|
|
* @ifalias: SNMP alias
|
|
* @mem_end: Shared memory end
|
|
* @mem_start: Shared memory start
|
|
* @base_addr: Device I/O address
|
|
* @irq: Device IRQ number
|
|
*
|
|
* @state: Generic network queuing layer state, see netdev_state_t
|
|
* @dev_list: The global list of network devices
|
|
* @napi_list: List entry used for polling NAPI devices
|
|
* @unreg_list: List entry when we are unregistering the
|
|
* device; see the function unregister_netdev
|
|
* @close_list: List entry used when we are closing the device
|
|
* @ptype_all: Device-specific packet handlers for all protocols
|
|
* @ptype_specific: Device-specific, protocol-specific packet handlers
|
|
*
|
|
* @adj_list: Directly linked devices, like slaves for bonding
|
|
* @features: Currently active device features
|
|
* @hw_features: User-changeable features
|
|
*
|
|
* @wanted_features: User-requested features
|
|
* @vlan_features: Mask of features inheritable by VLAN devices
|
|
*
|
|
* @hw_enc_features: Mask of features inherited by encapsulating devices
|
|
* This field indicates what encapsulation
|
|
* offloads the hardware is capable of doing,
|
|
* and drivers will need to set them appropriately.
|
|
*
|
|
* @mpls_features: Mask of features inheritable by MPLS
|
|
*
|
|
* @ifindex: interface index
|
|
* @group: The group the device belongs to
|
|
*
|
|
* @stats: Statistics struct, which was left as a legacy, use
|
|
* rtnl_link_stats64 instead
|
|
*
|
|
* @rx_dropped: Dropped packets by core network,
|
|
* do not use this in drivers
|
|
* @tx_dropped: Dropped packets by core network,
|
|
* do not use this in drivers
|
|
* @rx_nohandler: nohandler dropped packets by core network on
|
|
* inactive devices, do not use this in drivers
|
|
* @carrier_up_count: Number of times the carrier has been up
|
|
* @carrier_down_count: Number of times the carrier has been down
|
|
*
|
|
* @wireless_handlers: List of functions to handle Wireless Extensions,
|
|
* instead of ioctl,
|
|
* see <net/iw_handler.h> for details.
|
|
* @wireless_data: Instance data managed by the core of wireless extensions
|
|
*
|
|
* @netdev_ops: Includes several pointers to callbacks,
|
|
* if one wants to override the ndo_*() functions
|
|
* @ethtool_ops: Management operations
|
|
* @ndisc_ops: Includes callbacks for different IPv6 neighbour
|
|
* discovery handling. Necessary for e.g. 6LoWPAN.
|
|
* @header_ops: Includes callbacks for creating,parsing,caching,etc
|
|
* of Layer 2 headers.
|
|
*
|
|
* @flags: Interface flags (a la BSD)
|
|
* @priv_flags: Like 'flags' but invisible to userspace,
|
|
* see if.h for the definitions
|
|
* @gflags: Global flags ( kept as legacy )
|
|
* @padded: How much padding added by alloc_netdev()
|
|
* @operstate: RFC2863 operstate
|
|
* @link_mode: Mapping policy to operstate
|
|
* @if_port: Selectable AUI, TP, ...
|
|
* @dma: DMA channel
|
|
* @mtu: Interface MTU value
|
|
* @min_mtu: Interface Minimum MTU value
|
|
* @max_mtu: Interface Maximum MTU value
|
|
* @type: Interface hardware type
|
|
* @hard_header_len: Maximum hardware header length.
|
|
* @min_header_len: Minimum hardware header length
|
|
*
|
|
* @needed_headroom: Extra headroom the hardware may need, but not in all
|
|
* cases can this be guaranteed
|
|
* @needed_tailroom: Extra tailroom the hardware may need, but not in all
|
|
* cases can this be guaranteed. Some cases also use
|
|
* LL_MAX_HEADER instead to allocate the skb
|
|
*
|
|
* interface address info:
|
|
*
|
|
* @perm_addr: Permanent hw address
|
|
* @addr_assign_type: Hw address assignment type
|
|
* @addr_len: Hardware address length
|
|
* @upper_level: Maximum depth level of upper devices.
|
|
* @lower_level: Maximum depth level of lower devices.
|
|
* @neigh_priv_len: Used in neigh_alloc()
|
|
* @dev_id: Used to differentiate devices that share
|
|
* the same link layer address
|
|
* @dev_port: Used to differentiate devices that share
|
|
* the same function
|
|
* @addr_list_lock: XXX: need comments on this one
|
|
* @uc_promisc: Counter that indicates promiscuous mode
|
|
* has been enabled due to the need to listen to
|
|
* additional unicast addresses in a device that
|
|
* does not implement ndo_set_rx_mode()
|
|
* @uc: unicast mac addresses
|
|
* @mc: multicast mac addresses
|
|
* @dev_addrs: list of device hw addresses
|
|
* @queues_kset: Group of all Kobjects in the Tx and RX queues
|
|
* @promiscuity: Number of times the NIC is told to work in
|
|
* promiscuous mode; if it becomes 0 the NIC will
|
|
* exit promiscuous mode
|
|
* @allmulti: Counter, enables or disables allmulticast mode
|
|
*
|
|
* @vlan_info: VLAN info
|
|
* @dsa_ptr: dsa specific data
|
|
* @tipc_ptr: TIPC specific data
|
|
* @atalk_ptr: AppleTalk link
|
|
* @ip_ptr: IPv4 specific data
|
|
* @dn_ptr: DECnet specific data
|
|
* @ip6_ptr: IPv6 specific data
|
|
* @ax25_ptr: AX.25 specific data
|
|
* @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
|
|
*
|
|
* @dev_addr: Hw address (before bcast,
|
|
* because most packets are unicast)
|
|
*
|
|
* @_rx: Array of RX queues
|
|
* @num_rx_queues: Number of RX queues
|
|
* allocated at register_netdev() time
|
|
* @real_num_rx_queues: Number of RX queues currently active in device
|
|
*
|
|
* @rx_handler: handler for received packets
|
|
* @rx_handler_data: XXX: need comments on this one
|
|
* @miniq_ingress: ingress/clsact qdisc specific data for
|
|
* ingress processing
|
|
* @ingress_queue: XXX: need comments on this one
|
|
* @broadcast: hw bcast address
|
|
*
|
|
* @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
|
|
* indexed by RX queue number. Assigned by driver.
|
|
* This must only be set if the ndo_rx_flow_steer
|
|
* operation is defined
|
|
* @index_hlist: Device index hash chain
|
|
*
|
|
* @_tx: Array of TX queues
|
|
* @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
|
|
* @real_num_tx_queues: Number of TX queues currently active in device
|
|
* @qdisc: Root qdisc from userspace point of view
|
|
* @tx_queue_len: Max frames per queue allowed
|
|
* @tx_global_lock: XXX: need comments on this one
|
|
*
|
|
* @xps_maps: XXX: need comments on this one
|
|
* @miniq_egress: clsact qdisc specific data for
|
|
* egress processing
|
|
* @watchdog_timeo: Represents the timeout that is used by
|
|
* the watchdog (see dev_watchdog())
|
|
* @watchdog_timer: List of timers
|
|
*
|
|
* @pcpu_refcnt: Number of references to this device
|
|
* @todo_list: Delayed register/unregister
|
|
* @link_watch_list: XXX: need comments on this one
|
|
*
|
|
* @reg_state: Register/unregister state machine
|
|
* @dismantle: Device is going to be freed
|
|
* @rtnl_link_state: This enum represents the phases of creating
|
|
* a new link
|
|
*
|
|
* @needs_free_netdev: Should unregister perform free_netdev?
|
|
* @priv_destructor: Called from unregister
|
|
* @npinfo: XXX: need comments on this one
|
|
* @nd_net: Network namespace this network device is inside
|
|
*
|
|
* @ml_priv: Mid-layer private
|
|
* @lstats: Loopback statistics
|
|
* @tstats: Tunnel statistics
|
|
* @dstats: Dummy statistics
|
|
* @vstats: Virtual ethernet statistics
|
|
*
|
|
* @garp_port: GARP
|
|
* @mrp_port: MRP
|
|
*
|
|
* @dev: Class/net/name entry
|
|
* @sysfs_groups: Space for optional device, statistics and wireless
|
|
* sysfs groups
|
|
*
|
|
* @sysfs_rx_queue_group: Space for optional per-rx queue attributes
|
|
* @rtnl_link_ops: Rtnl_link_ops
|
|
*
|
|
* @gso_max_size: Maximum size of generic segmentation offload
|
|
* @gso_max_segs: Maximum number of segments that can be passed to the
|
|
* NIC for GSO
|
|
*
|
|
* @dcbnl_ops: Data Center Bridging netlink ops
|
|
* @num_tc: Number of traffic classes in the net device
|
|
* @tc_to_txq: XXX: need comments on this one
|
|
* @prio_tc_map: XXX: need comments on this one
|
|
*
|
|
* @fcoe_ddp_xid: Max exchange id for FCoE LRO by ddp
|
|
*
|
|
* @priomap: XXX: need comments on this one
|
|
* @phydev: Physical device may attach itself
|
|
* for hardware timestamping
|
|
* @sfp_bus: attached &struct sfp_bus structure.
|
|
*
|
|
* @qdisc_tx_busylock: lockdep class annotating Qdisc->busylock spinlock
|
|
* @qdisc_running_key: lockdep class annotating Qdisc->running seqcount
|
|
*
|
|
* @proto_down: protocol port state information can be sent to the
|
|
* switch driver and used to set the phys state of the
|
|
* switch port.
|
|
*
|
|
* @wol_enabled: Wake-on-LAN is enabled
|
|
*
|
|
* FIXME: cleanup struct net_device such that network protocol info
|
|
* moves out.
|
|
*/
|
|
|
|
struct net_device {
|
|
char name[IFNAMSIZ];
|
|
struct hlist_node name_hlist;
|
|
struct dev_ifalias __rcu *ifalias;
|
|
/*
|
|
* I/O specific fields
|
|
* FIXME: Merge these and struct ifmap into one
|
|
*/
|
|
unsigned long mem_end;
|
|
unsigned long mem_start;
|
|
unsigned long base_addr;
|
|
int irq;
|
|
|
|
/*
|
|
* Some hardware also needs these fields (state,dev_list,
|
|
* napi_list,unreg_list,close_list) but they are not
|
|
* part of the usual set specified in Space.c.
|
|
*/
|
|
|
|
unsigned long state;
|
|
|
|
struct list_head dev_list;
|
|
struct list_head napi_list;
|
|
struct list_head unreg_list;
|
|
struct list_head close_list;
|
|
struct list_head ptype_all;
|
|
struct list_head ptype_specific;
|
|
|
|
struct {
|
|
struct list_head upper;
|
|
struct list_head lower;
|
|
} adj_list;
|
|
|
|
netdev_features_t features;
|
|
netdev_features_t hw_features;
|
|
netdev_features_t wanted_features;
|
|
netdev_features_t vlan_features;
|
|
netdev_features_t hw_enc_features;
|
|
netdev_features_t mpls_features;
|
|
netdev_features_t gso_partial_features;
|
|
|
|
int ifindex;
|
|
int group;
|
|
|
|
struct net_device_stats stats;
|
|
|
|
atomic_long_t rx_dropped;
|
|
atomic_long_t tx_dropped;
|
|
atomic_long_t rx_nohandler;
|
|
|
|
/* Stats to monitor link on/off, flapping */
|
|
atomic_t carrier_up_count;
|
|
atomic_t carrier_down_count;
|
|
|
|
#ifdef CONFIG_WIRELESS_EXT
|
|
const struct iw_handler_def *wireless_handlers;
|
|
struct iw_public_data *wireless_data;
|
|
#endif
|
|
const struct net_device_ops *netdev_ops;
|
|
const struct ethtool_ops *ethtool_ops;
|
|
#ifdef CONFIG_NET_SWITCHDEV
|
|
const struct switchdev_ops *switchdev_ops;
|
|
#endif
|
|
#ifdef CONFIG_NET_L3_MASTER_DEV
|
|
const struct l3mdev_ops *l3mdev_ops;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
const struct ndisc_ops *ndisc_ops;
|
|
#endif
|
|
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
const struct xfrmdev_ops *xfrmdev_ops;
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_TLS_DEVICE)
|
|
const struct tlsdev_ops *tlsdev_ops;
|
|
#endif
|
|
|
|
const struct header_ops *header_ops;
|
|
|
|
unsigned int flags;
|
|
unsigned int priv_flags;
|
|
|
|
unsigned short gflags;
|
|
unsigned short padded;
|
|
|
|
unsigned char operstate;
|
|
unsigned char link_mode;
|
|
|
|
unsigned char if_port;
|
|
unsigned char dma;
|
|
|
|
/* Note : dev->mtu is often read without holding a lock.
|
|
* Writers usually hold RTNL.
|
|
* It is recommended to use READ_ONCE() to annotate the reads,
|
|
* and to use WRITE_ONCE() to annotate the writes.
|
|
*/
|
|
unsigned int mtu;
|
|
unsigned int min_mtu;
|
|
unsigned int max_mtu;
|
|
unsigned short type;
|
|
unsigned short hard_header_len;
|
|
unsigned char min_header_len;
|
|
|
|
unsigned short needed_headroom;
|
|
unsigned short needed_tailroom;
|
|
|
|
/* Interface address info. */
|
|
unsigned char perm_addr[MAX_ADDR_LEN];
|
|
unsigned char addr_assign_type;
|
|
unsigned char addr_len;
|
|
unsigned char upper_level;
|
|
unsigned char lower_level;
|
|
unsigned short neigh_priv_len;
|
|
unsigned short dev_id;
|
|
unsigned short dev_port;
|
|
spinlock_t addr_list_lock;
|
|
unsigned char name_assign_type;
|
|
bool uc_promisc;
|
|
struct netdev_hw_addr_list uc;
|
|
struct netdev_hw_addr_list mc;
|
|
struct netdev_hw_addr_list dev_addrs;
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
struct kset *queues_kset;
|
|
#endif
|
|
unsigned int promiscuity;
|
|
unsigned int allmulti;
|
|
|
|
|
|
/* Protocol-specific pointers */
|
|
|
|
#if IS_ENABLED(CONFIG_VLAN_8021Q)
|
|
struct vlan_info __rcu *vlan_info;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_NET_DSA)
|
|
struct dsa_port *dsa_ptr;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_TIPC)
|
|
struct tipc_bearer __rcu *tipc_ptr;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_IRDA) || IS_ENABLED(CONFIG_ATALK)
|
|
void *atalk_ptr;
|
|
#endif
|
|
struct in_device __rcu *ip_ptr;
|
|
#if IS_ENABLED(CONFIG_DECNET)
|
|
struct dn_dev __rcu *dn_ptr;
|
|
#endif
|
|
struct inet6_dev __rcu *ip6_ptr;
|
|
#if IS_ENABLED(CONFIG_AX25)
|
|
void *ax25_ptr;
|
|
#endif
|
|
struct wireless_dev *ieee80211_ptr;
|
|
struct wpan_dev *ieee802154_ptr;
|
|
#if IS_ENABLED(CONFIG_MPLS_ROUTING)
|
|
struct mpls_dev __rcu *mpls_ptr;
|
|
#endif
|
|
|
|
/*
|
|
* Cache lines mostly used on receive path (including eth_type_trans())
|
|
*/
|
|
/* Interface address info used in eth_type_trans() */
|
|
unsigned char *dev_addr;
|
|
|
|
struct netdev_rx_queue *_rx;
|
|
unsigned int num_rx_queues;
|
|
unsigned int real_num_rx_queues;
|
|
|
|
struct bpf_prog __rcu *xdp_prog;
|
|
unsigned long gro_flush_timeout;
|
|
rx_handler_func_t __rcu *rx_handler;
|
|
void __rcu *rx_handler_data;
|
|
|
|
#ifdef CONFIG_NET_CLS_ACT
|
|
struct mini_Qdisc __rcu *miniq_ingress;
|
|
#endif
|
|
struct netdev_queue __rcu *ingress_queue;
|
|
#ifdef CONFIG_NETFILTER_INGRESS
|
|
struct nf_hook_entries __rcu *nf_hooks_ingress;
|
|
#endif
|
|
|
|
unsigned char broadcast[MAX_ADDR_LEN];
|
|
#ifdef CONFIG_RFS_ACCEL
|
|
struct cpu_rmap *rx_cpu_rmap;
|
|
#endif
|
|
struct hlist_node index_hlist;
|
|
|
|
/*
|
|
* Cache lines mostly used on transmit path
|
|
*/
|
|
struct netdev_queue *_tx ____cacheline_aligned_in_smp;
|
|
unsigned int num_tx_queues;
|
|
unsigned int real_num_tx_queues;
|
|
struct Qdisc *qdisc;
|
|
#ifdef CONFIG_NET_SCHED
|
|
DECLARE_HASHTABLE (qdisc_hash, 4);
|
|
#endif
|
|
unsigned int tx_queue_len;
|
|
spinlock_t tx_global_lock;
|
|
int watchdog_timeo;
|
|
|
|
#ifdef CONFIG_XPS
|
|
struct xps_dev_maps __rcu *xps_cpus_map;
|
|
struct xps_dev_maps __rcu *xps_rxqs_map;
|
|
#endif
|
|
#ifdef CONFIG_NET_CLS_ACT
|
|
struct mini_Qdisc __rcu *miniq_egress;
|
|
#endif
|
|
|
|
/* These may be needed for future network-power-down code. */
|
|
struct timer_list watchdog_timer;
|
|
|
|
int __percpu *pcpu_refcnt;
|
|
struct list_head todo_list;
|
|
|
|
struct list_head link_watch_list;
|
|
|
|
enum { NETREG_UNINITIALIZED=0,
|
|
NETREG_REGISTERED, /* completed register_netdevice */
|
|
NETREG_UNREGISTERING, /* called unregister_netdevice */
|
|
NETREG_UNREGISTERED, /* completed unregister todo */
|
|
NETREG_RELEASED, /* called free_netdev */
|
|
NETREG_DUMMY, /* dummy device for NAPI poll */
|
|
} reg_state:8;
|
|
|
|
bool dismantle;
|
|
|
|
enum {
|
|
RTNL_LINK_INITIALIZED,
|
|
RTNL_LINK_INITIALIZING,
|
|
} rtnl_link_state:16;
|
|
|
|
bool needs_free_netdev;
|
|
void (*priv_destructor)(struct net_device *dev);
|
|
|
|
#ifdef CONFIG_NETPOLL
|
|
struct netpoll_info __rcu *npinfo;
|
|
#endif
|
|
|
|
possible_net_t nd_net;
|
|
|
|
/* mid-layer private */
|
|
union {
|
|
void *ml_priv;
|
|
struct pcpu_lstats __percpu *lstats;
|
|
struct pcpu_sw_netstats __percpu *tstats;
|
|
struct pcpu_dstats __percpu *dstats;
|
|
struct pcpu_vstats __percpu *vstats;
|
|
};
|
|
|
|
#if IS_ENABLED(CONFIG_GARP)
|
|
struct garp_port __rcu *garp_port;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_MRP)
|
|
struct mrp_port __rcu *mrp_port;
|
|
#endif
|
|
|
|
struct device dev;
|
|
const struct attribute_group *sysfs_groups[4];
|
|
const struct attribute_group *sysfs_rx_queue_group;
|
|
|
|
const struct rtnl_link_ops *rtnl_link_ops;
|
|
|
|
/* for setting kernel sock attribute on TCP connection setup */
|
|
#define GSO_MAX_SIZE 65536
|
|
unsigned int gso_max_size;
|
|
#define GSO_MAX_SEGS 65535
|
|
u16 gso_max_segs;
|
|
|
|
#ifdef CONFIG_DCB
|
|
const struct dcbnl_rtnl_ops *dcbnl_ops;
|
|
#endif
|
|
s16 num_tc;
|
|
struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
|
|
u8 prio_tc_map[TC_BITMASK + 1];
|
|
|
|
#if IS_ENABLED(CONFIG_FCOE)
|
|
unsigned int fcoe_ddp_xid;
|
|
#endif
|
|
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
|
|
struct netprio_map __rcu *priomap;
|
|
#endif
|
|
struct phy_device *phydev;
|
|
struct sfp_bus *sfp_bus;
|
|
struct lock_class_key *qdisc_tx_busylock;
|
|
struct lock_class_key *qdisc_running_key;
|
|
bool proto_down;
|
|
unsigned wol_enabled:1;
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
ANDROID_KABI_RESERVE(5);
|
|
ANDROID_KABI_RESERVE(6);
|
|
ANDROID_KABI_RESERVE(7);
|
|
ANDROID_KABI_RESERVE(8);
|
|
|
|
};
|
|
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
|
|
|
static inline bool netif_elide_gro(const struct net_device *dev)
|
|
{
|
|
if (!(dev->features & NETIF_F_GRO) || dev->xdp_prog)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
#define NETDEV_ALIGN 32
|
|
|
|
static inline
|
|
int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio)
|
|
{
|
|
return dev->prio_tc_map[prio & TC_BITMASK];
|
|
}
|
|
|
|
static inline
|
|
int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc)
|
|
{
|
|
if (tc >= dev->num_tc)
|
|
return -EINVAL;
|
|
|
|
dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK;
|
|
return 0;
|
|
}
|
|
|
|
int netdev_txq_to_tc(struct net_device *dev, unsigned int txq);
|
|
void netdev_reset_tc(struct net_device *dev);
|
|
int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset);
|
|
int netdev_set_num_tc(struct net_device *dev, u8 num_tc);
|
|
|
|
static inline
|
|
int netdev_get_num_tc(struct net_device *dev)
|
|
{
|
|
return dev->num_tc;
|
|
}
|
|
|
|
void netdev_unbind_sb_channel(struct net_device *dev,
|
|
struct net_device *sb_dev);
|
|
int netdev_bind_sb_channel_queue(struct net_device *dev,
|
|
struct net_device *sb_dev,
|
|
u8 tc, u16 count, u16 offset);
|
|
int netdev_set_sb_channel(struct net_device *dev, u16 channel);
|
|
static inline int netdev_get_sb_channel(struct net_device *dev)
|
|
{
|
|
return max_t(int, -dev->num_tc, 0);
|
|
}
|
|
|
|
static inline
|
|
struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
|
|
unsigned int index)
|
|
{
|
|
return &dev->_tx[index];
|
|
}
|
|
|
|
static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
|
|
const struct sk_buff *skb)
|
|
{
|
|
return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
|
|
}
|
|
|
|
static inline void netdev_for_each_tx_queue(struct net_device *dev,
|
|
void (*f)(struct net_device *,
|
|
struct netdev_queue *,
|
|
void *),
|
|
void *arg)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++)
|
|
f(dev, &dev->_tx[i], arg);
|
|
}
|
|
|
|
#define netdev_lockdep_set_classes(dev) \
|
|
{ \
|
|
static struct lock_class_key qdisc_tx_busylock_key; \
|
|
static struct lock_class_key qdisc_running_key; \
|
|
static struct lock_class_key qdisc_xmit_lock_key; \
|
|
static struct lock_class_key dev_addr_list_lock_key; \
|
|
unsigned int i; \
|
|
\
|
|
(dev)->qdisc_tx_busylock = &qdisc_tx_busylock_key; \
|
|
(dev)->qdisc_running_key = &qdisc_running_key; \
|
|
lockdep_set_class(&(dev)->addr_list_lock, \
|
|
&dev_addr_list_lock_key); \
|
|
for (i = 0; i < (dev)->num_tx_queues; i++) \
|
|
lockdep_set_class(&(dev)->_tx[i]._xmit_lock, \
|
|
&qdisc_xmit_lock_key); \
|
|
}
|
|
|
|
struct netdev_queue *netdev_pick_tx(struct net_device *dev,
|
|
struct sk_buff *skb,
|
|
struct net_device *sb_dev);
|
|
|
|
/* returns the headroom that the master device needs to take in account
|
|
* when forwarding to this dev
|
|
*/
|
|
static inline unsigned netdev_get_fwd_headroom(struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_PHONY_HEADROOM ? 0 : dev->needed_headroom;
|
|
}
|
|
|
|
static inline void netdev_set_rx_headroom(struct net_device *dev, int new_hr)
|
|
{
|
|
if (dev->netdev_ops->ndo_set_rx_headroom)
|
|
dev->netdev_ops->ndo_set_rx_headroom(dev, new_hr);
|
|
}
|
|
|
|
/* set the device rx headroom to the dev's default */
|
|
static inline void netdev_reset_rx_headroom(struct net_device *dev)
|
|
{
|
|
netdev_set_rx_headroom(dev, -1);
|
|
}
|
|
|
|
/*
|
|
* Net namespace inlines
|
|
*/
|
|
static inline
|
|
struct net *dev_net(const struct net_device *dev)
|
|
{
|
|
return read_pnet(&dev->nd_net);
|
|
}
|
|
|
|
static inline
|
|
void dev_net_set(struct net_device *dev, struct net *net)
|
|
{
|
|
write_pnet(&dev->nd_net, net);
|
|
}
|
|
|
|
/**
|
|
* netdev_priv - access network device private data
|
|
* @dev: network device
|
|
*
|
|
* Get network device private data
|
|
*/
|
|
static inline void *netdev_priv(const struct net_device *dev)
|
|
{
|
|
return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
|
|
}
|
|
|
|
/* Set the sysfs physical device reference for the network logical device
|
|
* if set prior to registration will cause a symlink during initialization.
|
|
*/
|
|
#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
|
|
|
|
/* Set the sysfs device type for the network logical device to allow
|
|
* fine-grained identification of different network device types. For
|
|
* example Ethernet, Wireless LAN, Bluetooth, WiMAX etc.
|
|
*/
|
|
#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
|
|
|
|
/* Default NAPI poll() weight
|
|
* Device drivers are strongly advised to not use bigger value
|
|
*/
|
|
#define NAPI_POLL_WEIGHT 64
|
|
|
|
/**
|
|
* netif_napi_add - initialize a NAPI context
|
|
* @dev: network device
|
|
* @napi: NAPI context
|
|
* @poll: polling function
|
|
* @weight: default weight
|
|
*
|
|
* netif_napi_add() must be used to initialize a NAPI context prior to calling
|
|
* *any* of the other NAPI-related functions.
|
|
*/
|
|
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
|
|
int (*poll)(struct napi_struct *, int), int weight);
|
|
|
|
/**
|
|
* netif_tx_napi_add - initialize a NAPI context
|
|
* @dev: network device
|
|
* @napi: NAPI context
|
|
* @poll: polling function
|
|
* @weight: default weight
|
|
*
|
|
* This variant of netif_napi_add() should be used from drivers using NAPI
|
|
* to exclusively poll a TX queue.
|
|
* This will avoid we add it into napi_hash[], thus polluting this hash table.
|
|
*/
|
|
static inline void netif_tx_napi_add(struct net_device *dev,
|
|
struct napi_struct *napi,
|
|
int (*poll)(struct napi_struct *, int),
|
|
int weight)
|
|
{
|
|
set_bit(NAPI_STATE_NO_BUSY_POLL, &napi->state);
|
|
netif_napi_add(dev, napi, poll, weight);
|
|
}
|
|
|
|
/**
|
|
* netif_napi_del - remove a NAPI context
|
|
* @napi: NAPI context
|
|
*
|
|
* netif_napi_del() removes a NAPI context from the network device NAPI list
|
|
*/
|
|
void netif_napi_del(struct napi_struct *napi);
|
|
|
|
struct napi_gro_cb {
|
|
/* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
|
|
void *frag0;
|
|
|
|
/* Length of frag0. */
|
|
unsigned int frag0_len;
|
|
|
|
/* This indicates where we are processing relative to skb->data. */
|
|
int data_offset;
|
|
|
|
/* This is non-zero if the packet cannot be merged with the new skb. */
|
|
u16 flush;
|
|
|
|
/* Save the IP ID here and check when we get to the transport layer */
|
|
u16 flush_id;
|
|
|
|
/* Number of segments aggregated. */
|
|
u16 count;
|
|
|
|
/* Start offset for remote checksum offload */
|
|
u16 gro_remcsum_start;
|
|
|
|
/* jiffies when first packet was created/queued */
|
|
unsigned long age;
|
|
|
|
/* Used in ipv6_gro_receive() and foo-over-udp */
|
|
u16 proto;
|
|
|
|
/* This is non-zero if the packet may be of the same flow. */
|
|
u8 same_flow:1;
|
|
|
|
/* Used in tunnel GRO receive */
|
|
u8 encap_mark:1;
|
|
|
|
/* GRO checksum is valid */
|
|
u8 csum_valid:1;
|
|
|
|
/* Number of checksums via CHECKSUM_UNNECESSARY */
|
|
u8 csum_cnt:3;
|
|
|
|
/* Free the skb? */
|
|
u8 free:2;
|
|
#define NAPI_GRO_FREE 1
|
|
#define NAPI_GRO_FREE_STOLEN_HEAD 2
|
|
|
|
/* Used in foo-over-udp, set in udp[46]_gro_receive */
|
|
u8 is_ipv6:1;
|
|
|
|
/* Used in GRE, set in fou/gue_gro_receive */
|
|
u8 is_fou:1;
|
|
|
|
/* Number of gro_receive callbacks this packet already went through */
|
|
u8 recursion_counter:4;
|
|
|
|
/* 2 bit hole */
|
|
|
|
/* used to support CHECKSUM_COMPLETE for tunneling protocols */
|
|
__wsum csum;
|
|
|
|
/* used in skb_gro_receive() slow path */
|
|
struct sk_buff *last;
|
|
};
|
|
|
|
#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
|
|
|
|
#define GRO_RECURSION_LIMIT 15
|
|
static inline int gro_recursion_inc_test(struct sk_buff *skb)
|
|
{
|
|
return ++NAPI_GRO_CB(skb)->recursion_counter == GRO_RECURSION_LIMIT;
|
|
}
|
|
|
|
typedef struct sk_buff *(*gro_receive_t)(struct list_head *, struct sk_buff *);
|
|
static inline struct sk_buff *call_gro_receive(gro_receive_t cb,
|
|
struct list_head *head,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (unlikely(gro_recursion_inc_test(skb))) {
|
|
NAPI_GRO_CB(skb)->flush |= 1;
|
|
return NULL;
|
|
}
|
|
|
|
return cb(head, skb);
|
|
}
|
|
|
|
typedef struct sk_buff *(*gro_receive_sk_t)(struct sock *, struct list_head *,
|
|
struct sk_buff *);
|
|
static inline struct sk_buff *call_gro_receive_sk(gro_receive_sk_t cb,
|
|
struct sock *sk,
|
|
struct list_head *head,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (unlikely(gro_recursion_inc_test(skb))) {
|
|
NAPI_GRO_CB(skb)->flush |= 1;
|
|
return NULL;
|
|
}
|
|
|
|
return cb(sk, head, skb);
|
|
}
|
|
|
|
struct packet_type {
|
|
__be16 type; /* This is really htons(ether_type). */
|
|
struct net_device *dev; /* NULL is wildcarded here */
|
|
int (*func) (struct sk_buff *,
|
|
struct net_device *,
|
|
struct packet_type *,
|
|
struct net_device *);
|
|
void (*list_func) (struct list_head *,
|
|
struct packet_type *,
|
|
struct net_device *);
|
|
bool (*id_match)(struct packet_type *ptype,
|
|
struct sock *sk);
|
|
void *af_packet_priv;
|
|
struct list_head list;
|
|
|
|
ANDROID_KABI_RESERVE(1);
|
|
ANDROID_KABI_RESERVE(2);
|
|
ANDROID_KABI_RESERVE(3);
|
|
ANDROID_KABI_RESERVE(4);
|
|
};
|
|
|
|
struct offload_callbacks {
|
|
struct sk_buff *(*gso_segment)(struct sk_buff *skb,
|
|
netdev_features_t features);
|
|
struct sk_buff *(*gro_receive)(struct list_head *head,
|
|
struct sk_buff *skb);
|
|
int (*gro_complete)(struct sk_buff *skb, int nhoff);
|
|
};
|
|
|
|
struct packet_offload {
|
|
__be16 type; /* This is really htons(ether_type). */
|
|
u16 priority;
|
|
struct offload_callbacks callbacks;
|
|
struct list_head list;
|
|
};
|
|
|
|
/* often modified stats are per-CPU, other are shared (netdev->stats) */
|
|
struct pcpu_sw_netstats {
|
|
u64 rx_packets;
|
|
u64 rx_bytes;
|
|
u64 tx_packets;
|
|
u64 tx_bytes;
|
|
struct u64_stats_sync syncp;
|
|
};
|
|
|
|
#define __netdev_alloc_pcpu_stats(type, gfp) \
|
|
({ \
|
|
typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
|
|
if (pcpu_stats) { \
|
|
int __cpu; \
|
|
for_each_possible_cpu(__cpu) { \
|
|
typeof(type) *stat; \
|
|
stat = per_cpu_ptr(pcpu_stats, __cpu); \
|
|
u64_stats_init(&stat->syncp); \
|
|
} \
|
|
} \
|
|
pcpu_stats; \
|
|
})
|
|
|
|
#define netdev_alloc_pcpu_stats(type) \
|
|
__netdev_alloc_pcpu_stats(type, GFP_KERNEL)
|
|
|
|
enum netdev_lag_tx_type {
|
|
NETDEV_LAG_TX_TYPE_UNKNOWN,
|
|
NETDEV_LAG_TX_TYPE_RANDOM,
|
|
NETDEV_LAG_TX_TYPE_BROADCAST,
|
|
NETDEV_LAG_TX_TYPE_ROUNDROBIN,
|
|
NETDEV_LAG_TX_TYPE_ACTIVEBACKUP,
|
|
NETDEV_LAG_TX_TYPE_HASH,
|
|
};
|
|
|
|
enum netdev_lag_hash {
|
|
NETDEV_LAG_HASH_NONE,
|
|
NETDEV_LAG_HASH_L2,
|
|
NETDEV_LAG_HASH_L34,
|
|
NETDEV_LAG_HASH_L23,
|
|
NETDEV_LAG_HASH_E23,
|
|
NETDEV_LAG_HASH_E34,
|
|
NETDEV_LAG_HASH_UNKNOWN,
|
|
};
|
|
|
|
struct netdev_lag_upper_info {
|
|
enum netdev_lag_tx_type tx_type;
|
|
enum netdev_lag_hash hash_type;
|
|
};
|
|
|
|
struct netdev_lag_lower_state_info {
|
|
u8 link_up : 1,
|
|
tx_enabled : 1;
|
|
};
|
|
|
|
#include <linux/notifier.h>
|
|
|
|
/* netdevice notifier chain. Please remember to update netdev_cmd_to_name()
|
|
* and the rtnetlink notification exclusion list in rtnetlink_event() when
|
|
* adding new types.
|
|
*/
|
|
enum netdev_cmd {
|
|
NETDEV_UP = 1, /* For now you can't veto a device up/down */
|
|
NETDEV_DOWN,
|
|
NETDEV_REBOOT, /* Tell a protocol stack a network interface
|
|
detected a hardware crash and restarted
|
|
- we can use this eg to kick tcp sessions
|
|
once done */
|
|
NETDEV_CHANGE, /* Notify device state change */
|
|
NETDEV_REGISTER,
|
|
NETDEV_UNREGISTER,
|
|
NETDEV_CHANGEMTU, /* notify after mtu change happened */
|
|
NETDEV_CHANGEADDR,
|
|
NETDEV_GOING_DOWN,
|
|
NETDEV_CHANGENAME,
|
|
NETDEV_FEAT_CHANGE,
|
|
NETDEV_BONDING_FAILOVER,
|
|
NETDEV_PRE_UP,
|
|
NETDEV_PRE_TYPE_CHANGE,
|
|
NETDEV_POST_TYPE_CHANGE,
|
|
NETDEV_POST_INIT,
|
|
NETDEV_RELEASE,
|
|
NETDEV_NOTIFY_PEERS,
|
|
NETDEV_JOIN,
|
|
NETDEV_CHANGEUPPER,
|
|
NETDEV_RESEND_IGMP,
|
|
NETDEV_PRECHANGEMTU, /* notify before mtu change happened */
|
|
NETDEV_CHANGEINFODATA,
|
|
NETDEV_BONDING_INFO,
|
|
NETDEV_PRECHANGEUPPER,
|
|
NETDEV_CHANGELOWERSTATE,
|
|
NETDEV_UDP_TUNNEL_PUSH_INFO,
|
|
NETDEV_UDP_TUNNEL_DROP_INFO,
|
|
NETDEV_CHANGE_TX_QUEUE_LEN,
|
|
NETDEV_CVLAN_FILTER_PUSH_INFO,
|
|
NETDEV_CVLAN_FILTER_DROP_INFO,
|
|
NETDEV_SVLAN_FILTER_PUSH_INFO,
|
|
NETDEV_SVLAN_FILTER_DROP_INFO,
|
|
};
|
|
const char *netdev_cmd_to_name(enum netdev_cmd cmd);
|
|
|
|
int register_netdevice_notifier(struct notifier_block *nb);
|
|
int unregister_netdevice_notifier(struct notifier_block *nb);
|
|
|
|
struct netdev_notifier_info {
|
|
struct net_device *dev;
|
|
struct netlink_ext_ack *extack;
|
|
};
|
|
|
|
struct netdev_notifier_info_ext {
|
|
struct netdev_notifier_info info; /* must be first */
|
|
union {
|
|
u32 mtu;
|
|
} ext;
|
|
};
|
|
|
|
struct netdev_notifier_change_info {
|
|
struct netdev_notifier_info info; /* must be first */
|
|
unsigned int flags_changed;
|
|
};
|
|
|
|
struct netdev_notifier_changeupper_info {
|
|
struct netdev_notifier_info info; /* must be first */
|
|
struct net_device *upper_dev; /* new upper dev */
|
|
bool master; /* is upper dev master */
|
|
bool linking; /* is the notification for link or unlink */
|
|
void *upper_info; /* upper dev info */
|
|
};
|
|
|
|
struct netdev_notifier_changelowerstate_info {
|
|
struct netdev_notifier_info info; /* must be first */
|
|
void *lower_state_info; /* is lower dev state */
|
|
};
|
|
|
|
static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
|
|
struct net_device *dev)
|
|
{
|
|
info->dev = dev;
|
|
info->extack = NULL;
|
|
}
|
|
|
|
static inline struct net_device *
|
|
netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
|
|
{
|
|
return info->dev;
|
|
}
|
|
|
|
static inline struct netlink_ext_ack *
|
|
netdev_notifier_info_to_extack(const struct netdev_notifier_info *info)
|
|
{
|
|
return info->extack;
|
|
}
|
|
|
|
int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
|
|
|
|
|
|
extern rwlock_t dev_base_lock; /* Device list lock */
|
|
|
|
#define for_each_netdev(net, d) \
|
|
list_for_each_entry(d, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_reverse(net, d) \
|
|
list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_rcu(net, d) \
|
|
list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_safe(net, d, n) \
|
|
list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_continue(net, d) \
|
|
list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_continue_rcu(net, d) \
|
|
list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
|
|
#define for_each_netdev_in_bond_rcu(bond, slave) \
|
|
for_each_netdev_rcu(&init_net, slave) \
|
|
if (netdev_master_upper_dev_get_rcu(slave) == (bond))
|
|
#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
|
|
|
|
static inline struct net_device *next_net_device(struct net_device *dev)
|
|
{
|
|
struct list_head *lh;
|
|
struct net *net;
|
|
|
|
net = dev_net(dev);
|
|
lh = dev->dev_list.next;
|
|
return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
|
|
}
|
|
|
|
static inline struct net_device *next_net_device_rcu(struct net_device *dev)
|
|
{
|
|
struct list_head *lh;
|
|
struct net *net;
|
|
|
|
net = dev_net(dev);
|
|
lh = rcu_dereference(list_next_rcu(&dev->dev_list));
|
|
return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
|
|
}
|
|
|
|
static inline struct net_device *first_net_device(struct net *net)
|
|
{
|
|
return list_empty(&net->dev_base_head) ? NULL :
|
|
net_device_entry(net->dev_base_head.next);
|
|
}
|
|
|
|
static inline struct net_device *first_net_device_rcu(struct net *net)
|
|
{
|
|
struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head));
|
|
|
|
return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
|
|
}
|
|
|
|
int netdev_boot_setup_check(struct net_device *dev);
|
|
unsigned long netdev_boot_base(const char *prefix, int unit);
|
|
struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
|
|
const char *hwaddr);
|
|
struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
|
|
struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
|
|
void dev_add_pack(struct packet_type *pt);
|
|
void dev_remove_pack(struct packet_type *pt);
|
|
void __dev_remove_pack(struct packet_type *pt);
|
|
void dev_add_offload(struct packet_offload *po);
|
|
void dev_remove_offload(struct packet_offload *po);
|
|
|
|
int dev_get_iflink(const struct net_device *dev);
|
|
int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
|
|
struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
|
|
unsigned short mask);
|
|
struct net_device *dev_get_by_name(struct net *net, const char *name);
|
|
struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
|
|
struct net_device *__dev_get_by_name(struct net *net, const char *name);
|
|
int dev_alloc_name(struct net_device *dev, const char *name);
|
|
int dev_open(struct net_device *dev);
|
|
void dev_close(struct net_device *dev);
|
|
void dev_close_many(struct list_head *head, bool unlink);
|
|
void dev_disable_lro(struct net_device *dev);
|
|
int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
|
|
u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb,
|
|
struct net_device *sb_dev,
|
|
select_queue_fallback_t fallback);
|
|
u16 dev_pick_tx_cpu_id(struct net_device *dev, struct sk_buff *skb,
|
|
struct net_device *sb_dev,
|
|
select_queue_fallback_t fallback);
|
|
int dev_queue_xmit(struct sk_buff *skb);
|
|
int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev);
|
|
int dev_direct_xmit(struct sk_buff *skb, u16 queue_id);
|
|
int register_netdevice(struct net_device *dev);
|
|
void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
|
|
void unregister_netdevice_many(struct list_head *head);
|
|
static inline void unregister_netdevice(struct net_device *dev)
|
|
{
|
|
unregister_netdevice_queue(dev, NULL);
|
|
}
|
|
|
|
int netdev_refcnt_read(const struct net_device *dev);
|
|
void free_netdev(struct net_device *dev);
|
|
void netdev_freemem(struct net_device *dev);
|
|
void synchronize_net(void);
|
|
int init_dummy_netdev(struct net_device *dev);
|
|
|
|
struct net_device *dev_get_by_index(struct net *net, int ifindex);
|
|
struct net_device *__dev_get_by_index(struct net *net, int ifindex);
|
|
struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
|
|
struct net_device *dev_get_by_napi_id(unsigned int napi_id);
|
|
int netdev_get_name(struct net *net, char *name, int ifindex);
|
|
int dev_restart(struct net_device *dev);
|
|
int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
|
|
|
|
static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
|
|
{
|
|
return NAPI_GRO_CB(skb)->data_offset;
|
|
}
|
|
|
|
static inline unsigned int skb_gro_len(const struct sk_buff *skb)
|
|
{
|
|
return skb->len - NAPI_GRO_CB(skb)->data_offset;
|
|
}
|
|
|
|
static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
|
|
{
|
|
NAPI_GRO_CB(skb)->data_offset += len;
|
|
}
|
|
|
|
static inline void *skb_gro_header_fast(struct sk_buff *skb,
|
|
unsigned int offset)
|
|
{
|
|
return NAPI_GRO_CB(skb)->frag0 + offset;
|
|
}
|
|
|
|
static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
|
|
{
|
|
return NAPI_GRO_CB(skb)->frag0_len < hlen;
|
|
}
|
|
|
|
static inline void skb_gro_frag0_invalidate(struct sk_buff *skb)
|
|
{
|
|
NAPI_GRO_CB(skb)->frag0 = NULL;
|
|
NAPI_GRO_CB(skb)->frag0_len = 0;
|
|
}
|
|
|
|
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
|
|
unsigned int offset)
|
|
{
|
|
if (!pskb_may_pull(skb, hlen))
|
|
return NULL;
|
|
|
|
skb_gro_frag0_invalidate(skb);
|
|
return skb->data + offset;
|
|
}
|
|
|
|
static inline void *skb_gro_network_header(struct sk_buff *skb)
|
|
{
|
|
return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
|
|
skb_network_offset(skb);
|
|
}
|
|
|
|
static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
|
|
const void *start, unsigned int len)
|
|
{
|
|
if (NAPI_GRO_CB(skb)->csum_valid)
|
|
NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum,
|
|
csum_partial(start, len, 0));
|
|
}
|
|
|
|
/* GRO checksum functions. These are logical equivalents of the normal
|
|
* checksum functions (in skbuff.h) except that they operate on the GRO
|
|
* offsets and fields in sk_buff.
|
|
*/
|
|
|
|
__sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
|
|
|
|
static inline bool skb_at_gro_remcsum_start(struct sk_buff *skb)
|
|
{
|
|
return (NAPI_GRO_CB(skb)->gro_remcsum_start == skb_gro_offset(skb));
|
|
}
|
|
|
|
static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
|
|
bool zero_okay,
|
|
__sum16 check)
|
|
{
|
|
return ((skb->ip_summed != CHECKSUM_PARTIAL ||
|
|
skb_checksum_start_offset(skb) <
|
|
skb_gro_offset(skb)) &&
|
|
!skb_at_gro_remcsum_start(skb) &&
|
|
NAPI_GRO_CB(skb)->csum_cnt == 0 &&
|
|
(!zero_okay || check));
|
|
}
|
|
|
|
static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
|
|
__wsum psum)
|
|
{
|
|
if (NAPI_GRO_CB(skb)->csum_valid &&
|
|
!csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
|
|
return 0;
|
|
|
|
NAPI_GRO_CB(skb)->csum = psum;
|
|
|
|
return __skb_gro_checksum_complete(skb);
|
|
}
|
|
|
|
static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
|
|
{
|
|
if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
|
|
/* Consume a checksum from CHECKSUM_UNNECESSARY */
|
|
NAPI_GRO_CB(skb)->csum_cnt--;
|
|
} else {
|
|
/* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
|
|
* verified a new top level checksum or an encapsulated one
|
|
* during GRO. This saves work if we fallback to normal path.
|
|
*/
|
|
__skb_incr_checksum_unnecessary(skb);
|
|
}
|
|
}
|
|
|
|
#define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
|
|
compute_pseudo) \
|
|
({ \
|
|
__sum16 __ret = 0; \
|
|
if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
|
|
__ret = __skb_gro_checksum_validate_complete(skb, \
|
|
compute_pseudo(skb, proto)); \
|
|
if (!__ret) \
|
|
skb_gro_incr_csum_unnecessary(skb); \
|
|
__ret; \
|
|
})
|
|
|
|
#define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
|
|
__skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
|
|
|
|
#define skb_gro_checksum_validate_zero_check(skb, proto, check, \
|
|
compute_pseudo) \
|
|
__skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
|
|
|
|
#define skb_gro_checksum_simple_validate(skb) \
|
|
__skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
|
|
|
|
static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
|
|
{
|
|
return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
|
|
!NAPI_GRO_CB(skb)->csum_valid);
|
|
}
|
|
|
|
static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
|
|
__sum16 check, __wsum pseudo)
|
|
{
|
|
NAPI_GRO_CB(skb)->csum = ~pseudo;
|
|
NAPI_GRO_CB(skb)->csum_valid = 1;
|
|
}
|
|
|
|
#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo) \
|
|
do { \
|
|
if (__skb_gro_checksum_convert_check(skb)) \
|
|
__skb_gro_checksum_convert(skb, check, \
|
|
compute_pseudo(skb, proto)); \
|
|
} while (0)
|
|
|
|
struct gro_remcsum {
|
|
int offset;
|
|
__wsum delta;
|
|
};
|
|
|
|
static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
|
|
{
|
|
grc->offset = 0;
|
|
grc->delta = 0;
|
|
}
|
|
|
|
static inline void *skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
|
|
unsigned int off, size_t hdrlen,
|
|
int start, int offset,
|
|
struct gro_remcsum *grc,
|
|
bool nopartial)
|
|
{
|
|
__wsum delta;
|
|
size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
|
|
|
|
BUG_ON(!NAPI_GRO_CB(skb)->csum_valid);
|
|
|
|
if (!nopartial) {
|
|
NAPI_GRO_CB(skb)->gro_remcsum_start = off + hdrlen + start;
|
|
return ptr;
|
|
}
|
|
|
|
ptr = skb_gro_header_fast(skb, off);
|
|
if (skb_gro_header_hard(skb, off + plen)) {
|
|
ptr = skb_gro_header_slow(skb, off + plen, off);
|
|
if (!ptr)
|
|
return NULL;
|
|
}
|
|
|
|
delta = remcsum_adjust(ptr + hdrlen, NAPI_GRO_CB(skb)->csum,
|
|
start, offset);
|
|
|
|
/* Adjust skb->csum since we changed the packet */
|
|
NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
|
|
|
|
grc->offset = off + hdrlen + offset;
|
|
grc->delta = delta;
|
|
|
|
return ptr;
|
|
}
|
|
|
|
static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
|
|
struct gro_remcsum *grc)
|
|
{
|
|
void *ptr;
|
|
size_t plen = grc->offset + sizeof(u16);
|
|
|
|
if (!grc->delta)
|
|
return;
|
|
|
|
ptr = skb_gro_header_fast(skb, grc->offset);
|
|
if (skb_gro_header_hard(skb, grc->offset + sizeof(u16))) {
|
|
ptr = skb_gro_header_slow(skb, plen, grc->offset);
|
|
if (!ptr)
|
|
return;
|
|
}
|
|
|
|
remcsum_unadjust((__sum16 *)ptr, grc->delta);
|
|
}
|
|
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
|
|
{
|
|
if (PTR_ERR(pp) != -EINPROGRESS)
|
|
NAPI_GRO_CB(skb)->flush |= flush;
|
|
}
|
|
static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
|
|
struct sk_buff *pp,
|
|
int flush,
|
|
struct gro_remcsum *grc)
|
|
{
|
|
if (PTR_ERR(pp) != -EINPROGRESS) {
|
|
NAPI_GRO_CB(skb)->flush |= flush;
|
|
skb_gro_remcsum_cleanup(skb, grc);
|
|
skb->remcsum_offload = 0;
|
|
}
|
|
}
|
|
#else
|
|
static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff *pp, int flush)
|
|
{
|
|
NAPI_GRO_CB(skb)->flush |= flush;
|
|
}
|
|
static inline void skb_gro_flush_final_remcsum(struct sk_buff *skb,
|
|
struct sk_buff *pp,
|
|
int flush,
|
|
struct gro_remcsum *grc)
|
|
{
|
|
NAPI_GRO_CB(skb)->flush |= flush;
|
|
skb_gro_remcsum_cleanup(skb, grc);
|
|
skb->remcsum_offload = 0;
|
|
}
|
|
#endif
|
|
|
|
static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
|
unsigned short type,
|
|
const void *daddr, const void *saddr,
|
|
unsigned int len)
|
|
{
|
|
if (!dev->header_ops || !dev->header_ops->create)
|
|
return 0;
|
|
|
|
return dev->header_ops->create(skb, dev, type, daddr, saddr, len);
|
|
}
|
|
|
|
static inline int dev_parse_header(const struct sk_buff *skb,
|
|
unsigned char *haddr)
|
|
{
|
|
const struct net_device *dev = skb->dev;
|
|
|
|
if (!dev->header_ops || !dev->header_ops->parse)
|
|
return 0;
|
|
return dev->header_ops->parse(skb, haddr);
|
|
}
|
|
|
|
/* ll_header must have at least hard_header_len allocated */
|
|
static inline bool dev_validate_header(const struct net_device *dev,
|
|
char *ll_header, int len)
|
|
{
|
|
if (likely(len >= dev->hard_header_len))
|
|
return true;
|
|
if (len < dev->min_header_len)
|
|
return false;
|
|
|
|
if (capable(CAP_SYS_RAWIO)) {
|
|
memset(ll_header + len, 0, dev->hard_header_len - len);
|
|
return true;
|
|
}
|
|
|
|
if (dev->header_ops && dev->header_ops->validate)
|
|
return dev->header_ops->validate(ll_header, len);
|
|
|
|
return false;
|
|
}
|
|
|
|
typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr,
|
|
int len, int size);
|
|
int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
|
|
static inline int unregister_gifconf(unsigned int family)
|
|
{
|
|
return register_gifconf(family, NULL);
|
|
}
|
|
|
|
#ifdef CONFIG_NET_FLOW_LIMIT
|
|
#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
|
|
struct sd_flow_limit {
|
|
u64 count;
|
|
unsigned int num_buckets;
|
|
unsigned int history_head;
|
|
u16 history[FLOW_LIMIT_HISTORY];
|
|
u8 buckets[];
|
|
};
|
|
|
|
extern int netdev_flow_limit_table_len;
|
|
#endif /* CONFIG_NET_FLOW_LIMIT */
|
|
|
|
/*
|
|
* Incoming packets are placed on per-CPU queues
|
|
*/
|
|
struct softnet_data {
|
|
struct list_head poll_list;
|
|
struct napi_struct *current_napi;
|
|
struct sk_buff_head process_queue;
|
|
|
|
/* stats */
|
|
unsigned int processed;
|
|
unsigned int time_squeeze;
|
|
unsigned int received_rps;
|
|
/* unused partner variable for ABI alignment */
|
|
unsigned int gro_coalesced;
|
|
|
|
#ifdef CONFIG_RPS
|
|
struct softnet_data *rps_ipi_list;
|
|
#endif
|
|
#ifdef CONFIG_NET_FLOW_LIMIT
|
|
struct sd_flow_limit __rcu *flow_limit;
|
|
#endif
|
|
struct Qdisc *output_queue;
|
|
struct Qdisc **output_queue_tailp;
|
|
struct sk_buff *completion_queue;
|
|
#ifdef CONFIG_XFRM_OFFLOAD
|
|
struct sk_buff_head xfrm_backlog;
|
|
#endif
|
|
/* written and read only by owning cpu: */
|
|
struct {
|
|
u16 recursion;
|
|
u8 more;
|
|
} xmit;
|
|
#ifdef CONFIG_RPS
|
|
/* input_queue_head should be written by cpu owning this struct,
|
|
* and only read by other cpus. Worth using a cache line.
|
|
*/
|
|
unsigned int input_queue_head ____cacheline_aligned_in_smp;
|
|
|
|
/* Elements below can be accessed between CPUs for RPS/RFS */
|
|
call_single_data_t csd ____cacheline_aligned_in_smp;
|
|
struct softnet_data *rps_ipi_next;
|
|
unsigned int cpu;
|
|
unsigned int input_queue_tail;
|
|
#endif
|
|
unsigned int dropped;
|
|
struct sk_buff_head input_pkt_queue;
|
|
struct napi_struct backlog;
|
|
|
|
};
|
|
|
|
static inline void input_queue_head_incr(struct softnet_data *sd)
|
|
{
|
|
#ifdef CONFIG_RPS
|
|
sd->input_queue_head++;
|
|
#endif
|
|
}
|
|
|
|
static inline void input_queue_tail_incr_save(struct softnet_data *sd,
|
|
unsigned int *qtail)
|
|
{
|
|
#ifdef CONFIG_RPS
|
|
*qtail = ++sd->input_queue_tail;
|
|
#endif
|
|
}
|
|
|
|
DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
|
|
|
|
static inline int dev_recursion_level(void)
|
|
{
|
|
return this_cpu_read(softnet_data.xmit.recursion);
|
|
}
|
|
|
|
#define XMIT_RECURSION_LIMIT 8
|
|
static inline bool dev_xmit_recursion(void)
|
|
{
|
|
return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
|
|
XMIT_RECURSION_LIMIT);
|
|
}
|
|
|
|
static inline void dev_xmit_recursion_inc(void)
|
|
{
|
|
__this_cpu_inc(softnet_data.xmit.recursion);
|
|
}
|
|
|
|
static inline void dev_xmit_recursion_dec(void)
|
|
{
|
|
__this_cpu_dec(softnet_data.xmit.recursion);
|
|
}
|
|
|
|
void __netif_schedule(struct Qdisc *q);
|
|
void netif_schedule_queue(struct netdev_queue *txq);
|
|
|
|
static inline void netif_tx_schedule_all(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++)
|
|
netif_schedule_queue(netdev_get_tx_queue(dev, i));
|
|
}
|
|
|
|
static __always_inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
|
|
{
|
|
clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
|
}
|
|
|
|
/**
|
|
* netif_start_queue - allow transmit
|
|
* @dev: network device
|
|
*
|
|
* Allow upper layers to call the device hard_start_xmit routine.
|
|
*/
|
|
static inline void netif_start_queue(struct net_device *dev)
|
|
{
|
|
netif_tx_start_queue(netdev_get_tx_queue(dev, 0));
|
|
}
|
|
|
|
static inline void netif_tx_start_all_queues(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
netif_tx_start_queue(txq);
|
|
}
|
|
}
|
|
|
|
void netif_tx_wake_queue(struct netdev_queue *dev_queue);
|
|
|
|
/**
|
|
* netif_wake_queue - restart transmit
|
|
* @dev: network device
|
|
*
|
|
* Allow upper layers to call the device hard_start_xmit routine.
|
|
* Used for flow control when transmit resources are available.
|
|
*/
|
|
static inline void netif_wake_queue(struct net_device *dev)
|
|
{
|
|
netif_tx_wake_queue(netdev_get_tx_queue(dev, 0));
|
|
}
|
|
|
|
static inline void netif_tx_wake_all_queues(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
netif_tx_wake_queue(txq);
|
|
}
|
|
}
|
|
|
|
static __always_inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
|
|
{
|
|
set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
|
}
|
|
|
|
/**
|
|
* netif_stop_queue - stop transmitted packets
|
|
* @dev: network device
|
|
*
|
|
* Stop upper layers calling the device hard_start_xmit routine.
|
|
* Used for flow control when transmit resources are unavailable.
|
|
*/
|
|
static inline void netif_stop_queue(struct net_device *dev)
|
|
{
|
|
netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
|
|
}
|
|
|
|
void netif_tx_stop_all_queues(struct net_device *dev);
|
|
|
|
static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
|
|
{
|
|
return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
|
}
|
|
|
|
/**
|
|
* netif_queue_stopped - test if transmit queue is flowblocked
|
|
* @dev: network device
|
|
*
|
|
* Test if transmit queue on device is currently unable to send.
|
|
*/
|
|
static inline bool netif_queue_stopped(const struct net_device *dev)
|
|
{
|
|
return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
|
|
}
|
|
|
|
static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
|
|
{
|
|
return dev_queue->state & QUEUE_STATE_ANY_XOFF;
|
|
}
|
|
|
|
static inline bool
|
|
netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
|
|
{
|
|
return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
|
|
}
|
|
|
|
static inline bool
|
|
netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
|
|
{
|
|
return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
|
|
}
|
|
|
|
/**
|
|
* netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write
|
|
* @dev_queue: pointer to transmit queue
|
|
*
|
|
* BQL enabled drivers might use this helper in their ndo_start_xmit(),
|
|
* to give appropriate hint to the CPU.
|
|
*/
|
|
static inline void netdev_txq_bql_enqueue_prefetchw(struct netdev_queue *dev_queue)
|
|
{
|
|
#ifdef CONFIG_BQL
|
|
prefetchw(&dev_queue->dql.num_queued);
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* netdev_txq_bql_complete_prefetchw - prefetch bql data for write
|
|
* @dev_queue: pointer to transmit queue
|
|
*
|
|
* BQL enabled drivers might use this helper in their TX completion path,
|
|
* to give appropriate hint to the CPU.
|
|
*/
|
|
static inline void netdev_txq_bql_complete_prefetchw(struct netdev_queue *dev_queue)
|
|
{
|
|
#ifdef CONFIG_BQL
|
|
prefetchw(&dev_queue->dql.limit);
|
|
#endif
|
|
}
|
|
|
|
static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
|
|
unsigned int bytes)
|
|
{
|
|
#ifdef CONFIG_BQL
|
|
dql_queued(&dev_queue->dql, bytes);
|
|
|
|
if (likely(dql_avail(&dev_queue->dql) >= 0))
|
|
return;
|
|
|
|
set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
|
|
|
|
/*
|
|
* The XOFF flag must be set before checking the dql_avail below,
|
|
* because in netdev_tx_completed_queue we update the dql_completed
|
|
* before checking the XOFF flag.
|
|
*/
|
|
smp_mb();
|
|
|
|
/* check again in case another CPU has just made room avail */
|
|
if (unlikely(dql_avail(&dev_queue->dql) >= 0))
|
|
clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* netdev_sent_queue - report the number of bytes queued to hardware
|
|
* @dev: network device
|
|
* @bytes: number of bytes queued to the hardware device queue
|
|
*
|
|
* Report the number of bytes queued for sending/completion to the network
|
|
* device hardware queue. @bytes should be a good approximation and should
|
|
* exactly match netdev_completed_queue() @bytes
|
|
*/
|
|
static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
|
|
{
|
|
netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
|
|
}
|
|
|
|
static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
|
|
unsigned int pkts, unsigned int bytes)
|
|
{
|
|
#ifdef CONFIG_BQL
|
|
if (unlikely(!bytes))
|
|
return;
|
|
|
|
dql_completed(&dev_queue->dql, bytes);
|
|
|
|
/*
|
|
* Without the memory barrier there is a small possiblity that
|
|
* netdev_tx_sent_queue will miss the update and cause the queue to
|
|
* be stopped forever
|
|
*/
|
|
smp_mb();
|
|
|
|
if (dql_avail(&dev_queue->dql) < 0)
|
|
return;
|
|
|
|
if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state))
|
|
netif_schedule_queue(dev_queue);
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* netdev_completed_queue - report bytes and packets completed by device
|
|
* @dev: network device
|
|
* @pkts: actual number of packets sent over the medium
|
|
* @bytes: actual number of bytes sent over the medium
|
|
*
|
|
* Report the number of bytes and packets transmitted by the network device
|
|
* hardware queue over the physical medium, @bytes must exactly match the
|
|
* @bytes amount passed to netdev_sent_queue()
|
|
*/
|
|
static inline void netdev_completed_queue(struct net_device *dev,
|
|
unsigned int pkts, unsigned int bytes)
|
|
{
|
|
netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
|
|
}
|
|
|
|
static inline void netdev_tx_reset_queue(struct netdev_queue *q)
|
|
{
|
|
#ifdef CONFIG_BQL
|
|
clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state);
|
|
dql_reset(&q->dql);
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* netdev_reset_queue - reset the packets and bytes count of a network device
|
|
* @dev_queue: network device
|
|
*
|
|
* Reset the bytes and packet count of a network device and clear the
|
|
* software flow control OFF bit for this network device
|
|
*/
|
|
static inline void netdev_reset_queue(struct net_device *dev_queue)
|
|
{
|
|
netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
|
|
}
|
|
|
|
/**
|
|
* netdev_cap_txqueue - check if selected tx queue exceeds device queues
|
|
* @dev: network device
|
|
* @queue_index: given tx queue index
|
|
*
|
|
* Returns 0 if given tx queue index >= number of device tx queues,
|
|
* otherwise returns the originally passed tx queue index.
|
|
*/
|
|
static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index)
|
|
{
|
|
if (unlikely(queue_index >= dev->real_num_tx_queues)) {
|
|
net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",
|
|
dev->name, queue_index,
|
|
dev->real_num_tx_queues);
|
|
return 0;
|
|
}
|
|
|
|
return queue_index;
|
|
}
|
|
|
|
/**
|
|
* netif_running - test if up
|
|
* @dev: network device
|
|
*
|
|
* Test if the device has been brought up.
|
|
*/
|
|
static inline bool netif_running(const struct net_device *dev)
|
|
{
|
|
return test_bit(__LINK_STATE_START, &dev->state);
|
|
}
|
|
|
|
/*
|
|
* Routines to manage the subqueues on a device. We only need start,
|
|
* stop, and a check if it's stopped. All other device management is
|
|
* done at the overall netdevice level.
|
|
* Also test the device if we're multiqueue.
|
|
*/
|
|
|
|
/**
|
|
* netif_start_subqueue - allow sending packets on subqueue
|
|
* @dev: network device
|
|
* @queue_index: sub queue index
|
|
*
|
|
* Start individual transmit queue of a device with multiple transmit queues.
|
|
*/
|
|
static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
|
|
{
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
|
|
|
|
netif_tx_start_queue(txq);
|
|
}
|
|
|
|
/**
|
|
* netif_stop_subqueue - stop sending packets on subqueue
|
|
* @dev: network device
|
|
* @queue_index: sub queue index
|
|
*
|
|
* Stop individual transmit queue of a device with multiple transmit queues.
|
|
*/
|
|
static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
|
|
{
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
|
|
netif_tx_stop_queue(txq);
|
|
}
|
|
|
|
/**
|
|
* netif_subqueue_stopped - test status of subqueue
|
|
* @dev: network device
|
|
* @queue_index: sub queue index
|
|
*
|
|
* Check individual transmit queue of a device with multiple transmit queues.
|
|
*/
|
|
static inline bool __netif_subqueue_stopped(const struct net_device *dev,
|
|
u16 queue_index)
|
|
{
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
|
|
|
|
return netif_tx_queue_stopped(txq);
|
|
}
|
|
|
|
static inline bool netif_subqueue_stopped(const struct net_device *dev,
|
|
struct sk_buff *skb)
|
|
{
|
|
return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
|
|
}
|
|
|
|
/**
|
|
* netif_wake_subqueue - allow sending packets on subqueue
|
|
* @dev: network device
|
|
* @queue_index: sub queue index
|
|
*
|
|
* Resume individual transmit queue of a device with multiple transmit queues.
|
|
*/
|
|
static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
|
|
{
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
|
|
|
|
netif_tx_wake_queue(txq);
|
|
}
|
|
|
|
#ifdef CONFIG_XPS
|
|
int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
|
|
u16 index);
|
|
int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,
|
|
u16 index, bool is_rxqs_map);
|
|
|
|
/**
|
|
* netif_attr_test_mask - Test a CPU or Rx queue set in a mask
|
|
* @j: CPU/Rx queue index
|
|
* @mask: bitmask of all cpus/rx queues
|
|
* @nr_bits: number of bits in the bitmask
|
|
*
|
|
* Test if a CPU or Rx queue index is set in a mask of all CPU/Rx queues.
|
|
*/
|
|
static inline bool netif_attr_test_mask(unsigned long j,
|
|
const unsigned long *mask,
|
|
unsigned int nr_bits)
|
|
{
|
|
cpu_max_bits_warn(j, nr_bits);
|
|
return test_bit(j, mask);
|
|
}
|
|
|
|
/**
|
|
* netif_attr_test_online - Test for online CPU/Rx queue
|
|
* @j: CPU/Rx queue index
|
|
* @online_mask: bitmask for CPUs/Rx queues that are online
|
|
* @nr_bits: number of bits in the bitmask
|
|
*
|
|
* Returns true if a CPU/Rx queue is online.
|
|
*/
|
|
static inline bool netif_attr_test_online(unsigned long j,
|
|
const unsigned long *online_mask,
|
|
unsigned int nr_bits)
|
|
{
|
|
cpu_max_bits_warn(j, nr_bits);
|
|
|
|
if (online_mask)
|
|
return test_bit(j, online_mask);
|
|
|
|
return (j < nr_bits);
|
|
}
|
|
|
|
/**
|
|
* netif_attrmask_next - get the next CPU/Rx queue in a cpu/Rx queues mask
|
|
* @n: CPU/Rx queue index
|
|
* @srcp: the cpumask/Rx queue mask pointer
|
|
* @nr_bits: number of bits in the bitmask
|
|
*
|
|
* Returns >= nr_bits if no further CPUs/Rx queues set.
|
|
*/
|
|
static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp,
|
|
unsigned int nr_bits)
|
|
{
|
|
/* -1 is a legal arg here. */
|
|
if (n != -1)
|
|
cpu_max_bits_warn(n, nr_bits);
|
|
|
|
if (srcp)
|
|
return find_next_bit(srcp, nr_bits, n + 1);
|
|
|
|
return n + 1;
|
|
}
|
|
|
|
/**
|
|
* netif_attrmask_next_and - get the next CPU/Rx queue in *src1p & *src2p
|
|
* @n: CPU/Rx queue index
|
|
* @src1p: the first CPUs/Rx queues mask pointer
|
|
* @src2p: the second CPUs/Rx queues mask pointer
|
|
* @nr_bits: number of bits in the bitmask
|
|
*
|
|
* Returns >= nr_bits if no further CPUs/Rx queues set in both.
|
|
*/
|
|
static inline int netif_attrmask_next_and(int n, const unsigned long *src1p,
|
|
const unsigned long *src2p,
|
|
unsigned int nr_bits)
|
|
{
|
|
/* -1 is a legal arg here. */
|
|
if (n != -1)
|
|
cpu_max_bits_warn(n, nr_bits);
|
|
|
|
if (src1p && src2p)
|
|
return find_next_and_bit(src1p, src2p, nr_bits, n + 1);
|
|
else if (src1p)
|
|
return find_next_bit(src1p, nr_bits, n + 1);
|
|
else if (src2p)
|
|
return find_next_bit(src2p, nr_bits, n + 1);
|
|
|
|
return n + 1;
|
|
}
|
|
#else
|
|
static inline int netif_set_xps_queue(struct net_device *dev,
|
|
const struct cpumask *mask,
|
|
u16 index)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int __netif_set_xps_queue(struct net_device *dev,
|
|
const unsigned long *mask,
|
|
u16 index, bool is_rxqs_map)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* netif_is_multiqueue - test if device has multiple transmit queues
|
|
* @dev: network device
|
|
*
|
|
* Check if device has multiple transmit queues
|
|
*/
|
|
static inline bool netif_is_multiqueue(const struct net_device *dev)
|
|
{
|
|
return dev->num_tx_queues > 1;
|
|
}
|
|
|
|
int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
|
|
#else
|
|
static inline int netif_set_real_num_rx_queues(struct net_device *dev,
|
|
unsigned int rxqs)
|
|
{
|
|
dev->real_num_rx_queues = rxqs;
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static inline struct netdev_rx_queue *
|
|
__netif_get_rx_queue(struct net_device *dev, unsigned int rxq)
|
|
{
|
|
return dev->_rx + rxq;
|
|
}
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
static inline unsigned int get_netdev_rx_queue_index(
|
|
struct netdev_rx_queue *queue)
|
|
{
|
|
struct net_device *dev = queue->dev;
|
|
int index = queue - dev->_rx;
|
|
|
|
BUG_ON(index >= dev->num_rx_queues);
|
|
return index;
|
|
}
|
|
#endif
|
|
|
|
#define DEFAULT_MAX_NUM_RSS_QUEUES (8)
|
|
int netif_get_num_default_rss_queues(void);
|
|
|
|
enum skb_free_reason {
|
|
SKB_REASON_CONSUMED,
|
|
SKB_REASON_DROPPED,
|
|
};
|
|
|
|
void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason);
|
|
void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason);
|
|
|
|
/*
|
|
* It is not allowed to call kfree_skb() or consume_skb() from hardware
|
|
* interrupt context or with hardware interrupts being disabled.
|
|
* (in_irq() || irqs_disabled())
|
|
*
|
|
* We provide four helpers that can be used in following contexts :
|
|
*
|
|
* dev_kfree_skb_irq(skb) when caller drops a packet from irq context,
|
|
* replacing kfree_skb(skb)
|
|
*
|
|
* dev_consume_skb_irq(skb) when caller consumes a packet from irq context.
|
|
* Typically used in place of consume_skb(skb) in TX completion path
|
|
*
|
|
* dev_kfree_skb_any(skb) when caller doesn't know its current irq context,
|
|
* replacing kfree_skb(skb)
|
|
*
|
|
* dev_consume_skb_any(skb) when caller doesn't know its current irq context,
|
|
* and consumed a packet. Used in place of consume_skb(skb)
|
|
*/
|
|
static inline void dev_kfree_skb_irq(struct sk_buff *skb)
|
|
{
|
|
__dev_kfree_skb_irq(skb, SKB_REASON_DROPPED);
|
|
}
|
|
|
|
static inline void dev_consume_skb_irq(struct sk_buff *skb)
|
|
{
|
|
__dev_kfree_skb_irq(skb, SKB_REASON_CONSUMED);
|
|
}
|
|
|
|
static inline void dev_kfree_skb_any(struct sk_buff *skb)
|
|
{
|
|
__dev_kfree_skb_any(skb, SKB_REASON_DROPPED);
|
|
}
|
|
|
|
static inline void dev_consume_skb_any(struct sk_buff *skb)
|
|
{
|
|
__dev_kfree_skb_any(skb, SKB_REASON_CONSUMED);
|
|
}
|
|
|
|
void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog);
|
|
int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb);
|
|
int netif_rx(struct sk_buff *skb);
|
|
int netif_rx_ni(struct sk_buff *skb);
|
|
int netif_receive_skb(struct sk_buff *skb);
|
|
int netif_receive_skb_core(struct sk_buff *skb);
|
|
void netif_receive_skb_list(struct list_head *head);
|
|
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
|
|
void napi_gro_flush(struct napi_struct *napi, bool flush_old);
|
|
struct sk_buff *napi_get_frags(struct napi_struct *napi);
|
|
gro_result_t napi_gro_frags(struct napi_struct *napi);
|
|
struct packet_offload *gro_find_receive_by_type(__be16 type);
|
|
struct packet_offload *gro_find_complete_by_type(__be16 type);
|
|
extern struct napi_struct *get_current_napi_context(void);
|
|
|
|
static inline void napi_free_frags(struct napi_struct *napi)
|
|
{
|
|
kfree_skb(napi->skb);
|
|
napi->skb = NULL;
|
|
}
|
|
|
|
bool netdev_is_rx_handler_busy(struct net_device *dev);
|
|
int netdev_rx_handler_register(struct net_device *dev,
|
|
rx_handler_func_t *rx_handler,
|
|
void *rx_handler_data);
|
|
void netdev_rx_handler_unregister(struct net_device *dev);
|
|
|
|
bool dev_valid_name(const char *name);
|
|
int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
|
|
bool *need_copyout);
|
|
int dev_ifconf(struct net *net, struct ifconf *, int);
|
|
int dev_ethtool(struct net *net, struct ifreq *);
|
|
unsigned int dev_get_flags(const struct net_device *);
|
|
int __dev_change_flags(struct net_device *, unsigned int flags);
|
|
int dev_change_flags(struct net_device *, unsigned int);
|
|
void __dev_notify_flags(struct net_device *, unsigned int old_flags,
|
|
unsigned int gchanges);
|
|
int dev_change_name(struct net_device *, const char *);
|
|
int dev_set_alias(struct net_device *, const char *, size_t);
|
|
int dev_get_alias(const struct net_device *, char *, size_t);
|
|
int dev_change_net_namespace(struct net_device *, struct net *, const char *);
|
|
int __dev_set_mtu(struct net_device *, int);
|
|
int dev_validate_mtu(struct net_device *dev, int mtu,
|
|
struct netlink_ext_ack *extack);
|
|
int dev_set_mtu_ext(struct net_device *dev, int mtu,
|
|
struct netlink_ext_ack *extack);
|
|
int dev_set_mtu(struct net_device *, int);
|
|
int dev_change_tx_queue_len(struct net_device *, unsigned long);
|
|
void dev_set_group(struct net_device *, int);
|
|
int dev_set_mac_address(struct net_device *, struct sockaddr *);
|
|
int dev_change_carrier(struct net_device *, bool new_carrier);
|
|
int dev_get_phys_port_id(struct net_device *dev,
|
|
struct netdev_phys_item_id *ppid);
|
|
int dev_get_phys_port_name(struct net_device *dev,
|
|
char *name, size_t len);
|
|
int dev_change_proto_down(struct net_device *dev, bool proto_down);
|
|
struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);
|
|
struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
|
struct netdev_queue *txq, int *ret);
|
|
|
|
typedef int (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf);
|
|
int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
|
|
int fd, u32 flags);
|
|
u32 __dev_xdp_query(struct net_device *dev, bpf_op_t xdp_op,
|
|
enum bpf_netdev_command cmd);
|
|
int xdp_umem_query(struct net_device *dev, u16 queue_id);
|
|
|
|
int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
|
|
int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
|
|
bool is_skb_forwardable(const struct net_device *dev,
|
|
const struct sk_buff *skb);
|
|
|
|
static __always_inline int ____dev_forward_skb(struct net_device *dev,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (skb_orphan_frags(skb, GFP_ATOMIC) ||
|
|
unlikely(!is_skb_forwardable(dev, skb))) {
|
|
atomic_long_inc(&dev->rx_dropped);
|
|
kfree_skb(skb);
|
|
return NET_RX_DROP;
|
|
}
|
|
|
|
skb_scrub_packet(skb, true);
|
|
skb->priority = 0;
|
|
return 0;
|
|
}
|
|
|
|
void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
|
|
|
|
extern int netdev_budget;
|
|
extern unsigned int netdev_budget_usecs;
|
|
|
|
/* Called by rtnetlink.c:rtnl_unlock() */
|
|
void netdev_run_todo(void);
|
|
|
|
/**
|
|
* dev_put - release reference to device
|
|
* @dev: network device
|
|
*
|
|
* Release reference to device to allow it to be freed.
|
|
*/
|
|
static inline void dev_put(struct net_device *dev)
|
|
{
|
|
this_cpu_dec(*dev->pcpu_refcnt);
|
|
}
|
|
|
|
/**
|
|
* dev_hold - get reference to device
|
|
* @dev: network device
|
|
*
|
|
* Hold reference to device to keep it from being freed.
|
|
*/
|
|
static inline void dev_hold(struct net_device *dev)
|
|
{
|
|
this_cpu_inc(*dev->pcpu_refcnt);
|
|
}
|
|
|
|
/* Carrier loss detection, dial on demand. The functions netif_carrier_on
|
|
* and _off may be called from IRQ context, but it is caller
|
|
* who is responsible for serialization of these calls.
|
|
*
|
|
* The name carrier is inappropriate, these functions should really be
|
|
* called netif_lowerlayer_*() because they represent the state of any
|
|
* kind of lower layer not just hardware media.
|
|
*/
|
|
|
|
void linkwatch_init_dev(struct net_device *dev);
|
|
void linkwatch_fire_event(struct net_device *dev);
|
|
void linkwatch_forget_dev(struct net_device *dev);
|
|
|
|
/**
|
|
* netif_carrier_ok - test if carrier present
|
|
* @dev: network device
|
|
*
|
|
* Check if carrier is present on device
|
|
*/
|
|
static inline bool netif_carrier_ok(const struct net_device *dev)
|
|
{
|
|
return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
|
|
}
|
|
|
|
unsigned long dev_trans_start(struct net_device *dev);
|
|
|
|
void __netdev_watchdog_up(struct net_device *dev);
|
|
|
|
void netif_carrier_on(struct net_device *dev);
|
|
|
|
void netif_carrier_off(struct net_device *dev);
|
|
|
|
/**
|
|
* netif_dormant_on - mark device as dormant.
|
|
* @dev: network device
|
|
*
|
|
* Mark device as dormant (as per RFC2863).
|
|
*
|
|
* The dormant state indicates that the relevant interface is not
|
|
* actually in a condition to pass packets (i.e., it is not 'up') but is
|
|
* in a "pending" state, waiting for some external event. For "on-
|
|
* demand" interfaces, this new state identifies the situation where the
|
|
* interface is waiting for events to place it in the up state.
|
|
*/
|
|
static inline void netif_dormant_on(struct net_device *dev)
|
|
{
|
|
if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
|
|
linkwatch_fire_event(dev);
|
|
}
|
|
|
|
/**
|
|
* netif_dormant_off - set device as not dormant.
|
|
* @dev: network device
|
|
*
|
|
* Device is not in dormant state.
|
|
*/
|
|
static inline void netif_dormant_off(struct net_device *dev)
|
|
{
|
|
if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
|
|
linkwatch_fire_event(dev);
|
|
}
|
|
|
|
/**
|
|
* netif_dormant - test if device is dormant
|
|
* @dev: network device
|
|
*
|
|
* Check if device is dormant.
|
|
*/
|
|
static inline bool netif_dormant(const struct net_device *dev)
|
|
{
|
|
return test_bit(__LINK_STATE_DORMANT, &dev->state);
|
|
}
|
|
|
|
|
|
/**
|
|
* netif_oper_up - test if device is operational
|
|
* @dev: network device
|
|
*
|
|
* Check if carrier is operational
|
|
*/
|
|
static inline bool netif_oper_up(const struct net_device *dev)
|
|
{
|
|
return (dev->operstate == IF_OPER_UP ||
|
|
dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
|
|
}
|
|
|
|
/**
|
|
* netif_device_present - is device available or removed
|
|
* @dev: network device
|
|
*
|
|
* Check if device has not been removed from system.
|
|
*/
|
|
static inline bool netif_device_present(struct net_device *dev)
|
|
{
|
|
return test_bit(__LINK_STATE_PRESENT, &dev->state);
|
|
}
|
|
|
|
void netif_device_detach(struct net_device *dev);
|
|
|
|
void netif_device_attach(struct net_device *dev);
|
|
|
|
/*
|
|
* Network interface message level settings
|
|
*/
|
|
|
|
enum {
|
|
NETIF_MSG_DRV = 0x0001,
|
|
NETIF_MSG_PROBE = 0x0002,
|
|
NETIF_MSG_LINK = 0x0004,
|
|
NETIF_MSG_TIMER = 0x0008,
|
|
NETIF_MSG_IFDOWN = 0x0010,
|
|
NETIF_MSG_IFUP = 0x0020,
|
|
NETIF_MSG_RX_ERR = 0x0040,
|
|
NETIF_MSG_TX_ERR = 0x0080,
|
|
NETIF_MSG_TX_QUEUED = 0x0100,
|
|
NETIF_MSG_INTR = 0x0200,
|
|
NETIF_MSG_TX_DONE = 0x0400,
|
|
NETIF_MSG_RX_STATUS = 0x0800,
|
|
NETIF_MSG_PKTDATA = 0x1000,
|
|
NETIF_MSG_HW = 0x2000,
|
|
NETIF_MSG_WOL = 0x4000,
|
|
};
|
|
|
|
#define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV)
|
|
#define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE)
|
|
#define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK)
|
|
#define netif_msg_timer(p) ((p)->msg_enable & NETIF_MSG_TIMER)
|
|
#define netif_msg_ifdown(p) ((p)->msg_enable & NETIF_MSG_IFDOWN)
|
|
#define netif_msg_ifup(p) ((p)->msg_enable & NETIF_MSG_IFUP)
|
|
#define netif_msg_rx_err(p) ((p)->msg_enable & NETIF_MSG_RX_ERR)
|
|
#define netif_msg_tx_err(p) ((p)->msg_enable & NETIF_MSG_TX_ERR)
|
|
#define netif_msg_tx_queued(p) ((p)->msg_enable & NETIF_MSG_TX_QUEUED)
|
|
#define netif_msg_intr(p) ((p)->msg_enable & NETIF_MSG_INTR)
|
|
#define netif_msg_tx_done(p) ((p)->msg_enable & NETIF_MSG_TX_DONE)
|
|
#define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS)
|
|
#define netif_msg_pktdata(p) ((p)->msg_enable & NETIF_MSG_PKTDATA)
|
|
#define netif_msg_hw(p) ((p)->msg_enable & NETIF_MSG_HW)
|
|
#define netif_msg_wol(p) ((p)->msg_enable & NETIF_MSG_WOL)
|
|
|
|
static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
|
|
{
|
|
/* use default */
|
|
if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
|
|
return default_msg_enable_bits;
|
|
if (debug_value == 0) /* no output */
|
|
return 0;
|
|
/* set low N bits */
|
|
return (1U << debug_value) - 1;
|
|
}
|
|
|
|
static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
|
|
{
|
|
spin_lock(&txq->_xmit_lock);
|
|
txq->xmit_lock_owner = cpu;
|
|
}
|
|
|
|
static inline bool __netif_tx_acquire(struct netdev_queue *txq)
|
|
{
|
|
__acquire(&txq->_xmit_lock);
|
|
return true;
|
|
}
|
|
|
|
static inline void __netif_tx_release(struct netdev_queue *txq)
|
|
{
|
|
__release(&txq->_xmit_lock);
|
|
}
|
|
|
|
static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
|
|
{
|
|
spin_lock_bh(&txq->_xmit_lock);
|
|
txq->xmit_lock_owner = smp_processor_id();
|
|
}
|
|
|
|
static inline bool __netif_tx_trylock(struct netdev_queue *txq)
|
|
{
|
|
bool ok = spin_trylock(&txq->_xmit_lock);
|
|
if (likely(ok))
|
|
txq->xmit_lock_owner = smp_processor_id();
|
|
return ok;
|
|
}
|
|
|
|
static inline void __netif_tx_unlock(struct netdev_queue *txq)
|
|
{
|
|
txq->xmit_lock_owner = -1;
|
|
spin_unlock(&txq->_xmit_lock);
|
|
}
|
|
|
|
static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
|
|
{
|
|
txq->xmit_lock_owner = -1;
|
|
spin_unlock_bh(&txq->_xmit_lock);
|
|
}
|
|
|
|
static inline void txq_trans_update(struct netdev_queue *txq)
|
|
{
|
|
if (txq->xmit_lock_owner != -1)
|
|
txq->trans_start = jiffies;
|
|
}
|
|
|
|
/* legacy drivers only, netdev_start_xmit() sets txq->trans_start */
|
|
static inline void netif_trans_update(struct net_device *dev)
|
|
{
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
|
|
|
|
if (txq->trans_start != jiffies)
|
|
txq->trans_start = jiffies;
|
|
}
|
|
|
|
/**
|
|
* netif_tx_lock - grab network device transmit lock
|
|
* @dev: network device
|
|
*
|
|
* Get network device transmit lock
|
|
*/
|
|
static inline void netif_tx_lock(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
int cpu;
|
|
|
|
spin_lock(&dev->tx_global_lock);
|
|
cpu = smp_processor_id();
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
|
|
/* We are the only thread of execution doing a
|
|
* freeze, but we have to grab the _xmit_lock in
|
|
* order to synchronize with threads which are in
|
|
* the ->hard_start_xmit() handler and already
|
|
* checked the frozen bit.
|
|
*/
|
|
__netif_tx_lock(txq, cpu);
|
|
set_bit(__QUEUE_STATE_FROZEN, &txq->state);
|
|
__netif_tx_unlock(txq);
|
|
}
|
|
}
|
|
|
|
static inline void netif_tx_lock_bh(struct net_device *dev)
|
|
{
|
|
local_bh_disable();
|
|
netif_tx_lock(dev);
|
|
}
|
|
|
|
static inline void netif_tx_unlock(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
|
|
/* No need to grab the _xmit_lock here. If the
|
|
* queue is not stopped for another reason, we
|
|
* force a schedule.
|
|
*/
|
|
clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
|
|
netif_schedule_queue(txq);
|
|
}
|
|
spin_unlock(&dev->tx_global_lock);
|
|
}
|
|
|
|
static inline void netif_tx_unlock_bh(struct net_device *dev)
|
|
{
|
|
netif_tx_unlock(dev);
|
|
local_bh_enable();
|
|
}
|
|
|
|
#define HARD_TX_LOCK(dev, txq, cpu) { \
|
|
if ((dev->features & NETIF_F_LLTX) == 0) { \
|
|
__netif_tx_lock(txq, cpu); \
|
|
} else { \
|
|
__netif_tx_acquire(txq); \
|
|
} \
|
|
}
|
|
|
|
#define HARD_TX_TRYLOCK(dev, txq) \
|
|
(((dev->features & NETIF_F_LLTX) == 0) ? \
|
|
__netif_tx_trylock(txq) : \
|
|
__netif_tx_acquire(txq))
|
|
|
|
#define HARD_TX_UNLOCK(dev, txq) { \
|
|
if ((dev->features & NETIF_F_LLTX) == 0) { \
|
|
__netif_tx_unlock(txq); \
|
|
} else { \
|
|
__netif_tx_release(txq); \
|
|
} \
|
|
}
|
|
|
|
static inline void netif_tx_disable(struct net_device *dev)
|
|
{
|
|
unsigned int i;
|
|
int cpu;
|
|
|
|
local_bh_disable();
|
|
cpu = smp_processor_id();
|
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
|
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
|
|
|
__netif_tx_lock(txq, cpu);
|
|
netif_tx_stop_queue(txq);
|
|
__netif_tx_unlock(txq);
|
|
}
|
|
local_bh_enable();
|
|
}
|
|
|
|
static inline void netif_addr_lock(struct net_device *dev)
|
|
{
|
|
spin_lock(&dev->addr_list_lock);
|
|
}
|
|
|
|
static inline void netif_addr_lock_nested(struct net_device *dev)
|
|
{
|
|
int subclass = SINGLE_DEPTH_NESTING;
|
|
|
|
if (dev->netdev_ops->ndo_get_lock_subclass)
|
|
subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
|
|
|
|
spin_lock_nested(&dev->addr_list_lock, subclass);
|
|
}
|
|
|
|
static inline void netif_addr_lock_bh(struct net_device *dev)
|
|
{
|
|
spin_lock_bh(&dev->addr_list_lock);
|
|
}
|
|
|
|
static inline void netif_addr_unlock(struct net_device *dev)
|
|
{
|
|
spin_unlock(&dev->addr_list_lock);
|
|
}
|
|
|
|
static inline void netif_addr_unlock_bh(struct net_device *dev)
|
|
{
|
|
spin_unlock_bh(&dev->addr_list_lock);
|
|
}
|
|
|
|
/*
|
|
* dev_addrs walker. Should be used only for read access. Call with
|
|
* rcu_read_lock held.
|
|
*/
|
|
#define for_each_dev_addr(dev, ha) \
|
|
list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list)
|
|
|
|
/* These functions live elsewhere (drivers/net/net_init.c, but related) */
|
|
|
|
void ether_setup(struct net_device *dev);
|
|
|
|
/* Support for loadable net-drivers */
|
|
struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
|
|
unsigned char name_assign_type,
|
|
void (*setup)(struct net_device *),
|
|
unsigned int txqs, unsigned int rxqs);
|
|
int dev_get_valid_name(struct net *net, struct net_device *dev,
|
|
const char *name);
|
|
|
|
#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
|
|
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
|
|
|
|
#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
|
|
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
|
|
count)
|
|
|
|
int register_netdev(struct net_device *dev);
|
|
void unregister_netdev(struct net_device *dev);
|
|
|
|
/* General hardware address lists handling functions */
|
|
int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
|
|
struct netdev_hw_addr_list *from_list, int addr_len);
|
|
void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
|
|
struct netdev_hw_addr_list *from_list, int addr_len);
|
|
int __hw_addr_sync_dev(struct netdev_hw_addr_list *list,
|
|
struct net_device *dev,
|
|
int (*sync)(struct net_device *, const unsigned char *),
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *));
|
|
void __hw_addr_unsync_dev(struct netdev_hw_addr_list *list,
|
|
struct net_device *dev,
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *));
|
|
void __hw_addr_init(struct netdev_hw_addr_list *list);
|
|
|
|
/* Functions used for device addresses handling */
|
|
int dev_addr_add(struct net_device *dev, const unsigned char *addr,
|
|
unsigned char addr_type);
|
|
int dev_addr_del(struct net_device *dev, const unsigned char *addr,
|
|
unsigned char addr_type);
|
|
void dev_addr_flush(struct net_device *dev);
|
|
int dev_addr_init(struct net_device *dev);
|
|
|
|
/* Functions used for unicast addresses handling */
|
|
int dev_uc_add(struct net_device *dev, const unsigned char *addr);
|
|
int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
|
|
int dev_uc_del(struct net_device *dev, const unsigned char *addr);
|
|
int dev_uc_sync(struct net_device *to, struct net_device *from);
|
|
int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
|
|
void dev_uc_unsync(struct net_device *to, struct net_device *from);
|
|
void dev_uc_flush(struct net_device *dev);
|
|
void dev_uc_init(struct net_device *dev);
|
|
|
|
/**
|
|
* __dev_uc_sync - Synchonize device's unicast list
|
|
* @dev: device to sync
|
|
* @sync: function to call if address should be added
|
|
* @unsync: function to call if address should be removed
|
|
*
|
|
* Add newly added addresses to the interface, and release
|
|
* addresses that have been deleted.
|
|
*/
|
|
static inline int __dev_uc_sync(struct net_device *dev,
|
|
int (*sync)(struct net_device *,
|
|
const unsigned char *),
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *))
|
|
{
|
|
return __hw_addr_sync_dev(&dev->uc, dev, sync, unsync);
|
|
}
|
|
|
|
/**
|
|
* __dev_uc_unsync - Remove synchronized addresses from device
|
|
* @dev: device to sync
|
|
* @unsync: function to call if address should be removed
|
|
*
|
|
* Remove all addresses that were added to the device by dev_uc_sync().
|
|
*/
|
|
static inline void __dev_uc_unsync(struct net_device *dev,
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *))
|
|
{
|
|
__hw_addr_unsync_dev(&dev->uc, dev, unsync);
|
|
}
|
|
|
|
/* Functions used for multicast addresses handling */
|
|
int dev_mc_add(struct net_device *dev, const unsigned char *addr);
|
|
int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
|
|
int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
|
|
int dev_mc_del(struct net_device *dev, const unsigned char *addr);
|
|
int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
|
|
int dev_mc_sync(struct net_device *to, struct net_device *from);
|
|
int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
|
|
void dev_mc_unsync(struct net_device *to, struct net_device *from);
|
|
void dev_mc_flush(struct net_device *dev);
|
|
void dev_mc_init(struct net_device *dev);
|
|
|
|
/**
|
|
* __dev_mc_sync - Synchonize device's multicast list
|
|
* @dev: device to sync
|
|
* @sync: function to call if address should be added
|
|
* @unsync: function to call if address should be removed
|
|
*
|
|
* Add newly added addresses to the interface, and release
|
|
* addresses that have been deleted.
|
|
*/
|
|
static inline int __dev_mc_sync(struct net_device *dev,
|
|
int (*sync)(struct net_device *,
|
|
const unsigned char *),
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *))
|
|
{
|
|
return __hw_addr_sync_dev(&dev->mc, dev, sync, unsync);
|
|
}
|
|
|
|
/**
|
|
* __dev_mc_unsync - Remove synchronized addresses from device
|
|
* @dev: device to sync
|
|
* @unsync: function to call if address should be removed
|
|
*
|
|
* Remove all addresses that were added to the device by dev_mc_sync().
|
|
*/
|
|
static inline void __dev_mc_unsync(struct net_device *dev,
|
|
int (*unsync)(struct net_device *,
|
|
const unsigned char *))
|
|
{
|
|
__hw_addr_unsync_dev(&dev->mc, dev, unsync);
|
|
}
|
|
|
|
/* Functions used for secondary unicast and multicast support */
|
|
void dev_set_rx_mode(struct net_device *dev);
|
|
void __dev_set_rx_mode(struct net_device *dev);
|
|
int dev_set_promiscuity(struct net_device *dev, int inc);
|
|
int dev_set_allmulti(struct net_device *dev, int inc);
|
|
void netdev_state_change(struct net_device *dev);
|
|
void netdev_notify_peers(struct net_device *dev);
|
|
void netdev_features_change(struct net_device *dev);
|
|
/* Load a device via the kmod */
|
|
void dev_load(struct net *net, const char *name);
|
|
struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
|
|
struct rtnl_link_stats64 *storage);
|
|
void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
|
|
const struct net_device_stats *netdev_stats);
|
|
|
|
extern int netdev_max_backlog;
|
|
extern int netdev_tstamp_prequeue;
|
|
extern int weight_p;
|
|
extern int dev_weight_rx_bias;
|
|
extern int dev_weight_tx_bias;
|
|
extern int dev_rx_weight;
|
|
extern int dev_tx_weight;
|
|
|
|
bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
|
|
struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
|
|
struct list_head **iter);
|
|
struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
|
|
struct list_head **iter);
|
|
|
|
/* iterate through upper list, must be called under RCU read lock */
|
|
#define netdev_for_each_upper_dev_rcu(dev, updev, iter) \
|
|
for (iter = &(dev)->adj_list.upper, \
|
|
updev = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
|
|
updev; \
|
|
updev = netdev_upper_get_next_dev_rcu(dev, &(iter)))
|
|
|
|
int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
|
|
int (*fn)(struct net_device *upper_dev,
|
|
void *data),
|
|
void *data);
|
|
|
|
bool netdev_has_upper_dev_all_rcu(struct net_device *dev,
|
|
struct net_device *upper_dev);
|
|
|
|
bool netdev_has_any_upper_dev(struct net_device *dev);
|
|
|
|
void *netdev_lower_get_next_private(struct net_device *dev,
|
|
struct list_head **iter);
|
|
void *netdev_lower_get_next_private_rcu(struct net_device *dev,
|
|
struct list_head **iter);
|
|
|
|
#define netdev_for_each_lower_private(dev, priv, iter) \
|
|
for (iter = (dev)->adj_list.lower.next, \
|
|
priv = netdev_lower_get_next_private(dev, &(iter)); \
|
|
priv; \
|
|
priv = netdev_lower_get_next_private(dev, &(iter)))
|
|
|
|
#define netdev_for_each_lower_private_rcu(dev, priv, iter) \
|
|
for (iter = &(dev)->adj_list.lower, \
|
|
priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
|
|
priv; \
|
|
priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
|
|
|
|
void *netdev_lower_get_next(struct net_device *dev,
|
|
struct list_head **iter);
|
|
|
|
#define netdev_for_each_lower_dev(dev, ldev, iter) \
|
|
for (iter = (dev)->adj_list.lower.next, \
|
|
ldev = netdev_lower_get_next(dev, &(iter)); \
|
|
ldev; \
|
|
ldev = netdev_lower_get_next(dev, &(iter)))
|
|
|
|
struct net_device *netdev_all_lower_get_next(struct net_device *dev,
|
|
struct list_head **iter);
|
|
struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev,
|
|
struct list_head **iter);
|
|
|
|
int netdev_walk_all_lower_dev(struct net_device *dev,
|
|
int (*fn)(struct net_device *lower_dev,
|
|
void *data),
|
|
void *data);
|
|
int netdev_walk_all_lower_dev_rcu(struct net_device *dev,
|
|
int (*fn)(struct net_device *lower_dev,
|
|
void *data),
|
|
void *data);
|
|
|
|
void *netdev_adjacent_get_private(struct list_head *adj_list);
|
|
void *netdev_lower_get_first_private_rcu(struct net_device *dev);
|
|
struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
|
|
struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
|
|
int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev,
|
|
struct netlink_ext_ack *extack);
|
|
int netdev_master_upper_dev_link(struct net_device *dev,
|
|
struct net_device *upper_dev,
|
|
void *upper_priv, void *upper_info,
|
|
struct netlink_ext_ack *extack);
|
|
void netdev_upper_dev_unlink(struct net_device *dev,
|
|
struct net_device *upper_dev);
|
|
void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
|
|
void *netdev_lower_dev_get_private(struct net_device *dev,
|
|
struct net_device *lower_dev);
|
|
void netdev_lower_state_changed(struct net_device *lower_dev,
|
|
void *lower_state_info);
|
|
|
|
/* RSS keys are 40 or 52 bytes long */
|
|
#define NETDEV_RSS_KEY_LEN 52
|
|
extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
|
|
void netdev_rss_key_fill(void *buffer, size_t len);
|
|
|
|
int dev_get_nest_level(struct net_device *dev);
|
|
int skb_checksum_help(struct sk_buff *skb);
|
|
int skb_crc32c_csum_help(struct sk_buff *skb);
|
|
int skb_csum_hwoffload_help(struct sk_buff *skb,
|
|
const netdev_features_t features);
|
|
|
|
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
|
|
netdev_features_t features, bool tx_path);
|
|
struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
|
|
netdev_features_t features);
|
|
|
|
struct netdev_bonding_info {
|
|
ifslave slave;
|
|
ifbond master;
|
|
};
|
|
|
|
struct netdev_notifier_bonding_info {
|
|
struct netdev_notifier_info info; /* must be first */
|
|
struct netdev_bonding_info bonding_info;
|
|
};
|
|
|
|
void netdev_bonding_info_change(struct net_device *dev,
|
|
struct netdev_bonding_info *bonding_info);
|
|
|
|
static inline
|
|
struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
|
|
{
|
|
return __skb_gso_segment(skb, features, true);
|
|
}
|
|
__be16 skb_network_protocol(struct sk_buff *skb, int *depth);
|
|
|
|
static inline bool can_checksum_protocol(netdev_features_t features,
|
|
__be16 protocol)
|
|
{
|
|
if (protocol == htons(ETH_P_FCOE))
|
|
return !!(features & NETIF_F_FCOE_CRC);
|
|
|
|
/* Assume this is an IP checksum (not SCTP CRC) */
|
|
|
|
if (features & NETIF_F_HW_CSUM) {
|
|
/* Can checksum everything */
|
|
return true;
|
|
}
|
|
|
|
switch (protocol) {
|
|
case htons(ETH_P_IP):
|
|
return !!(features & NETIF_F_IP_CSUM);
|
|
case htons(ETH_P_IPV6):
|
|
return !!(features & NETIF_F_IPV6_CSUM);
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_BUG
|
|
void netdev_rx_csum_fault(struct net_device *dev);
|
|
#else
|
|
static inline void netdev_rx_csum_fault(struct net_device *dev)
|
|
{
|
|
}
|
|
#endif
|
|
/* rx skb timestamps */
|
|
void net_enable_timestamp(void);
|
|
void net_disable_timestamp(void);
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
int __init dev_proc_init(void);
|
|
#else
|
|
#define dev_proc_init() 0
|
|
#endif
|
|
|
|
static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
|
|
struct sk_buff *skb, struct net_device *dev,
|
|
bool more)
|
|
{
|
|
skb->xmit_more = more ? 1 : 0;
|
|
return ops->ndo_start_xmit(skb, dev);
|
|
}
|
|
|
|
static inline bool netdev_xmit_more(void)
|
|
{
|
|
return __this_cpu_read(softnet_data.xmit.more);
|
|
}
|
|
|
|
static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
|
struct netdev_queue *txq, bool more)
|
|
{
|
|
const struct net_device_ops *ops = dev->netdev_ops;
|
|
int rc;
|
|
|
|
rc = __netdev_start_xmit(ops, skb, dev, more);
|
|
if (rc == NETDEV_TX_OK)
|
|
txq_trans_update(txq);
|
|
|
|
return rc;
|
|
}
|
|
|
|
int netdev_class_create_file_ns(const struct class_attribute *class_attr,
|
|
const void *ns);
|
|
void netdev_class_remove_file_ns(const struct class_attribute *class_attr,
|
|
const void *ns);
|
|
|
|
static inline int netdev_class_create_file(const struct class_attribute *class_attr)
|
|
{
|
|
return netdev_class_create_file_ns(class_attr, NULL);
|
|
}
|
|
|
|
static inline void netdev_class_remove_file(const struct class_attribute *class_attr)
|
|
{
|
|
netdev_class_remove_file_ns(class_attr, NULL);
|
|
}
|
|
|
|
extern const struct kobj_ns_type_operations net_ns_type_operations;
|
|
|
|
const char *netdev_drivername(const struct net_device *dev);
|
|
|
|
void linkwatch_run_queue(void);
|
|
|
|
static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
|
|
netdev_features_t f2)
|
|
{
|
|
if ((f1 ^ f2) & NETIF_F_HW_CSUM) {
|
|
if (f1 & NETIF_F_HW_CSUM)
|
|
f1 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
|
|
else
|
|
f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
|
|
}
|
|
|
|
return f1 & f2;
|
|
}
|
|
|
|
static inline netdev_features_t netdev_get_wanted_features(
|
|
struct net_device *dev)
|
|
{
|
|
return (dev->features & ~dev->hw_features) | dev->wanted_features;
|
|
}
|
|
netdev_features_t netdev_increment_features(netdev_features_t all,
|
|
netdev_features_t one, netdev_features_t mask);
|
|
|
|
/* Allow TSO being used on stacked device :
|
|
* Performing the GSO segmentation before last device
|
|
* is a performance improvement.
|
|
*/
|
|
static inline netdev_features_t netdev_add_tso_features(netdev_features_t features,
|
|
netdev_features_t mask)
|
|
{
|
|
return netdev_increment_features(features, NETIF_F_ALL_TSO, mask);
|
|
}
|
|
|
|
int __netdev_update_features(struct net_device *dev);
|
|
void netdev_update_features(struct net_device *dev);
|
|
void netdev_change_features(struct net_device *dev);
|
|
|
|
void netif_stacked_transfer_operstate(const struct net_device *rootdev,
|
|
struct net_device *dev);
|
|
|
|
netdev_features_t passthru_features_check(struct sk_buff *skb,
|
|
struct net_device *dev,
|
|
netdev_features_t features);
|
|
netdev_features_t netif_skb_features(struct sk_buff *skb);
|
|
|
|
static inline bool net_gso_ok(netdev_features_t features, int gso_type)
|
|
{
|
|
netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
|
|
|
|
/* check flags correspondence */
|
|
BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_TCP_FIXEDID != (NETIF_F_TSO_MANGLEID >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_GRE != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_GRE_CSUM != (NETIF_F_GSO_GRE_CSUM >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_IPXIP4 != (NETIF_F_GSO_IPXIP4 >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_IPXIP6 != (NETIF_F_GSO_IPXIP6 >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_SCTP != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT));
|
|
BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT));
|
|
|
|
return (features & feature) == feature;
|
|
}
|
|
|
|
static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
|
|
{
|
|
return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
|
|
(!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
|
|
}
|
|
|
|
static inline bool netif_needs_gso(struct sk_buff *skb,
|
|
netdev_features_t features)
|
|
{
|
|
return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
|
|
unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
|
|
(skb->ip_summed != CHECKSUM_UNNECESSARY)));
|
|
}
|
|
|
|
static inline void netif_set_gso_max_size(struct net_device *dev,
|
|
unsigned int size)
|
|
{
|
|
dev->gso_max_size = size;
|
|
}
|
|
|
|
static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
|
|
int pulled_hlen, u16 mac_offset,
|
|
int mac_len)
|
|
{
|
|
skb->protocol = protocol;
|
|
skb->encapsulation = 1;
|
|
skb_push(skb, pulled_hlen);
|
|
skb_reset_transport_header(skb);
|
|
skb->mac_header = mac_offset;
|
|
skb->network_header = skb->mac_header + mac_len;
|
|
skb->mac_len = mac_len;
|
|
}
|
|
|
|
static inline bool netif_is_macsec(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_MACSEC;
|
|
}
|
|
|
|
static inline bool netif_is_macvlan(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_MACVLAN;
|
|
}
|
|
|
|
static inline bool netif_is_macvlan_port(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_MACVLAN_PORT;
|
|
}
|
|
|
|
static inline bool netif_is_bond_master(const struct net_device *dev)
|
|
{
|
|
return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
|
|
}
|
|
|
|
static inline bool netif_is_bond_slave(const struct net_device *dev)
|
|
{
|
|
return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
|
|
}
|
|
|
|
static inline bool netif_supports_nofcs(struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_SUPP_NOFCS;
|
|
}
|
|
|
|
static inline bool netif_has_l3_rx_handler(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_L3MDEV_RX_HANDLER;
|
|
}
|
|
|
|
static inline bool netif_is_l3_master(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_L3MDEV_MASTER;
|
|
}
|
|
|
|
static inline bool netif_is_l3_slave(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_L3MDEV_SLAVE;
|
|
}
|
|
|
|
static inline bool netif_is_bridge_master(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_EBRIDGE;
|
|
}
|
|
|
|
static inline bool netif_is_bridge_port(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_BRIDGE_PORT;
|
|
}
|
|
|
|
static inline bool netif_is_ovs_master(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_OPENVSWITCH;
|
|
}
|
|
|
|
static inline bool netif_is_ovs_port(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_OVS_DATAPATH;
|
|
}
|
|
|
|
static inline bool netif_is_team_master(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_TEAM;
|
|
}
|
|
|
|
static inline bool netif_is_team_port(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_TEAM_PORT;
|
|
}
|
|
|
|
static inline bool netif_is_lag_master(const struct net_device *dev)
|
|
{
|
|
return netif_is_bond_master(dev) || netif_is_team_master(dev);
|
|
}
|
|
|
|
static inline bool netif_is_lag_port(const struct net_device *dev)
|
|
{
|
|
return netif_is_bond_slave(dev) || netif_is_team_port(dev);
|
|
}
|
|
|
|
static inline bool netif_is_rxfh_configured(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_RXFH_CONFIGURED;
|
|
}
|
|
|
|
static inline bool netif_is_failover(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_FAILOVER;
|
|
}
|
|
|
|
static inline bool netif_is_failover_slave(const struct net_device *dev)
|
|
{
|
|
return dev->priv_flags & IFF_FAILOVER_SLAVE;
|
|
}
|
|
|
|
/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
|
|
static inline void netif_keep_dst(struct net_device *dev)
|
|
{
|
|
dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM);
|
|
}
|
|
|
|
/* return true if dev can't cope with mtu frames that need vlan tag insertion */
|
|
static inline bool netif_reduces_vlan_mtu(struct net_device *dev)
|
|
{
|
|
/* TODO: reserve and use an additional IFF bit, if we get more users */
|
|
return dev->priv_flags & IFF_MACSEC;
|
|
}
|
|
|
|
extern struct pernet_operations __net_initdata loopback_net_ops;
|
|
|
|
/* Logging, debugging and troubleshooting/diagnostic helpers. */
|
|
|
|
/* netdev_printk helpers, similar to dev_printk */
|
|
|
|
static inline const char *netdev_name(const struct net_device *dev)
|
|
{
|
|
if (!dev->name[0] || strchr(dev->name, '%'))
|
|
return "(unnamed net_device)";
|
|
return dev->name;
|
|
}
|
|
|
|
static inline bool netdev_unregistering(const struct net_device *dev)
|
|
{
|
|
return dev->reg_state == NETREG_UNREGISTERING;
|
|
}
|
|
|
|
static inline const char *netdev_reg_state(const struct net_device *dev)
|
|
{
|
|
switch (dev->reg_state) {
|
|
case NETREG_UNINITIALIZED: return " (uninitialized)";
|
|
case NETREG_REGISTERED: return "";
|
|
case NETREG_UNREGISTERING: return " (unregistering)";
|
|
case NETREG_UNREGISTERED: return " (unregistered)";
|
|
case NETREG_RELEASED: return " (released)";
|
|
case NETREG_DUMMY: return " (dummy)";
|
|
}
|
|
|
|
WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state);
|
|
return " (unknown)";
|
|
}
|
|
|
|
__printf(3, 4)
|
|
void netdev_printk(const char *level, const struct net_device *dev,
|
|
const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_emerg(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_alert(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_crit(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_err(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_warn(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_notice(const struct net_device *dev, const char *format, ...);
|
|
__printf(2, 3)
|
|
void netdev_info(const struct net_device *dev, const char *format, ...);
|
|
|
|
#define netdev_level_once(level, dev, fmt, ...) \
|
|
do { \
|
|
static bool __print_once __read_mostly; \
|
|
\
|
|
if (!__print_once) { \
|
|
__print_once = true; \
|
|
netdev_printk(level, dev, fmt, ##__VA_ARGS__); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define netdev_emerg_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_EMERG, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_alert_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_ALERT, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_crit_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_CRIT, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_err_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_ERR, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_warn_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_WARNING, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_notice_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_NOTICE, dev, fmt, ##__VA_ARGS__)
|
|
#define netdev_info_once(dev, fmt, ...) \
|
|
netdev_level_once(KERN_INFO, dev, fmt, ##__VA_ARGS__)
|
|
|
|
#define MODULE_ALIAS_NETDEV(device) \
|
|
MODULE_ALIAS("netdev-" device)
|
|
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
#define netdev_dbg(__dev, format, args...) \
|
|
do { \
|
|
dynamic_netdev_dbg(__dev, format, ##args); \
|
|
} while (0)
|
|
#elif defined(DEBUG)
|
|
#define netdev_dbg(__dev, format, args...) \
|
|
netdev_printk(KERN_DEBUG, __dev, format, ##args)
|
|
#else
|
|
#define netdev_dbg(__dev, format, args...) \
|
|
({ \
|
|
if (0) \
|
|
netdev_printk(KERN_DEBUG, __dev, format, ##args); \
|
|
})
|
|
#endif
|
|
|
|
#if defined(VERBOSE_DEBUG)
|
|
#define netdev_vdbg netdev_dbg
|
|
#else
|
|
|
|
#define netdev_vdbg(dev, format, args...) \
|
|
({ \
|
|
if (0) \
|
|
netdev_printk(KERN_DEBUG, dev, format, ##args); \
|
|
0; \
|
|
})
|
|
#endif
|
|
|
|
/*
|
|
* netdev_WARN() acts like dev_printk(), but with the key difference
|
|
* of using a WARN/WARN_ON to get the message out, including the
|
|
* file/line information and a backtrace.
|
|
*/
|
|
#define netdev_WARN(dev, format, args...) \
|
|
WARN(1, "netdevice: %s%s: " format, netdev_name(dev), \
|
|
netdev_reg_state(dev), ##args)
|
|
|
|
#define netdev_WARN_ONCE(dev, format, args...) \
|
|
WARN_ONCE(1, "netdevice: %s%s: " format, netdev_name(dev), \
|
|
netdev_reg_state(dev), ##args)
|
|
|
|
/* netif printk helpers, similar to netdev_printk */
|
|
|
|
#define netif_printk(priv, type, level, dev, fmt, args...) \
|
|
do { \
|
|
if (netif_msg_##type(priv)) \
|
|
netdev_printk(level, (dev), fmt, ##args); \
|
|
} while (0)
|
|
|
|
#define netif_level(level, priv, type, dev, fmt, args...) \
|
|
do { \
|
|
if (netif_msg_##type(priv)) \
|
|
netdev_##level(dev, fmt, ##args); \
|
|
} while (0)
|
|
|
|
#define netif_emerg(priv, type, dev, fmt, args...) \
|
|
netif_level(emerg, priv, type, dev, fmt, ##args)
|
|
#define netif_alert(priv, type, dev, fmt, args...) \
|
|
netif_level(alert, priv, type, dev, fmt, ##args)
|
|
#define netif_crit(priv, type, dev, fmt, args...) \
|
|
netif_level(crit, priv, type, dev, fmt, ##args)
|
|
#define netif_err(priv, type, dev, fmt, args...) \
|
|
netif_level(err, priv, type, dev, fmt, ##args)
|
|
#define netif_warn(priv, type, dev, fmt, args...) \
|
|
netif_level(warn, priv, type, dev, fmt, ##args)
|
|
#define netif_notice(priv, type, dev, fmt, args...) \
|
|
netif_level(notice, priv, type, dev, fmt, ##args)
|
|
#define netif_info(priv, type, dev, fmt, args...) \
|
|
netif_level(info, priv, type, dev, fmt, ##args)
|
|
|
|
#if defined(CONFIG_DYNAMIC_DEBUG)
|
|
#define netif_dbg(priv, type, netdev, format, args...) \
|
|
do { \
|
|
if (netif_msg_##type(priv)) \
|
|
dynamic_netdev_dbg(netdev, format, ##args); \
|
|
} while (0)
|
|
#elif defined(DEBUG)
|
|
#define netif_dbg(priv, type, dev, format, args...) \
|
|
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
|
|
#else
|
|
#define netif_dbg(priv, type, dev, format, args...) \
|
|
({ \
|
|
if (0) \
|
|
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
|
|
0; \
|
|
})
|
|
#endif
|
|
|
|
/* if @cond then downgrade to debug, else print at @level */
|
|
#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...) \
|
|
do { \
|
|
if (cond) \
|
|
netif_dbg(priv, type, netdev, fmt, ##args); \
|
|
else \
|
|
netif_ ## level(priv, type, netdev, fmt, ##args); \
|
|
} while (0)
|
|
|
|
#if defined(VERBOSE_DEBUG)
|
|
#define netif_vdbg netif_dbg
|
|
#else
|
|
#define netif_vdbg(priv, type, dev, format, args...) \
|
|
({ \
|
|
if (0) \
|
|
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
|
|
0; \
|
|
})
|
|
#endif
|
|
|
|
/*
|
|
* The list of packet types we will receive (as opposed to discard)
|
|
* and the routines to invoke.
|
|
*
|
|
* Why 16. Because with 16 the only overlap we get on a hash of the
|
|
* low nibble of the protocol value is RARP/SNAP/X.25.
|
|
*
|
|
* 0800 IP
|
|
* 0001 802.3
|
|
* 0002 AX.25
|
|
* 0004 802.2
|
|
* 8035 RARP
|
|
* 0005 SNAP
|
|
* 0805 X.25
|
|
* 0806 ARP
|
|
* 8137 IPX
|
|
* 0009 Localtalk
|
|
* 86DD IPv6
|
|
*/
|
|
#define PTYPE_HASH_SIZE (16)
|
|
#define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
|
|
|
|
#endif /* _LINUX_NETDEVICE_H */
|