Changes in 4.9.180 ext4: do not delete unlinked inode from orphan list on failed truncate KVM: x86: fix return value for reserved EFER bio: fix improper use of smp_mb__before_atomic() Revert "scsi: sd: Keep disk read-only when re-reading partition" crypto: vmx - CTR: always increment IV as quadword kvm: svm/avic: fix off-by-one in checking host APIC ID libnvdimm/namespace: Fix label tracking error arm64: Save and restore OSDLR_EL1 across suspend/resume gfs2: Fix sign extension bug in gfs2_update_stats Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path Btrfs: fix race between ranged fsync and writeback of adjacent ranges btrfs: sysfs: don't leak memory when failing add fsid fbdev: fix divide error in fb_var_to_videomode hugetlb: use same fault hash key for shared and private mappings fbdev: fix WARNING in __alloc_pages_nodemask bug media: cpia2: Fix use-after-free in cpia2_exit media: vivid: use vfree() instead of kfree() for dev->bitmap_cap ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit at76c50x-usb: Don't register led_trigger if usb_register_driver failed perf tools: No need to include bitops.h in util.h tools include: Adopt linux/bits.h Revert "btrfs: Honour FITRIM range constraints during free space trim" gfs2: Fix lru_count going negative cxgb4: Fix error path in cxgb4_init_module mmc: core: Verify SD bus width dmaengine: tegra210-dma: free dma controller in remove() net: ena: gcc 8: fix compilation warning ASoC: hdmi-codec: unlock the device on startup errors powerpc/boot: Fix missing check of lseek() return value ASoC: imx: fix fiq dependencies spi: pxa2xx: fix SCR (divisor) calculation brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler() ARM: vdso: Remove dependency with the arch_timer driver internals arm64: Fix compiler warning from pte_unmap() with -Wunused-but-set-variable sched/cpufreq: Fix kobject memleak scsi: qla2xxx: Fix a qla24xx_enable_msix() error path iwlwifi: pcie: don't crash on invalid RX interrupt rtc: 88pm860x: prevent use-after-free on device remove w1: fix the resume command API dmaengine: pl330: _stop: clear interrupt status mac80211/cfg80211: update bss channel on channel switch ASoC: fsl_sai: Update is_slave_mode with correct value mwifiex: prevent an array overflow net: cw1200: fix a NULL pointer dereference crypto: sun4i-ss - Fix invalid calculation of hash end bcache: return error immediately in bch_journal_replay() bcache: fix failure in journal relplay bcache: add failure check to run_cache_set() for journal replay bcache: avoid clang -Wunintialized warning x86/build: Move _etext to actual end of .text smpboot: Place the __percpu annotation correctly x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault() mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions HID: logitech-hidpp: use RAP instead of FAP to get the protocol version pinctrl: pistachio: fix leaked of_node references dmaengine: at_xdmac: remove BUG_ON macro in tasklet media: coda: clear error return value before picture run media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper media: au0828: stop video streaming only when last user stops media: ov2659: make S_FMT succeed even if requested format doesn't match audit: fix a memory leak bug media: au0828: Fix NULL pointer dereference in au0828_analog_stream_enable() media: pvrusb2: Prevent a buffer overflow powerpc/numa: improve control of topology updates sched/core: Check quota and period overflow at usec to nsec conversion sched/core: Handle overflow in cpu_shares_write_u64 USB: core: Don't unbind interfaces following device reset failure x86/irq/64: Limit IST stack overflow check to #DB stack i40e: don't allow changes to HW VLAN stripping on active port VLANs arm64: vdso: Fix clock_getres() for CLOCK_REALTIME RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure hwmon: (vt1211) Use request_muxed_region for Super-IO accesses hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses hwmon: (pc87427) Use request_muxed_region for Super-IO accesses hwmon: (f71805f) Use request_muxed_region for Super-IO accesses scsi: libsas: Do discovery on empty PHY to update PHY info mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers mmc_spi: add a status check for spi_sync_locked mmc: sdhci-of-esdhc: add erratum eSDHC5 support mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support PM / core: Propagate dev->power.wakeup_path when no callbacks extcon: arizona: Disable mic detect if running when driver is removed s390: cio: fix cio_irb declaration cpufreq: ppc_cbe: fix possible object reference leak cpufreq/pasemi: fix possible object reference leak cpufreq: pmac32: fix possible object reference leak x86/build: Keep local relocations with ld.lld iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion iio: hmc5843: fix potential NULL pointer dereferences iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data rtlwifi: fix a potential NULL pointer dereference mwifiex: Fix mem leak in mwifiex_tm_cmd brcmfmac: fix missing checks for kmemdup b43: shut up clang -Wuninitialized variable warning brcmfmac: convert dev_init_lock mutex to completion brcmfmac: fix race during disconnect when USB completion is in progress brcmfmac: fix Oops when bringing up interface during USB disconnect scsi: ufs: Fix regulator load and icc-level configuration scsi: ufs: Avoid configuring regulator with undefined voltage range arm64: cpu_ops: fix a leaked reference by adding missing of_node_put x86/uaccess, signal: Fix AC=1 bloat x86/ia32: Fix ia32_restore_sigcontext() AC leak chardev: add additional check for minor range overlap HID: core: move Usage Page concatenation to Main item ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put ASoC: fsl_utils: fix a leaked reference by adding missing of_node_put cxgb3/l2t: Fix undefined behaviour spi: tegra114: reset controller on probe media: wl128x: prevent two potential buffer overflows virtio_console: initialize vtermno value for ports tty: ipwireless: fix missing checks for ioremap x86/mce: Fix machine_check_poll() tests for error types rcutorture: Fix cleanup path for invalid torture_type strings rcuperf: Fix cleanup path for invalid perf_type strings usb: core: Add PM runtime calls to usb_hcd_platform_shutdown scsi: qla4xxx: avoid freeing unallocated dma memory dmaengine: tegra210-adma: use devm_clk_*() helpers media: m88ds3103: serialize reset messages in m88ds3103_set_frontend media: go7007: avoid clang frame overflow warning with KASAN scsi: lpfc: Fix FDMI manufacturer attribute value media: saa7146: avoid high stack usage with clang scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices spi : spi-topcliff-pch: Fix to handle empty DMA buffers spi: rspi: Fix sequencer reset during initialization spi: Fix zero length xfer bug ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM drm: Wake up next in drm_read() chain if we are forced to putback the event Linux 4.9.180 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
150 lines
4.9 KiB
C
150 lines
4.9 KiB
C
/*
|
|
* Copyright (c) 2003-2008 Chelsio, Inc. All rights reserved.
|
|
*
|
|
* This software is available to you under a choice of one of two
|
|
* licenses. You may choose to be licensed under the terms of the GNU
|
|
* General Public License (GPL) Version 2, available from the file
|
|
* COPYING in the main directory of this source tree, or the
|
|
* OpenIB.org BSD license below:
|
|
*
|
|
* Redistribution and use in source and binary forms, with or
|
|
* without modification, are permitted provided that the following
|
|
* conditions are met:
|
|
*
|
|
* - Redistributions of source code must retain the above
|
|
* copyright notice, this list of conditions and the following
|
|
* disclaimer.
|
|
*
|
|
* - Redistributions in binary form must reproduce the above
|
|
* copyright notice, this list of conditions and the following
|
|
* disclaimer in the documentation and/or other materials
|
|
* provided with the distribution.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
#ifndef _CHELSIO_L2T_H
|
|
#define _CHELSIO_L2T_H
|
|
|
|
#include <linux/spinlock.h>
|
|
#include "t3cdev.h"
|
|
#include <linux/atomic.h>
|
|
|
|
enum {
|
|
L2T_STATE_VALID, /* entry is up to date */
|
|
L2T_STATE_STALE, /* entry may be used but needs revalidation */
|
|
L2T_STATE_RESOLVING, /* entry needs address resolution */
|
|
L2T_STATE_UNUSED /* entry not in use */
|
|
};
|
|
|
|
struct neighbour;
|
|
struct sk_buff;
|
|
|
|
/*
|
|
* Each L2T entry plays multiple roles. First of all, it keeps state for the
|
|
* corresponding entry of the HW L2 table and maintains a queue of offload
|
|
* packets awaiting address resolution. Second, it is a node of a hash table
|
|
* chain, where the nodes of the chain are linked together through their next
|
|
* pointer. Finally, each node is a bucket of a hash table, pointing to the
|
|
* first element in its chain through its first pointer.
|
|
*/
|
|
struct l2t_entry {
|
|
u16 state; /* entry state */
|
|
u16 idx; /* entry index */
|
|
u32 addr; /* dest IP address */
|
|
int ifindex; /* neighbor's net_device's ifindex */
|
|
u16 smt_idx; /* SMT index */
|
|
u16 vlan; /* VLAN TCI (id: bits 0-11, prio: 13-15 */
|
|
struct neighbour *neigh; /* associated neighbour */
|
|
struct l2t_entry *first; /* start of hash chain */
|
|
struct l2t_entry *next; /* next l2t_entry on chain */
|
|
struct sk_buff_head arpq; /* queue of packets awaiting resolution */
|
|
spinlock_t lock;
|
|
atomic_t refcnt; /* entry reference count */
|
|
u8 dmac[6]; /* neighbour's MAC address */
|
|
};
|
|
|
|
struct l2t_data {
|
|
unsigned int nentries; /* number of entries */
|
|
struct l2t_entry *rover; /* starting point for next allocation */
|
|
atomic_t nfree; /* number of free entries */
|
|
rwlock_t lock;
|
|
struct rcu_head rcu_head; /* to handle rcu cleanup */
|
|
struct l2t_entry l2tab[];
|
|
};
|
|
|
|
typedef void (*arp_failure_handler_func)(struct t3cdev * dev,
|
|
struct sk_buff * skb);
|
|
|
|
/*
|
|
* Callback stored in an skb to handle address resolution failure.
|
|
*/
|
|
struct l2t_skb_cb {
|
|
arp_failure_handler_func arp_failure_handler;
|
|
};
|
|
|
|
#define L2T_SKB_CB(skb) ((struct l2t_skb_cb *)(skb)->cb)
|
|
|
|
static inline void set_arp_failure_handler(struct sk_buff *skb,
|
|
arp_failure_handler_func hnd)
|
|
{
|
|
L2T_SKB_CB(skb)->arp_failure_handler = hnd;
|
|
}
|
|
|
|
/*
|
|
* Getting to the L2 data from an offload device.
|
|
*/
|
|
#define L2DATA(cdev) (rcu_dereference((cdev)->l2opt))
|
|
|
|
#define W_TCB_L2T_IX 0
|
|
#define S_TCB_L2T_IX 7
|
|
#define M_TCB_L2T_IX 0x7ffULL
|
|
#define V_TCB_L2T_IX(x) ((x) << S_TCB_L2T_IX)
|
|
|
|
void t3_l2e_free(struct l2t_data *d, struct l2t_entry *e);
|
|
void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh);
|
|
struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct dst_entry *dst,
|
|
struct net_device *dev, const void *daddr);
|
|
int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb,
|
|
struct l2t_entry *e);
|
|
void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e);
|
|
struct l2t_data *t3_init_l2t(unsigned int l2t_capacity);
|
|
void t3_free_l2t(struct l2t_data *d);
|
|
|
|
int cxgb3_ofld_send(struct t3cdev *dev, struct sk_buff *skb);
|
|
|
|
static inline int l2t_send(struct t3cdev *dev, struct sk_buff *skb,
|
|
struct l2t_entry *e)
|
|
{
|
|
if (likely(e->state == L2T_STATE_VALID))
|
|
return cxgb3_ofld_send(dev, skb);
|
|
return t3_l2t_send_slow(dev, skb, e);
|
|
}
|
|
|
|
static inline void l2t_release(struct t3cdev *t, struct l2t_entry *e)
|
|
{
|
|
struct l2t_data *d;
|
|
|
|
rcu_read_lock();
|
|
d = L2DATA(t);
|
|
|
|
if (atomic_dec_and_test(&e->refcnt) && d)
|
|
t3_l2e_free(d, e);
|
|
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
static inline void l2t_hold(struct l2t_data *d, struct l2t_entry *e)
|
|
{
|
|
if (d && atomic_add_return(1, &e->refcnt) == 1) /* 0 -> 1 transition */
|
|
atomic_dec(&d->nfree);
|
|
}
|
|
|
|
#endif
|