Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into sh-latest
Conflicts: arch/arm/mach-shmobile/clock-sh73a0.c Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h
|
||||
header-y += if_pppox.h
|
||||
header-y += if_slip.h
|
||||
header-y += if_strip.h
|
||||
header-y += if_team.h
|
||||
header-y += if_tr.h
|
||||
header-y += if_tun.h
|
||||
header-y += if_tunnel.h
|
||||
@@ -194,7 +195,9 @@ header-y += igmp.h
|
||||
header-y += in.h
|
||||
header-y += in6.h
|
||||
header-y += in_route.h
|
||||
header-y += sock_diag.h
|
||||
header-y += inet_diag.h
|
||||
header-y += unix_diag.h
|
||||
header-y += inotify.h
|
||||
header-y += input.h
|
||||
header-y += ioctl.h
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/resource.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
@@ -35,12 +36,6 @@ struct amba_device {
|
||||
unsigned int irq[AMBA_NR_IRQS];
|
||||
};
|
||||
|
||||
struct amba_id {
|
||||
unsigned int id;
|
||||
unsigned int mask;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct amba_driver {
|
||||
struct device_driver drv;
|
||||
int (*probe)(struct amba_device *, const struct amba_id *);
|
||||
|
@@ -238,6 +238,9 @@ struct dma_chan;
|
||||
* @enable_dma: if true enables DMA driven transfers.
|
||||
* @dma_rx_param: parameter to locate an RX DMA channel.
|
||||
* @dma_tx_param: parameter to locate a TX DMA channel.
|
||||
* @autosuspend_delay: delay in ms following transfer completion before the
|
||||
* runtime power management system suspends the device. A setting of 0
|
||||
* indicates no delay and the device will be suspended immediately.
|
||||
*/
|
||||
struct pl022_ssp_controller {
|
||||
u16 bus_id;
|
||||
@@ -246,6 +249,7 @@ struct pl022_ssp_controller {
|
||||
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
|
||||
void *dma_rx_param;
|
||||
void *dma_tx_param;
|
||||
int autosuspend_delay;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -445,16 +445,6 @@ void vcc_insert_socket(struct sock *sk);
|
||||
|
||||
void atm_dev_release_vccs(struct atm_dev *dev);
|
||||
|
||||
/*
|
||||
* This is approximately the algorithm used by alloc_skb.
|
||||
*
|
||||
*/
|
||||
|
||||
static inline int atm_guess_pdu2truesize(int size)
|
||||
{
|
||||
return SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info);
|
||||
}
|
||||
|
||||
|
||||
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
|
||||
{
|
||||
|
@@ -468,13 +468,13 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
||||
#define audit_get_sessionid(t) ((t)->sessionid)
|
||||
extern void audit_log_task_context(struct audit_buffer *ab);
|
||||
extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
||||
extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
||||
extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
|
||||
extern int audit_bprm(struct linux_binprm *bprm);
|
||||
extern void audit_socketcall(int nargs, unsigned long *args);
|
||||
extern int audit_sockaddr(int len, void *addr);
|
||||
extern void __audit_fd_pair(int fd1, int fd2);
|
||||
extern int audit_set_macxattr(const char *name);
|
||||
extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
|
||||
extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
|
||||
extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
|
||||
extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
|
||||
extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
|
||||
@@ -494,12 +494,12 @@ static inline void audit_fd_pair(int fd1, int fd2)
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_fd_pair(fd1, fd2);
|
||||
}
|
||||
static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
|
||||
static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_ipc_set_perm(qbytes, uid, gid, mode);
|
||||
}
|
||||
static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr)
|
||||
static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_mq_open(oflag, mode, attr);
|
||||
|
@@ -205,61 +205,82 @@ struct bcma_bus {
|
||||
struct ssb_sprom sprom;
|
||||
};
|
||||
|
||||
extern inline u32 bcma_read8(struct bcma_device *core, u16 offset)
|
||||
static inline u32 bcma_read8(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read8(core, offset);
|
||||
}
|
||||
extern inline u32 bcma_read16(struct bcma_device *core, u16 offset)
|
||||
static inline u32 bcma_read16(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read16(core, offset);
|
||||
}
|
||||
extern inline u32 bcma_read32(struct bcma_device *core, u16 offset)
|
||||
static inline u32 bcma_read32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->read32(core, offset);
|
||||
}
|
||||
extern inline
|
||||
static inline
|
||||
void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write8(core, offset, value);
|
||||
}
|
||||
extern inline
|
||||
static inline
|
||||
void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write16(core, offset, value);
|
||||
}
|
||||
extern inline
|
||||
static inline
|
||||
void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->write32(core, offset, value);
|
||||
}
|
||||
#ifdef CONFIG_BCMA_BLOCKIO
|
||||
extern inline void bcma_block_read(struct bcma_device *core, void *buffer,
|
||||
static inline void bcma_block_read(struct bcma_device *core, void *buffer,
|
||||
size_t count, u16 offset, u8 reg_width)
|
||||
{
|
||||
core->bus->ops->block_read(core, buffer, count, offset, reg_width);
|
||||
}
|
||||
extern inline void bcma_block_write(struct bcma_device *core, const void *buffer,
|
||||
size_t count, u16 offset, u8 reg_width)
|
||||
static inline void bcma_block_write(struct bcma_device *core,
|
||||
const void *buffer, size_t count,
|
||||
u16 offset, u8 reg_width)
|
||||
{
|
||||
core->bus->ops->block_write(core, buffer, count, offset, reg_width);
|
||||
}
|
||||
#endif
|
||||
extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
|
||||
static inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
|
||||
{
|
||||
return core->bus->ops->aread32(core, offset);
|
||||
}
|
||||
extern inline
|
||||
static inline
|
||||
void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
|
||||
{
|
||||
core->bus->ops->awrite32(core, offset, value);
|
||||
}
|
||||
|
||||
#define bcma_mask32(cc, offset, mask) \
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask))
|
||||
#define bcma_set32(cc, offset, set) \
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) | (set))
|
||||
#define bcma_maskset32(cc, offset, mask, set) \
|
||||
bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set))
|
||||
static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask)
|
||||
{
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) & mask);
|
||||
}
|
||||
static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set)
|
||||
{
|
||||
bcma_write32(cc, offset, bcma_read32(cc, offset) | set);
|
||||
}
|
||||
static inline void bcma_maskset32(struct bcma_device *cc,
|
||||
u16 offset, u32 mask, u32 set)
|
||||
{
|
||||
bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set);
|
||||
}
|
||||
static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask)
|
||||
{
|
||||
bcma_write16(cc, offset, bcma_read16(cc, offset) & mask);
|
||||
}
|
||||
static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set)
|
||||
{
|
||||
bcma_write16(cc, offset, bcma_read16(cc, offset) | set);
|
||||
}
|
||||
static inline void bcma_maskset16(struct bcma_device *cc,
|
||||
u16 offset, u16 mask, u16 set)
|
||||
{
|
||||
bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
|
||||
}
|
||||
|
||||
extern bool bcma_core_is_enabled(struct bcma_device *core);
|
||||
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
|
||||
|
@@ -203,6 +203,7 @@
|
||||
#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
|
||||
#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
|
||||
#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
|
||||
#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400
|
||||
#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
|
||||
#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
|
||||
#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
|
||||
|
@@ -22,8 +22,14 @@ extern unsigned long __sw_hweight64(__u64 w);
|
||||
#include <asm/bitops.h>
|
||||
|
||||
#define for_each_set_bit(bit, addr, size) \
|
||||
for ((bit) = find_first_bit((addr), (size)); \
|
||||
(bit) < (size); \
|
||||
for ((bit) = find_first_bit((addr), (size)); \
|
||||
(bit) < (size); \
|
||||
(bit) = find_next_bit((addr), (size), (bit) + 1))
|
||||
|
||||
/* same as for_each_set_bit() but use bit as value to start with */
|
||||
#define for_each_set_bit_cont(bit, addr, size) \
|
||||
for ((bit) = find_next_bit((addr), (size), (bit)); \
|
||||
(bit) < (size); \
|
||||
(bit) = find_next_bit((addr), (size), (bit) + 1))
|
||||
|
||||
static __inline__ int get_bitmask_order(unsigned int count)
|
||||
|
@@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *);
|
||||
*/
|
||||
extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
|
||||
spinlock_t *lock, int node_id);
|
||||
extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
|
||||
request_fn_proc *,
|
||||
spinlock_t *, int node_id);
|
||||
extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
|
||||
extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
|
||||
request_fn_proc *, spinlock_t *);
|
||||
|
@@ -44,7 +44,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
|
||||
unsigned long endpfn);
|
||||
extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
|
||||
|
||||
unsigned long free_all_memory_core_early(int nodeid);
|
||||
extern unsigned long free_low_memory_core_early(int nodeid);
|
||||
extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
|
||||
extern unsigned long free_all_bootmem(void);
|
||||
|
||||
|
33
include/linux/can/platform/cc770.h
Normal file
33
include/linux/can/platform/cc770.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _CAN_PLATFORM_CC770_H_
|
||||
#define _CAN_PLATFORM_CC770_H_
|
||||
|
||||
/* CPU Interface Register (0x02) */
|
||||
#define CPUIF_CEN 0x01 /* Clock Out Enable */
|
||||
#define CPUIF_MUX 0x04 /* Multiplex */
|
||||
#define CPUIF_SLP 0x08 /* Sleep */
|
||||
#define CPUIF_PWD 0x10 /* Power Down Mode */
|
||||
#define CPUIF_DMC 0x20 /* Divide Memory Clock */
|
||||
#define CPUIF_DSC 0x40 /* Divide System Clock */
|
||||
#define CPUIF_RST 0x80 /* Hardware Reset Status */
|
||||
|
||||
/* Clock Out Register (0x1f) */
|
||||
#define CLKOUT_CD_MASK 0x0f /* Clock Divider mask */
|
||||
#define CLKOUT_SL_MASK 0x30 /* Slew Rate mask */
|
||||
#define CLKOUT_SL_SHIFT 4
|
||||
|
||||
/* Bus Configuration Register (0x2f) */
|
||||
#define BUSCFG_DR0 0x01 /* Disconnect RX0 Input / Select RX input */
|
||||
#define BUSCFG_DR1 0x02 /* Disconnect RX1 Input / Silent mode */
|
||||
#define BUSCFG_DT1 0x08 /* Disconnect TX1 Output */
|
||||
#define BUSCFG_POL 0x20 /* Polarity dominant or recessive */
|
||||
#define BUSCFG_CBY 0x40 /* Input Comparator Bypass */
|
||||
|
||||
struct cc770_platform_data {
|
||||
u32 osc_freq; /* CAN bus oscillator frequency in Hz */
|
||||
|
||||
u8 cir; /* CPU Interface Register */
|
||||
u8 cor; /* Clock Out Register */
|
||||
u8 bcr; /* Bus Configuration Register */
|
||||
};
|
||||
|
||||
#endif /* !_CAN_PLATFORM_CC770_H_ */
|
@@ -319,7 +319,7 @@ struct cftype {
|
||||
* If not 0, file mode is set to this value, otherwise it will
|
||||
* be figured out automatically
|
||||
*/
|
||||
mode_t mode;
|
||||
umode_t mode;
|
||||
|
||||
/*
|
||||
* If non-zero, defines the maximum length of string that can
|
||||
|
@@ -59,8 +59,16 @@ SUBSYS(net_cls)
|
||||
SUBSYS(blkio)
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
||||
#ifdef CONFIG_CGROUP_PERF
|
||||
SUBSYS(perf)
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
||||
#ifdef CONFIG_NETPRIO_CGROUP
|
||||
SUBSYS(net_prio)
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
@@ -71,7 +71,7 @@ struct timecounter {
|
||||
|
||||
/**
|
||||
* cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
|
||||
* @tc: Pointer to cycle counter.
|
||||
* @cc: Pointer to cycle counter.
|
||||
* @cycles: Cycles
|
||||
*
|
||||
* XXX - This could use some mult_lxl_ll() asm optimization. Same code
|
||||
@@ -114,7 +114,7 @@ extern u64 timecounter_read(struct timecounter *tc);
|
||||
* time base as values returned by
|
||||
* timecounter_read()
|
||||
* @tc: Pointer to time counter.
|
||||
* @cycle: a value returned by tc->cc->read()
|
||||
* @cycle_tstamp: a value returned by tc->cc->read()
|
||||
*
|
||||
* Cycle counts that are converted correctly as long as they
|
||||
* fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
|
||||
@@ -156,11 +156,12 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
|
||||
* @mult: cycle to nanosecond multiplier
|
||||
* @shift: cycle to nanosecond divisor (power of two)
|
||||
* @max_idle_ns: max idle time permitted by the clocksource (nsecs)
|
||||
* @maxadj maximum adjustment value to mult (~11%)
|
||||
* @maxadj: maximum adjustment value to mult (~11%)
|
||||
* @flags: flags describing special properties
|
||||
* @archdata: arch-specific data
|
||||
* @suspend: suspend function for the clocksource, if necessary
|
||||
* @resume: resume function for the clocksource, if necessary
|
||||
* @cycle_last: most recent cycle counter value seen by ::read()
|
||||
*/
|
||||
struct clocksource {
|
||||
/*
|
||||
@@ -187,6 +188,7 @@ struct clocksource {
|
||||
void (*suspend)(struct clocksource *cs);
|
||||
void (*resume)(struct clocksource *cs);
|
||||
|
||||
/* private: */
|
||||
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
|
||||
/* Watchdog related data, used by the framework */
|
||||
struct list_head wd_list;
|
||||
@@ -261,6 +263,9 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
|
||||
|
||||
/**
|
||||
* clocksource_cyc2ns - converts clocksource cycles to nanoseconds
|
||||
* @cycles: cycles
|
||||
* @mult: cycle to nanosecond multiplier
|
||||
* @shift: cycle to nanosecond divisor (power of two)
|
||||
*
|
||||
* Converts cycles to nanoseconds, using the given mult and shift.
|
||||
*
|
||||
|
@@ -422,9 +422,9 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
|
||||
asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
|
||||
unsigned int nr_segs, unsigned int flags);
|
||||
asmlinkage long compat_sys_open(const char __user *filename, int flags,
|
||||
int mode);
|
||||
umode_t mode);
|
||||
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
|
||||
int flags, int mode);
|
||||
int flags, umode_t mode);
|
||||
asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
|
||||
struct file_handle __user *handle,
|
||||
int flags);
|
||||
@@ -552,5 +552,14 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
|
||||
|
||||
extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
|
||||
asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
|
||||
const struct compat_iovec __user *lvec,
|
||||
unsigned long liovcnt, const struct compat_iovec __user *rvec,
|
||||
unsigned long riovcnt, unsigned long flags);
|
||||
asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
|
||||
const struct compat_iovec __user *lvec,
|
||||
unsigned long liovcnt, const struct compat_iovec __user *rvec,
|
||||
unsigned long riovcnt, unsigned long flags);
|
||||
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
|
@@ -124,7 +124,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
|
||||
struct configfs_attribute {
|
||||
const char *ca_name;
|
||||
struct module *ca_owner;
|
||||
mode_t ca_mode;
|
||||
umode_t ca_mode;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -35,8 +35,8 @@ struct cordic_iq {
|
||||
* @theta: angle in degrees for which i/q coordinate is to be calculated.
|
||||
* @coord: function output parameter holding the i/q coordinate.
|
||||
*
|
||||
* The function calculates the i/q coordinate for a given angle using
|
||||
* cordic algorithm. The coordinate consists of a real (i) and an
|
||||
* The function calculates the i/q coordinate for a given angle using the
|
||||
* CORDIC algorithm. The coordinate consists of a real (i) and an
|
||||
* imaginary (q) part. The real part is essentially the cosine of the
|
||||
* angle and the imaginary part is the sine of the angle. The returned
|
||||
* values are scaled by 2^16 for precision. The range for theta is
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#ifndef _LINUX_CPU_H_
|
||||
#define _LINUX_CPU_H_
|
||||
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/node.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/cpumask.h>
|
||||
@@ -22,19 +22,20 @@
|
||||
struct cpu {
|
||||
int node_id; /* The node which contains the CPU */
|
||||
int hotpluggable; /* creates sysfs control file if hotpluggable */
|
||||
struct sys_device sysdev;
|
||||
struct device dev;
|
||||
};
|
||||
|
||||
extern int register_cpu(struct cpu *cpu, int num);
|
||||
extern struct sys_device *get_cpu_sysdev(unsigned cpu);
|
||||
extern struct device *get_cpu_device(unsigned cpu);
|
||||
extern bool cpu_is_hotpluggable(unsigned cpu);
|
||||
|
||||
extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr);
|
||||
extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr);
|
||||
extern int cpu_add_dev_attr(struct device_attribute *attr);
|
||||
extern void cpu_remove_dev_attr(struct device_attribute *attr);
|
||||
|
||||
extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
|
||||
extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
|
||||
extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
|
||||
extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
|
||||
|
||||
extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
|
||||
extern int sched_create_sysfs_power_savings_entries(struct device *dev);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
extern void unregister_cpu(struct cpu *cpu);
|
||||
@@ -160,7 +161,7 @@ static inline void cpu_maps_update_done(void)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
extern struct sysdev_class cpu_sysdev_class;
|
||||
extern struct bus_type cpu_subsys;
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
/* Stop CPUs going up and down. */
|
||||
|
@@ -130,7 +130,6 @@ struct cpuidle_driver {
|
||||
#ifdef CONFIG_CPU_IDLE
|
||||
extern void disable_cpuidle(void);
|
||||
extern int cpuidle_idle_call(void);
|
||||
|
||||
extern int cpuidle_register_driver(struct cpuidle_driver *drv);
|
||||
struct cpuidle_driver *cpuidle_get_driver(void);
|
||||
extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
|
||||
@@ -145,7 +144,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
|
||||
#else
|
||||
static inline void disable_cpuidle(void) { }
|
||||
static inline int cpuidle_idle_call(void) { return -ENODEV; }
|
||||
|
||||
static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
|
||||
{return -ENODEV; }
|
||||
static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
|
||||
|
@@ -339,7 +339,8 @@ extern int d_validate(struct dentry *, struct dentry *);
|
||||
*/
|
||||
extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
|
||||
|
||||
extern char *__d_path(const struct path *path, struct path *root, char *, int);
|
||||
extern char *__d_path(const struct path *, const struct path *, char *, int);
|
||||
extern char *d_absolute_path(const struct path *, char *, int);
|
||||
extern char *d_path(const struct path *, char *, int);
|
||||
extern char *d_path_with_unreachable(const struct path *, char *, int);
|
||||
extern char *dentry_path_raw(struct dentry *, char *, int);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#define _DEBUGFS_H_
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -26,6 +27,17 @@ struct debugfs_blob_wrapper {
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
struct debugfs_reg32 {
|
||||
char *name;
|
||||
unsigned long offset;
|
||||
};
|
||||
|
||||
struct debugfs_regset32 {
|
||||
struct debugfs_reg32 *regs;
|
||||
int nregs;
|
||||
void __iomem *base;
|
||||
};
|
||||
|
||||
extern struct dentry *arch_debugfs_dir;
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
@@ -34,7 +46,7 @@ extern struct dentry *arch_debugfs_dir;
|
||||
extern const struct file_operations debugfs_file_operations;
|
||||
extern const struct inode_operations debugfs_link_operations;
|
||||
|
||||
struct dentry *debugfs_create_file(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_file(const char *name, umode_t mode,
|
||||
struct dentry *parent, void *data,
|
||||
const struct file_operations *fops);
|
||||
|
||||
@@ -49,31 +61,38 @@ void debugfs_remove_recursive(struct dentry *dentry);
|
||||
struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
|
||||
struct dentry *new_dir, const char *new_name);
|
||||
|
||||
struct dentry *debugfs_create_u8(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_u8(const char *name, umode_t mode,
|
||||
struct dentry *parent, u8 *value);
|
||||
struct dentry *debugfs_create_u16(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_u16(const char *name, umode_t mode,
|
||||
struct dentry *parent, u16 *value);
|
||||
struct dentry *debugfs_create_u32(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_u32(const char *name, umode_t mode,
|
||||
struct dentry *parent, u32 *value);
|
||||
struct dentry *debugfs_create_u64(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_u64(const char *name, umode_t mode,
|
||||
struct dentry *parent, u64 *value);
|
||||
struct dentry *debugfs_create_x8(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_x8(const char *name, umode_t mode,
|
||||
struct dentry *parent, u8 *value);
|
||||
struct dentry *debugfs_create_x16(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_x16(const char *name, umode_t mode,
|
||||
struct dentry *parent, u16 *value);
|
||||
struct dentry *debugfs_create_x32(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_x32(const char *name, umode_t mode,
|
||||
struct dentry *parent, u32 *value);
|
||||
struct dentry *debugfs_create_x64(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_x64(const char *name, umode_t mode,
|
||||
struct dentry *parent, u64 *value);
|
||||
struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
|
||||
struct dentry *parent, size_t *value);
|
||||
struct dentry *debugfs_create_bool(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_bool(const char *name, umode_t mode,
|
||||
struct dentry *parent, u32 *value);
|
||||
|
||||
struct dentry *debugfs_create_blob(const char *name, mode_t mode,
|
||||
struct dentry *debugfs_create_blob(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_blob_wrapper *blob);
|
||||
|
||||
struct dentry *debugfs_create_regset32(const char *name, mode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_regset32 *regset);
|
||||
|
||||
int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
|
||||
int nregs, void __iomem *base, char *prefix);
|
||||
|
||||
bool debugfs_initialized(void);
|
||||
|
||||
#else
|
||||
@@ -86,7 +105,7 @@ bool debugfs_initialized(void);
|
||||
* want to duplicate the design decision mistakes of procfs and devfs again.
|
||||
*/
|
||||
|
||||
static inline struct dentry *debugfs_create_file(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
|
||||
struct dentry *parent, void *data,
|
||||
const struct file_operations *fops)
|
||||
{
|
||||
@@ -118,76 +137,83 @@ static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentr
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u8 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u16 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u32 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u64 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u8 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u16 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u32 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
size_t *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
u32 *value)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
|
||||
static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
|
||||
struct dentry *parent,
|
||||
struct debugfs_blob_wrapper *blob)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_regset32(const char *name,
|
||||
mode_t mode, struct dentry *parent,
|
||||
struct debugfs_regset32 *regset)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline bool debugfs_initialized(void)
|
||||
{
|
||||
return false;
|
||||
|
@@ -46,6 +46,8 @@ struct debug_obj {
|
||||
* fails
|
||||
* @fixup_free: fixup function, which is called when the free check
|
||||
* fails
|
||||
* @fixup_assert_init: fixup function, which is called when the assert_init
|
||||
* check fails
|
||||
*/
|
||||
struct debug_obj_descr {
|
||||
const char *name;
|
||||
@@ -54,6 +56,7 @@ struct debug_obj_descr {
|
||||
int (*fixup_activate) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_destroy) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_free) (void *addr, enum debug_obj_state state);
|
||||
int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DEBUG_OBJECTS
|
||||
@@ -64,6 +67,7 @@ extern void debug_object_activate (void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
|
||||
extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
|
||||
|
||||
/*
|
||||
* Active state:
|
||||
@@ -89,6 +93,8 @@ static inline void
|
||||
debug_object_destroy (void *addr, struct debug_obj_descr *descr) { }
|
||||
static inline void
|
||||
debug_object_free (void *addr, struct debug_obj_descr *descr) { }
|
||||
static inline void
|
||||
debug_object_assert_init(void *addr, struct debug_obj_descr *descr) { }
|
||||
|
||||
static inline void debug_objects_early_init(void) { }
|
||||
static inline void debug_objects_mem_init(void) { }
|
||||
|
@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
|
||||
* struct bus_type - The bus type of the device
|
||||
*
|
||||
* @name: The name of the bus.
|
||||
* @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
|
||||
* @dev_root: Default device to use as the parent.
|
||||
* @bus_attrs: Default attributes of the bus.
|
||||
* @dev_attrs: Default attributes of the devices on the bus.
|
||||
* @drv_attrs: Default attributes of the device drivers on the bus.
|
||||
@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
|
||||
*/
|
||||
struct bus_type {
|
||||
const char *name;
|
||||
const char *dev_name;
|
||||
struct device *dev_root;
|
||||
struct bus_attribute *bus_attrs;
|
||||
struct device_attribute *dev_attrs;
|
||||
struct driver_attribute *drv_attrs;
|
||||
@@ -106,12 +110,30 @@ struct bus_type {
|
||||
struct subsys_private *p;
|
||||
};
|
||||
|
||||
extern int __must_check bus_register(struct bus_type *bus);
|
||||
/* This is a #define to keep the compiler from merging different
|
||||
* instances of the __key variable */
|
||||
#define bus_register(subsys) \
|
||||
({ \
|
||||
static struct lock_class_key __key; \
|
||||
__bus_register(subsys, &__key); \
|
||||
})
|
||||
extern int __must_check __bus_register(struct bus_type *bus,
|
||||
struct lock_class_key *key);
|
||||
extern void bus_unregister(struct bus_type *bus);
|
||||
|
||||
extern int __must_check bus_rescan_devices(struct bus_type *bus);
|
||||
|
||||
/* iterator helpers for buses */
|
||||
struct subsys_dev_iter {
|
||||
struct klist_iter ki;
|
||||
const struct device_type *type;
|
||||
};
|
||||
void subsys_dev_iter_init(struct subsys_dev_iter *iter,
|
||||
struct bus_type *subsys,
|
||||
struct device *start,
|
||||
const struct device_type *type);
|
||||
struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
|
||||
void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
|
||||
|
||||
int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
|
||||
int (*fn)(struct device *dev, void *data));
|
||||
@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
|
||||
struct device *bus_find_device_by_name(struct bus_type *bus,
|
||||
struct device *start,
|
||||
const char *name);
|
||||
|
||||
struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
|
||||
struct device *hint);
|
||||
int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
|
||||
void *data, int (*fn)(struct device_driver *, void *));
|
||||
|
||||
void bus_sort_breadthfirst(struct bus_type *bus,
|
||||
int (*compare)(const struct device *a,
|
||||
const struct device *b));
|
||||
@@ -255,6 +277,33 @@ struct device *driver_find_device(struct device_driver *drv,
|
||||
struct device *start, void *data,
|
||||
int (*match)(struct device *dev, void *data));
|
||||
|
||||
/**
|
||||
* struct subsys_interface - interfaces to device functions
|
||||
* @name name of the device function
|
||||
* @subsystem subsytem of the devices to attach to
|
||||
* @node the list of functions registered at the subsystem
|
||||
* @add device hookup to device function handler
|
||||
* @remove device hookup to device function handler
|
||||
*
|
||||
* Simple interfaces attached to a subsystem. Multiple interfaces can
|
||||
* attach to a subsystem and its devices. Unlike drivers, they do not
|
||||
* exclusively claim or control devices. Interfaces usually represent
|
||||
* a specific functionality of a subsystem/class of devices.
|
||||
*/
|
||||
struct subsys_interface {
|
||||
const char *name;
|
||||
struct bus_type *subsys;
|
||||
struct list_head node;
|
||||
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
|
||||
int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
|
||||
};
|
||||
|
||||
int subsys_interface_register(struct subsys_interface *sif);
|
||||
void subsys_interface_unregister(struct subsys_interface *sif);
|
||||
|
||||
int subsys_system_register(struct bus_type *subsys,
|
||||
const struct attribute_group **groups);
|
||||
|
||||
/**
|
||||
* struct class - device classes
|
||||
* @name: Name of the class.
|
||||
@@ -294,7 +343,7 @@ struct class {
|
||||
struct kobject *dev_kobj;
|
||||
|
||||
int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
char *(*devnode)(struct device *dev, mode_t *mode);
|
||||
char *(*devnode)(struct device *dev, umode_t *mode);
|
||||
|
||||
void (*class_release)(struct class *class);
|
||||
void (*dev_release)(struct device *dev);
|
||||
@@ -423,7 +472,7 @@ struct device_type {
|
||||
const char *name;
|
||||
const struct attribute_group **groups;
|
||||
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
|
||||
char *(*devnode)(struct device *dev, mode_t *mode);
|
||||
char *(*devnode)(struct device *dev, umode_t *mode);
|
||||
void (*release)(struct device *dev);
|
||||
|
||||
const struct dev_pm_ops *pm;
|
||||
@@ -438,11 +487,31 @@ struct device_attribute {
|
||||
const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define DEVICE_ATTR(_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
struct dev_ext_attribute {
|
||||
struct device_attribute attr;
|
||||
void *var;
|
||||
};
|
||||
|
||||
extern int __must_check device_create_file(struct device *device,
|
||||
const struct device_attribute *entry);
|
||||
ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
|
||||
char *buf);
|
||||
ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count);
|
||||
ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
|
||||
char *buf);
|
||||
ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count);
|
||||
|
||||
#define DEVICE_ATTR(_name, _mode, _show, _store) \
|
||||
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
|
||||
#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
|
||||
struct dev_ext_attribute dev_attr_##_name = \
|
||||
{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
|
||||
#define DEVICE_INT_ATTR(_name, _mode, _var) \
|
||||
struct dev_ext_attribute dev_attr_##_name = \
|
||||
{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
|
||||
|
||||
extern int device_create_file(struct device *device,
|
||||
const struct device_attribute *entry);
|
||||
extern void device_remove_file(struct device *dev,
|
||||
const struct device_attribute *attr);
|
||||
extern int __must_check device_create_bin_file(struct device *dev,
|
||||
@@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id);
|
||||
extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
|
||||
extern void devm_kfree(struct device *dev, void *p);
|
||||
|
||||
void __iomem *devm_request_and_ioremap(struct device *dev,
|
||||
struct resource *res);
|
||||
|
||||
struct device_dma_parameters {
|
||||
/*
|
||||
* a low level driver may set these to teach IOMMU code about
|
||||
@@ -600,6 +672,7 @@ struct device {
|
||||
struct device_node *of_node; /* associated device tree node */
|
||||
|
||||
dev_t devt; /* dev_t, creates the sysfs "dev" */
|
||||
u32 id; /* device instance */
|
||||
|
||||
spinlock_t devres_lock;
|
||||
struct list_head devres_head;
|
||||
@@ -720,7 +793,7 @@ extern int device_rename(struct device *dev, const char *new_name);
|
||||
extern int device_move(struct device *dev, struct device *new_parent,
|
||||
enum dpm_order dpm_order);
|
||||
extern const char *device_get_devnode(struct device *dev,
|
||||
mode_t *mode, const char **tmp);
|
||||
umode_t *mode, const char **tmp);
|
||||
extern void *dev_get_drvdata(const struct device *dev);
|
||||
extern int dev_set_drvdata(struct device *dev, void *data);
|
||||
|
||||
@@ -924,4 +997,25 @@ extern long sysfs_deprecated;
|
||||
#define sysfs_deprecated 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* module_driver() - Helper macro for drivers that don't do anything
|
||||
* special in module init/exit. This eliminates a lot of boilerplate.
|
||||
* Each module may only use this macro once, and calling it replaces
|
||||
* module_init() and module_exit().
|
||||
*
|
||||
* Use this macro to construct bus specific macros for registering
|
||||
* drivers, and do not use it on its own.
|
||||
*/
|
||||
#define module_driver(__driver, __register, __unregister) \
|
||||
static int __init __driver##_init(void) \
|
||||
{ \
|
||||
return __register(&(__driver)); \
|
||||
} \
|
||||
module_init(__driver##_init); \
|
||||
static void __exit __driver##_exit(void) \
|
||||
{ \
|
||||
__unregister(&(__driver)); \
|
||||
} \
|
||||
module_exit(__driver##_exit);
|
||||
|
||||
#endif /* _DEVICE_H_ */
|
||||
|
176
include/linux/dma-buf.h
Normal file
176
include/linux/dma-buf.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Header file for dma buffer sharing framework.
|
||||
*
|
||||
* Copyright(C) 2011 Linaro Limited. All rights reserved.
|
||||
* Author: Sumit Semwal <sumit.semwal@ti.com>
|
||||
*
|
||||
* Many thanks to linaro-mm-sig list, and specially
|
||||
* Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
|
||||
* Daniel Vetter <daniel@ffwll.ch> for their support in creation and
|
||||
* refining of this idea.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published by
|
||||
* the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __DMA_BUF_H__
|
||||
#define __DMA_BUF_H__
|
||||
|
||||
#include <linux/file.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
|
||||
struct dma_buf;
|
||||
struct dma_buf_attachment;
|
||||
|
||||
/**
|
||||
* struct dma_buf_ops - operations possible on struct dma_buf
|
||||
* @attach: [optional] allows different devices to 'attach' themselves to the
|
||||
* given buffer. It might return -EBUSY to signal that backing storage
|
||||
* is already allocated and incompatible with the requirements
|
||||
* of requesting device.
|
||||
* @detach: [optional] detach a given device from this buffer.
|
||||
* @map_dma_buf: returns list of scatter pages allocated, increases usecount
|
||||
* of the buffer. Requires atleast one attach to be called
|
||||
* before. Returned sg list should already be mapped into
|
||||
* _device_ address space. This call may sleep. May also return
|
||||
* -EINTR. Should return -EINVAL if attach hasn't been called yet.
|
||||
* @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
|
||||
* pages.
|
||||
* @release: release this buffer; to be called after the last dma_buf_put.
|
||||
*/
|
||||
struct dma_buf_ops {
|
||||
int (*attach)(struct dma_buf *, struct device *,
|
||||
struct dma_buf_attachment *);
|
||||
|
||||
void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
|
||||
|
||||
/* For {map,unmap}_dma_buf below, any specific buffer attributes
|
||||
* required should get added to device_dma_parameters accessible
|
||||
* via dev->dma_params.
|
||||
*/
|
||||
struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
|
||||
enum dma_data_direction);
|
||||
void (*unmap_dma_buf)(struct dma_buf_attachment *,
|
||||
struct sg_table *);
|
||||
/* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
|
||||
* if the call would block.
|
||||
*/
|
||||
|
||||
/* after final dma_buf_put() */
|
||||
void (*release)(struct dma_buf *);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dma_buf - shared buffer object
|
||||
* @size: size of the buffer
|
||||
* @file: file pointer used for sharing buffers across, and for refcounting.
|
||||
* @attachments: list of dma_buf_attachment that denotes all devices attached.
|
||||
* @ops: dma_buf_ops associated with this buffer object.
|
||||
* @priv: exporter specific private data for this buffer object.
|
||||
*/
|
||||
struct dma_buf {
|
||||
size_t size;
|
||||
struct file *file;
|
||||
struct list_head attachments;
|
||||
const struct dma_buf_ops *ops;
|
||||
/* mutex to serialize list manipulation and other ops */
|
||||
struct mutex lock;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dma_buf_attachment - holds device-buffer attachment data
|
||||
* @dmabuf: buffer for this attachment.
|
||||
* @dev: device attached to the buffer.
|
||||
* @node: list of dma_buf_attachment.
|
||||
* @priv: exporter specific attachment data.
|
||||
*
|
||||
* This structure holds the attachment information between the dma_buf buffer
|
||||
* and its user device(s). The list contains one attachment struct per device
|
||||
* attached to the buffer.
|
||||
*/
|
||||
struct dma_buf_attachment {
|
||||
struct dma_buf *dmabuf;
|
||||
struct device *dev;
|
||||
struct list_head node;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_DMA_SHARED_BUFFER
|
||||
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
||||
struct device *dev);
|
||||
void dma_buf_detach(struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment *dmabuf_attach);
|
||||
struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
|
||||
size_t size, int flags);
|
||||
int dma_buf_fd(struct dma_buf *dmabuf);
|
||||
struct dma_buf *dma_buf_get(int fd);
|
||||
void dma_buf_put(struct dma_buf *dmabuf);
|
||||
|
||||
struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
|
||||
enum dma_data_direction);
|
||||
void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
|
||||
#else
|
||||
|
||||
static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
||||
struct device *dev)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline void dma_buf_detach(struct dma_buf *dmabuf,
|
||||
struct dma_buf_attachment *dmabuf_attach)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline struct dma_buf *dma_buf_export(void *priv,
|
||||
struct dma_buf_ops *ops,
|
||||
size_t size, int flags)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline int dma_buf_fd(struct dma_buf *dmabuf)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline struct dma_buf *dma_buf_get(int fd)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline void dma_buf_put(struct dma_buf *dmabuf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline struct sg_table *dma_buf_map_attachment(
|
||||
struct dma_buf_attachment *attach, enum dma_data_direction write)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
|
||||
struct sg_table *sg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DMA_SHARED_BUFFER */
|
||||
|
||||
#endif /* __DMA_BUF_H__ */
|
@@ -31,6 +31,7 @@ extern void free_dmar_iommu(struct intel_iommu *iommu);
|
||||
extern int iommu_calculate_agaw(struct intel_iommu *iommu);
|
||||
extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
|
||||
extern int dmar_disabled;
|
||||
extern int intel_iommu_enabled;
|
||||
#else
|
||||
static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
|
||||
{
|
||||
@@ -44,6 +45,7 @@ static inline void free_dmar_iommu(struct intel_iommu *iommu)
|
||||
{
|
||||
}
|
||||
#define dmar_disabled (1)
|
||||
#define intel_iommu_enabled (0)
|
||||
#endif
|
||||
|
||||
|
||||
|
97
include/linux/dynamic_queue_limits.h
Normal file
97
include/linux/dynamic_queue_limits.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Dynamic queue limits (dql) - Definitions
|
||||
*
|
||||
* Copyright (c) 2011, Tom Herbert <therbert@google.com>
|
||||
*
|
||||
* This header file contains the definitions for dynamic queue limits (dql).
|
||||
* dql would be used in conjunction with a producer/consumer type queue
|
||||
* (possibly a HW queue). Such a queue would have these general properties:
|
||||
*
|
||||
* 1) Objects are queued up to some limit specified as number of objects.
|
||||
* 2) Periodically a completion process executes which retires consumed
|
||||
* objects.
|
||||
* 3) Starvation occurs when limit has been reached, all queued data has
|
||||
* actually been consumed, but completion processing has not yet run
|
||||
* so queuing new data is blocked.
|
||||
* 4) Minimizing the amount of queued data is desirable.
|
||||
*
|
||||
* The goal of dql is to calculate the limit as the minimum number of objects
|
||||
* needed to prevent starvation.
|
||||
*
|
||||
* The primary functions of dql are:
|
||||
* dql_queued - called when objects are enqueued to record number of objects
|
||||
* dql_avail - returns how many objects are available to be queued based
|
||||
* on the object limit and how many objects are already enqueued
|
||||
* dql_completed - called at completion time to indicate how many objects
|
||||
* were retired from the queue
|
||||
*
|
||||
* The dql implementation does not implement any locking for the dql data
|
||||
* structures, the higher layer should provide this. dql_queued should
|
||||
* be serialized to prevent concurrent execution of the function; this
|
||||
* is also true for dql_completed. However, dql_queued and dlq_completed can
|
||||
* be executed concurrently (i.e. they can be protected by different locks).
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_DQL_H
|
||||
#define _LINUX_DQL_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct dql {
|
||||
/* Fields accessed in enqueue path (dql_queued) */
|
||||
unsigned int num_queued; /* Total ever queued */
|
||||
unsigned int adj_limit; /* limit + num_completed */
|
||||
unsigned int last_obj_cnt; /* Count at last queuing */
|
||||
|
||||
/* Fields accessed only by completion path (dql_completed) */
|
||||
|
||||
unsigned int limit ____cacheline_aligned_in_smp; /* Current limit */
|
||||
unsigned int num_completed; /* Total ever completed */
|
||||
|
||||
unsigned int prev_ovlimit; /* Previous over limit */
|
||||
unsigned int prev_num_queued; /* Previous queue total */
|
||||
unsigned int prev_last_obj_cnt; /* Previous queuing cnt */
|
||||
|
||||
unsigned int lowest_slack; /* Lowest slack found */
|
||||
unsigned long slack_start_time; /* Time slacks seen */
|
||||
|
||||
/* Configuration */
|
||||
unsigned int max_limit; /* Max limit */
|
||||
unsigned int min_limit; /* Minimum limit */
|
||||
unsigned int slack_hold_time; /* Time to measure slack */
|
||||
};
|
||||
|
||||
/* Set some static maximums */
|
||||
#define DQL_MAX_OBJECT (UINT_MAX / 16)
|
||||
#define DQL_MAX_LIMIT ((UINT_MAX / 2) - DQL_MAX_OBJECT)
|
||||
|
||||
/*
|
||||
* Record number of objects queued. Assumes that caller has already checked
|
||||
* availability in the queue with dql_avail.
|
||||
*/
|
||||
static inline void dql_queued(struct dql *dql, unsigned int count)
|
||||
{
|
||||
BUG_ON(count > DQL_MAX_OBJECT);
|
||||
|
||||
dql->num_queued += count;
|
||||
dql->last_obj_cnt = count;
|
||||
}
|
||||
|
||||
/* Returns how many objects can be queued, < 0 indicates over limit. */
|
||||
static inline int dql_avail(const struct dql *dql)
|
||||
{
|
||||
return dql->adj_limit - dql->num_queued;
|
||||
}
|
||||
|
||||
/* Record number of completed objects and recalculate the limit. */
|
||||
void dql_completed(struct dql *dql, unsigned int count);
|
||||
|
||||
/* Reset dql state */
|
||||
void dql_reset(struct dql *dql);
|
||||
|
||||
/* Initialize dql state */
|
||||
int dql_init(struct dql *dql, unsigned hold_time);
|
||||
|
||||
#endif /* _KERNEL_ */
|
||||
|
||||
#endif /* _LINUX_DQL_H */
|
@@ -13,7 +13,7 @@
|
||||
#define _LINUX_EDAC_H_
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#define EDAC_OPSTATE_INVAL -1
|
||||
#define EDAC_OPSTATE_POLL 0
|
||||
@@ -23,12 +23,12 @@
|
||||
extern int edac_op_state;
|
||||
extern int edac_err_assert;
|
||||
extern atomic_t edac_handlers;
|
||||
extern struct sysdev_class edac_class;
|
||||
extern struct bus_type edac_subsys;
|
||||
|
||||
extern int edac_handler_set(void);
|
||||
extern void edac_atomic_assert_error(void);
|
||||
extern struct sysdev_class *edac_get_sysfs_class(void);
|
||||
extern void edac_put_sysfs_class(void);
|
||||
extern struct bus_type *edac_get_sysfs_subsys(void);
|
||||
extern void edac_put_sysfs_subsys(void);
|
||||
|
||||
static inline void opstate_init(void)
|
||||
{
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#define PCI_EEPROM_WIDTH_93C86 8
|
||||
#define PCI_EEPROM_WIDTH_OPCODE 3
|
||||
#define PCI_EEPROM_WRITE_OPCODE 0x05
|
||||
#define PCI_EEPROM_ERASE_OPCODE 0x07
|
||||
#define PCI_EEPROM_READ_OPCODE 0x06
|
||||
#define PCI_EEPROM_EWDS_OPCODE 0x10
|
||||
#define PCI_EEPROM_EWEN_OPCODE 0x13
|
||||
@@ -46,6 +47,7 @@
|
||||
* @register_write(struct eeprom_93cx6 *eeprom): handler to
|
||||
* write to the eeprom register by using all reg_* fields.
|
||||
* @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
|
||||
* @drive_data: Set if we're driving the data line.
|
||||
* @reg_data_in: register field to indicate data input
|
||||
* @reg_data_out: register field to indicate data output
|
||||
* @reg_data_clock: register field to set the data clock
|
||||
@@ -62,6 +64,7 @@ struct eeprom_93cx6 {
|
||||
|
||||
int width;
|
||||
|
||||
char drive_data;
|
||||
char reg_data_in;
|
||||
char reg_data_out;
|
||||
char reg_data_clock;
|
||||
@@ -72,3 +75,8 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
|
||||
const u8 word, u16 *data);
|
||||
extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
|
||||
const u8 word, __le16 *data, const u16 words);
|
||||
|
||||
extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
|
||||
|
||||
extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom,
|
||||
u8 addr, u16 data);
|
||||
|
@@ -17,14 +17,15 @@ struct sock_extended_err {
|
||||
#define SO_EE_ORIGIN_LOCAL 1
|
||||
#define SO_EE_ORIGIN_ICMP 2
|
||||
#define SO_EE_ORIGIN_ICMP6 3
|
||||
#define SO_EE_ORIGIN_TIMESTAMPING 4
|
||||
#define SO_EE_ORIGIN_TXSTATUS 4
|
||||
#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
|
||||
|
||||
#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <net/ip.h>
|
||||
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
#include <linux/ipv6.h>
|
||||
#endif
|
||||
|
||||
@@ -33,7 +34,7 @@ struct sock_extended_err {
|
||||
struct sock_exterr_skb {
|
||||
union {
|
||||
struct inet_skb_parm h4;
|
||||
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
struct inet6_skb_parm h6;
|
||||
#endif
|
||||
} header;
|
||||
|
@@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
|
||||
* on return.
|
||||
*
|
||||
* For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
|
||||
* rules on return.
|
||||
* rules on return. If @data is non-zero on return then it is the
|
||||
* size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
|
||||
* driver supports any special location values. If that flag is not
|
||||
* set in @data then special location values should not be used.
|
||||
*
|
||||
* For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
|
||||
* existing rule on entry and @fs contains the rule on return.
|
||||
@@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
|
||||
* must use the second parameter to get_rxnfc() instead of @rule_locs.
|
||||
*
|
||||
* For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
|
||||
* @fs.@location specifies the location to use and must not be ignored.
|
||||
* @fs.@location either specifies the location to use or is a special
|
||||
* location value with %RX_CLS_LOC_SPECIAL flag set. On return,
|
||||
* @fs.@location is the actual rule location.
|
||||
*
|
||||
* For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
|
||||
* existing rule on entry.
|
||||
*
|
||||
* A driver supporting the special location values for
|
||||
* %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
|
||||
* location, and may remove a rule at a later location (lower
|
||||
* priority) that matches exactly the same set of flows. The special
|
||||
* values are: %RX_CLS_LOC_ANY, selecting any location;
|
||||
* %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
|
||||
* priority); and %RX_CLS_LOC_LAST, selecting the last suitable
|
||||
* location (minimum priority). Additional special values may be
|
||||
* defined in future and drivers must return -%EINVAL for any
|
||||
* unrecognised value.
|
||||
*/
|
||||
struct ethtool_rxnfc {
|
||||
__u32 cmd;
|
||||
@@ -543,9 +559,15 @@ struct compat_ethtool_rxnfc {
|
||||
/**
|
||||
* struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
|
||||
* @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
|
||||
* @size: On entry, the array size of the user buffer. On return from
|
||||
* %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
|
||||
* @size: On entry, the array size of the user buffer, which may be zero.
|
||||
* On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
|
||||
* indirection table.
|
||||
* @ring_index: RX ring/queue index for each hash value
|
||||
*
|
||||
* For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
|
||||
* should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
|
||||
* the table should be reset to default values. This last feature
|
||||
* is not supported by the original implementations.
|
||||
*/
|
||||
struct ethtool_rxfh_indir {
|
||||
__u32 cmd;
|
||||
@@ -724,9 +746,6 @@ enum ethtool_sfeatures_retval_bits {
|
||||
|
||||
#include <linux/rculist.h>
|
||||
|
||||
/* needed by dev_disable_lro() */
|
||||
extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
|
||||
|
||||
extern int __ethtool_get_settings(struct net_device *dev,
|
||||
struct ethtool_cmd *cmd);
|
||||
|
||||
@@ -750,19 +769,18 @@ struct net_device;
|
||||
|
||||
/* Some generic methods drivers may use in their ethtool_ops */
|
||||
u32 ethtool_op_get_link(struct net_device *dev);
|
||||
u32 ethtool_op_get_tx_csum(struct net_device *dev);
|
||||
int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
|
||||
int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
|
||||
int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data);
|
||||
u32 ethtool_op_get_sg(struct net_device *dev);
|
||||
int ethtool_op_set_sg(struct net_device *dev, u32 data);
|
||||
u32 ethtool_op_get_tso(struct net_device *dev);
|
||||
int ethtool_op_set_tso(struct net_device *dev, u32 data);
|
||||
u32 ethtool_op_get_ufo(struct net_device *dev);
|
||||
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
|
||||
u32 ethtool_op_get_flags(struct net_device *dev);
|
||||
int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
|
||||
bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
|
||||
|
||||
/**
|
||||
* ethtool_rxfh_indir_default - get default value for RX flow hash indirection
|
||||
* @index: Index in RX flow hash indirection table
|
||||
* @n_rx_rings: Number of RX rings to use
|
||||
*
|
||||
* This function provides the default policy for RX flow hash indirection.
|
||||
*/
|
||||
static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
|
||||
{
|
||||
return index % n_rx_rings;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct ethtool_ops - optional netdev operations
|
||||
@@ -807,22 +825,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
|
||||
* @get_pauseparam: Report pause parameters
|
||||
* @set_pauseparam: Set pause parameters. Returns a negative error code
|
||||
* or zero.
|
||||
* @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
|
||||
* Report whether receive checksums are turned on or off.
|
||||
* @set_rx_csum: Deprecated in favour of generic netdev features. Turn
|
||||
* receive checksum on or off. Returns a negative error code or zero.
|
||||
* @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
|
||||
* are turned on or off.
|
||||
* @set_tx_csum: Deprecated in favour of generic netdev features. Turn
|
||||
* transmit checksums on or off. Returns a negative error code or zero.
|
||||
* @get_sg: Deprecated as redundant. Report whether scatter-gather is
|
||||
* enabled.
|
||||
* @set_sg: Deprecated in favour of generic netdev features. Turn
|
||||
* scatter-gather on or off. Returns a negative error code or zero.
|
||||
* @get_tso: Deprecated as redundant. Report whether TCP segmentation
|
||||
* offload is enabled.
|
||||
* @set_tso: Deprecated in favour of generic netdev features. Turn TCP
|
||||
* segmentation offload on or off. Returns a negative error code or zero.
|
||||
* @self_test: Run specified self-tests
|
||||
* @get_strings: Return a set of strings that describe the requested objects
|
||||
* @set_phys_id: Identify the physical devices, e.g. by flashing an LED
|
||||
@@ -844,15 +846,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
|
||||
* negative error code or zero.
|
||||
* @complete: Function to be called after any other operation except
|
||||
* @begin. Will be called even if the other operation failed.
|
||||
* @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
|
||||
* offload is enabled.
|
||||
* @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
|
||||
* fragmentation offload on or off. Returns a negative error code or zero.
|
||||
* @get_flags: Deprecated as redundant. Report features included in
|
||||
* &enum ethtool_flags that are enabled.
|
||||
* @set_flags: Deprecated in favour of generic netdev features. Turn
|
||||
* features included in &enum ethtool_flags on or off. Returns a
|
||||
* negative error code or zero.
|
||||
* @get_priv_flags: Report driver-specific feature flags.
|
||||
* @set_priv_flags: Set driver-specific feature flags. Returns a negative
|
||||
* error code or zero.
|
||||
@@ -866,11 +859,13 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
|
||||
* @reset: Reset (part of) the device, as specified by a bitmask of
|
||||
* flags from &enum ethtool_reset_flags. Returns a negative
|
||||
* error code or zero.
|
||||
* @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code
|
||||
* or zero.
|
||||
* @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
|
||||
* Returns zero if not supported for this specific device.
|
||||
* @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
|
||||
* Will not be called if @get_rxfh_indir_size returns zero.
|
||||
* Returns a negative error code or zero.
|
||||
* @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
|
||||
* Will not be called if @get_rxfh_indir_size returns zero.
|
||||
* Returns a negative error code or zero.
|
||||
* @get_channels: Get number of channels.
|
||||
* @set_channels: Set number of channels. Returns a negative error code or
|
||||
@@ -917,14 +912,6 @@ struct ethtool_ops {
|
||||
struct ethtool_pauseparam*);
|
||||
int (*set_pauseparam)(struct net_device *,
|
||||
struct ethtool_pauseparam*);
|
||||
u32 (*get_rx_csum)(struct net_device *);
|
||||
int (*set_rx_csum)(struct net_device *, u32);
|
||||
u32 (*get_tx_csum)(struct net_device *);
|
||||
int (*set_tx_csum)(struct net_device *, u32);
|
||||
u32 (*get_sg)(struct net_device *);
|
||||
int (*set_sg)(struct net_device *, u32);
|
||||
u32 (*get_tso)(struct net_device *);
|
||||
int (*set_tso)(struct net_device *, u32);
|
||||
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
|
||||
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
|
||||
int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
|
||||
@@ -932,10 +919,6 @@ struct ethtool_ops {
|
||||
struct ethtool_stats *, u64 *);
|
||||
int (*begin)(struct net_device *);
|
||||
void (*complete)(struct net_device *);
|
||||
u32 (*get_ufo)(struct net_device *);
|
||||
int (*set_ufo)(struct net_device *, u32);
|
||||
u32 (*get_flags)(struct net_device *);
|
||||
int (*set_flags)(struct net_device *, u32);
|
||||
u32 (*get_priv_flags)(struct net_device *);
|
||||
int (*set_priv_flags)(struct net_device *, u32);
|
||||
int (*get_sset_count)(struct net_device *, int);
|
||||
@@ -944,12 +927,9 @@ struct ethtool_ops {
|
||||
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
|
||||
int (*flash_device)(struct net_device *, struct ethtool_flash *);
|
||||
int (*reset)(struct net_device *, u32 *);
|
||||
int (*set_rx_ntuple)(struct net_device *,
|
||||
struct ethtool_rx_ntuple *);
|
||||
int (*get_rxfh_indir)(struct net_device *,
|
||||
struct ethtool_rxfh_indir *);
|
||||
int (*set_rxfh_indir)(struct net_device *,
|
||||
const struct ethtool_rxfh_indir *);
|
||||
u32 (*get_rxfh_indir_size)(struct net_device *);
|
||||
int (*get_rxfh_indir)(struct net_device *, u32 *);
|
||||
int (*set_rxfh_indir)(struct net_device *, const u32 *);
|
||||
void (*get_channels)(struct net_device *, struct ethtool_channels *);
|
||||
int (*set_channels)(struct net_device *, struct ethtool_channels *);
|
||||
int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
|
||||
@@ -1173,6 +1153,12 @@ struct ethtool_ops {
|
||||
|
||||
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
|
||||
|
||||
/* Special RX classification rule insert location values */
|
||||
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
|
||||
#define RX_CLS_LOC_ANY 0xffffffff
|
||||
#define RX_CLS_LOC_FIRST 0xfffffffe
|
||||
#define RX_CLS_LOC_LAST 0xfffffffd
|
||||
|
||||
/* Reset flags */
|
||||
/* The reset() operation must clear the flags for the components which
|
||||
* were actually reset. On successful return, the flags indicate the
|
||||
|
@@ -884,7 +884,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
|
||||
|
||||
/* ialloc.c */
|
||||
extern struct inode * ext3_new_inode (handle_t *, struct inode *,
|
||||
const struct qstr *, int);
|
||||
const struct qstr *, umode_t);
|
||||
extern void ext3_free_inode (handle_t *, struct inode *);
|
||||
extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
|
||||
extern unsigned long ext3_count_free_inodes (struct super_block *);
|
||||
|
@@ -5,71 +5,58 @@
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
#ifdef CONFIG_FREEZER
|
||||
extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */
|
||||
extern bool pm_freezing; /* PM freezing in effect */
|
||||
extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
|
||||
|
||||
/*
|
||||
* Check if a process has been frozen
|
||||
*/
|
||||
static inline int frozen(struct task_struct *p)
|
||||
static inline bool frozen(struct task_struct *p)
|
||||
{
|
||||
return p->flags & PF_FROZEN;
|
||||
}
|
||||
|
||||
extern bool freezing_slow_path(struct task_struct *p);
|
||||
|
||||
/*
|
||||
* Check if there is a request to freeze a process
|
||||
*/
|
||||
static inline int freezing(struct task_struct *p)
|
||||
static inline bool freezing(struct task_struct *p)
|
||||
{
|
||||
return test_tsk_thread_flag(p, TIF_FREEZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Request that a process be frozen
|
||||
*/
|
||||
static inline void set_freeze_flag(struct task_struct *p)
|
||||
{
|
||||
set_tsk_thread_flag(p, TIF_FREEZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sometimes we may need to cancel the previous 'freeze' request
|
||||
*/
|
||||
static inline void clear_freeze_flag(struct task_struct *p)
|
||||
{
|
||||
clear_tsk_thread_flag(p, TIF_FREEZE);
|
||||
}
|
||||
|
||||
static inline bool should_send_signal(struct task_struct *p)
|
||||
{
|
||||
return !(p->flags & PF_FREEZER_NOSIG);
|
||||
if (likely(!atomic_read(&system_freezing_cnt)))
|
||||
return false;
|
||||
return freezing_slow_path(p);
|
||||
}
|
||||
|
||||
/* Takes and releases task alloc lock using task_lock() */
|
||||
extern int thaw_process(struct task_struct *p);
|
||||
extern void __thaw_task(struct task_struct *t);
|
||||
|
||||
extern void refrigerator(void);
|
||||
extern bool __refrigerator(bool check_kthr_stop);
|
||||
extern int freeze_processes(void);
|
||||
extern int freeze_kernel_threads(void);
|
||||
extern void thaw_processes(void);
|
||||
|
||||
static inline int try_to_freeze(void)
|
||||
static inline bool try_to_freeze(void)
|
||||
{
|
||||
if (freezing(current)) {
|
||||
refrigerator();
|
||||
return 1;
|
||||
} else
|
||||
return 0;
|
||||
might_sleep();
|
||||
if (likely(!freezing(current)))
|
||||
return false;
|
||||
return __refrigerator(false);
|
||||
}
|
||||
|
||||
extern bool freeze_task(struct task_struct *p, bool sig_only);
|
||||
extern void cancel_freezing(struct task_struct *p);
|
||||
extern bool freeze_task(struct task_struct *p);
|
||||
extern bool set_freezable(void);
|
||||
|
||||
#ifdef CONFIG_CGROUP_FREEZER
|
||||
extern int cgroup_freezing_or_frozen(struct task_struct *task);
|
||||
extern bool cgroup_freezing(struct task_struct *task);
|
||||
#else /* !CONFIG_CGROUP_FREEZER */
|
||||
static inline int cgroup_freezing_or_frozen(struct task_struct *task)
|
||||
static inline bool cgroup_freezing(struct task_struct *task)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
#endif /* !CONFIG_CGROUP_FREEZER */
|
||||
|
||||
@@ -80,33 +67,27 @@ static inline int cgroup_freezing_or_frozen(struct task_struct *task)
|
||||
* appropriately in case the child has exited before the freezing of tasks is
|
||||
* complete. However, we don't want kernel threads to be frozen in unexpected
|
||||
* places, so we allow them to block freeze_processes() instead or to set
|
||||
* PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork
|
||||
* parents. Fortunately, in the ____call_usermodehelper() case the parent won't
|
||||
* really block freeze_processes(), since ____call_usermodehelper() (the child)
|
||||
* does a little before exec/exit and it can't be frozen before waking up the
|
||||
* parent.
|
||||
* PF_NOFREEZE if needed. Fortunately, in the ____call_usermodehelper() case the
|
||||
* parent won't really block freeze_processes(), since ____call_usermodehelper()
|
||||
* (the child) does a little before exec/exit and it can't be frozen before
|
||||
* waking up the parent.
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the current task is a user space one, tell the freezer not to count it as
|
||||
* freezable.
|
||||
*/
|
||||
|
||||
/* Tell the freezer not to count the current task as freezable. */
|
||||
static inline void freezer_do_not_count(void)
|
||||
{
|
||||
if (current->mm)
|
||||
current->flags |= PF_FREEZER_SKIP;
|
||||
current->flags |= PF_FREEZER_SKIP;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the current task is a user space one, tell the freezer to count it as
|
||||
* freezable again and try to freeze it.
|
||||
* Tell the freezer to count the current task as freezable again and try to
|
||||
* freeze it.
|
||||
*/
|
||||
static inline void freezer_count(void)
|
||||
{
|
||||
if (current->mm) {
|
||||
current->flags &= ~PF_FREEZER_SKIP;
|
||||
try_to_freeze();
|
||||
}
|
||||
current->flags &= ~PF_FREEZER_SKIP;
|
||||
try_to_freeze();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -118,21 +99,29 @@ static inline int freezer_should_skip(struct task_struct *p)
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell the freezer that the current task should be frozen by it
|
||||
* These macros are intended to be used whenever you want allow a task that's
|
||||
* sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
|
||||
* that neither return any clear indication of whether a freeze event happened
|
||||
* while in this function.
|
||||
*/
|
||||
static inline void set_freezable(void)
|
||||
{
|
||||
current->flags &= ~PF_NOFREEZE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell the freezer that the current task should be frozen by it and that it
|
||||
* should send a fake signal to the task to freeze it.
|
||||
*/
|
||||
static inline void set_freezable_with_signal(void)
|
||||
{
|
||||
current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG);
|
||||
}
|
||||
/* Like schedule(), but should not block the freezer. */
|
||||
#define freezable_schedule() \
|
||||
({ \
|
||||
freezer_do_not_count(); \
|
||||
schedule(); \
|
||||
freezer_count(); \
|
||||
})
|
||||
|
||||
/* Like schedule_timeout_killable(), but should not block the freezer. */
|
||||
#define freezable_schedule_timeout_killable(timeout) \
|
||||
({ \
|
||||
long __retval; \
|
||||
freezer_do_not_count(); \
|
||||
__retval = schedule_timeout_killable(timeout); \
|
||||
freezer_count(); \
|
||||
__retval; \
|
||||
})
|
||||
|
||||
/*
|
||||
* Freezer-friendly wrappers around wait_event_interruptible(),
|
||||
@@ -152,47 +141,51 @@ static inline void set_freezable_with_signal(void)
|
||||
#define wait_event_freezable(wq, condition) \
|
||||
({ \
|
||||
int __retval; \
|
||||
do { \
|
||||
for (;;) { \
|
||||
__retval = wait_event_interruptible(wq, \
|
||||
(condition) || freezing(current)); \
|
||||
if (__retval && !freezing(current)) \
|
||||
if (__retval || (condition)) \
|
||||
break; \
|
||||
else if (!(condition)) \
|
||||
__retval = -ERESTARTSYS; \
|
||||
} while (try_to_freeze()); \
|
||||
try_to_freeze(); \
|
||||
} \
|
||||
__retval; \
|
||||
})
|
||||
|
||||
|
||||
#define wait_event_freezable_timeout(wq, condition, timeout) \
|
||||
({ \
|
||||
long __retval = timeout; \
|
||||
do { \
|
||||
for (;;) { \
|
||||
__retval = wait_event_interruptible_timeout(wq, \
|
||||
(condition) || freezing(current), \
|
||||
__retval); \
|
||||
} while (try_to_freeze()); \
|
||||
if (__retval <= 0 || (condition)) \
|
||||
break; \
|
||||
try_to_freeze(); \
|
||||
} \
|
||||
__retval; \
|
||||
})
|
||||
#else /* !CONFIG_FREEZER */
|
||||
static inline int frozen(struct task_struct *p) { return 0; }
|
||||
static inline int freezing(struct task_struct *p) { return 0; }
|
||||
static inline void set_freeze_flag(struct task_struct *p) {}
|
||||
static inline void clear_freeze_flag(struct task_struct *p) {}
|
||||
static inline int thaw_process(struct task_struct *p) { return 1; }
|
||||
|
||||
static inline void refrigerator(void) {}
|
||||
#else /* !CONFIG_FREEZER */
|
||||
static inline bool frozen(struct task_struct *p) { return false; }
|
||||
static inline bool freezing(struct task_struct *p) { return false; }
|
||||
static inline void __thaw_task(struct task_struct *t) {}
|
||||
|
||||
static inline bool __refrigerator(bool check_kthr_stop) { return false; }
|
||||
static inline int freeze_processes(void) { return -ENOSYS; }
|
||||
static inline int freeze_kernel_threads(void) { return -ENOSYS; }
|
||||
static inline void thaw_processes(void) {}
|
||||
|
||||
static inline int try_to_freeze(void) { return 0; }
|
||||
static inline bool try_to_freeze(void) { return false; }
|
||||
|
||||
static inline void freezer_do_not_count(void) {}
|
||||
static inline void freezer_count(void) {}
|
||||
static inline int freezer_should_skip(struct task_struct *p) { return 0; }
|
||||
static inline void set_freezable(void) {}
|
||||
static inline void set_freezable_with_signal(void) {}
|
||||
|
||||
#define freezable_schedule() schedule()
|
||||
|
||||
#define freezable_schedule_timeout_killable(timeout) \
|
||||
schedule_timeout_killable(timeout)
|
||||
|
||||
#define wait_event_freezable(wq, condition) \
|
||||
wait_event_interruptible(wq, condition)
|
||||
|
@@ -393,8 +393,8 @@ struct inodes_stat_t {
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/fiemap.h>
|
||||
#include <linux/rculist_bl.h>
|
||||
#include <linux/shrinker.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/shrinker.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
@@ -1428,6 +1428,7 @@ struct super_block {
|
||||
#else
|
||||
struct list_head s_files;
|
||||
#endif
|
||||
struct list_head s_mounts; /* list of mounts; _not_ for fs use */
|
||||
/* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
|
||||
struct list_head s_dentry_lru; /* unused dentry lru */
|
||||
int s_nr_dentry_unused; /* # of dentry on lru */
|
||||
@@ -1440,7 +1441,7 @@ struct super_block {
|
||||
struct block_device *s_bdev;
|
||||
struct backing_dev_info *s_bdi;
|
||||
struct mtd_info *s_mtd;
|
||||
struct list_head s_instances;
|
||||
struct hlist_node s_instances;
|
||||
struct quota_info s_dquot; /* Diskquota specific options */
|
||||
|
||||
int s_frozen;
|
||||
@@ -1481,6 +1482,12 @@ struct super_block {
|
||||
int cleancache_poolid;
|
||||
|
||||
struct shrinker s_shrink; /* per-sb shrinker handle */
|
||||
|
||||
/* Number of inodes with nlink == 0 but still referenced */
|
||||
atomic_long_t s_remove_count;
|
||||
|
||||
/* Being remounted read-only */
|
||||
int s_readonly_remount;
|
||||
};
|
||||
|
||||
/* superblock cache pruning functions */
|
||||
@@ -1516,9 +1523,9 @@ extern void unlock_super(struct super_block *);
|
||||
/*
|
||||
* VFS helper functions..
|
||||
*/
|
||||
extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
|
||||
extern int vfs_mkdir(struct inode *, struct dentry *, int);
|
||||
extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
|
||||
extern int vfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *);
|
||||
extern int vfs_mkdir(struct inode *, struct dentry *, umode_t);
|
||||
extern int vfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
|
||||
extern int vfs_symlink(struct inode *, struct dentry *, const char *);
|
||||
extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
|
||||
extern int vfs_rmdir(struct inode *, struct dentry *);
|
||||
@@ -1534,7 +1541,7 @@ extern void dentry_unhash(struct dentry *dentry);
|
||||
* VFS file helper functions.
|
||||
*/
|
||||
extern void inode_init_owner(struct inode *inode, const struct inode *dir,
|
||||
mode_t mode);
|
||||
umode_t mode);
|
||||
/*
|
||||
* VFS FS_IOC_FIEMAP helper definitions.
|
||||
*/
|
||||
@@ -1619,13 +1626,13 @@ struct inode_operations {
|
||||
int (*readlink) (struct dentry *, char __user *,int);
|
||||
void (*put_link) (struct dentry *, struct nameidata *, void *);
|
||||
|
||||
int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
|
||||
int (*create) (struct inode *,struct dentry *,umode_t,struct nameidata *);
|
||||
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
||||
int (*unlink) (struct inode *,struct dentry *);
|
||||
int (*symlink) (struct inode *,struct dentry *,const char *);
|
||||
int (*mkdir) (struct inode *,struct dentry *,int);
|
||||
int (*mkdir) (struct inode *,struct dentry *,umode_t);
|
||||
int (*rmdir) (struct inode *,struct dentry *);
|
||||
int (*mknod) (struct inode *,struct dentry *,int,dev_t);
|
||||
int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
|
||||
int (*rename) (struct inode *, struct dentry *,
|
||||
struct inode *, struct dentry *);
|
||||
void (*truncate) (struct inode *);
|
||||
@@ -1672,10 +1679,10 @@ struct super_operations {
|
||||
int (*remount_fs) (struct super_block *, int *, char *);
|
||||
void (*umount_begin) (struct super_block *);
|
||||
|
||||
int (*show_options)(struct seq_file *, struct vfsmount *);
|
||||
int (*show_devname)(struct seq_file *, struct vfsmount *);
|
||||
int (*show_path)(struct seq_file *, struct vfsmount *);
|
||||
int (*show_stats)(struct seq_file *, struct vfsmount *);
|
||||
int (*show_options)(struct seq_file *, struct dentry *);
|
||||
int (*show_devname)(struct seq_file *, struct dentry *);
|
||||
int (*show_path)(struct seq_file *, struct dentry *);
|
||||
int (*show_stats)(struct seq_file *, struct dentry *);
|
||||
#ifdef CONFIG_QUOTA
|
||||
ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
|
||||
ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
|
||||
@@ -1764,31 +1771,10 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
|
||||
__mark_inode_dirty(inode, I_DIRTY_SYNC);
|
||||
}
|
||||
|
||||
/**
|
||||
* set_nlink - directly set an inode's link count
|
||||
* @inode: inode
|
||||
* @nlink: new nlink (should be non-zero)
|
||||
*
|
||||
* This is a low-level filesystem helper to replace any
|
||||
* direct filesystem manipulation of i_nlink.
|
||||
*/
|
||||
static inline void set_nlink(struct inode *inode, unsigned int nlink)
|
||||
{
|
||||
inode->__i_nlink = nlink;
|
||||
}
|
||||
|
||||
/**
|
||||
* inc_nlink - directly increment an inode's link count
|
||||
* @inode: inode
|
||||
*
|
||||
* This is a low-level filesystem helper to replace any
|
||||
* direct filesystem manipulation of i_nlink. Currently,
|
||||
* it is only here for parity with dec_nlink().
|
||||
*/
|
||||
static inline void inc_nlink(struct inode *inode)
|
||||
{
|
||||
inode->__i_nlink++;
|
||||
}
|
||||
extern void inc_nlink(struct inode *inode);
|
||||
extern void drop_nlink(struct inode *inode);
|
||||
extern void clear_nlink(struct inode *inode);
|
||||
extern void set_nlink(struct inode *inode, unsigned int nlink);
|
||||
|
||||
static inline void inode_inc_link_count(struct inode *inode)
|
||||
{
|
||||
@@ -1796,35 +1782,6 @@ static inline void inode_inc_link_count(struct inode *inode)
|
||||
mark_inode_dirty(inode);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop_nlink - directly drop an inode's link count
|
||||
* @inode: inode
|
||||
*
|
||||
* This is a low-level filesystem helper to replace any
|
||||
* direct filesystem manipulation of i_nlink. In cases
|
||||
* where we are attempting to track writes to the
|
||||
* filesystem, a decrement to zero means an imminent
|
||||
* write when the file is truncated and actually unlinked
|
||||
* on the filesystem.
|
||||
*/
|
||||
static inline void drop_nlink(struct inode *inode)
|
||||
{
|
||||
inode->__i_nlink--;
|
||||
}
|
||||
|
||||
/**
|
||||
* clear_nlink - directly zero an inode's link count
|
||||
* @inode: inode
|
||||
*
|
||||
* This is a low-level filesystem helper to replace any
|
||||
* direct filesystem manipulation of i_nlink. See
|
||||
* drop_nlink() for why we care about i_nlink hitting zero.
|
||||
*/
|
||||
static inline void clear_nlink(struct inode *inode)
|
||||
{
|
||||
inode->__i_nlink = 0;
|
||||
}
|
||||
|
||||
static inline void inode_dec_link_count(struct inode *inode)
|
||||
{
|
||||
drop_nlink(inode);
|
||||
@@ -1864,7 +1821,7 @@ struct file_system_type {
|
||||
void (*kill_sb) (struct super_block *);
|
||||
struct module *owner;
|
||||
struct file_system_type * next;
|
||||
struct list_head fs_supers;
|
||||
struct hlist_head fs_supers;
|
||||
|
||||
struct lock_class_key s_lock_key;
|
||||
struct lock_class_key s_umount_key;
|
||||
@@ -1939,9 +1896,10 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
|
||||
extern int vfs_statfs(struct path *, struct kstatfs *);
|
||||
extern int user_statfs(const char __user *, struct kstatfs *);
|
||||
extern int fd_statfs(int, struct kstatfs *);
|
||||
extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
|
||||
extern int vfs_ustat(dev_t, struct kstatfs *);
|
||||
extern int freeze_super(struct super_block *super);
|
||||
extern int thaw_super(struct super_block *super);
|
||||
extern bool our_mnt(struct vfsmount *mnt);
|
||||
|
||||
extern int current_umask(void);
|
||||
|
||||
@@ -2053,8 +2011,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
|
||||
extern int do_fallocate(struct file *file, int mode, loff_t offset,
|
||||
loff_t len);
|
||||
extern long do_sys_open(int dfd, const char __user *filename, int flags,
|
||||
int mode);
|
||||
extern struct file *filp_open(const char *, int, int);
|
||||
umode_t mode);
|
||||
extern struct file *filp_open(const char *, int, umode_t);
|
||||
extern struct file *file_open_root(struct dentry *, struct vfsmount *,
|
||||
const char *, int);
|
||||
extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
|
||||
@@ -2091,6 +2049,7 @@ extern void bd_forget(struct inode *inode);
|
||||
extern void bdput(struct block_device *);
|
||||
extern void invalidate_bdev(struct block_device *);
|
||||
extern int sync_blockdev(struct block_device *bdev);
|
||||
extern void kill_bdev(struct block_device *);
|
||||
extern struct super_block *freeze_bdev(struct block_device *);
|
||||
extern void emergency_thaw_all(void);
|
||||
extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
|
||||
@@ -2098,6 +2057,7 @@ extern int fsync_bdev(struct block_device *);
|
||||
#else
|
||||
static inline void bd_forget(struct inode *inode) {}
|
||||
static inline int sync_blockdev(struct block_device *bdev) { return 0; }
|
||||
static inline void kill_bdev(struct block_device *bdev) {}
|
||||
static inline void invalidate_bdev(struct block_device *bdev) {}
|
||||
|
||||
static inline struct super_block *freeze_bdev(struct block_device *sb)
|
||||
@@ -2190,8 +2150,6 @@ extern const struct file_operations read_pipefifo_fops;
|
||||
extern const struct file_operations write_pipefifo_fops;
|
||||
extern const struct file_operations rdwr_pipefifo_fops;
|
||||
|
||||
extern int fs_may_remount_ro(struct super_block *);
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
/*
|
||||
* return READ, READA, or WRITE
|
||||
@@ -2414,6 +2372,7 @@ extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos);
|
||||
extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
|
||||
int datasync);
|
||||
extern void block_sync_page(struct page *page);
|
||||
|
||||
/* fs/splice.c */
|
||||
extern ssize_t generic_file_splice_read(struct file *, loff_t *,
|
||||
@@ -2530,7 +2489,6 @@ extern void put_filesystem(struct file_system_type *fs);
|
||||
extern struct file_system_type *get_fs_type(const char *name);
|
||||
extern struct super_block *get_super(struct block_device *);
|
||||
extern struct super_block *get_active_super(struct block_device *bdev);
|
||||
extern struct super_block *user_get_super(dev_t);
|
||||
extern void drop_super(struct super_block *sb);
|
||||
extern void iterate_supers(void (*)(struct super_block *, void *), void *);
|
||||
extern void iterate_supers_type(struct file_system_type *,
|
||||
@@ -2589,7 +2547,7 @@ extern void setattr_copy(struct inode *inode, const struct iattr *attr);
|
||||
|
||||
extern void file_update_time(struct file *file);
|
||||
|
||||
extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt);
|
||||
extern int generic_show_options(struct seq_file *m, struct dentry *root);
|
||||
extern void save_mount_options(struct super_block *sb, char *options);
|
||||
extern void replace_mount_options(struct super_block *sb, char *options);
|
||||
|
||||
@@ -2690,7 +2648,7 @@ int __init get_filesystem_list(char *buf);
|
||||
#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
|
||||
(flag & __FMODE_NONOTIFY)))
|
||||
|
||||
static inline int is_sxid(mode_t mode)
|
||||
static inline int is_sxid(umode_t mode)
|
||||
{
|
||||
return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
|
||||
}
|
||||
|
@@ -172,6 +172,7 @@ enum {
|
||||
TRACE_EVENT_FL_FILTERED_BIT,
|
||||
TRACE_EVENT_FL_RECORDED_CMD_BIT,
|
||||
TRACE_EVENT_FL_CAP_ANY_BIT,
|
||||
TRACE_EVENT_FL_NO_SET_FILTER_BIT,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -179,6 +180,7 @@ enum {
|
||||
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
|
||||
TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
|
||||
TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
|
||||
TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
|
||||
};
|
||||
|
||||
struct ftrace_event_call {
|
||||
|
@@ -85,6 +85,30 @@ enum {
|
||||
/* All generic netlink requests are serialized by a global lock. */
|
||||
extern void genl_lock(void);
|
||||
extern void genl_unlock(void);
|
||||
#ifdef CONFIG_PROVE_LOCKING
|
||||
extern int lockdep_genl_is_held(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* rcu_dereference_genl - rcu_dereference with debug checking
|
||||
* @p: The pointer to read, prior to dereferencing
|
||||
*
|
||||
* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
|
||||
* or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
|
||||
*/
|
||||
#define rcu_dereference_genl(p) \
|
||||
rcu_dereference_check(p, lockdep_genl_is_held())
|
||||
|
||||
/**
|
||||
* genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
|
||||
* @p: The pointer to read, prior to dereferencing
|
||||
*
|
||||
* Return the value of the specified RCU-protected pointer, but omit
|
||||
* both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
|
||||
* caller holds genl mutex.
|
||||
*/
|
||||
#define genl_dereference(p) \
|
||||
rcu_dereference_protected(p, lockdep_genl_is_held())
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
@@ -163,7 +163,7 @@ struct gendisk {
|
||||
* disks that can't be partitioned. */
|
||||
|
||||
char disk_name[DISK_NAME_LEN]; /* name of major driver */
|
||||
char *(*devnode)(struct gendisk *gd, mode_t *mode);
|
||||
char *(*devnode)(struct gendisk *gd, umode_t *mode);
|
||||
|
||||
unsigned int events; /* supported events */
|
||||
unsigned int async_events; /* async events, subset of all */
|
||||
|
@@ -139,20 +139,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
|
||||
extern void account_system_vtime(struct task_struct *tsk);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NO_HZ)
|
||||
#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
|
||||
extern void rcu_enter_nohz(void);
|
||||
extern void rcu_exit_nohz(void);
|
||||
|
||||
static inline void rcu_irq_enter(void)
|
||||
{
|
||||
rcu_exit_nohz();
|
||||
}
|
||||
|
||||
static inline void rcu_irq_exit(void)
|
||||
{
|
||||
rcu_enter_nohz();
|
||||
}
|
||||
|
||||
static inline void rcu_nmi_enter(void)
|
||||
{
|
||||
@@ -163,17 +150,9 @@ static inline void rcu_nmi_exit(void)
|
||||
}
|
||||
|
||||
#else
|
||||
extern void rcu_irq_enter(void);
|
||||
extern void rcu_irq_exit(void);
|
||||
extern void rcu_nmi_enter(void);
|
||||
extern void rcu_nmi_exit(void);
|
||||
#endif
|
||||
#else
|
||||
# define rcu_irq_enter() do { } while (0)
|
||||
# define rcu_irq_exit() do { } while (0)
|
||||
# define rcu_nmi_enter() do { } while (0)
|
||||
# define rcu_nmi_exit() do { } while (0)
|
||||
#endif /* #if defined(CONFIG_NO_HZ) */
|
||||
|
||||
/*
|
||||
* It is safe to do non-atomic ops on ->hardirq_context,
|
||||
|
@@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
|
||||
{
|
||||
return adap->nr;
|
||||
}
|
||||
|
||||
/**
|
||||
* module_i2c_driver() - Helper macro for registering a I2C driver
|
||||
* @__i2c_driver: i2c_driver struct
|
||||
*
|
||||
* Helper macro for I2C drivers which do not do anything special in module
|
||||
* init/exit. This eliminates a lot of boilerplate. Each module may only
|
||||
* use this macro once, and calling it replaces module_init() and module_exit()
|
||||
*/
|
||||
#define module_i2c_driver(__i2c_driver) \
|
||||
module_driver(__i2c_driver, i2c_add_driver, \
|
||||
i2c_del_driver)
|
||||
|
||||
#endif /* I2C */
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
|
@@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
mode_t mode;
|
||||
umode_t mode;
|
||||
const struct file_operations *proc_fops;
|
||||
} ide_proc_entry_t;
|
||||
|
||||
|
@@ -128,6 +128,7 @@
|
||||
#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
|
||||
#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
|
||||
#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
|
||||
#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
|
||||
/* A-MSDU 802.11n */
|
||||
#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
|
||||
/* Mesh Control 802.11s */
|
||||
@@ -543,6 +544,15 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
|
||||
cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
|
||||
* @seq_ctrl: frame sequence control bytes in little-endian byteorder
|
||||
*/
|
||||
static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
|
||||
{
|
||||
return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
|
||||
}
|
||||
|
||||
struct ieee80211s_hdr {
|
||||
u8 flags;
|
||||
u8 ttl;
|
||||
@@ -770,6 +780,9 @@ struct ieee80211_mgmt {
|
||||
} u;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
|
||||
#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
|
||||
|
||||
/* mgmt header + 1 byte category code */
|
||||
#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
|
||||
|
||||
@@ -1552,6 +1565,8 @@ enum ieee80211_sa_query_action {
|
||||
#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
|
||||
#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
|
||||
|
||||
#define WLAN_CIPHER_SUITE_SMS4 0x00147201
|
||||
|
||||
/* AKM suite selectors */
|
||||
#define WLAN_AKM_SUITE_8021X 0x000FAC01
|
||||
#define WLAN_AKM_SUITE_PSK 0x000FAC02
|
||||
@@ -1688,6 +1703,23 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_is_public_action - check if frame is a public action frame
|
||||
* @hdr: the frame
|
||||
* @len: length of the frame
|
||||
*/
|
||||
static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
|
||||
size_t len)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt = (void *)hdr;
|
||||
|
||||
if (len < IEEE80211_MIN_ACTION_SIZE)
|
||||
return false;
|
||||
if (!ieee80211_is_action(hdr->frame_control))
|
||||
return false;
|
||||
return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee80211_fhss_chan_to_freq - get channel frequency
|
||||
* @channel: the FHSS channel
|
||||
|
@@ -79,6 +79,7 @@
|
||||
#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
|
||||
* skbs on transmit */
|
||||
#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
|
||||
#define IFF_TEAM_PORT 0x40000 /* device used as team port */
|
||||
|
||||
#define IF_GET_IFACE 0x0001 /* for querying only */
|
||||
#define IF_GET_PROTO 0x0002
|
||||
|
@@ -79,6 +79,7 @@
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
|
||||
#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
|
||||
#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
|
||||
#define ETH_P_TIPC 0x88CA /* TIPC */
|
||||
#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
|
||||
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
|
||||
|
242
include/linux/if_team.h
Normal file
242
include/linux/if_team.h
Normal file
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* include/linux/if_team.h - Network team device driver header
|
||||
* Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_IF_TEAM_H_
|
||||
#define _LINUX_IF_TEAM_H_
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct team_pcpu_stats {
|
||||
u64 rx_packets;
|
||||
u64 rx_bytes;
|
||||
u64 rx_multicast;
|
||||
u64 tx_packets;
|
||||
u64 tx_bytes;
|
||||
struct u64_stats_sync syncp;
|
||||
u32 rx_dropped;
|
||||
u32 tx_dropped;
|
||||
};
|
||||
|
||||
struct team;
|
||||
|
||||
struct team_port {
|
||||
struct net_device *dev;
|
||||
struct hlist_node hlist; /* node in hash list */
|
||||
struct list_head list; /* node in ordinary list */
|
||||
struct team *team;
|
||||
int index;
|
||||
|
||||
/*
|
||||
* A place for storing original values of the device before it
|
||||
* become a port.
|
||||
*/
|
||||
struct {
|
||||
unsigned char dev_addr[MAX_ADDR_LEN];
|
||||
unsigned int mtu;
|
||||
} orig;
|
||||
|
||||
bool linkup;
|
||||
u32 speed;
|
||||
u8 duplex;
|
||||
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
struct team_mode_ops {
|
||||
int (*init)(struct team *team);
|
||||
void (*exit)(struct team *team);
|
||||
rx_handler_result_t (*receive)(struct team *team,
|
||||
struct team_port *port,
|
||||
struct sk_buff *skb);
|
||||
bool (*transmit)(struct team *team, struct sk_buff *skb);
|
||||
int (*port_enter)(struct team *team, struct team_port *port);
|
||||
void (*port_leave)(struct team *team, struct team_port *port);
|
||||
void (*port_change_mac)(struct team *team, struct team_port *port);
|
||||
};
|
||||
|
||||
enum team_option_type {
|
||||
TEAM_OPTION_TYPE_U32,
|
||||
TEAM_OPTION_TYPE_STRING,
|
||||
};
|
||||
|
||||
struct team_option {
|
||||
struct list_head list;
|
||||
const char *name;
|
||||
enum team_option_type type;
|
||||
int (*getter)(struct team *team, void *arg);
|
||||
int (*setter)(struct team *team, void *arg);
|
||||
};
|
||||
|
||||
struct team_mode {
|
||||
struct list_head list;
|
||||
const char *kind;
|
||||
struct module *owner;
|
||||
size_t priv_size;
|
||||
const struct team_mode_ops *ops;
|
||||
};
|
||||
|
||||
#define TEAM_PORT_HASHBITS 4
|
||||
#define TEAM_PORT_HASHENTRIES (1 << TEAM_PORT_HASHBITS)
|
||||
|
||||
#define TEAM_MODE_PRIV_LONGS 4
|
||||
#define TEAM_MODE_PRIV_SIZE (sizeof(long) * TEAM_MODE_PRIV_LONGS)
|
||||
|
||||
struct team {
|
||||
struct net_device *dev; /* associated netdevice */
|
||||
struct team_pcpu_stats __percpu *pcpu_stats;
|
||||
|
||||
struct mutex lock; /* used for overall locking, e.g. port lists write */
|
||||
|
||||
/*
|
||||
* port lists with port count
|
||||
*/
|
||||
int port_count;
|
||||
struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES];
|
||||
struct list_head port_list;
|
||||
|
||||
struct list_head option_list;
|
||||
|
||||
const struct team_mode *mode;
|
||||
struct team_mode_ops ops;
|
||||
long mode_priv[TEAM_MODE_PRIV_LONGS];
|
||||
};
|
||||
|
||||
static inline struct hlist_head *team_port_index_hash(struct team *team,
|
||||
int port_index)
|
||||
{
|
||||
return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
|
||||
}
|
||||
|
||||
static inline struct team_port *team_get_port_by_index(struct team *team,
|
||||
int port_index)
|
||||
{
|
||||
struct hlist_node *p;
|
||||
struct team_port *port;
|
||||
struct hlist_head *head = team_port_index_hash(team, port_index);
|
||||
|
||||
hlist_for_each_entry(port, p, head, hlist)
|
||||
if (port->index == port_index)
|
||||
return port;
|
||||
return NULL;
|
||||
}
|
||||
static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
|
||||
int port_index)
|
||||
{
|
||||
struct hlist_node *p;
|
||||
struct team_port *port;
|
||||
struct hlist_head *head = team_port_index_hash(team, port_index);
|
||||
|
||||
hlist_for_each_entry_rcu(port, p, head, hlist)
|
||||
if (port->index == port_index)
|
||||
return port;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern int team_port_set_team_mac(struct team_port *port);
|
||||
extern int team_options_register(struct team *team,
|
||||
const struct team_option *option,
|
||||
size_t option_count);
|
||||
extern void team_options_unregister(struct team *team,
|
||||
const struct team_option *option,
|
||||
size_t option_count);
|
||||
extern int team_mode_register(struct team_mode *mode);
|
||||
extern int team_mode_unregister(struct team_mode *mode);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#define TEAM_STRING_MAX_LEN 32
|
||||
|
||||
/**********************************
|
||||
* NETLINK_GENERIC netlink family.
|
||||
**********************************/
|
||||
|
||||
enum {
|
||||
TEAM_CMD_NOOP,
|
||||
TEAM_CMD_OPTIONS_SET,
|
||||
TEAM_CMD_OPTIONS_GET,
|
||||
TEAM_CMD_PORT_LIST_GET,
|
||||
|
||||
__TEAM_CMD_MAX,
|
||||
TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
|
||||
};
|
||||
|
||||
enum {
|
||||
TEAM_ATTR_UNSPEC,
|
||||
TEAM_ATTR_TEAM_IFINDEX, /* u32 */
|
||||
TEAM_ATTR_LIST_OPTION, /* nest */
|
||||
TEAM_ATTR_LIST_PORT, /* nest */
|
||||
|
||||
__TEAM_ATTR_MAX,
|
||||
TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
|
||||
};
|
||||
|
||||
/* Nested layout of get/set msg:
|
||||
*
|
||||
* [TEAM_ATTR_LIST_OPTION]
|
||||
* [TEAM_ATTR_ITEM_OPTION]
|
||||
* [TEAM_ATTR_OPTION_*], ...
|
||||
* [TEAM_ATTR_ITEM_OPTION]
|
||||
* [TEAM_ATTR_OPTION_*], ...
|
||||
* ...
|
||||
* [TEAM_ATTR_LIST_PORT]
|
||||
* [TEAM_ATTR_ITEM_PORT]
|
||||
* [TEAM_ATTR_PORT_*], ...
|
||||
* [TEAM_ATTR_ITEM_PORT]
|
||||
* [TEAM_ATTR_PORT_*], ...
|
||||
* ...
|
||||
*/
|
||||
|
||||
enum {
|
||||
TEAM_ATTR_ITEM_OPTION_UNSPEC,
|
||||
TEAM_ATTR_ITEM_OPTION, /* nest */
|
||||
|
||||
__TEAM_ATTR_ITEM_OPTION_MAX,
|
||||
TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
TEAM_ATTR_OPTION_UNSPEC,
|
||||
TEAM_ATTR_OPTION_NAME, /* string */
|
||||
TEAM_ATTR_OPTION_CHANGED, /* flag */
|
||||
TEAM_ATTR_OPTION_TYPE, /* u8 */
|
||||
TEAM_ATTR_OPTION_DATA, /* dynamic */
|
||||
|
||||
__TEAM_ATTR_OPTION_MAX,
|
||||
TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
TEAM_ATTR_ITEM_PORT_UNSPEC,
|
||||
TEAM_ATTR_ITEM_PORT, /* nest */
|
||||
|
||||
__TEAM_ATTR_ITEM_PORT_MAX,
|
||||
TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
TEAM_ATTR_PORT_UNSPEC,
|
||||
TEAM_ATTR_PORT_IFINDEX, /* u32 */
|
||||
TEAM_ATTR_PORT_CHANGED, /* flag */
|
||||
TEAM_ATTR_PORT_LINKUP, /* flag */
|
||||
TEAM_ATTR_PORT_SPEED, /* u32 */
|
||||
TEAM_ATTR_PORT_DUPLEX, /* u8 */
|
||||
|
||||
__TEAM_ATTR_PORT_MAX,
|
||||
TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
|
||||
};
|
||||
|
||||
/*
|
||||
* NETLINK_GENERIC related info
|
||||
*/
|
||||
#define TEAM_GENL_NAME "team"
|
||||
#define TEAM_GENL_VERSION 0x1
|
||||
#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
|
||||
|
||||
#endif /* _LINUX_IF_TEAM_H_ */
|
@@ -74,22 +74,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
|
||||
/* found in socket.c */
|
||||
extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
|
||||
|
||||
/* if this changes, algorithm will have to be reworked because this
|
||||
* depends on completely exhausting the VLAN identifier space. Thus
|
||||
* it gives constant time look-up, but in many cases it wastes memory.
|
||||
*/
|
||||
#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
|
||||
#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS)
|
||||
|
||||
struct vlan_group {
|
||||
struct net_device *real_dev; /* The ethernet(like) device
|
||||
* the vlan is attached to.
|
||||
*/
|
||||
unsigned int nr_vlans;
|
||||
struct hlist_node hlist; /* linked list */
|
||||
struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
struct vlan_info;
|
||||
|
||||
static inline int is_vlan_dev(struct net_device *dev)
|
||||
{
|
||||
@@ -109,6 +94,13 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
|
||||
extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
|
||||
extern struct sk_buff *vlan_untag(struct sk_buff *skb);
|
||||
|
||||
extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
|
||||
extern void vlan_vid_del(struct net_device *dev, unsigned short vid);
|
||||
|
||||
extern int vlan_vids_add_by_dev(struct net_device *dev,
|
||||
const struct net_device *by_dev);
|
||||
extern void vlan_vids_del_by_dev(struct net_device *dev,
|
||||
const struct net_device *by_dev);
|
||||
#else
|
||||
static inline struct net_device *
|
||||
__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
|
||||
@@ -139,6 +131,26 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
|
||||
{
|
||||
return skb;
|
||||
}
|
||||
|
||||
static inline int vlan_vid_add(struct net_device *dev, unsigned short vid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void vlan_vid_del(struct net_device *dev, unsigned short vid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int vlan_vids_add_by_dev(struct net_device *dev,
|
||||
const struct net_device *by_dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void vlan_vids_del_by_dev(struct net_device *dev,
|
||||
const struct net_device *by_dev)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -310,6 +322,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
||||
static inline void vlan_set_encap_proto(struct sk_buff *skb,
|
||||
struct vlan_hdr *vhdr)
|
||||
{
|
||||
__be16 proto;
|
||||
unsigned char *rawp;
|
||||
|
||||
/*
|
||||
* Was a VLAN packet, grab the encapsulated protocol, which the layer
|
||||
* three protocols care about.
|
||||
*/
|
||||
|
||||
proto = vhdr->h_vlan_encapsulated_proto;
|
||||
if (ntohs(proto) >= 1536) {
|
||||
skb->protocol = proto;
|
||||
return;
|
||||
}
|
||||
|
||||
rawp = skb->data;
|
||||
if (*(unsigned short *) rawp == 0xFFFF)
|
||||
/*
|
||||
* This is a magic hack to spot IPX packets. Older Novell
|
||||
* breaks the protocol design and runs IPX over 802.3 without
|
||||
* an 802.2 LLC layer. We look for FFFF which isn't a used
|
||||
* 802.2 SSAP/DSAP. This won't work for fault tolerant netware
|
||||
* but does for the rest.
|
||||
*/
|
||||
skb->protocol = htons(ETH_P_802_3);
|
||||
else
|
||||
/*
|
||||
* Real 802.2 LLC
|
||||
*/
|
||||
skb->protocol = htons(ETH_P_802_2);
|
||||
}
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/* VLAN IOCTLs are found in sockios.h */
|
||||
@@ -352,7 +398,7 @@ struct vlan_ioctl_args {
|
||||
unsigned int skb_priority;
|
||||
unsigned int name_type;
|
||||
unsigned int bind_type;
|
||||
unsigned int flag; /* Matches vlan_dev_info flags */
|
||||
unsigned int flag; /* Matches vlan_dev_priv flags */
|
||||
} u;
|
||||
|
||||
short vlan_qos;
|
||||
|
@@ -22,7 +22,7 @@ struct inet_diag_sockid {
|
||||
|
||||
/* Request structure */
|
||||
|
||||
struct inet_diag_req {
|
||||
struct inet_diag_req_compat {
|
||||
__u8 idiag_family; /* Family of addresses. */
|
||||
__u8 idiag_src_len;
|
||||
__u8 idiag_dst_len;
|
||||
@@ -34,6 +34,15 @@ struct inet_diag_req {
|
||||
__u32 idiag_dbs; /* Tables to dump (NI) */
|
||||
};
|
||||
|
||||
struct inet_diag_req {
|
||||
__u8 sdiag_family;
|
||||
__u8 sdiag_protocol;
|
||||
__u8 idiag_ext;
|
||||
__u8 pad;
|
||||
__u32 idiag_states;
|
||||
struct inet_diag_sockid id;
|
||||
};
|
||||
|
||||
enum {
|
||||
INET_DIAG_REQ_NONE,
|
||||
INET_DIAG_REQ_BYTECODE,
|
||||
@@ -99,9 +108,10 @@ enum {
|
||||
INET_DIAG_CONG,
|
||||
INET_DIAG_TOS,
|
||||
INET_DIAG_TCLASS,
|
||||
INET_DIAG_SKMEMINFO,
|
||||
};
|
||||
|
||||
#define INET_DIAG_MAX INET_DIAG_TCLASS
|
||||
#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
|
||||
|
||||
|
||||
/* INET_DIAG_MEM */
|
||||
@@ -125,16 +135,41 @@ struct tcpvegas_info {
|
||||
#ifdef __KERNEL__
|
||||
struct sock;
|
||||
struct inet_hashinfo;
|
||||
struct nlattr;
|
||||
struct nlmsghdr;
|
||||
struct sk_buff;
|
||||
struct netlink_callback;
|
||||
|
||||
struct inet_diag_handler {
|
||||
struct inet_hashinfo *idiag_hashinfo;
|
||||
void (*dump)(struct sk_buff *skb,
|
||||
struct netlink_callback *cb,
|
||||
struct inet_diag_req *r,
|
||||
struct nlattr *bc);
|
||||
|
||||
int (*dump_one)(struct sk_buff *in_skb,
|
||||
const struct nlmsghdr *nlh,
|
||||
struct inet_diag_req *req);
|
||||
|
||||
void (*idiag_get_info)(struct sock *sk,
|
||||
struct inet_diag_msg *r,
|
||||
void *info);
|
||||
__u16 idiag_info_size;
|
||||
__u16 idiag_type;
|
||||
};
|
||||
|
||||
struct inet_connection_sock;
|
||||
int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
|
||||
struct sk_buff *skb, struct inet_diag_req *req,
|
||||
u32 pid, u32 seq, u16 nlmsg_flags,
|
||||
const struct nlmsghdr *unlh);
|
||||
void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
|
||||
struct netlink_callback *cb, struct inet_diag_req *r,
|
||||
struct nlattr *bc);
|
||||
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
|
||||
struct sk_buff *in_skb, const struct nlmsghdr *nlh,
|
||||
struct inet_diag_req *req);
|
||||
|
||||
int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
|
||||
|
||||
extern int inet_diag_register(const struct inet_diag_handler *handler);
|
||||
extern void inet_diag_unregister(const struct inet_diag_handler *handler);
|
||||
#endif /* __KERNEL__ */
|
||||
|
@@ -126,6 +126,8 @@ extern struct cred init_cred;
|
||||
# define INIT_PERF_EVENTS(tsk)
|
||||
#endif
|
||||
|
||||
#define INIT_TASK_COMM "swapper"
|
||||
|
||||
/*
|
||||
* INIT_TASK is used to set up the first task table, touch at
|
||||
* your own risk!. Base=0, limit=0x1fffff (=2MB)
|
||||
@@ -162,7 +164,7 @@ extern struct cred init_cred;
|
||||
.group_leader = &tsk, \
|
||||
RCU_INIT_POINTER(.real_cred, &init_cred), \
|
||||
RCU_INIT_POINTER(.cred, &init_cred), \
|
||||
.comm = "swapper", \
|
||||
.comm = INIT_TASK_COMM, \
|
||||
.thread = INIT_THREAD, \
|
||||
.fs = &init_fs, \
|
||||
.files = &init_files, \
|
||||
|
@@ -93,7 +93,7 @@ struct kern_ipc_perm
|
||||
gid_t gid;
|
||||
uid_t cuid;
|
||||
gid_t cgid;
|
||||
mode_t mode;
|
||||
umode_t mode;
|
||||
unsigned long seq;
|
||||
void *security;
|
||||
};
|
||||
|
@@ -404,7 +404,7 @@ struct tcp6_sock {
|
||||
|
||||
extern int inet6_sk_rebuild_header(struct sock *sk);
|
||||
|
||||
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
|
||||
{
|
||||
return inet_sk(__sk)->pinet6;
|
||||
@@ -515,7 +515,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
|
||||
#define inet6_rcv_saddr(__sk) NULL
|
||||
#define tcp_twsk_ipv6only(__sk) 0
|
||||
#define inet_v6_ipv6only(__sk) 0
|
||||
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
|
||||
#endif /* IS_ENABLED(CONFIG_IPV6) */
|
||||
|
||||
#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
|
@@ -91,10 +91,11 @@ static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
|
||||
|
||||
extern void irq_domain_add(struct irq_domain *domain);
|
||||
extern void irq_domain_del(struct irq_domain *domain);
|
||||
|
||||
extern struct irq_domain_ops irq_domain_simple_ops;
|
||||
#endif /* CONFIG_IRQ_DOMAIN */
|
||||
|
||||
#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
|
||||
extern struct irq_domain_ops irq_domain_simple_ops;
|
||||
extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
|
||||
extern void irq_domain_generate_simple(const struct of_device_id *match,
|
||||
u64 phys_base, unsigned int irq_start);
|
||||
|
@@ -91,7 +91,7 @@ struct iscsi_boot_kobj {
|
||||
* The enum of the type. This can be any value of the above
|
||||
* properties.
|
||||
*/
|
||||
mode_t (*is_visible) (void *data, int type);
|
||||
umode_t (*is_visible) (void *data, int type);
|
||||
|
||||
/*
|
||||
* Driver specific release function.
|
||||
@@ -110,20 +110,20 @@ struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
umode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
|
||||
struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
umode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
umode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
|
||||
struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
|
||||
|
||||
@@ -14,6 +15,12 @@ struct jump_label_key {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct jump_label_key_deferred {
|
||||
struct jump_label_key key;
|
||||
unsigned long timeout;
|
||||
struct delayed_work work;
|
||||
};
|
||||
|
||||
# include <asm/jump_label.h>
|
||||
# define HAVE_JUMP_LABEL
|
||||
#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
|
||||
@@ -51,8 +58,11 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
|
||||
extern int jump_label_text_reserved(void *start, void *end);
|
||||
extern void jump_label_inc(struct jump_label_key *key);
|
||||
extern void jump_label_dec(struct jump_label_key *key);
|
||||
extern void jump_label_dec_deferred(struct jump_label_key_deferred *key);
|
||||
extern bool jump_label_enabled(struct jump_label_key *key);
|
||||
extern void jump_label_apply_nops(struct module *mod);
|
||||
extern void jump_label_rate_limit(struct jump_label_key_deferred *key,
|
||||
unsigned long rl);
|
||||
|
||||
#else /* !HAVE_JUMP_LABEL */
|
||||
|
||||
@@ -68,6 +78,10 @@ static __always_inline void jump_label_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
struct jump_label_key_deferred {
|
||||
struct jump_label_key key;
|
||||
};
|
||||
|
||||
static __always_inline bool static_branch(struct jump_label_key *key)
|
||||
{
|
||||
if (unlikely(atomic_read(&key->enabled)))
|
||||
@@ -85,6 +99,11 @@ static inline void jump_label_dec(struct jump_label_key *key)
|
||||
atomic_dec(&key->enabled);
|
||||
}
|
||||
|
||||
static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key)
|
||||
{
|
||||
jump_label_dec(&key->key);
|
||||
}
|
||||
|
||||
static inline int jump_label_text_reserved(void *start, void *end)
|
||||
{
|
||||
return 0;
|
||||
@@ -102,6 +121,14 @@ static inline int jump_label_apply_nops(struct module *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void jump_label_rate_limit(struct jump_label_key_deferred *key,
|
||||
unsigned long rl)
|
||||
{
|
||||
}
|
||||
#endif /* HAVE_JUMP_LABEL */
|
||||
|
||||
#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), })
|
||||
#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), })
|
||||
|
||||
#endif /* _LINUX_JUMP_LABEL_H */
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sched.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/cputime.h>
|
||||
|
||||
@@ -15,21 +16,25 @@
|
||||
* used by rstatd/perfmeter
|
||||
*/
|
||||
|
||||
struct cpu_usage_stat {
|
||||
cputime64_t user;
|
||||
cputime64_t nice;
|
||||
cputime64_t system;
|
||||
cputime64_t softirq;
|
||||
cputime64_t irq;
|
||||
cputime64_t idle;
|
||||
cputime64_t iowait;
|
||||
cputime64_t steal;
|
||||
cputime64_t guest;
|
||||
cputime64_t guest_nice;
|
||||
enum cpu_usage_stat {
|
||||
CPUTIME_USER,
|
||||
CPUTIME_NICE,
|
||||
CPUTIME_SYSTEM,
|
||||
CPUTIME_SOFTIRQ,
|
||||
CPUTIME_IRQ,
|
||||
CPUTIME_IDLE,
|
||||
CPUTIME_IOWAIT,
|
||||
CPUTIME_STEAL,
|
||||
CPUTIME_GUEST,
|
||||
CPUTIME_GUEST_NICE,
|
||||
NR_STATS,
|
||||
};
|
||||
|
||||
struct kernel_cpustat {
|
||||
u64 cpustat[NR_STATS];
|
||||
};
|
||||
|
||||
struct kernel_stat {
|
||||
struct cpu_usage_stat cpustat;
|
||||
#ifndef CONFIG_GENERIC_HARDIRQS
|
||||
unsigned int irqs[NR_IRQS];
|
||||
#endif
|
||||
@@ -38,10 +43,13 @@ struct kernel_stat {
|
||||
};
|
||||
|
||||
DECLARE_PER_CPU(struct kernel_stat, kstat);
|
||||
DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
|
||||
|
||||
#define kstat_cpu(cpu) per_cpu(kstat, cpu)
|
||||
/* Must have preemption disabled for this to be meaningful. */
|
||||
#define kstat_this_cpu __get_cpu_var(kstat)
|
||||
#define kstat_this_cpu (&__get_cpu_var(kstat))
|
||||
#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat))
|
||||
#define kstat_cpu(cpu) per_cpu(kstat, cpu)
|
||||
#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
|
||||
|
||||
extern unsigned long long nr_context_switches(void);
|
||||
|
||||
|
@@ -117,5 +117,7 @@ extern void usermodehelper_init(void);
|
||||
extern int usermodehelper_disable(void);
|
||||
extern void usermodehelper_enable(void);
|
||||
extern bool usermodehelper_is_disabled(void);
|
||||
extern void read_lock_usermodehelper(void);
|
||||
extern void read_unlock_usermodehelper(void);
|
||||
|
||||
#endif /* __LINUX_KMOD_H__ */
|
||||
|
@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
|
||||
}
|
||||
|
||||
extern struct kobject *kset_find_obj(struct kset *, const char *);
|
||||
extern struct kobject *kset_find_obj_hinted(struct kset *, const char *,
|
||||
struct kobject *);
|
||||
|
||||
/* The global /sys/kernel/ kobject for people to chain off of */
|
||||
extern struct kobject *kernel_kobj;
|
||||
|
@@ -15,16 +15,81 @@
|
||||
#ifndef _KREF_H_
|
||||
#define _KREF_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
struct kref {
|
||||
atomic_t refcount;
|
||||
};
|
||||
|
||||
void kref_init(struct kref *kref);
|
||||
void kref_get(struct kref *kref);
|
||||
int kref_put(struct kref *kref, void (*release) (struct kref *kref));
|
||||
int kref_sub(struct kref *kref, unsigned int count,
|
||||
void (*release) (struct kref *kref));
|
||||
/**
|
||||
* kref_init - initialize object.
|
||||
* @kref: object in question.
|
||||
*/
|
||||
static inline void kref_init(struct kref *kref)
|
||||
{
|
||||
atomic_set(&kref->refcount, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* kref_get - increment refcount for object.
|
||||
* @kref: object.
|
||||
*/
|
||||
static inline void kref_get(struct kref *kref)
|
||||
{
|
||||
WARN_ON(!atomic_read(&kref->refcount));
|
||||
atomic_inc(&kref->refcount);
|
||||
}
|
||||
|
||||
/**
|
||||
* kref_sub - subtract a number of refcounts for object.
|
||||
* @kref: object.
|
||||
* @count: Number of recounts to subtract.
|
||||
* @release: pointer to the function that will clean up the object when the
|
||||
* last reference to the object is released.
|
||||
* This pointer is required, and it is not acceptable to pass kfree
|
||||
* in as this function. If the caller does pass kfree to this
|
||||
* function, you will be publicly mocked mercilessly by the kref
|
||||
* maintainer, and anyone else who happens to notice it. You have
|
||||
* been warned.
|
||||
*
|
||||
* Subtract @count from the refcount, and if 0, call release().
|
||||
* Return 1 if the object was removed, otherwise return 0. Beware, if this
|
||||
* function returns 0, you still can not count on the kref from remaining in
|
||||
* memory. Only use the return value if you want to see if the kref is now
|
||||
* gone, not present.
|
||||
*/
|
||||
static inline int kref_sub(struct kref *kref, unsigned int count,
|
||||
void (*release)(struct kref *kref))
|
||||
{
|
||||
WARN_ON(release == NULL);
|
||||
|
||||
if (atomic_sub_and_test((int) count, &kref->refcount)) {
|
||||
release(kref);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* kref_put - decrement refcount for object.
|
||||
* @kref: object.
|
||||
* @release: pointer to the function that will clean up the object when the
|
||||
* last reference to the object is released.
|
||||
* This pointer is required, and it is not acceptable to pass kfree
|
||||
* in as this function. If the caller does pass kfree to this
|
||||
* function, you will be publicly mocked mercilessly by the kref
|
||||
* maintainer, and anyone else who happens to notice it. You have
|
||||
* been warned.
|
||||
*
|
||||
* Decrement the refcount, and if 0, call release().
|
||||
* Return 1 if the object was removed, otherwise return 0. Beware, if this
|
||||
* function returns 0, you still can not count on the kref from remaining in
|
||||
* memory. Only use the return value if you want to see if the kref is now
|
||||
* gone, not present.
|
||||
*/
|
||||
static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
|
||||
{
|
||||
return kref_sub(kref, 1, release);
|
||||
}
|
||||
#endif /* _KREF_H_ */
|
||||
|
@@ -35,6 +35,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
|
||||
void kthread_bind(struct task_struct *k, unsigned int cpu);
|
||||
int kthread_stop(struct task_struct *k);
|
||||
int kthread_should_stop(void);
|
||||
bool kthread_freezable_should_stop(bool *was_frozen);
|
||||
void *kthread_data(struct task_struct *k);
|
||||
|
||||
int kthreadd(void *unused);
|
||||
|
@@ -557,6 +557,7 @@ struct kvm_ppc_pvinfo {
|
||||
#define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */
|
||||
#define KVM_CAP_PPC_PAPR 68
|
||||
#define KVM_CAP_S390_GMAP 71
|
||||
#define KVM_CAP_TSC_DEADLINE_TIMER 72
|
||||
|
||||
#ifdef KVM_CAP_IRQ_ROUTING
|
||||
|
||||
|
@@ -10,6 +10,8 @@
|
||||
#define _INCLUDE_GUARD_LATENCYTOP_H_
|
||||
|
||||
#include <linux/compiler.h>
|
||||
struct task_struct;
|
||||
|
||||
#ifdef CONFIG_LATENCYTOP
|
||||
|
||||
#define LT_SAVECOUNT 32
|
||||
@@ -23,7 +25,6 @@ struct latency_record {
|
||||
};
|
||||
|
||||
|
||||
struct task_struct;
|
||||
|
||||
extern int latencytop_enabled;
|
||||
void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/cpu.h>
|
||||
|
||||
/* can make br locks by using local lock for read side, global lock for write */
|
||||
#define br_lock_init(name) name##_lock_init()
|
||||
@@ -72,9 +73,31 @@
|
||||
|
||||
#define DEFINE_LGLOCK(name) \
|
||||
\
|
||||
DEFINE_SPINLOCK(name##_cpu_lock); \
|
||||
cpumask_t name##_cpus __read_mostly; \
|
||||
DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
|
||||
DEFINE_LGLOCK_LOCKDEP(name); \
|
||||
\
|
||||
static int \
|
||||
name##_lg_cpu_callback(struct notifier_block *nb, \
|
||||
unsigned long action, void *hcpu) \
|
||||
{ \
|
||||
switch (action & ~CPU_TASKS_FROZEN) { \
|
||||
case CPU_UP_PREPARE: \
|
||||
spin_lock(&name##_cpu_lock); \
|
||||
cpu_set((unsigned long)hcpu, name##_cpus); \
|
||||
spin_unlock(&name##_cpu_lock); \
|
||||
break; \
|
||||
case CPU_UP_CANCELED: case CPU_DEAD: \
|
||||
spin_lock(&name##_cpu_lock); \
|
||||
cpu_clear((unsigned long)hcpu, name##_cpus); \
|
||||
spin_unlock(&name##_cpu_lock); \
|
||||
} \
|
||||
return NOTIFY_OK; \
|
||||
} \
|
||||
static struct notifier_block name##_lg_cpu_notifier = { \
|
||||
.notifier_call = name##_lg_cpu_callback, \
|
||||
}; \
|
||||
void name##_lock_init(void) { \
|
||||
int i; \
|
||||
LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
|
||||
@@ -83,6 +106,11 @@
|
||||
lock = &per_cpu(name##_lock, i); \
|
||||
*lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
|
||||
} \
|
||||
register_hotcpu_notifier(&name##_lg_cpu_notifier); \
|
||||
get_online_cpus(); \
|
||||
for_each_online_cpu(i) \
|
||||
cpu_set(i, name##_cpus); \
|
||||
put_online_cpus(); \
|
||||
} \
|
||||
EXPORT_SYMBOL(name##_lock_init); \
|
||||
\
|
||||
@@ -124,9 +152,9 @@
|
||||
\
|
||||
void name##_global_lock_online(void) { \
|
||||
int i; \
|
||||
preempt_disable(); \
|
||||
spin_lock(&name##_cpu_lock); \
|
||||
rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
|
||||
for_each_online_cpu(i) { \
|
||||
for_each_cpu(i, &name##_cpus) { \
|
||||
arch_spinlock_t *lock; \
|
||||
lock = &per_cpu(name##_lock, i); \
|
||||
arch_spin_lock(lock); \
|
||||
@@ -137,12 +165,12 @@
|
||||
void name##_global_unlock_online(void) { \
|
||||
int i; \
|
||||
rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
|
||||
for_each_online_cpu(i) { \
|
||||
for_each_cpu(i, &name##_cpus) { \
|
||||
arch_spinlock_t *lock; \
|
||||
lock = &per_cpu(name##_lock, i); \
|
||||
arch_spin_unlock(lock); \
|
||||
} \
|
||||
preempt_enable(); \
|
||||
spin_unlock(&name##_cpu_lock); \
|
||||
} \
|
||||
EXPORT_SYMBOL(name##_global_unlock_online); \
|
||||
\
|
||||
|
@@ -301,7 +301,7 @@ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
|
||||
return ipv4_is_loopback(sin->sin_addr.s_addr);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
static inline int __nlm_privileged_request6(const struct sockaddr *sap)
|
||||
{
|
||||
const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
|
||||
@@ -314,12 +314,12 @@ static inline int __nlm_privileged_request6(const struct sockaddr *sap)
|
||||
|
||||
return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
|
||||
}
|
||||
#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
|
||||
#else /* IS_ENABLED(CONFIG_IPV6) */
|
||||
static inline int __nlm_privileged_request6(const struct sockaddr *sap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
|
||||
#endif /* IS_ENABLED(CONFIG_IPV6) */
|
||||
|
||||
/*
|
||||
* Ensure incoming requests are from local privileged callers.
|
||||
|
@@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
|
||||
|
||||
#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
|
||||
|
||||
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
|
||||
|
||||
#else /* !LOCKDEP */
|
||||
|
||||
static inline void lockdep_off(void)
|
||||
@@ -392,6 +394,8 @@ struct lock_class_key { };
|
||||
|
||||
#define lockdep_assert_held(l) do { } while (0)
|
||||
|
||||
#define lockdep_recursing(tsk) (0)
|
||||
|
||||
#endif /* !LOCKDEP */
|
||||
|
||||
#ifdef CONFIG_LOCK_STAT
|
||||
|
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
|
||||
#define rounddown_pow_of_two(n) \
|
||||
( \
|
||||
__builtin_constant_p(n) ? ( \
|
||||
(n == 1) ? 0 : \
|
||||
(1UL << ilog2(n))) : \
|
||||
__rounddown_pow_of_two(n) \
|
||||
)
|
||||
|
@@ -32,6 +32,8 @@ struct mdiobb_ops {
|
||||
|
||||
struct mdiobb_ctrl {
|
||||
const struct mdiobb_ops *ops;
|
||||
/* reset callback */
|
||||
int (*reset)(struct mii_bus *bus);
|
||||
};
|
||||
|
||||
/* The returned bus is not yet registered with the phy layer. */
|
||||
|
@@ -20,6 +20,8 @@ struct mdio_gpio_platform_data {
|
||||
|
||||
unsigned int phy_mask;
|
||||
int irqs[PHY_MAX_ADDR];
|
||||
/* reset callback */
|
||||
int (*reset)(struct mii_bus *bus);
|
||||
};
|
||||
|
||||
#endif /* __LINUX_MDIO_GPIO_H */
|
||||
|
@@ -2,8 +2,6 @@
|
||||
#define _LINUX_MEMBLOCK_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define MEMBLOCK_ERROR 0
|
||||
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK
|
||||
/*
|
||||
* Logical memory blocks.
|
||||
@@ -19,81 +17,161 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#include <asm/memblock.h>
|
||||
|
||||
#define INIT_MEMBLOCK_REGIONS 128
|
||||
|
||||
struct memblock_region {
|
||||
phys_addr_t base;
|
||||
phys_addr_t size;
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
int nid;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct memblock_type {
|
||||
unsigned long cnt; /* number of regions */
|
||||
unsigned long max; /* size of the allocated array */
|
||||
phys_addr_t total_size; /* size of all regions */
|
||||
struct memblock_region *regions;
|
||||
};
|
||||
|
||||
struct memblock {
|
||||
phys_addr_t current_limit;
|
||||
phys_addr_t memory_size; /* Updated by memblock_analyze() */
|
||||
struct memblock_type memory;
|
||||
struct memblock_type reserved;
|
||||
};
|
||||
|
||||
extern struct memblock memblock;
|
||||
extern int memblock_debug;
|
||||
extern int memblock_can_resize;
|
||||
|
||||
#define memblock_dbg(fmt, ...) \
|
||||
if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
|
||||
|
||||
u64 memblock_find_in_range(u64 start, u64 end, u64 size, u64 align);
|
||||
phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
|
||||
phys_addr_t size, phys_addr_t align, int nid);
|
||||
phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
|
||||
phys_addr_t size, phys_addr_t align);
|
||||
int memblock_free_reserved_regions(void);
|
||||
int memblock_reserve_reserved_regions(void);
|
||||
|
||||
extern void memblock_init(void);
|
||||
extern void memblock_analyze(void);
|
||||
extern long memblock_add(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_remove(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_free(phys_addr_t base, phys_addr_t size);
|
||||
extern long memblock_reserve(phys_addr_t base, phys_addr_t size);
|
||||
void memblock_allow_resize(void);
|
||||
int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
|
||||
int memblock_add(phys_addr_t base, phys_addr_t size);
|
||||
int memblock_remove(phys_addr_t base, phys_addr_t size);
|
||||
int memblock_free(phys_addr_t base, phys_addr_t size);
|
||||
int memblock_reserve(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
/* The numa aware allocator is only available if
|
||||
* CONFIG_ARCH_POPULATES_NODE_MAP is set
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
|
||||
unsigned long *out_end_pfn, int *out_nid);
|
||||
|
||||
/**
|
||||
* for_each_mem_pfn_range - early memory pfn range iterator
|
||||
* @i: an integer used as loop variable
|
||||
* @nid: node selector, %MAX_NUMNODES for all nodes
|
||||
* @p_start: ptr to ulong for start pfn of the range, can be %NULL
|
||||
* @p_end: ptr to ulong for end pfn of the range, can be %NULL
|
||||
* @p_nid: ptr to int for nid of the range, can be %NULL
|
||||
*
|
||||
* Walks over configured memory ranges. Available after early_node_map is
|
||||
* populated.
|
||||
*/
|
||||
extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align,
|
||||
int nid);
|
||||
extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
|
||||
int nid);
|
||||
#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
|
||||
for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
|
||||
i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
|
||||
|
||||
extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
|
||||
void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
|
||||
phys_addr_t *out_end, int *out_nid);
|
||||
|
||||
/**
|
||||
* for_each_free_mem_range - iterate through free memblock areas
|
||||
* @i: u64 used as loop variable
|
||||
* @nid: node selector, %MAX_NUMNODES for all nodes
|
||||
* @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
|
||||
* @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
|
||||
* @p_nid: ptr to int for nid of the range, can be %NULL
|
||||
*
|
||||
* Walks over free (memory && !reserved) areas of memblock. Available as
|
||||
* soon as memblock is initialized.
|
||||
*/
|
||||
#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
|
||||
for (i = 0, \
|
||||
__next_free_mem_range(&i, nid, p_start, p_end, p_nid); \
|
||||
i != (u64)ULLONG_MAX; \
|
||||
__next_free_mem_range(&i, nid, p_start, p_end, p_nid))
|
||||
|
||||
void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
|
||||
phys_addr_t *out_end, int *out_nid);
|
||||
|
||||
/**
|
||||
* for_each_free_mem_range_reverse - rev-iterate through free memblock areas
|
||||
* @i: u64 used as loop variable
|
||||
* @nid: node selector, %MAX_NUMNODES for all nodes
|
||||
* @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
|
||||
* @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
|
||||
* @p_nid: ptr to int for nid of the range, can be %NULL
|
||||
*
|
||||
* Walks over free (memory && !reserved) areas of memblock in reverse
|
||||
* order. Available as soon as memblock is initialized.
|
||||
*/
|
||||
#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
|
||||
for (i = (u64)ULLONG_MAX, \
|
||||
__next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \
|
||||
i != (u64)ULLONG_MAX; \
|
||||
__next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
|
||||
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
|
||||
|
||||
static inline void memblock_set_region_node(struct memblock_region *r, int nid)
|
||||
{
|
||||
r->nid = nid;
|
||||
}
|
||||
|
||||
static inline int memblock_get_region_node(const struct memblock_region *r)
|
||||
{
|
||||
return r->nid;
|
||||
}
|
||||
#else
|
||||
static inline void memblock_set_region_node(struct memblock_region *r, int nid)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int memblock_get_region_node(const struct memblock_region *r)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
|
||||
|
||||
phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
|
||||
phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
|
||||
|
||||
phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
|
||||
|
||||
/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
|
||||
#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
|
||||
#define MEMBLOCK_ALLOC_ACCESSIBLE 0
|
||||
|
||||
extern phys_addr_t memblock_alloc_base(phys_addr_t size,
|
||||
phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
extern phys_addr_t __memblock_alloc_base(phys_addr_t size,
|
||||
phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
extern phys_addr_t memblock_phys_mem_size(void);
|
||||
extern phys_addr_t memblock_start_of_DRAM(void);
|
||||
extern phys_addr_t memblock_end_of_DRAM(void);
|
||||
extern void memblock_enforce_memory_limit(phys_addr_t memory_limit);
|
||||
extern int memblock_is_memory(phys_addr_t addr);
|
||||
extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
|
||||
extern int memblock_is_reserved(phys_addr_t addr);
|
||||
extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
|
||||
phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
|
||||
phys_addr_t max_addr);
|
||||
phys_addr_t memblock_phys_mem_size(void);
|
||||
phys_addr_t memblock_start_of_DRAM(void);
|
||||
phys_addr_t memblock_end_of_DRAM(void);
|
||||
void memblock_enforce_memory_limit(phys_addr_t memory_limit);
|
||||
int memblock_is_memory(phys_addr_t addr);
|
||||
int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
|
||||
int memblock_is_reserved(phys_addr_t addr);
|
||||
int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
|
||||
|
||||
extern void memblock_dump_all(void);
|
||||
extern void __memblock_dump_all(void);
|
||||
|
||||
/* Provided by the architecture */
|
||||
extern phys_addr_t memblock_nid_range(phys_addr_t start, phys_addr_t end, int *nid);
|
||||
extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
|
||||
phys_addr_t addr2, phys_addr_t size2);
|
||||
static inline void memblock_dump_all(void)
|
||||
{
|
||||
if (memblock_debug)
|
||||
__memblock_dump_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* memblock_set_current_limit - Set the current allocation limit to allow
|
||||
@@ -101,7 +179,7 @@ extern int memblock_memory_can_coalesce(phys_addr_t addr1, phys_addr_t size1,
|
||||
* accessible during boot
|
||||
* @limit: New limit value (physical address)
|
||||
*/
|
||||
extern void memblock_set_current_limit(phys_addr_t limit);
|
||||
void memblock_set_current_limit(phys_addr_t limit);
|
||||
|
||||
|
||||
/*
|
||||
@@ -154,9 +232,9 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
|
||||
region++)
|
||||
|
||||
|
||||
#ifdef ARCH_DISCARD_MEMBLOCK
|
||||
#define __init_memblock __init
|
||||
#define __initdata_memblock __initdata
|
||||
#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK
|
||||
#define __init_memblock __meminit
|
||||
#define __initdata_memblock __meminitdata
|
||||
#else
|
||||
#define __init_memblock
|
||||
#define __initdata_memblock
|
||||
@@ -165,7 +243,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
|
||||
#else
|
||||
static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
|
||||
{
|
||||
return MEMBLOCK_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK */
|
||||
|
@@ -85,6 +85,9 @@ extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
|
||||
extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
|
||||
extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
|
||||
|
||||
extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
|
||||
extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
|
||||
|
||||
static inline
|
||||
int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
|
||||
{
|
||||
@@ -381,5 +384,25 @@ mem_cgroup_print_bad_page(struct page *page)
|
||||
}
|
||||
#endif
|
||||
|
||||
enum {
|
||||
UNDER_LIMIT,
|
||||
SOFT_LIMIT,
|
||||
OVER_LIMIT,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_INET
|
||||
struct sock;
|
||||
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
|
||||
void sock_update_memcg(struct sock *sk);
|
||||
void sock_release_memcg(struct sock *sk);
|
||||
#else
|
||||
static inline void sock_update_memcg(struct sock *sk)
|
||||
{
|
||||
}
|
||||
static inline void sock_release_memcg(struct sock *sk)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
|
||||
#endif /* CONFIG_INET */
|
||||
#endif /* _LINUX_MEMCONTROL_H */
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#ifndef _LINUX_MEMORY_H_
|
||||
#define _LINUX_MEMORY_H_
|
||||
|
||||
#include <linux/sysdev.h>
|
||||
#include <linux/node.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/mutex.h>
|
||||
@@ -38,7 +37,7 @@ struct memory_block {
|
||||
int phys_device; /* to which fru does this belong? */
|
||||
void *hw; /* optional pointer to fw/hw data */
|
||||
int (*phys_callback)(struct memory_block *);
|
||||
struct sys_device sysdev;
|
||||
struct device dev;
|
||||
};
|
||||
|
||||
int arch_get_memory_phys_device(unsigned long start_pfn);
|
||||
|
131
include/linux/mfd/da9052/da9052.h
Normal file
131
include/linux/mfd/da9052/da9052.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* da9052 declarations for DA9052 PMICs.
|
||||
*
|
||||
* Copyright(c) 2011 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: David Dajun Chen <dchen@diasemi.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __MFD_DA9052_DA9052_H
|
||||
#define __MFD_DA9052_DA9052_H
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/mfd/core.h>
|
||||
|
||||
#include <linux/mfd/da9052/reg.h>
|
||||
|
||||
#define DA9052_IRQ_DCIN 0
|
||||
#define DA9052_IRQ_VBUS 1
|
||||
#define DA9052_IRQ_DCINREM 2
|
||||
#define DA9052_IRQ_VBUSREM 3
|
||||
#define DA9052_IRQ_VDDLOW 4
|
||||
#define DA9052_IRQ_ALARM 5
|
||||
#define DA9052_IRQ_SEQRDY 6
|
||||
#define DA9052_IRQ_COMP1V2 7
|
||||
#define DA9052_IRQ_NONKEY 8
|
||||
#define DA9052_IRQ_IDFLOAT 9
|
||||
#define DA9052_IRQ_IDGND 10
|
||||
#define DA9052_IRQ_CHGEND 11
|
||||
#define DA9052_IRQ_TBAT 12
|
||||
#define DA9052_IRQ_ADC_EOM 13
|
||||
#define DA9052_IRQ_PENDOWN 14
|
||||
#define DA9052_IRQ_TSIREADY 15
|
||||
#define DA9052_IRQ_GPI0 16
|
||||
#define DA9052_IRQ_GPI1 17
|
||||
#define DA9052_IRQ_GPI2 18
|
||||
#define DA9052_IRQ_GPI3 19
|
||||
#define DA9052_IRQ_GPI4 20
|
||||
#define DA9052_IRQ_GPI5 21
|
||||
#define DA9052_IRQ_GPI6 22
|
||||
#define DA9052_IRQ_GPI7 23
|
||||
#define DA9052_IRQ_GPI8 24
|
||||
#define DA9052_IRQ_GPI9 25
|
||||
#define DA9052_IRQ_GPI10 26
|
||||
#define DA9052_IRQ_GPI11 27
|
||||
#define DA9052_IRQ_GPI12 28
|
||||
#define DA9052_IRQ_GPI13 29
|
||||
#define DA9052_IRQ_GPI14 30
|
||||
#define DA9052_IRQ_GPI15 31
|
||||
|
||||
enum da9052_chip_id {
|
||||
DA9052,
|
||||
DA9053_AA,
|
||||
DA9053_BA,
|
||||
DA9053_BB,
|
||||
};
|
||||
|
||||
struct da9052_pdata;
|
||||
|
||||
struct da9052 {
|
||||
struct mutex io_lock;
|
||||
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
|
||||
int irq_base;
|
||||
u8 chip_id;
|
||||
|
||||
int chip_irq;
|
||||
};
|
||||
|
||||
/* Device I/O API */
|
||||
static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
|
||||
{
|
||||
int val, ret;
|
||||
|
||||
ret = regmap_read(da9052->regmap, reg, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
|
||||
unsigned char val)
|
||||
{
|
||||
return regmap_write(da9052->regmap, reg, val);
|
||||
}
|
||||
|
||||
static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
|
||||
unsigned reg_cnt, unsigned char *val)
|
||||
{
|
||||
return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
|
||||
}
|
||||
|
||||
static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
|
||||
unsigned reg_cnt, unsigned char *val)
|
||||
{
|
||||
return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
|
||||
}
|
||||
|
||||
static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
|
||||
unsigned char bit_mask,
|
||||
unsigned char reg_val)
|
||||
{
|
||||
return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
|
||||
}
|
||||
|
||||
int da9052_device_init(struct da9052 *da9052, u8 chip_id);
|
||||
void da9052_device_exit(struct da9052 *da9052);
|
||||
|
||||
extern struct regmap_config da9052_regmap_config;
|
||||
|
||||
#endif /* __MFD_DA9052_DA9052_H */
|
40
include/linux/mfd/da9052/pdata.h
Normal file
40
include/linux/mfd/da9052/pdata.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Platform data declarations for DA9052 PMICs.
|
||||
*
|
||||
* Copyright(c) 2011 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: David Dajun Chen <dchen@diasemi.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __MFD_DA9052_PDATA_H__
|
||||
#define __MFD_DA9052_PDATA_H__
|
||||
|
||||
#define DA9052_MAX_REGULATORS 14
|
||||
|
||||
struct da9052;
|
||||
|
||||
struct da9052_pdata {
|
||||
struct led_platform_data *pled;
|
||||
int (*init) (struct da9052 *da9052);
|
||||
int irq_base;
|
||||
int gpio_base;
|
||||
int use_for_apm;
|
||||
struct regulator_init_data *regulators[DA9052_MAX_REGULATORS];
|
||||
};
|
||||
|
||||
#endif
|
749
include/linux/mfd/da9052/reg.h
Normal file
749
include/linux/mfd/da9052/reg.h
Normal file
@@ -0,0 +1,749 @@
|
||||
/*
|
||||
* Register declarations for DA9052 PMICs.
|
||||
*
|
||||
* Copyright(c) 2011 Dialog Semiconductor Ltd.
|
||||
*
|
||||
* Author: David Dajun Chen <dchen@diasemi.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MFD_DA9052_REG_H
|
||||
#define __LINUX_MFD_DA9052_REG_H
|
||||
|
||||
/* PAGE REGISTERS */
|
||||
#define DA9052_PAGE0_CON_REG 0
|
||||
#define DA9052_PAGE1_CON_REG 128
|
||||
|
||||
/* STATUS REGISTERS */
|
||||
#define DA9052_STATUS_A_REG 1
|
||||
#define DA9052_STATUS_B_REG 2
|
||||
#define DA9052_STATUS_C_REG 3
|
||||
#define DA9052_STATUS_D_REG 4
|
||||
|
||||
/* EVENT REGISTERS */
|
||||
#define DA9052_EVENT_A_REG 5
|
||||
#define DA9052_EVENT_B_REG 6
|
||||
#define DA9052_EVENT_C_REG 7
|
||||
#define DA9052_EVENT_D_REG 8
|
||||
#define DA9052_FAULTLOG_REG 9
|
||||
|
||||
/* IRQ REGISTERS */
|
||||
#define DA9052_IRQ_MASK_A_REG 10
|
||||
#define DA9052_IRQ_MASK_B_REG 11
|
||||
#define DA9052_IRQ_MASK_C_REG 12
|
||||
#define DA9052_IRQ_MASK_D_REG 13
|
||||
|
||||
/* CONTROL REGISTERS */
|
||||
#define DA9052_CONTROL_A_REG 14
|
||||
#define DA9052_CONTROL_B_REG 15
|
||||
#define DA9052_CONTROL_C_REG 16
|
||||
#define DA9052_CONTROL_D_REG 17
|
||||
|
||||
#define DA9052_PDDIS_REG 18
|
||||
#define DA9052_INTERFACE_REG 19
|
||||
#define DA9052_RESET_REG 20
|
||||
|
||||
/* GPIO REGISTERS */
|
||||
#define DA9052_GPIO_0_1_REG 21
|
||||
#define DA9052_GPIO_2_3_REG 22
|
||||
#define DA9052_GPIO_4_5_REG 23
|
||||
#define DA9052_GPIO_6_7_REG 24
|
||||
#define DA9052_GPIO_14_15_REG 28
|
||||
|
||||
/* POWER SEQUENCER CONTROL REGISTERS */
|
||||
#define DA9052_ID_0_1_REG 29
|
||||
#define DA9052_ID_2_3_REG 30
|
||||
#define DA9052_ID_4_5_REG 31
|
||||
#define DA9052_ID_6_7_REG 32
|
||||
#define DA9052_ID_8_9_REG 33
|
||||
#define DA9052_ID_10_11_REG 34
|
||||
#define DA9052_ID_12_13_REG 35
|
||||
#define DA9052_ID_14_15_REG 36
|
||||
#define DA9052_ID_16_17_REG 37
|
||||
#define DA9052_ID_18_19_REG 38
|
||||
#define DA9052_ID_20_21_REG 39
|
||||
#define DA9052_SEQ_STATUS_REG 40
|
||||
#define DA9052_SEQ_A_REG 41
|
||||
#define DA9052_SEQ_B_REG 42
|
||||
#define DA9052_SEQ_TIMER_REG 43
|
||||
|
||||
/* LDO AND BUCK REGISTERS */
|
||||
#define DA9052_BUCKA_REG 44
|
||||
#define DA9052_BUCKB_REG 45
|
||||
#define DA9052_BUCKCORE_REG 46
|
||||
#define DA9052_BUCKPRO_REG 47
|
||||
#define DA9052_BUCKMEM_REG 48
|
||||
#define DA9052_BUCKPERI_REG 49
|
||||
#define DA9052_LDO1_REG 50
|
||||
#define DA9052_LDO2_REG 51
|
||||
#define DA9052_LDO3_REG 52
|
||||
#define DA9052_LDO4_REG 53
|
||||
#define DA9052_LDO5_REG 54
|
||||
#define DA9052_LDO6_REG 55
|
||||
#define DA9052_LDO7_REG 56
|
||||
#define DA9052_LDO8_REG 57
|
||||
#define DA9052_LDO9_REG 58
|
||||
#define DA9052_LDO10_REG 59
|
||||
#define DA9052_SUPPLY_REG 60
|
||||
#define DA9052_PULLDOWN_REG 61
|
||||
#define DA9052_CHGBUCK_REG 62
|
||||
#define DA9052_WAITCONT_REG 63
|
||||
#define DA9052_ISET_REG 64
|
||||
#define DA9052_BATCHG_REG 65
|
||||
|
||||
/* BATTERY CONTROL REGISTRS */
|
||||
#define DA9052_CHG_CONT_REG 66
|
||||
#define DA9052_INPUT_CONT_REG 67
|
||||
#define DA9052_CHG_TIME_REG 68
|
||||
#define DA9052_BBAT_CONT_REG 69
|
||||
|
||||
/* LED CONTROL REGISTERS */
|
||||
#define DA9052_BOOST_REG 70
|
||||
#define DA9052_LED_CONT_REG 71
|
||||
#define DA9052_LEDMIN123_REG 72
|
||||
#define DA9052_LED1_CONF_REG 73
|
||||
#define DA9052_LED2_CONF_REG 74
|
||||
#define DA9052_LED3_CONF_REG 75
|
||||
#define DA9052_LED1CONT_REG 76
|
||||
#define DA9052_LED2CONT_REG 77
|
||||
#define DA9052_LED3CONT_REG 78
|
||||
#define DA9052_LED_CONT_4_REG 79
|
||||
#define DA9052_LED_CONT_5_REG 80
|
||||
|
||||
/* ADC CONTROL REGISTERS */
|
||||
#define DA9052_ADC_MAN_REG 81
|
||||
#define DA9052_ADC_CONT_REG 82
|
||||
#define DA9052_ADC_RES_L_REG 83
|
||||
#define DA9052_ADC_RES_H_REG 84
|
||||
#define DA9052_VDD_RES_REG 85
|
||||
#define DA9052_VDD_MON_REG 86
|
||||
|
||||
#define DA9052_ICHG_AV_REG 87
|
||||
#define DA9052_ICHG_THD_REG 88
|
||||
#define DA9052_ICHG_END_REG 89
|
||||
#define DA9052_TBAT_RES_REG 90
|
||||
#define DA9052_TBAT_HIGHP_REG 91
|
||||
#define DA9052_TBAT_HIGHN_REG 92
|
||||
#define DA9052_TBAT_LOW_REG 93
|
||||
#define DA9052_T_OFFSET_REG 94
|
||||
|
||||
#define DA9052_ADCIN4_RES_REG 95
|
||||
#define DA9052_AUTO4_HIGH_REG 96
|
||||
#define DA9052_AUTO4_LOW_REG 97
|
||||
#define DA9052_ADCIN5_RES_REG 98
|
||||
#define DA9052_AUTO5_HIGH_REG 99
|
||||
#define DA9052_AUTO5_LOW_REG 100
|
||||
#define DA9052_ADCIN6_RES_REG 101
|
||||
#define DA9052_AUTO6_HIGH_REG 102
|
||||
#define DA9052_AUTO6_LOW_REG 103
|
||||
|
||||
#define DA9052_TJUNC_RES_REG 104
|
||||
|
||||
/* TSI CONTROL REGISTERS */
|
||||
#define DA9052_TSI_CONT_A_REG 105
|
||||
#define DA9052_TSI_CONT_B_REG 106
|
||||
#define DA9052_TSI_X_MSB_REG 107
|
||||
#define DA9052_TSI_Y_MSB_REG 108
|
||||
#define DA9052_TSI_LSB_REG 109
|
||||
#define DA9052_TSI_Z_MSB_REG 110
|
||||
|
||||
/* RTC COUNT REGISTERS */
|
||||
#define DA9052_COUNT_S_REG 111
|
||||
#define DA9052_COUNT_MI_REG 112
|
||||
#define DA9052_COUNT_H_REG 113
|
||||
#define DA9052_COUNT_D_REG 114
|
||||
#define DA9052_COUNT_MO_REG 115
|
||||
#define DA9052_COUNT_Y_REG 116
|
||||
|
||||
/* RTC CONTROL REGISTERS */
|
||||
#define DA9052_ALARM_MI_REG 117
|
||||
#define DA9052_ALARM_H_REG 118
|
||||
#define DA9052_ALARM_D_REG 119
|
||||
#define DA9052_ALARM_MO_REG 120
|
||||
#define DA9052_ALARM_Y_REG 121
|
||||
#define DA9052_SECOND_A_REG 122
|
||||
#define DA9052_SECOND_B_REG 123
|
||||
#define DA9052_SECOND_C_REG 124
|
||||
#define DA9052_SECOND_D_REG 125
|
||||
|
||||
/* PAGE CONFIGURATION BIT */
|
||||
#define DA9052_PAGE_CONF 0X80
|
||||
|
||||
/* STATUS REGISTER A BITS */
|
||||
#define DA9052_STATUSA_VDATDET 0X80
|
||||
#define DA9052_STATUSA_VBUSSEL 0X40
|
||||
#define DA9052_STATUSA_DCINSEL 0X20
|
||||
#define DA9052_STATUSA_VBUSDET 0X10
|
||||
#define DA9052_STATUSA_DCINDET 0X08
|
||||
#define DA9052_STATUSA_IDGND 0X04
|
||||
#define DA9052_STATUSA_IDFLOAT 0X02
|
||||
#define DA9052_STATUSA_NONKEY 0X01
|
||||
|
||||
/* STATUS REGISTER B BITS */
|
||||
#define DA9052_STATUSB_COMPDET 0X80
|
||||
#define DA9052_STATUSB_SEQUENCING 0X40
|
||||
#define DA9052_STATUSB_GPFB2 0X20
|
||||
#define DA9052_STATUSB_CHGTO 0X10
|
||||
#define DA9052_STATUSB_CHGEND 0X08
|
||||
#define DA9052_STATUSB_CHGLIM 0X04
|
||||
#define DA9052_STATUSB_CHGPRE 0X02
|
||||
#define DA9052_STATUSB_CHGATT 0X01
|
||||
|
||||
/* STATUS REGISTER C BITS */
|
||||
#define DA9052_STATUSC_GPI7 0X80
|
||||
#define DA9052_STATUSC_GPI6 0X40
|
||||
#define DA9052_STATUSC_GPI5 0X20
|
||||
#define DA9052_STATUSC_GPI4 0X10
|
||||
#define DA9052_STATUSC_GPI3 0X08
|
||||
#define DA9052_STATUSC_GPI2 0X04
|
||||
#define DA9052_STATUSC_GPI1 0X02
|
||||
#define DA9052_STATUSC_GPI0 0X01
|
||||
|
||||
/* STATUS REGISTER D BITS */
|
||||
#define DA9052_STATUSD_GPI15 0X80
|
||||
#define DA9052_STATUSD_GPI14 0X40
|
||||
#define DA9052_STATUSD_GPI13 0X20
|
||||
#define DA9052_STATUSD_GPI12 0X10
|
||||
#define DA9052_STATUSD_GPI11 0X08
|
||||
#define DA9052_STATUSD_GPI10 0X04
|
||||
#define DA9052_STATUSD_GPI9 0X02
|
||||
#define DA9052_STATUSD_GPI8 0X01
|
||||
|
||||
/* EVENT REGISTER A BITS */
|
||||
#define DA9052_EVENTA_ECOMP1V2 0X80
|
||||
#define DA9052_EVENTA_ESEQRDY 0X40
|
||||
#define DA9052_EVENTA_EALRAM 0X20
|
||||
#define DA9052_EVENTA_EVDDLOW 0X10
|
||||
#define DA9052_EVENTA_EVBUSREM 0X08
|
||||
#define DA9052_EVENTA_EDCINREM 0X04
|
||||
#define DA9052_EVENTA_EVBUSDET 0X02
|
||||
#define DA9052_EVENTA_EDCINDET 0X01
|
||||
|
||||
/* EVENT REGISTER B BITS */
|
||||
#define DA9052_EVENTB_ETSIREADY 0X80
|
||||
#define DA9052_EVENTB_EPENDOWN 0X40
|
||||
#define DA9052_EVENTB_EADCEOM 0X20
|
||||
#define DA9052_EVENTB_ETBAT 0X10
|
||||
#define DA9052_EVENTB_ECHGEND 0X08
|
||||
#define DA9052_EVENTB_EIDGND 0X04
|
||||
#define DA9052_EVENTB_EIDFLOAT 0X02
|
||||
#define DA9052_EVENTB_ENONKEY 0X01
|
||||
|
||||
/* EVENT REGISTER C BITS */
|
||||
#define DA9052_EVENTC_EGPI7 0X80
|
||||
#define DA9052_EVENTC_EGPI6 0X40
|
||||
#define DA9052_EVENTC_EGPI5 0X20
|
||||
#define DA9052_EVENTC_EGPI4 0X10
|
||||
#define DA9052_EVENTC_EGPI3 0X08
|
||||
#define DA9052_EVENTC_EGPI2 0X04
|
||||
#define DA9052_EVENTC_EGPI1 0X02
|
||||
#define DA9052_EVENTC_EGPI0 0X01
|
||||
|
||||
/* EVENT REGISTER D BITS */
|
||||
#define DA9052_EVENTD_EGPI15 0X80
|
||||
#define DA9052_EVENTD_EGPI14 0X40
|
||||
#define DA9052_EVENTD_EGPI13 0X20
|
||||
#define DA9052_EVENTD_EGPI12 0X10
|
||||
#define DA9052_EVENTD_EGPI11 0X08
|
||||
#define DA9052_EVENTD_EGPI10 0X04
|
||||
#define DA9052_EVENTD_EGPI9 0X02
|
||||
#define DA9052_EVENTD_EGPI8 0X01
|
||||
|
||||
/* IRQ MASK REGISTERS BITS */
|
||||
#define DA9052_M_NONKEY 0X0100
|
||||
|
||||
/* TSI EVENT REGISTERS BITS */
|
||||
#define DA9052_E_PEN_DOWN 0X4000
|
||||
#define DA9052_E_TSI_READY 0X8000
|
||||
|
||||
/* FAULT LOG REGISTER BITS */
|
||||
#define DA9052_FAULTLOG_WAITSET 0X80
|
||||
#define DA9052_FAULTLOG_NSDSET 0X40
|
||||
#define DA9052_FAULTLOG_KEYSHUT 0X20
|
||||
#define DA9052_FAULTLOG_TEMPOVER 0X08
|
||||
#define DA9052_FAULTLOG_VDDSTART 0X04
|
||||
#define DA9052_FAULTLOG_VDDFAULT 0X02
|
||||
#define DA9052_FAULTLOG_TWDERROR 0X01
|
||||
|
||||
/* CONTROL REGISTER A BITS */
|
||||
#define DA9052_CONTROLA_GPIV 0X80
|
||||
#define DA9052_CONTROLA_PMOTYPE 0X20
|
||||
#define DA9052_CONTROLA_PMOV 0X10
|
||||
#define DA9052_CONTROLA_PMIV 0X08
|
||||
#define DA9052_CONTROLA_PMIFV 0X08
|
||||
#define DA9052_CONTROLA_PWR1EN 0X04
|
||||
#define DA9052_CONTROLA_PWREN 0X02
|
||||
#define DA9052_CONTROLA_SYSEN 0X01
|
||||
|
||||
/* CONTROL REGISTER B BITS */
|
||||
#define DA9052_CONTROLB_SHUTDOWN 0X80
|
||||
#define DA9052_CONTROLB_DEEPSLEEP 0X40
|
||||
#define DA9052_CONTROL_B_WRITEMODE 0X20
|
||||
#define DA9052_CONTROLB_BBATEN 0X10
|
||||
#define DA9052_CONTROLB_OTPREADEN 0X08
|
||||
#define DA9052_CONTROLB_AUTOBOOT 0X04
|
||||
#define DA9052_CONTROLB_ACTDIODE 0X02
|
||||
#define DA9052_CONTROLB_BUCKMERGE 0X01
|
||||
|
||||
/* CONTROL REGISTER C BITS */
|
||||
#define DA9052_CONTROLC_BLINKDUR 0X80
|
||||
#define DA9052_CONTROLC_BLINKFRQ 0X60
|
||||
#define DA9052_CONTROLC_DEBOUNCING 0X1C
|
||||
#define DA9052_CONTROLC_PMFB2PIN 0X02
|
||||
#define DA9052_CONTROLC_PMFB1PIN 0X01
|
||||
|
||||
/* CONTROL REGISTER D BITS */
|
||||
#define DA9052_CONTROLD_WATCHDOG 0X80
|
||||
#define DA9052_CONTROLD_ACCDETEN 0X40
|
||||
#define DA9052_CONTROLD_GPI1415SD 0X20
|
||||
#define DA9052_CONTROLD_NONKEYSD 0X10
|
||||
#define DA9052_CONTROLD_KEEPACTEN 0X08
|
||||
#define DA9052_CONTROLD_TWDSCALE 0X07
|
||||
|
||||
/* POWER DOWN DISABLE REGISTER BITS */
|
||||
#define DA9052_PDDIS_PMCONTPD 0X80
|
||||
#define DA9052_PDDIS_OUT32KPD 0X40
|
||||
#define DA9052_PDDIS_CHGBBATPD 0X20
|
||||
#define DA9052_PDDIS_CHGPD 0X10
|
||||
#define DA9052_PDDIS_HS2WIREPD 0X08
|
||||
#define DA9052_PDDIS_PMIFPD 0X04
|
||||
#define DA9052_PDDIS_GPADCPD 0X02
|
||||
#define DA9052_PDDIS_GPIOPD 0X01
|
||||
|
||||
/* CONTROL REGISTER D BITS */
|
||||
#define DA9052_INTERFACE_IFBASEADDR 0XE0
|
||||
#define DA9052_INTERFACE_NCSPOL 0X10
|
||||
#define DA9052_INTERFACE_RWPOL 0X08
|
||||
#define DA9052_INTERFACE_CPHA 0X04
|
||||
#define DA9052_INTERFACE_CPOL 0X02
|
||||
#define DA9052_INTERFACE_IFTYPE 0X01
|
||||
|
||||
/* CONTROL REGISTER D BITS */
|
||||
#define DA9052_RESET_RESETEVENT 0XC0
|
||||
#define DA9052_RESET_RESETTIMER 0X3F
|
||||
|
||||
/* GPIO REGISTERS */
|
||||
/* GPIO CONTROL REGISTER BITS */
|
||||
#define DA9052_GPIO_EVEN_PORT_PIN 0X03
|
||||
#define DA9052_GPIO_EVEN_PORT_TYPE 0X04
|
||||
#define DA9052_GPIO_EVEN_PORT_MODE 0X08
|
||||
|
||||
#define DA9052_GPIO_ODD_PORT_PIN 0X30
|
||||
#define DA9052_GPIO_ODD_PORT_TYPE 0X40
|
||||
#define DA9052_GPIO_ODD_PORT_MODE 0X80
|
||||
|
||||
/*POWER SEQUENCER REGISTER BITS */
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 0 AND 1 */
|
||||
#define DA9052_ID01_LDO1STEP 0XF0
|
||||
#define DA9052_ID01_SYSPRE 0X04
|
||||
#define DA9052_ID01_DEFSUPPLY 0X02
|
||||
#define DA9052_ID01_NRESMODE 0X01
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 2 AND 3 */
|
||||
#define DA9052_ID23_LDO3STEP 0XF0
|
||||
#define DA9052_ID23_LDO2STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 4 AND 5 */
|
||||
#define DA9052_ID45_LDO5STEP 0XF0
|
||||
#define DA9052_ID45_LDO4STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 6 AND 7 */
|
||||
#define DA9052_ID67_LDO7STEP 0XF0
|
||||
#define DA9052_ID67_LDO6STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 8 AND 9 */
|
||||
#define DA9052_ID89_LDO9STEP 0XF0
|
||||
#define DA9052_ID89_LDO8STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 10 AND 11 */
|
||||
#define DA9052_ID1011_PDDISSTEP 0XF0
|
||||
#define DA9052_ID1011_LDO10STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 12 AND 13 */
|
||||
#define DA9052_ID1213_VMEMSWSTEP 0XF0
|
||||
#define DA9052_ID1213_VPERISWSTEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 14 AND 15 */
|
||||
#define DA9052_ID1415_BUCKPROSTEP 0XF0
|
||||
#define DA9052_ID1415_BUCKCORESTEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 16 AND 17 */
|
||||
#define DA9052_ID1617_BUCKPERISTEP 0XF0
|
||||
#define DA9052_ID1617_BUCKMEMSTEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 18 AND 19 */
|
||||
#define DA9052_ID1819_GPRISE2STEP 0XF0
|
||||
#define DA9052_ID1819_GPRISE1STEP 0X0F
|
||||
|
||||
/* SEQ CONTROL REGISTER BITS FOR ID 20 AND 21 */
|
||||
#define DA9052_ID2021_GPFALL2STEP 0XF0
|
||||
#define DA9052_ID2021_GPFALL1STEP 0X0F
|
||||
|
||||
/* POWER SEQ STATUS REGISTER BITS */
|
||||
#define DA9052_SEQSTATUS_SEQPOINTER 0XF0
|
||||
#define DA9052_SEQSTATUS_WAITSTEP 0X0F
|
||||
|
||||
/* POWER SEQ A REGISTER BITS */
|
||||
#define DA9052_SEQA_POWEREND 0XF0
|
||||
#define DA9052_SEQA_SYSTEMEND 0X0F
|
||||
|
||||
/* POWER SEQ B REGISTER BITS */
|
||||
#define DA9052_SEQB_PARTDOWN 0XF0
|
||||
#define DA9052_SEQB_MAXCOUNT 0X0F
|
||||
|
||||
/* POWER SEQ TIMER REGISTER BITS */
|
||||
#define DA9052_SEQTIMER_SEQDUMMY 0XF0
|
||||
#define DA9052_SEQTIMER_SEQTIME 0X0F
|
||||
|
||||
/*POWER SUPPLY CONTROL REGISTER BITS */
|
||||
/* BUCK REGISTER A BITS */
|
||||
#define DA9052_BUCKA_BPROILIM 0XC0
|
||||
#define DA9052_BUCKA_BPROMODE 0X30
|
||||
#define DA9052_BUCKA_BCOREILIM 0X0C
|
||||
#define DA9052_BUCKA_BCOREMODE 0X03
|
||||
|
||||
/* BUCK REGISTER B BITS */
|
||||
#define DA9052_BUCKB_BERIILIM 0XC0
|
||||
#define DA9052_BUCKB_BPERIMODE 0X30
|
||||
#define DA9052_BUCKB_BMEMILIM 0X0C
|
||||
#define DA9052_BUCKB_BMEMMODE 0X03
|
||||
|
||||
/* BUCKCORE REGISTER BITS */
|
||||
#define DA9052_BUCKCORE_BCORECONF 0X80
|
||||
#define DA9052_BUCKCORE_BCOREEN 0X40
|
||||
#define DA9052_BUCKCORE_VBCORE 0X3F
|
||||
|
||||
/* BUCKPRO REGISTER BITS */
|
||||
#define DA9052_BUCKPRO_BPROCONF 0X80
|
||||
#define DA9052_BUCKPRO_BPROEN 0X40
|
||||
#define DA9052_BUCKPRO_VBPRO 0X3F
|
||||
|
||||
/* BUCKMEM REGISTER BITS */
|
||||
#define DA9052_BUCKMEM_BMEMCONF 0X80
|
||||
#define DA9052_BUCKMEM_BMEMEN 0X40
|
||||
#define DA9052_BUCKMEM_VBMEM 0X3F
|
||||
|
||||
/* BUCKPERI REGISTER BITS */
|
||||
#define DA9052_BUCKPERI_BPERICONF 0X80
|
||||
#define DA9052_BUCKPERI_BPERIEN 0X40
|
||||
#define DA9052_BUCKPERI_BPERIHS 0X20
|
||||
#define DA9052_BUCKPERI_VBPERI 0X1F
|
||||
|
||||
/* LDO1 REGISTER BITS */
|
||||
#define DA9052_LDO1_LDO1CONF 0X80
|
||||
#define DA9052_LDO1_LDO1EN 0X40
|
||||
#define DA9052_LDO1_VLDO1 0X1F
|
||||
|
||||
/* LDO2 REGISTER BITS */
|
||||
#define DA9052_LDO2_LDO2CONF 0X80
|
||||
#define DA9052_LDO2_LDO2EN 0X40
|
||||
#define DA9052_LDO2_VLDO2 0X3F
|
||||
|
||||
/* LDO3 REGISTER BITS */
|
||||
#define DA9052_LDO3_LDO3CONF 0X80
|
||||
#define DA9052_LDO3_LDO3EN 0X40
|
||||
#define DA9052_LDO3_VLDO3 0X3F
|
||||
|
||||
/* LDO4 REGISTER BITS */
|
||||
#define DA9052_LDO4_LDO4CONF 0X80
|
||||
#define DA9052_LDO4_LDO4EN 0X40
|
||||
#define DA9052_LDO4_VLDO4 0X3F
|
||||
|
||||
/* LDO5 REGISTER BITS */
|
||||
#define DA9052_LDO5_LDO5CONF 0X80
|
||||
#define DA9052_LDO5_LDO5EN 0X40
|
||||
#define DA9052_LDO5_VLDO5 0X3F
|
||||
|
||||
/* LDO6 REGISTER BITS */
|
||||
#define DA9052_LDO6_LDO6CONF 0X80
|
||||
#define DA9052_LDO6_LDO6EN 0X40
|
||||
#define DA9052_LDO6_VLDO6 0X3F
|
||||
|
||||
/* LDO7 REGISTER BITS */
|
||||
#define DA9052_LDO7_LDO7CONF 0X80
|
||||
#define DA9052_LDO7_LDO7EN 0X40
|
||||
#define DA9052_LDO7_VLDO7 0X3F
|
||||
|
||||
/* LDO8 REGISTER BITS */
|
||||
#define DA9052_LDO8_LDO8CONF 0X80
|
||||
#define DA9052_LDO8_LDO8EN 0X40
|
||||
#define DA9052_LDO8_VLDO8 0X3F
|
||||
|
||||
/* LDO9 REGISTER BITS */
|
||||
#define DA9052_LDO9_LDO9CONF 0X80
|
||||
#define DA9052_LDO9_LDO9EN 0X40
|
||||
#define DA9052_LDO9_VLDO9 0X3F
|
||||
|
||||
/* LDO10 REGISTER BITS */
|
||||
#define DA9052_LDO10_LDO10CONF 0X80
|
||||
#define DA9052_LDO10_LDO10EN 0X40
|
||||
#define DA9052_LDO10_VLDO10 0X3F
|
||||
|
||||
/* SUPPLY REGISTER BITS */
|
||||
#define DA9052_SUPPLY_VLOCK 0X80
|
||||
#define DA9052_SUPPLY_VMEMSWEN 0X40
|
||||
#define DA9052_SUPPLY_VPERISWEN 0X20
|
||||
#define DA9052_SUPPLY_VLDO3GO 0X10
|
||||
#define DA9052_SUPPLY_VLDO2GO 0X08
|
||||
#define DA9052_SUPPLY_VBMEMGO 0X04
|
||||
#define DA9052_SUPPLY_VBPROGO 0X02
|
||||
#define DA9052_SUPPLY_VBCOREGO 0X01
|
||||
|
||||
/* PULLDOWN REGISTER BITS */
|
||||
#define DA9052_PULLDOWN_LDO5PDDIS 0X20
|
||||
#define DA9052_PULLDOWN_LDO2PDDIS 0X10
|
||||
#define DA9052_PULLDOWN_LDO1PDDIS 0X08
|
||||
#define DA9052_PULLDOWN_MEMPDDIS 0X04
|
||||
#define DA9052_PULLDOWN_PROPDDIS 0X02
|
||||
#define DA9052_PULLDOWN_COREPDDIS 0X01
|
||||
|
||||
/* BAT CHARGER REGISTER BITS */
|
||||
/* CHARGER BUCK REGISTER BITS */
|
||||
#define DA9052_CHGBUCK_CHGTEMP 0X80
|
||||
#define DA9052_CHGBUCK_CHGUSBILIM 0X40
|
||||
#define DA9052_CHGBUCK_CHGBUCKLP 0X20
|
||||
#define DA9052_CHGBUCK_CHGBUCKEN 0X10
|
||||
#define DA9052_CHGBUCK_ISETBUCK 0X0F
|
||||
|
||||
/* WAIT COUNTER REGISTER BITS */
|
||||
#define DA9052_WAITCONT_WAITDIR 0X80
|
||||
#define DA9052_WAITCONT_RTCCLOCK 0X40
|
||||
#define DA9052_WAITCONT_WAITMODE 0X20
|
||||
#define DA9052_WAITCONT_EN32KOUT 0X10
|
||||
#define DA9052_WAITCONT_DELAYTIME 0X0F
|
||||
|
||||
/* ISET CONTROL REGISTER BITS */
|
||||
#define DA9052_ISET_ISETDCIN 0XF0
|
||||
#define DA9052_ISET_ISETVBUS 0X0F
|
||||
|
||||
/* BATTERY CHARGER CONTROL REGISTER BITS */
|
||||
#define DA9052_BATCHG_ICHGPRE 0XC0
|
||||
#define DA9052_BATCHG_ICHGBAT 0X3F
|
||||
|
||||
/* CHARGER COUNTER REGISTER BITS */
|
||||
#define DA9052_CHG_CONT_VCHG_BAT 0XF8
|
||||
#define DA9052_CHG_CONT_TCTR 0X07
|
||||
|
||||
/* INPUT CONTROL REGISTER BITS */
|
||||
#define DA9052_INPUT_CONT_TCTR_MODE 0X80
|
||||
#define DA9052_INPUT_CONT_VBUS_SUSP 0X10
|
||||
#define DA9052_INPUT_CONT_DCIN_SUSP 0X08
|
||||
|
||||
/* CHARGING TIME REGISTER BITS */
|
||||
#define DA9052_CHGTIME_CHGTIME 0XFF
|
||||
|
||||
/* BACKUP BATTERY CONTROL REGISTER BITS */
|
||||
#define DA9052_BBATCONT_BCHARGERISET 0XF0
|
||||
#define DA9052_BBATCONT_BCHARGERVSET 0X0F
|
||||
|
||||
/* LED REGISTERS BITS */
|
||||
/* LED BOOST REGISTER BITS */
|
||||
#define DA9052_BOOST_EBFAULT 0X80
|
||||
#define DA9052_BOOST_MBFAULT 0X40
|
||||
#define DA9052_BOOST_BOOSTFRQ 0X20
|
||||
#define DA9052_BOOST_BOOSTILIM 0X10
|
||||
#define DA9052_BOOST_LED3INEN 0X08
|
||||
#define DA9052_BOOST_LED2INEN 0X04
|
||||
#define DA9052_BOOST_LED1INEN 0X02
|
||||
#define DA9052_BOOST_BOOSTEN 0X01
|
||||
|
||||
/* LED CONTROL REGISTER BITS */
|
||||
#define DA9052_LEDCONT_SELLEDMODE 0X80
|
||||
#define DA9052_LEDCONT_LED3ICONT 0X40
|
||||
#define DA9052_LEDCONT_LED3RAMP 0X20
|
||||
#define DA9052_LEDCONT_LED3EN 0X10
|
||||
#define DA9052_LEDCONT_LED2RAMP 0X08
|
||||
#define DA9052_LEDCONT_LED2EN 0X04
|
||||
#define DA9052_LEDCONT_LED1RAMP 0X02
|
||||
#define DA9052_LEDCONT_LED1EN 0X01
|
||||
|
||||
/* LEDMIN123 REGISTER BIT */
|
||||
#define DA9052_LEDMIN123_LEDMINCURRENT 0XFF
|
||||
|
||||
/* LED1CONF REGISTER BIT */
|
||||
#define DA9052_LED1CONF_LED1CURRENT 0XFF
|
||||
|
||||
/* LED2CONF REGISTER BIT */
|
||||
#define DA9052_LED2CONF_LED2CURRENT 0XFF
|
||||
|
||||
/* LED3CONF REGISTER BIT */
|
||||
#define DA9052_LED3CONF_LED3CURRENT 0XFF
|
||||
|
||||
/* LED COUNT REGISTER BIT */
|
||||
#define DA9052_LED_CONT_DIM 0X80
|
||||
|
||||
/* ADC MAN REGISTERS BITS */
|
||||
#define DA9052_ADC_MAN_MAN_CONV 0X10
|
||||
#define DA9052_ADC_MAN_MUXSEL_VDDOUT 0X00
|
||||
#define DA9052_ADC_MAN_MUXSEL_ICH 0X01
|
||||
#define DA9052_ADC_MAN_MUXSEL_TBAT 0X02
|
||||
#define DA9052_ADC_MAN_MUXSEL_VBAT 0X03
|
||||
#define DA9052_ADC_MAN_MUXSEL_AD4 0X04
|
||||
#define DA9052_ADC_MAN_MUXSEL_AD5 0X05
|
||||
#define DA9052_ADC_MAN_MUXSEL_AD6 0X06
|
||||
#define DA9052_ADC_MAN_MUXSEL_VBBAT 0X09
|
||||
|
||||
/* ADC CONTROL REGSISTERS BITS */
|
||||
#define DA9052_ADCCONT_COMP1V2EN 0X80
|
||||
#define DA9052_ADCCONT_ADCMODE 0X40
|
||||
#define DA9052_ADCCONT_TBATISRCEN 0X20
|
||||
#define DA9052_ADCCONT_AD4ISRCEN 0X10
|
||||
#define DA9052_ADCCONT_AUTOAD6EN 0X08
|
||||
#define DA9052_ADCCONT_AUTOAD5EN 0X04
|
||||
#define DA9052_ADCCONT_AUTOAD4EN 0X02
|
||||
#define DA9052_ADCCONT_AUTOVDDEN 0X01
|
||||
|
||||
/* ADC 10 BIT MANUAL CONVERSION RESULT LOW REGISTER */
|
||||
#define DA9052_ADC_RES_LSB 0X03
|
||||
|
||||
/* ADC 10 BIT MANUAL CONVERSION RESULT HIGH REGISTER */
|
||||
#define DA9052_ADCRESH_ADCRESMSB 0XFF
|
||||
|
||||
/* VDD RES REGSISTER BIT*/
|
||||
#define DA9052_VDDRES_VDDOUTRES 0XFF
|
||||
|
||||
/* VDD MON REGSISTER BIT */
|
||||
#define DA9052_VDDMON_VDDOUTMON 0XFF
|
||||
|
||||
/* ICHG_AV REGSISTER BIT */
|
||||
#define DA9052_ICHGAV_ICHGAV 0XFF
|
||||
|
||||
/* ICHG_THD REGSISTER BIT */
|
||||
#define DA9052_ICHGTHD_ICHGTHD 0XFF
|
||||
|
||||
/* ICHG_END REGSISTER BIT */
|
||||
#define DA9052_ICHGEND_ICHGEND 0XFF
|
||||
|
||||
/* TBAT_RES REGSISTER BIT */
|
||||
#define DA9052_TBATRES_TBATRES 0XFF
|
||||
|
||||
/* TBAT_HIGHP REGSISTER BIT */
|
||||
#define DA9052_TBATHIGHP_TBATHIGHP 0XFF
|
||||
|
||||
/* TBAT_HIGHN REGSISTER BIT */
|
||||
#define DA9052_TBATHIGHN_TBATHIGHN 0XFF
|
||||
|
||||
/* TBAT_LOW REGSISTER BIT */
|
||||
#define DA9052_TBATLOW_TBATLOW 0XFF
|
||||
|
||||
/* T_OFFSET REGSISTER BIT */
|
||||
#define DA9052_TOFFSET_TOFFSET 0XFF
|
||||
|
||||
/* ADCIN4_RES REGSISTER BIT */
|
||||
#define DA9052_ADCIN4RES_ADCIN4RES 0XFF
|
||||
|
||||
/* ADCIN4_HIGH REGSISTER BIT */
|
||||
#define DA9052_AUTO4HIGH_AUTO4HIGH 0XFF
|
||||
|
||||
/* ADCIN4_LOW REGSISTER BIT */
|
||||
#define DA9052_AUTO4LOW_AUTO4LOW 0XFF
|
||||
|
||||
/* ADCIN5_RES REGSISTER BIT */
|
||||
#define DA9052_ADCIN5RES_ADCIN5RES 0XFF
|
||||
|
||||
/* ADCIN5_HIGH REGSISTER BIT */
|
||||
#define DA9052_AUTO5HIGH_AUTOHIGH 0XFF
|
||||
|
||||
/* ADCIN5_LOW REGSISTER BIT */
|
||||
#define DA9052_AUTO5LOW_AUTO5LOW 0XFF
|
||||
|
||||
/* ADCIN6_RES REGSISTER BIT */
|
||||
#define DA9052_ADCIN6RES_ADCIN6RES 0XFF
|
||||
|
||||
/* ADCIN6_HIGH REGSISTER BIT */
|
||||
#define DA9052_AUTO6HIGH_AUTO6HIGH 0XFF
|
||||
|
||||
/* ADCIN6_LOW REGSISTER BIT */
|
||||
#define DA9052_AUTO6LOW_AUTO6LOW 0XFF
|
||||
|
||||
/* TJUNC_RES REGSISTER BIT*/
|
||||
#define DA9052_TJUNCRES_TJUNCRES 0XFF
|
||||
|
||||
/* TSI REGISTER */
|
||||
/* TSI CONTROL REGISTER A BITS */
|
||||
#define DA9052_TSICONTA_TSIDELAY 0XC0
|
||||
#define DA9052_TSICONTA_TSISKIP 0X38
|
||||
#define DA9052_TSICONTA_TSIMODE 0X04
|
||||
#define DA9052_TSICONTA_PENDETEN 0X02
|
||||
#define DA9052_TSICONTA_AUTOTSIEN 0X01
|
||||
|
||||
/* TSI CONTROL REGISTER B BITS */
|
||||
#define DA9052_TSICONTB_ADCREF 0X80
|
||||
#define DA9052_TSICONTB_TSIMAN 0X40
|
||||
#define DA9052_TSICONTB_TSIMUX 0X30
|
||||
#define DA9052_TSICONTB_TSISEL3 0X08
|
||||
#define DA9052_TSICONTB_TSISEL2 0X04
|
||||
#define DA9052_TSICONTB_TSISEL1 0X02
|
||||
#define DA9052_TSICONTB_TSISEL0 0X01
|
||||
|
||||
/* TSI X CO-ORDINATE MSB RESULT REGISTER BITS */
|
||||
#define DA9052_TSIXMSB_TSIXM 0XFF
|
||||
|
||||
/* TSI Y CO-ORDINATE MSB RESULT REGISTER BITS */
|
||||
#define DA9052_TSIYMSB_TSIYM 0XFF
|
||||
|
||||
/* TSI CO-ORDINATE LSB RESULT REGISTER BITS */
|
||||
#define DA9052_TSILSB_PENDOWN 0X40
|
||||
#define DA9052_TSILSB_TSIZL 0X30
|
||||
#define DA9052_TSILSB_TSIYL 0X0C
|
||||
#define DA9052_TSILSB_TSIXL 0X03
|
||||
|
||||
/* TSI Z MEASUREMENT MSB RESULT REGISTER BIT */
|
||||
#define DA9052_TSIZMSB_TSIZM 0XFF
|
||||
|
||||
/* RTC REGISTER */
|
||||
/* RTC TIMER SECONDS REGISTER BITS */
|
||||
#define DA9052_COUNTS_MONITOR 0X40
|
||||
#define DA9052_RTC_SEC 0X3F
|
||||
|
||||
/* RTC TIMER MINUTES REGISTER BIT */
|
||||
#define DA9052_RTC_MIN 0X3F
|
||||
|
||||
/* RTC TIMER HOUR REGISTER BIT */
|
||||
#define DA9052_RTC_HOUR 0X1F
|
||||
|
||||
/* RTC TIMER DAYS REGISTER BIT */
|
||||
#define DA9052_RTC_DAY 0X1F
|
||||
|
||||
/* RTC TIMER MONTHS REGISTER BIT */
|
||||
#define DA9052_RTC_MONTH 0X0F
|
||||
|
||||
/* RTC TIMER YEARS REGISTER BIT */
|
||||
#define DA9052_RTC_YEAR 0X3F
|
||||
|
||||
/* RTC ALARM MINUTES REGISTER BITS */
|
||||
#define DA9052_ALARMM_I_TICK_TYPE 0X80
|
||||
#define DA9052_ALARMMI_ALARMTYPE 0X40
|
||||
|
||||
/* RTC ALARM YEARS REGISTER BITS */
|
||||
#define DA9052_ALARM_Y_TICK_ON 0X80
|
||||
#define DA9052_ALARM_Y_ALARM_ON 0X40
|
||||
|
||||
/* RTC SECONDS REGISTER A BITS */
|
||||
#define DA9052_SECONDA_SECONDSA 0XFF
|
||||
|
||||
/* RTC SECONDS REGISTER B BITS */
|
||||
#define DA9052_SECONDB_SECONDSB 0XFF
|
||||
|
||||
/* RTC SECONDS REGISTER C BITS */
|
||||
#define DA9052_SECONDC_SECONDSC 0XFF
|
||||
|
||||
/* RTC SECONDS REGISTER D BITS */
|
||||
#define DA9052_SECONDD_SECONDSD 0XFF
|
||||
|
||||
#endif
|
||||
/* __LINUX_MFD_DA9052_REG_H */
|
@@ -9,6 +9,7 @@
|
||||
#define __LINUX_MII_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ethtool.h>
|
||||
|
||||
/* Generic MII registers. */
|
||||
#define MII_BMCR 0x00 /* Basic mode control register */
|
||||
@@ -239,6 +240,205 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ethtool_adv_to_mii_adv_t
|
||||
* @ethadv: the ethtool advertisement settings
|
||||
*
|
||||
* A small helper function that translates ethtool advertisement
|
||||
* settings to phy autonegotiation advertisements for the
|
||||
* MII_ADVERTISE register.
|
||||
*/
|
||||
static inline u32 ethtool_adv_to_mii_adv_t(u32 ethadv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (ethadv & ADVERTISED_10baseT_Half)
|
||||
result |= ADVERTISE_10HALF;
|
||||
if (ethadv & ADVERTISED_10baseT_Full)
|
||||
result |= ADVERTISE_10FULL;
|
||||
if (ethadv & ADVERTISED_100baseT_Half)
|
||||
result |= ADVERTISE_100HALF;
|
||||
if (ethadv & ADVERTISED_100baseT_Full)
|
||||
result |= ADVERTISE_100FULL;
|
||||
if (ethadv & ADVERTISED_Pause)
|
||||
result |= ADVERTISE_PAUSE_CAP;
|
||||
if (ethadv & ADVERTISED_Asym_Pause)
|
||||
result |= ADVERTISE_PAUSE_ASYM;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_adv_to_ethtool_adv_t
|
||||
* @adv: value of the MII_ADVERTISE register
|
||||
*
|
||||
* A small helper function that translates MII_ADVERTISE bits
|
||||
* to ethtool advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_adv_to_ethtool_adv_t(u32 adv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (adv & ADVERTISE_10HALF)
|
||||
result |= ADVERTISED_10baseT_Half;
|
||||
if (adv & ADVERTISE_10FULL)
|
||||
result |= ADVERTISED_10baseT_Full;
|
||||
if (adv & ADVERTISE_100HALF)
|
||||
result |= ADVERTISED_100baseT_Half;
|
||||
if (adv & ADVERTISE_100FULL)
|
||||
result |= ADVERTISED_100baseT_Full;
|
||||
if (adv & ADVERTISE_PAUSE_CAP)
|
||||
result |= ADVERTISED_Pause;
|
||||
if (adv & ADVERTISE_PAUSE_ASYM)
|
||||
result |= ADVERTISED_Asym_Pause;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* ethtool_adv_to_mii_ctrl1000_t
|
||||
* @ethadv: the ethtool advertisement settings
|
||||
*
|
||||
* A small helper function that translates ethtool advertisement
|
||||
* settings to phy autonegotiation advertisements for the
|
||||
* MII_CTRL1000 register when in 1000T mode.
|
||||
*/
|
||||
static inline u32 ethtool_adv_to_mii_ctrl1000_t(u32 ethadv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (ethadv & ADVERTISED_1000baseT_Half)
|
||||
result |= ADVERTISE_1000HALF;
|
||||
if (ethadv & ADVERTISED_1000baseT_Full)
|
||||
result |= ADVERTISE_1000FULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_ctrl1000_to_ethtool_adv_t
|
||||
* @adv: value of the MII_CTRL1000 register
|
||||
*
|
||||
* A small helper function that translates MII_CTRL1000
|
||||
* bits, when in 1000Base-T mode, to ethtool
|
||||
* advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_ctrl1000_to_ethtool_adv_t(u32 adv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (adv & ADVERTISE_1000HALF)
|
||||
result |= ADVERTISED_1000baseT_Half;
|
||||
if (adv & ADVERTISE_1000FULL)
|
||||
result |= ADVERTISED_1000baseT_Full;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_lpa_to_ethtool_lpa_t
|
||||
* @adv: value of the MII_LPA register
|
||||
*
|
||||
* A small helper function that translates MII_LPA
|
||||
* bits, when in 1000Base-T mode, to ethtool
|
||||
* LP advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_lpa_to_ethtool_lpa_t(u32 lpa)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (lpa & LPA_LPACK)
|
||||
result |= ADVERTISED_Autoneg;
|
||||
|
||||
return result | mii_adv_to_ethtool_adv_t(lpa);
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_stat1000_to_ethtool_lpa_t
|
||||
* @adv: value of the MII_STAT1000 register
|
||||
*
|
||||
* A small helper function that translates MII_STAT1000
|
||||
* bits, when in 1000Base-T mode, to ethtool
|
||||
* advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_stat1000_to_ethtool_lpa_t(u32 lpa)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (lpa & LPA_1000HALF)
|
||||
result |= ADVERTISED_1000baseT_Half;
|
||||
if (lpa & LPA_1000FULL)
|
||||
result |= ADVERTISED_1000baseT_Full;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* ethtool_adv_to_mii_adv_x
|
||||
* @ethadv: the ethtool advertisement settings
|
||||
*
|
||||
* A small helper function that translates ethtool advertisement
|
||||
* settings to phy autonegotiation advertisements for the
|
||||
* MII_CTRL1000 register when in 1000Base-X mode.
|
||||
*/
|
||||
static inline u32 ethtool_adv_to_mii_adv_x(u32 ethadv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (ethadv & ADVERTISED_1000baseT_Half)
|
||||
result |= ADVERTISE_1000XHALF;
|
||||
if (ethadv & ADVERTISED_1000baseT_Full)
|
||||
result |= ADVERTISE_1000XFULL;
|
||||
if (ethadv & ADVERTISED_Pause)
|
||||
result |= ADVERTISE_1000XPAUSE;
|
||||
if (ethadv & ADVERTISED_Asym_Pause)
|
||||
result |= ADVERTISE_1000XPSE_ASYM;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_adv_to_ethtool_adv_x
|
||||
* @adv: value of the MII_CTRL1000 register
|
||||
*
|
||||
* A small helper function that translates MII_CTRL1000
|
||||
* bits, when in 1000Base-X mode, to ethtool
|
||||
* advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_adv_to_ethtool_adv_x(u32 adv)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (adv & ADVERTISE_1000XHALF)
|
||||
result |= ADVERTISED_1000baseT_Half;
|
||||
if (adv & ADVERTISE_1000XFULL)
|
||||
result |= ADVERTISED_1000baseT_Full;
|
||||
if (adv & ADVERTISE_1000XPAUSE)
|
||||
result |= ADVERTISED_Pause;
|
||||
if (adv & ADVERTISE_1000XPSE_ASYM)
|
||||
result |= ADVERTISED_Asym_Pause;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_lpa_to_ethtool_lpa_x
|
||||
* @adv: value of the MII_LPA register
|
||||
*
|
||||
* A small helper function that translates MII_LPA
|
||||
* bits, when in 1000Base-X mode, to ethtool
|
||||
* LP advertisement settings.
|
||||
*/
|
||||
static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (lpa & LPA_LPACK)
|
||||
result |= ADVERTISED_Autoneg;
|
||||
|
||||
return result | mii_adv_to_ethtool_adv_x(lpa);
|
||||
}
|
||||
|
||||
/**
|
||||
* mii_advertise_flowctrl - get flow control advertisement flags
|
||||
* @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
|
||||
|
@@ -54,7 +54,7 @@ struct miscdevice {
|
||||
struct device *parent;
|
||||
struct device *this_device;
|
||||
const char *nodename;
|
||||
mode_t mode;
|
||||
umode_t mode;
|
||||
};
|
||||
|
||||
extern int misc_register(struct miscdevice * misc);
|
||||
|
@@ -59,12 +59,15 @@ enum {
|
||||
MLX4_CMD_HW_HEALTH_CHECK = 0x50,
|
||||
MLX4_CMD_SET_PORT = 0xc,
|
||||
MLX4_CMD_SET_NODE = 0x5a,
|
||||
MLX4_CMD_QUERY_FUNC = 0x56,
|
||||
MLX4_CMD_ACCESS_DDR = 0x2e,
|
||||
MLX4_CMD_MAP_ICM = 0xffa,
|
||||
MLX4_CMD_UNMAP_ICM = 0xff9,
|
||||
MLX4_CMD_MAP_ICM_AUX = 0xffc,
|
||||
MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
|
||||
MLX4_CMD_SET_ICM_SIZE = 0xffd,
|
||||
/*master notify fw on finish for slave's flr*/
|
||||
MLX4_CMD_INFORM_FLR_DONE = 0x5b,
|
||||
|
||||
/* TPT commands */
|
||||
MLX4_CMD_SW2HW_MPT = 0xd,
|
||||
@@ -119,6 +122,26 @@ enum {
|
||||
/* miscellaneous commands */
|
||||
MLX4_CMD_DIAG_RPRT = 0x30,
|
||||
MLX4_CMD_NOP = 0x31,
|
||||
MLX4_CMD_ACCESS_MEM = 0x2e,
|
||||
MLX4_CMD_SET_VEP = 0x52,
|
||||
|
||||
/* Ethernet specific commands */
|
||||
MLX4_CMD_SET_VLAN_FLTR = 0x47,
|
||||
MLX4_CMD_SET_MCAST_FLTR = 0x48,
|
||||
MLX4_CMD_DUMP_ETH_STATS = 0x49,
|
||||
|
||||
/* Communication channel commands */
|
||||
MLX4_CMD_ARM_COMM_CHANNEL = 0x57,
|
||||
MLX4_CMD_GEN_EQE = 0x58,
|
||||
|
||||
/* virtual commands */
|
||||
MLX4_CMD_ALLOC_RES = 0xf00,
|
||||
MLX4_CMD_FREE_RES = 0xf01,
|
||||
MLX4_CMD_MCAST_ATTACH = 0xf05,
|
||||
MLX4_CMD_UCAST_ATTACH = 0xf06,
|
||||
MLX4_CMD_PROMISC = 0xf08,
|
||||
MLX4_CMD_QUERY_FUNC_CAP = 0xf0a,
|
||||
MLX4_CMD_QP_ATTACH = 0xf0b,
|
||||
|
||||
/* debug commands */
|
||||
MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
|
||||
@@ -126,6 +149,7 @@ enum {
|
||||
|
||||
/* statistics commands */
|
||||
MLX4_CMD_QUERY_IF_STAT = 0X54,
|
||||
MLX4_CMD_SET_IF_STAT = 0X55,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -135,7 +159,8 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX4_MAILBOX_SIZE = 4096
|
||||
MLX4_MAILBOX_SIZE = 4096,
|
||||
MLX4_ACCESS_MEM_ALIGN = 256,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -148,6 +173,11 @@ enum {
|
||||
MLX4_SET_PORT_GID_TABLE = 0x5,
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX4_CMD_WRAPPED,
|
||||
MLX4_CMD_NATIVE
|
||||
};
|
||||
|
||||
struct mlx4_dev;
|
||||
|
||||
struct mlx4_cmd_mailbox {
|
||||
@@ -157,23 +187,24 @@ struct mlx4_cmd_mailbox {
|
||||
|
||||
int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
|
||||
int out_is_imm, u32 in_modifier, u8 op_modifier,
|
||||
u16 op, unsigned long timeout);
|
||||
u16 op, unsigned long timeout, int native);
|
||||
|
||||
/* Invoke a command with no output parameter */
|
||||
static inline int mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u32 in_modifier,
|
||||
u8 op_modifier, u16 op, unsigned long timeout)
|
||||
u8 op_modifier, u16 op, unsigned long timeout,
|
||||
int native)
|
||||
{
|
||||
return __mlx4_cmd(dev, in_param, NULL, 0, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
op_modifier, op, timeout, native);
|
||||
}
|
||||
|
||||
/* Invoke a command with an output mailbox */
|
||||
static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param,
|
||||
u32 in_modifier, u8 op_modifier, u16 op,
|
||||
unsigned long timeout)
|
||||
unsigned long timeout, int native)
|
||||
{
|
||||
return __mlx4_cmd(dev, in_param, &out_param, 0, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
op_modifier, op, timeout, native);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -183,13 +214,17 @@ static inline int mlx4_cmd_box(struct mlx4_dev *dev, u64 in_param, u64 out_param
|
||||
*/
|
||||
static inline int mlx4_cmd_imm(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
|
||||
u32 in_modifier, u8 op_modifier, u16 op,
|
||||
unsigned long timeout)
|
||||
unsigned long timeout, int native)
|
||||
{
|
||||
return __mlx4_cmd(dev, in_param, out_param, 1, in_modifier,
|
||||
op_modifier, op, timeout);
|
||||
op_modifier, op, timeout, native);
|
||||
}
|
||||
|
||||
struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);
|
||||
void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);
|
||||
|
||||
u32 mlx4_comm_get_version(void);
|
||||
|
||||
#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
|
||||
|
||||
#endif /* MLX4_CMD_H */
|
||||
|
@@ -47,6 +47,9 @@
|
||||
enum {
|
||||
MLX4_FLAG_MSI_X = 1 << 0,
|
||||
MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
|
||||
MLX4_FLAG_MASTER = 1 << 2,
|
||||
MLX4_FLAG_SLAVE = 1 << 3,
|
||||
MLX4_FLAG_SRIOV = 1 << 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -57,6 +60,15 @@ enum {
|
||||
MLX4_BOARD_ID_LEN = 64
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX4_MAX_NUM_PF = 16,
|
||||
MLX4_MAX_NUM_VF = 64,
|
||||
MLX4_MFUNC_MAX = 80,
|
||||
MLX4_MFUNC_EQ_NUM = 4,
|
||||
MLX4_MFUNC_MAX_EQES = 8,
|
||||
MLX4_MFUNC_EQE_MASK = (MLX4_MFUNC_MAX_EQES - 1)
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX4_DEV_CAP_FLAG_RC = 1LL << 0,
|
||||
MLX4_DEV_CAP_FLAG_UC = 1LL << 1,
|
||||
@@ -77,11 +89,13 @@ enum {
|
||||
MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
|
||||
MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
|
||||
MLX4_DEV_CAP_FLAG_FCS_KEEP = 1LL << 34,
|
||||
MLX4_DEV_CAP_FLAG_WOL = 1LL << 38,
|
||||
MLX4_DEV_CAP_FLAG_WOL_PORT1 = 1LL << 37,
|
||||
MLX4_DEV_CAP_FLAG_WOL_PORT2 = 1LL << 38,
|
||||
MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
|
||||
MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
|
||||
MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
|
||||
MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48
|
||||
MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
|
||||
MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
|
||||
};
|
||||
|
||||
#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
|
||||
@@ -116,7 +130,11 @@ enum mlx4_event {
|
||||
MLX4_EVENT_TYPE_PORT_CHANGE = 0x09,
|
||||
MLX4_EVENT_TYPE_EQ_OVERFLOW = 0x0f,
|
||||
MLX4_EVENT_TYPE_ECC_DETECT = 0x0e,
|
||||
MLX4_EVENT_TYPE_CMD = 0x0a
|
||||
MLX4_EVENT_TYPE_CMD = 0x0a,
|
||||
MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
|
||||
MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
|
||||
MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
|
||||
MLX4_EVENT_TYPE_NONE = 0xff,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -183,6 +201,7 @@ enum mlx4_qp_region {
|
||||
};
|
||||
|
||||
enum mlx4_port_type {
|
||||
MLX4_PORT_TYPE_NONE = 0,
|
||||
MLX4_PORT_TYPE_IB = 1,
|
||||
MLX4_PORT_TYPE_ETH = 2,
|
||||
MLX4_PORT_TYPE_AUTO = 3
|
||||
@@ -215,6 +234,7 @@ static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
|
||||
|
||||
struct mlx4_caps {
|
||||
u64 fw_ver;
|
||||
u32 function;
|
||||
int num_ports;
|
||||
int vl_cap[MLX4_MAX_PORTS + 1];
|
||||
int ib_mtu_cap[MLX4_MAX_PORTS + 1];
|
||||
@@ -229,6 +249,7 @@ struct mlx4_caps {
|
||||
u64 trans_code[MLX4_MAX_PORTS + 1];
|
||||
int local_ca_ack_delay;
|
||||
int num_uars;
|
||||
u32 uar_page_size;
|
||||
int bf_reg_size;
|
||||
int bf_regs_per_page;
|
||||
int max_sq_sg;
|
||||
@@ -252,8 +273,7 @@ struct mlx4_caps {
|
||||
int num_comp_vectors;
|
||||
int comp_pool;
|
||||
int num_mpts;
|
||||
int num_mtt_segs;
|
||||
int mtts_per_seg;
|
||||
int num_mtts;
|
||||
int fmr_reserved_mtts;
|
||||
int reserved_mtts;
|
||||
int reserved_mrws;
|
||||
@@ -283,7 +303,9 @@ struct mlx4_caps {
|
||||
int log_num_prios;
|
||||
enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
|
||||
u8 supported_type[MLX4_MAX_PORTS + 1];
|
||||
u32 port_mask;
|
||||
u8 suggested_type[MLX4_MAX_PORTS + 1];
|
||||
u8 default_sense[MLX4_MAX_PORTS + 1];
|
||||
u32 port_mask[MLX4_MAX_PORTS + 1];
|
||||
enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
|
||||
u32 max_counters;
|
||||
u8 ext_port_cap[MLX4_MAX_PORTS + 1];
|
||||
@@ -303,7 +325,7 @@ struct mlx4_buf {
|
||||
};
|
||||
|
||||
struct mlx4_mtt {
|
||||
u32 first_seg;
|
||||
u32 offset;
|
||||
int order;
|
||||
int page_shift;
|
||||
};
|
||||
@@ -465,10 +487,12 @@ struct mlx4_counter {
|
||||
struct mlx4_dev {
|
||||
struct pci_dev *pdev;
|
||||
unsigned long flags;
|
||||
unsigned long num_slaves;
|
||||
struct mlx4_caps caps;
|
||||
struct radix_tree_root qp_table_tree;
|
||||
u8 rev_id;
|
||||
char board_id[MLX4_BOARD_ID_LEN];
|
||||
int num_vfs;
|
||||
};
|
||||
|
||||
struct mlx4_init_port_param {
|
||||
@@ -487,14 +511,32 @@ struct mlx4_init_port_param {
|
||||
|
||||
#define mlx4_foreach_port(port, dev, type) \
|
||||
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
|
||||
if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \
|
||||
~(dev)->caps.port_mask) & 1 << ((port) - 1))
|
||||
if ((type) == (dev)->caps.port_mask[(port)])
|
||||
|
||||
#define mlx4_foreach_ib_transport_port(port, dev) \
|
||||
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
|
||||
if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \
|
||||
((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
|
||||
#define mlx4_foreach_ib_transport_port(port, dev) \
|
||||
for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
|
||||
if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
|
||||
((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
|
||||
|
||||
static inline int mlx4_is_master(struct mlx4_dev *dev)
|
||||
{
|
||||
return dev->flags & MLX4_FLAG_MASTER;
|
||||
}
|
||||
|
||||
static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
|
||||
{
|
||||
return (qpn < dev->caps.sqp_start + 8);
|
||||
}
|
||||
|
||||
static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
|
||||
{
|
||||
return dev->flags & (MLX4_FLAG_SLAVE | MLX4_FLAG_MASTER);
|
||||
}
|
||||
|
||||
static inline int mlx4_is_slave(struct mlx4_dev *dev)
|
||||
{
|
||||
return dev->flags & MLX4_FLAG_SLAVE;
|
||||
}
|
||||
|
||||
int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
|
||||
struct mlx4_buf *buf);
|
||||
@@ -560,6 +602,10 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
|
||||
int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
|
||||
int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
|
||||
|
||||
int mlx4_unicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
||||
int block_mcast_loopback, enum mlx4_protocol prot);
|
||||
int mlx4_unicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
||||
enum mlx4_protocol prot);
|
||||
int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
||||
int block_mcast_loopback, enum mlx4_protocol protocol);
|
||||
int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
|
||||
@@ -570,9 +616,11 @@ int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
|
||||
int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
|
||||
int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
|
||||
|
||||
int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap);
|
||||
void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn);
|
||||
int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap);
|
||||
int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
|
||||
void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
|
||||
int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
|
||||
int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
|
||||
void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
|
||||
|
||||
int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
|
||||
int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
|
||||
|
@@ -97,6 +97,33 @@ enum {
|
||||
MLX4_QP_BIT_RIC = 1 << 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX4_RSS_HASH_XOR = 0,
|
||||
MLX4_RSS_HASH_TOP = 1,
|
||||
|
||||
MLX4_RSS_UDP_IPV6 = 1 << 0,
|
||||
MLX4_RSS_UDP_IPV4 = 1 << 1,
|
||||
MLX4_RSS_TCP_IPV6 = 1 << 2,
|
||||
MLX4_RSS_IPV6 = 1 << 3,
|
||||
MLX4_RSS_TCP_IPV4 = 1 << 4,
|
||||
MLX4_RSS_IPV4 = 1 << 5,
|
||||
|
||||
/* offset of mlx4_rss_context within mlx4_qp_context.pri_path */
|
||||
MLX4_RSS_OFFSET_IN_QPC_PRI_PATH = 0x24,
|
||||
/* offset of being RSS indirection QP within mlx4_qp_context.flags */
|
||||
MLX4_RSS_QPC_FLAG_OFFSET = 13,
|
||||
};
|
||||
|
||||
struct mlx4_rss_context {
|
||||
__be32 base_qpn;
|
||||
__be32 default_qpn;
|
||||
u16 reserved;
|
||||
u8 hash_fn;
|
||||
u8 flags;
|
||||
__be32 rss_key[10];
|
||||
__be32 base_qpn_udp;
|
||||
};
|
||||
|
||||
struct mlx4_qp_path {
|
||||
u8 fl;
|
||||
u8 reserved1[2];
|
||||
@@ -183,6 +210,7 @@ struct mlx4_wqe_ctrl_seg {
|
||||
* [4] IP checksum
|
||||
* [3:2] C (generate completion queue entry)
|
||||
* [1] SE (solicited event)
|
||||
* [0] FL (force loopback)
|
||||
*/
|
||||
__be32 srcrb_flags;
|
||||
/*
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <linux/mmzone.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/prio_tree.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/debug_locks.h>
|
||||
#include <linux/mm_types.h>
|
||||
#include <linux/range.h>
|
||||
@@ -1252,41 +1253,34 @@ static inline void pgtable_page_dtor(struct page *page)
|
||||
extern void free_area_init(unsigned long * zones_size);
|
||||
extern void free_area_init_node(int nid, unsigned long * zones_size,
|
||||
unsigned long zone_start_pfn, unsigned long *zholes_size);
|
||||
#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
/*
|
||||
* With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
|
||||
* With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
|
||||
* zones, allocate the backing mem_map and account for memory holes in a more
|
||||
* architecture independent manner. This is a substitute for creating the
|
||||
* zone_sizes[] and zholes_size[] arrays and passing them to
|
||||
* free_area_init_node()
|
||||
*
|
||||
* An architecture is expected to register range of page frames backed by
|
||||
* physical memory with add_active_range() before calling
|
||||
* physical memory with memblock_add[_node]() before calling
|
||||
* free_area_init_nodes() passing in the PFN each zone ends at. At a basic
|
||||
* usage, an architecture is expected to do something like
|
||||
*
|
||||
* unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
|
||||
* max_highmem_pfn};
|
||||
* for_each_valid_physical_page_range()
|
||||
* add_active_range(node_id, start_pfn, end_pfn)
|
||||
* memblock_add_node(base, size, nid)
|
||||
* free_area_init_nodes(max_zone_pfns);
|
||||
*
|
||||
* If the architecture guarantees that there are no holes in the ranges
|
||||
* registered with add_active_range(), free_bootmem_active_regions()
|
||||
* will call free_bootmem_node() for each registered physical page range.
|
||||
* Similarly sparse_memory_present_with_active_regions() calls
|
||||
* memory_present() for each range when SPARSEMEM is enabled.
|
||||
* free_bootmem_with_active_regions() calls free_bootmem_node() for each
|
||||
* registered physical page range. Similarly
|
||||
* sparse_memory_present_with_active_regions() calls memory_present() for
|
||||
* each range when SPARSEMEM is enabled.
|
||||
*
|
||||
* See mm/page_alloc.c for more information on each function exposed by
|
||||
* CONFIG_ARCH_POPULATES_NODE_MAP
|
||||
* CONFIG_HAVE_MEMBLOCK_NODE_MAP.
|
||||
*/
|
||||
extern void free_area_init_nodes(unsigned long *max_zone_pfn);
|
||||
extern void add_active_range(unsigned int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
extern void remove_all_active_ranges(void);
|
||||
void sort_node_map(void);
|
||||
unsigned long node_map_pfn_alignment(void);
|
||||
unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
|
||||
unsigned long end_pfn);
|
||||
@@ -1299,14 +1293,11 @@ extern void free_bootmem_with_active_regions(int nid,
|
||||
unsigned long max_low_pfn);
|
||||
int add_from_early_node_map(struct range *range, int az,
|
||||
int nr_range, int nid);
|
||||
u64 __init find_memory_core_early(int nid, u64 size, u64 align,
|
||||
u64 goal, u64 limit);
|
||||
typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
|
||||
extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
|
||||
extern void sparse_memory_present_with_active_regions(int nid);
|
||||
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
|
||||
|
||||
#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
|
||||
|
||||
#if !defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) && \
|
||||
!defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
|
||||
static inline int __early_pfn_to_nid(unsigned long pfn)
|
||||
{
|
||||
|
@@ -218,6 +218,7 @@ struct mmc_card {
|
||||
#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
|
||||
#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
|
||||
#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
|
||||
#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
|
||||
/* byte mode */
|
||||
unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
|
||||
#define MMC_NO_POWER_NOTIFICATION 0
|
||||
@@ -433,6 +434,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
|
||||
return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
|
||||
}
|
||||
|
||||
static inline int mmc_card_long_read_time(const struct mmc_card *c)
|
||||
{
|
||||
return c->quirks & MMC_QUIRK_LONG_READ_TIME;
|
||||
}
|
||||
|
||||
#define mmc_card_name(c) ((c)->cid.prod_name)
|
||||
#define mmc_card_id(c) (dev_name(&(c)->dev))
|
||||
|
||||
|
@@ -598,13 +598,13 @@ struct zonelist {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
struct node_active_region {
|
||||
unsigned long start_pfn;
|
||||
unsigned long end_pfn;
|
||||
int nid;
|
||||
};
|
||||
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
|
||||
#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
|
||||
|
||||
#ifndef CONFIG_DISCONTIGMEM
|
||||
/* The array of struct pages - for discontigmem use pgdat->lmem_map */
|
||||
@@ -720,7 +720,7 @@ extern int movable_zone;
|
||||
|
||||
static inline int zone_movable_is_highmem(void)
|
||||
{
|
||||
#if defined(CONFIG_HIGHMEM) && defined(CONFIG_ARCH_POPULATES_NODE_MAP)
|
||||
#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE)
|
||||
return movable_zone == ZONE_HIGHMEM;
|
||||
#else
|
||||
return 0;
|
||||
@@ -938,7 +938,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
|
||||
!defined(CONFIG_ARCH_POPULATES_NODE_MAP)
|
||||
!defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
|
||||
static inline unsigned long early_pfn_to_nid(unsigned long pfn)
|
||||
{
|
||||
return 0;
|
||||
|
@@ -2,39 +2,16 @@
|
||||
#define _NAMESPACE_H_
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/path.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
struct mnt_namespace {
|
||||
atomic_t count;
|
||||
struct vfsmount * root;
|
||||
struct list_head list;
|
||||
wait_queue_head_t poll;
|
||||
int event;
|
||||
};
|
||||
|
||||
struct proc_mounts {
|
||||
struct seq_file m; /* must be the first element */
|
||||
struct mnt_namespace *ns;
|
||||
struct path root;
|
||||
};
|
||||
|
||||
struct mnt_namespace;
|
||||
struct fs_struct;
|
||||
|
||||
extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
|
||||
extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
|
||||
struct fs_struct *);
|
||||
extern void put_mnt_ns(struct mnt_namespace *ns);
|
||||
static inline void get_mnt_ns(struct mnt_namespace *ns)
|
||||
{
|
||||
atomic_inc(&ns->count);
|
||||
}
|
||||
|
||||
extern const struct seq_operations mounts_op;
|
||||
extern const struct seq_operations mountinfo_op;
|
||||
extern const struct seq_operations mountstats_op;
|
||||
extern int mnt_had_events(struct proc_mounts *);
|
||||
extern const struct file_operations proc_mounts_operations;
|
||||
extern const struct file_operations proc_mountinfo_operations;
|
||||
extern const struct file_operations proc_mountstats_operations;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -542,4 +542,22 @@ struct isapnp_device_id {
|
||||
kernel_ulong_t driver_data; /* data private to the driver */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct amba_id - identifies a device on an AMBA bus
|
||||
* @id: The significant bits if the hardware device ID
|
||||
* @mask: Bitmask specifying which bits of the id field are significant when
|
||||
* matching. A driver binds to a device when ((hardware device ID) & mask)
|
||||
* == id.
|
||||
* @data: Private data used by the driver.
|
||||
*/
|
||||
struct amba_id {
|
||||
unsigned int id;
|
||||
unsigned int mask;
|
||||
#ifndef __KERNEL__
|
||||
kernel_ulong_t data;
|
||||
#else
|
||||
void *data;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* LINUX_MOD_DEVICETABLE_H */
|
||||
|
@@ -47,45 +47,10 @@ struct mnt_namespace;
|
||||
|
||||
#define MNT_INTERNAL 0x4000
|
||||
|
||||
struct mnt_pcp {
|
||||
int mnt_count;
|
||||
int mnt_writers;
|
||||
};
|
||||
|
||||
struct vfsmount {
|
||||
struct list_head mnt_hash;
|
||||
struct vfsmount *mnt_parent; /* fs we are mounted on */
|
||||
struct dentry *mnt_mountpoint; /* dentry of mountpoint */
|
||||
struct dentry *mnt_root; /* root of the mounted tree */
|
||||
struct super_block *mnt_sb; /* pointer to superblock */
|
||||
#ifdef CONFIG_SMP
|
||||
struct mnt_pcp __percpu *mnt_pcp;
|
||||
atomic_t mnt_longterm; /* how many of the refs are longterm */
|
||||
#else
|
||||
int mnt_count;
|
||||
int mnt_writers;
|
||||
#endif
|
||||
struct list_head mnt_mounts; /* list of children, anchored here */
|
||||
struct list_head mnt_child; /* and going through their mnt_child */
|
||||
int mnt_flags;
|
||||
/* 4 bytes hole on 64bits arches without fsnotify */
|
||||
#ifdef CONFIG_FSNOTIFY
|
||||
__u32 mnt_fsnotify_mask;
|
||||
struct hlist_head mnt_fsnotify_marks;
|
||||
#endif
|
||||
const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
|
||||
struct list_head mnt_list;
|
||||
struct list_head mnt_expire; /* link in fs-specific expiry list */
|
||||
struct list_head mnt_share; /* circular list of shared mounts */
|
||||
struct list_head mnt_slave_list;/* list of slave mounts */
|
||||
struct list_head mnt_slave; /* slave list entry */
|
||||
struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
|
||||
struct mnt_namespace *mnt_ns; /* containing namespace */
|
||||
int mnt_id; /* mount identifier */
|
||||
int mnt_group_id; /* peer group identifier */
|
||||
int mnt_expiry_mark; /* true if marked for expiry */
|
||||
int mnt_pinned;
|
||||
int mnt_ghosts;
|
||||
};
|
||||
|
||||
struct file; /* forward dec */
|
||||
@@ -94,15 +59,13 @@ extern int mnt_want_write(struct vfsmount *mnt);
|
||||
extern int mnt_want_write_file(struct file *file);
|
||||
extern int mnt_clone_write(struct vfsmount *mnt);
|
||||
extern void mnt_drop_write(struct vfsmount *mnt);
|
||||
extern void mnt_drop_write_file(struct file *file);
|
||||
extern void mntput(struct vfsmount *mnt);
|
||||
extern struct vfsmount *mntget(struct vfsmount *mnt);
|
||||
extern void mnt_pin(struct vfsmount *mnt);
|
||||
extern void mnt_unpin(struct vfsmount *mnt);
|
||||
extern int __mnt_is_readonly(struct vfsmount *mnt);
|
||||
|
||||
extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
|
||||
const char *name, void *data);
|
||||
|
||||
struct file_system_type;
|
||||
extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
|
||||
int flags, const char *name,
|
||||
|
@@ -116,6 +116,7 @@ enum {
|
||||
NDTPA_PROXY_DELAY, /* u64, msecs */
|
||||
NDTPA_PROXY_QLEN, /* u32 */
|
||||
NDTPA_LOCKTIME, /* u64, msecs */
|
||||
NDTPA_QUEUE_LENBYTES, /* u32 */
|
||||
__NDTPA_MAX
|
||||
};
|
||||
#define NDTPA_MAX (__NDTPA_MAX - 1)
|
||||
|
146
include/linux/netdev_features.h
Normal file
146
include/linux/netdev_features.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Network device features.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _LINUX_NETDEV_FEATURES_H
|
||||
#define _LINUX_NETDEV_FEATURES_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef u64 netdev_features_t;
|
||||
|
||||
enum {
|
||||
NETIF_F_SG_BIT, /* Scatter/gather IO. */
|
||||
NETIF_F_IP_CSUM_BIT, /* Can checksum TCP/UDP over IPv4. */
|
||||
__UNUSED_NETIF_F_1,
|
||||
NETIF_F_HW_CSUM_BIT, /* Can checksum all the packets. */
|
||||
NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */
|
||||
NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */
|
||||
NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */
|
||||
NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */
|
||||
NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */
|
||||
NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */
|
||||
NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */
|
||||
NETIF_F_GSO_BIT, /* Enable software GSO. */
|
||||
NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */
|
||||
/* do not use LLTX in new drivers */
|
||||
NETIF_F_NETNS_LOCAL_BIT, /* Does not change network namespaces */
|
||||
NETIF_F_GRO_BIT, /* Generic receive offload */
|
||||
NETIF_F_LRO_BIT, /* large receive offload */
|
||||
|
||||
/**/NETIF_F_GSO_SHIFT, /* keep the order of SKB_GSO_* bits */
|
||||
NETIF_F_TSO_BIT /* ... TCPv4 segmentation */
|
||||
= NETIF_F_GSO_SHIFT,
|
||||
NETIF_F_UFO_BIT, /* ... UDPv4 fragmentation */
|
||||
NETIF_F_GSO_ROBUST_BIT, /* ... ->SKB_GSO_DODGY */
|
||||
NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
|
||||
NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
|
||||
NETIF_F_FSO_BIT, /* ... FCoE segmentation */
|
||||
NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */
|
||||
/**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
|
||||
NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
|
||||
= NETIF_F_GSO_LAST,
|
||||
|
||||
NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
|
||||
NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
|
||||
NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
|
||||
NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
|
||||
NETIF_F_RXHASH_BIT, /* Receive hashing offload */
|
||||
NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
|
||||
NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
|
||||
NETIF_F_LOOPBACK_BIT, /* Enable loopback */
|
||||
|
||||
/*
|
||||
* Add your fresh new feature above and remember to update
|
||||
* netdev_features_strings[] in net/core/ethtool.c and maybe
|
||||
* some feature mask #defines below. Please also describe it
|
||||
* in Documentation/networking/netdev-features.txt.
|
||||
*/
|
||||
|
||||
/**/NETDEV_FEATURE_COUNT
|
||||
};
|
||||
|
||||
/* copy'n'paste compression ;) */
|
||||
#define __NETIF_F_BIT(bit) ((netdev_features_t)1 << (bit))
|
||||
#define __NETIF_F(name) __NETIF_F_BIT(NETIF_F_##name##_BIT)
|
||||
|
||||
#define NETIF_F_FCOE_CRC __NETIF_F(FCOE_CRC)
|
||||
#define NETIF_F_FCOE_MTU __NETIF_F(FCOE_MTU)
|
||||
#define NETIF_F_FRAGLIST __NETIF_F(FRAGLIST)
|
||||
#define NETIF_F_FSO __NETIF_F(FSO)
|
||||
#define NETIF_F_GRO __NETIF_F(GRO)
|
||||
#define NETIF_F_GSO __NETIF_F(GSO)
|
||||
#define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST)
|
||||
#define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA)
|
||||
#define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM)
|
||||
#define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER)
|
||||
#define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX)
|
||||
#define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX)
|
||||
#define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM)
|
||||
#define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM)
|
||||
#define NETIF_F_LLTX __NETIF_F(LLTX)
|
||||
#define NETIF_F_LOOPBACK __NETIF_F(LOOPBACK)
|
||||
#define NETIF_F_LRO __NETIF_F(LRO)
|
||||
#define NETIF_F_NETNS_LOCAL __NETIF_F(NETNS_LOCAL)
|
||||
#define NETIF_F_NOCACHE_COPY __NETIF_F(NOCACHE_COPY)
|
||||
#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
|
||||
#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
|
||||
#define NETIF_F_RXHASH __NETIF_F(RXHASH)
|
||||
#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM)
|
||||
#define NETIF_F_SG __NETIF_F(SG)
|
||||
#define NETIF_F_TSO6 __NETIF_F(TSO6)
|
||||
#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
|
||||
#define NETIF_F_TSO __NETIF_F(TSO)
|
||||
#define NETIF_F_UFO __NETIF_F(UFO)
|
||||
#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
|
||||
|
||||
/* Features valid for ethtool to change */
|
||||
/* = all defined minus driver/device-class-related */
|
||||
#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
|
||||
NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
|
||||
|
||||
/* remember that ((t)1 << t_BITS) is undefined in C99 */
|
||||
#define NETIF_F_ETHTOOL_BITS ((__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) | \
|
||||
(__NETIF_F_BIT(NETDEV_FEATURE_COUNT - 1) - 1)) & \
|
||||
~NETIF_F_NEVER_CHANGE)
|
||||
|
||||
/* Segmentation offload feature mask */
|
||||
#define NETIF_F_GSO_MASK (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
|
||||
__NETIF_F_BIT(NETIF_F_GSO_SHIFT))
|
||||
|
||||
/* List of features with software fallbacks. */
|
||||
#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
|
||||
NETIF_F_TSO6 | NETIF_F_UFO)
|
||||
|
||||
#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
|
||||
#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
|
||||
#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
|
||||
#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
|
||||
|
||||
#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
|
||||
|
||||
#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
|
||||
NETIF_F_FSO)
|
||||
|
||||
/*
|
||||
* If one device supports one of these features, then enable them
|
||||
* for all in netdev_increment_features.
|
||||
*/
|
||||
#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
|
||||
NETIF_F_SG | NETIF_F_HIGHDMA | \
|
||||
NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
|
||||
/*
|
||||
* If one device doesn't support one of these features, then disable it
|
||||
* for all in netdev_increment_features.
|
||||
*/
|
||||
#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
|
||||
|
||||
/* changeable features with no special hardware requirements */
|
||||
#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
|
||||
|
||||
#endif /* _LINUX_NETDEV_FEATURES_H */
|
@@ -43,6 +43,7 @@
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/dmaengine.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/dynamic_queue_limits.h>
|
||||
|
||||
#include <linux/ethtool.h>
|
||||
#include <net/net_namespace.h>
|
||||
@@ -50,8 +51,10 @@
|
||||
#ifdef CONFIG_DCB
|
||||
#include <net/dcbnl.h>
|
||||
#endif
|
||||
#include <net/netprio_cgroup.h>
|
||||
|
||||
#include <linux/netdev_features.h>
|
||||
|
||||
struct vlan_group;
|
||||
struct netpoll_info;
|
||||
struct phy_device;
|
||||
/* 802.11 specific */
|
||||
@@ -141,22 +144,20 @@ static inline bool dev_xmit_complete(int rc)
|
||||
* used.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
|
||||
#if defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
|
||||
# if defined(CONFIG_MAC80211_MESH)
|
||||
# define LL_MAX_HEADER 128
|
||||
# else
|
||||
# define LL_MAX_HEADER 96
|
||||
# endif
|
||||
#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE)
|
||||
#elif IS_ENABLED(CONFIG_TR)
|
||||
# define LL_MAX_HEADER 48
|
||||
#else
|
||||
# define LL_MAX_HEADER 32
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
|
||||
!defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \
|
||||
!defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
|
||||
!defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
|
||||
#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)
|
||||
@@ -212,6 +213,11 @@ enum {
|
||||
#include <linux/cache.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#ifdef CONFIG_RPS
|
||||
#include <linux/jump_label.h>
|
||||
extern struct jump_label_key rps_needed;
|
||||
#endif
|
||||
|
||||
struct neighbour;
|
||||
struct neigh_parms;
|
||||
struct sk_buff;
|
||||
@@ -272,16 +278,11 @@ struct hh_cache {
|
||||
*
|
||||
* We could use other alignment values, but we must maintain the
|
||||
* relationship HH alignment <= LL alignment.
|
||||
*
|
||||
* LL_ALLOCATED_SPACE also takes into account the tailroom the device
|
||||
* may need.
|
||||
*/
|
||||
#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)
|
||||
#define LL_ALLOCATED_SPACE(dev) \
|
||||
((((dev)->hard_header_len+(dev)->needed_headroom+(dev)->needed_tailroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
|
||||
|
||||
struct header_ops {
|
||||
int (*create) (struct sk_buff *skb, struct net_device *dev,
|
||||
@@ -516,11 +517,23 @@ static inline void napi_synchronize(const struct napi_struct *n)
|
||||
#endif
|
||||
|
||||
enum netdev_queue_state_t {
|
||||
__QUEUE_STATE_XOFF,
|
||||
__QUEUE_STATE_DRV_XOFF,
|
||||
__QUEUE_STATE_STACK_XOFF,
|
||||
__QUEUE_STATE_FROZEN,
|
||||
#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \
|
||||
(1 << __QUEUE_STATE_FROZEN))
|
||||
#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
|
||||
(1 << __QUEUE_STATE_STACK_XOFF))
|
||||
#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
|
||||
(1 << __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 {
|
||||
/*
|
||||
@@ -528,9 +541,8 @@ struct netdev_queue {
|
||||
*/
|
||||
struct net_device *dev;
|
||||
struct Qdisc *qdisc;
|
||||
unsigned long state;
|
||||
struct Qdisc *qdisc_sleeping;
|
||||
#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct kobject kobj;
|
||||
#endif
|
||||
#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
|
||||
@@ -545,6 +557,18 @@ struct netdev_queue {
|
||||
* please use this field instead of dev->trans_start
|
||||
*/
|
||||
unsigned long trans_start;
|
||||
|
||||
/*
|
||||
* Number of TX timeouts for this queue
|
||||
* (/sys/class/net/DEV/Q/trans_timeout)
|
||||
*/
|
||||
unsigned long trans_timeout;
|
||||
|
||||
unsigned long state;
|
||||
|
||||
#ifdef CONFIG_BQL
|
||||
struct dql dql;
|
||||
#endif
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
|
||||
@@ -573,7 +597,7 @@ struct rps_map {
|
||||
struct rcu_head rcu;
|
||||
u16 cpus[0];
|
||||
};
|
||||
#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
|
||||
#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
|
||||
@@ -597,7 +621,7 @@ struct rps_dev_flow_table {
|
||||
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)))
|
||||
((_num) * sizeof(struct rps_dev_flow)))
|
||||
|
||||
/*
|
||||
* The rps_sock_flow_table contains mappings of flows to the last CPU
|
||||
@@ -608,7 +632,7 @@ struct rps_sock_flow_table {
|
||||
u16 ents[0];
|
||||
};
|
||||
#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
|
||||
(_num * sizeof(u16)))
|
||||
((_num) * sizeof(u16)))
|
||||
|
||||
#define RPS_NO_CPU 0xffff
|
||||
|
||||
@@ -660,7 +684,7 @@ struct xps_map {
|
||||
struct rcu_head rcu;
|
||||
u16 queues[0];
|
||||
};
|
||||
#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16)))
|
||||
#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
|
||||
#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
|
||||
/ sizeof(u16))
|
||||
|
||||
@@ -683,6 +707,23 @@ struct netdev_tc_txq {
|
||||
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
|
||||
|
||||
/*
|
||||
* This structure defines the management hooks for network devices.
|
||||
* The following hooks can be defined; unless noted otherwise, they are
|
||||
@@ -767,11 +808,11 @@ struct netdev_tc_txq {
|
||||
* 3. Update dev->stats asynchronously and atomically, and define
|
||||
* neither operation.
|
||||
*
|
||||
* void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
|
||||
* int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
|
||||
* If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
|
||||
* this function is called when a VLAN id is registered.
|
||||
*
|
||||
* void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
|
||||
* int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
|
||||
* If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
|
||||
* this function is called when a VLAN id is unregistered.
|
||||
*
|
||||
@@ -823,6 +864,13 @@ struct netdev_tc_txq {
|
||||
* 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
|
||||
@@ -845,12 +893,13 @@ struct netdev_tc_txq {
|
||||
* Called to release previously enslaved netdev.
|
||||
*
|
||||
* Feature/offload setting functions.
|
||||
* u32 (*ndo_fix_features)(struct net_device *dev, u32 features);
|
||||
* 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, u32 features);
|
||||
* 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.
|
||||
@@ -885,9 +934,9 @@ struct net_device_ops {
|
||||
struct rtnl_link_stats64 *storage);
|
||||
struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
||||
|
||||
void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
|
||||
int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
|
||||
int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
|
||||
unsigned short vid);
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
void (*ndo_poll_controller)(struct net_device *dev);
|
||||
@@ -912,7 +961,7 @@ struct net_device_ops {
|
||||
int (*ndo_get_vf_port)(struct net_device *dev,
|
||||
int vf, struct sk_buff *skb);
|
||||
int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
|
||||
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
||||
#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,
|
||||
@@ -925,9 +974,11 @@ struct net_device_ops {
|
||||
u16 xid,
|
||||
struct scatterlist *sgl,
|
||||
unsigned int sgc);
|
||||
int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
|
||||
struct netdev_fcoe_hbainfo *hbainfo);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE)
|
||||
#if IS_ENABLED(CONFIG_LIBFCOE)
|
||||
#define NETDEV_FCOE_WWNN 0
|
||||
#define NETDEV_FCOE_WWPN 1
|
||||
int (*ndo_fcoe_get_wwn)(struct net_device *dev,
|
||||
@@ -944,10 +995,12 @@ struct net_device_ops {
|
||||
struct net_device *slave_dev);
|
||||
int (*ndo_del_slave)(struct net_device *dev,
|
||||
struct net_device *slave_dev);
|
||||
u32 (*ndo_fix_features)(struct net_device *dev,
|
||||
u32 features);
|
||||
netdev_features_t (*ndo_fix_features)(struct net_device *dev,
|
||||
netdev_features_t features);
|
||||
int (*ndo_set_features)(struct net_device *dev,
|
||||
u32 features);
|
||||
netdev_features_t features);
|
||||
int (*ndo_neigh_construct)(struct neighbour *n);
|
||||
void (*ndo_neigh_destroy)(struct neighbour *n);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -997,91 +1050,13 @@ struct net_device {
|
||||
struct list_head unreg_list;
|
||||
|
||||
/* currently active device features */
|
||||
u32 features;
|
||||
netdev_features_t features;
|
||||
/* user-changeable features */
|
||||
u32 hw_features;
|
||||
netdev_features_t hw_features;
|
||||
/* user-requested features */
|
||||
u32 wanted_features;
|
||||
netdev_features_t wanted_features;
|
||||
/* mask of features inheritable by VLAN devices */
|
||||
u32 vlan_features;
|
||||
|
||||
/* Net device feature bits; if you change something,
|
||||
* also update netdev_features_strings[] in ethtool.c */
|
||||
|
||||
#define NETIF_F_SG 1 /* Scatter/gather IO. */
|
||||
#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
|
||||
#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
|
||||
#define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
|
||||
#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */
|
||||
#define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
|
||||
#define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
|
||||
#define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
|
||||
#define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
|
||||
#define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
|
||||
#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
|
||||
#define NETIF_F_GSO 2048 /* Enable software GSO. */
|
||||
#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
|
||||
/* do not use LLTX in new drivers */
|
||||
#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
|
||||
#define NETIF_F_GRO 16384 /* Generic receive offload */
|
||||
#define NETIF_F_LRO 32768 /* large receive offload */
|
||||
|
||||
/* the GSO_MASK reserves bits 16 through 23 */
|
||||
#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
|
||||
#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
|
||||
#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
|
||||
#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
|
||||
#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
|
||||
#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
|
||||
#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
|
||||
#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */
|
||||
|
||||
/* Segmentation offload features */
|
||||
#define NETIF_F_GSO_SHIFT 16
|
||||
#define NETIF_F_GSO_MASK 0x00ff0000
|
||||
#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
|
||||
#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
|
||||
#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
|
||||
#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
|
||||
#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
|
||||
#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
|
||||
|
||||
/* Features valid for ethtool to change */
|
||||
/* = all defined minus driver/device-class-related */
|
||||
#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
|
||||
NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
|
||||
#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
|
||||
|
||||
/* List of features with software fallbacks. */
|
||||
#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
|
||||
NETIF_F_TSO6 | NETIF_F_UFO)
|
||||
|
||||
|
||||
#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
|
||||
#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
|
||||
#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
|
||||
#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
|
||||
|
||||
#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
|
||||
|
||||
#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
|
||||
NETIF_F_FSO)
|
||||
|
||||
/*
|
||||
* If one device supports one of these features, then enable them
|
||||
* for all in netdev_increment_features.
|
||||
*/
|
||||
#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
|
||||
NETIF_F_SG | NETIF_F_HIGHDMA | \
|
||||
NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
|
||||
/*
|
||||
* If one device doesn't support one of these features, then disable it
|
||||
* for all in netdev_increment_features.
|
||||
*/
|
||||
#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
|
||||
|
||||
/* changeable features with no special hardware requirements */
|
||||
#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
|
||||
netdev_features_t vlan_features;
|
||||
|
||||
/* Interface index. Unique device identifier */
|
||||
int ifindex;
|
||||
@@ -1132,6 +1107,7 @@ struct net_device {
|
||||
unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
|
||||
unsigned char addr_assign_type; /* hw address assignment type */
|
||||
unsigned char addr_len; /* hardware address length */
|
||||
unsigned char neigh_priv_len;
|
||||
unsigned short dev_id; /* for shared network cards */
|
||||
|
||||
spinlock_t addr_list_lock;
|
||||
@@ -1144,11 +1120,11 @@ struct net_device {
|
||||
|
||||
/* Protocol specific pointers */
|
||||
|
||||
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
|
||||
struct vlan_group __rcu *vlgrp; /* VLAN group */
|
||||
#if IS_ENABLED(CONFIG_VLAN_8021Q)
|
||||
struct vlan_info __rcu *vlan_info; /* VLAN info */
|
||||
#endif
|
||||
#ifdef CONFIG_NET_DSA
|
||||
void *dsa_ptr; /* dsa specific data */
|
||||
#if IS_ENABLED(CONFIG_NET_DSA)
|
||||
struct dsa_switch_tree *dsa_ptr; /* dsa specific data */
|
||||
#endif
|
||||
void *atalk_ptr; /* AppleTalk link */
|
||||
struct in_device __rcu *ip_ptr; /* IPv4 specific data */
|
||||
@@ -1184,9 +1160,11 @@ struct net_device {
|
||||
|
||||
unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
|
||||
|
||||
#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct kset *queues_kset;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RPS
|
||||
struct netdev_rx_queue *_rx;
|
||||
|
||||
/* Number of RX queues allocated at register_netdev() time */
|
||||
@@ -1308,9 +1286,12 @@ struct net_device {
|
||||
struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
|
||||
u8 prio_tc_map[TC_BITMASK + 1];
|
||||
|
||||
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
|
||||
#if IS_ENABLED(CONFIG_FCOE)
|
||||
/* max exchange id for FCoE LRO by ddp */
|
||||
unsigned int fcoe_ddp_xid;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
|
||||
struct netprio_map __rcu *priomap;
|
||||
#endif
|
||||
/* phy device may attach itself for hardware timestamping */
|
||||
struct phy_device *phydev;
|
||||
@@ -1515,7 +1496,7 @@ struct packet_type {
|
||||
struct packet_type *,
|
||||
struct net_device *);
|
||||
struct sk_buff *(*gso_segment)(struct sk_buff *skb,
|
||||
u32 features);
|
||||
netdev_features_t features);
|
||||
int (*gso_send_check)(struct sk_buff *skb);
|
||||
struct sk_buff **(*gro_receive)(struct sk_buff **head,
|
||||
struct sk_buff *skb);
|
||||
@@ -1783,7 +1764,7 @@ extern void __netif_schedule(struct Qdisc *q);
|
||||
|
||||
static inline void netif_schedule_queue(struct netdev_queue *txq)
|
||||
{
|
||||
if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
|
||||
if (!(txq->state & QUEUE_STATE_ANY_XOFF))
|
||||
__netif_schedule(txq->qdisc);
|
||||
}
|
||||
|
||||
@@ -1797,7 +1778,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
|
||||
|
||||
static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
|
||||
{
|
||||
clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
|
||||
clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1829,7 +1810,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (test_and_clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state))
|
||||
if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
|
||||
__netif_schedule(dev_queue->qdisc);
|
||||
}
|
||||
|
||||
@@ -1861,7 +1842,7 @@ static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
|
||||
pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
|
||||
return;
|
||||
}
|
||||
set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
|
||||
set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1888,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
|
||||
|
||||
static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
|
||||
{
|
||||
return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
|
||||
return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1902,9 +1883,68 @@ static inline int netif_queue_stopped(const struct net_device *dev)
|
||||
return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
|
||||
}
|
||||
|
||||
static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue)
|
||||
static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue)
|
||||
{
|
||||
return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN;
|
||||
return dev_queue->state & QUEUE_STATE_ANY_XOFF;
|
||||
}
|
||||
|
||||
static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
|
||||
{
|
||||
return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
|
||||
}
|
||||
|
||||
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 (unlikely(dql_avail(&dev_queue->dql) < 0)) {
|
||||
set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
|
||||
if (unlikely(dql_avail(&dev_queue->dql) >= 0))
|
||||
clear_bit(__QUEUE_STATE_STACK_XOFF,
|
||||
&dev_queue->state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
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 pkts, unsigned bytes)
|
||||
{
|
||||
#ifdef CONFIG_BQL
|
||||
if (likely(bytes)) {
|
||||
dql_completed(&dev_queue->dql, bytes);
|
||||
if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF,
|
||||
&dev_queue->state) &&
|
||||
dql_avail(&dev_queue->dql) >= 0)) {
|
||||
if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF,
|
||||
&dev_queue->state))
|
||||
netif_schedule_queue(dev_queue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void netdev_completed_queue(struct net_device *dev,
|
||||
unsigned pkts, unsigned 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
|
||||
dql_reset(&q->dql);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void netdev_reset_queue(struct net_device *dev_queue)
|
||||
{
|
||||
netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1991,7 +2031,7 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
|
||||
if (netpoll_trap())
|
||||
return;
|
||||
#endif
|
||||
if (test_and_clear_bit(__QUEUE_STATE_XOFF, &txq->state))
|
||||
if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
|
||||
__netif_schedule(txq->qdisc);
|
||||
}
|
||||
|
||||
@@ -2520,7 +2560,8 @@ extern int netdev_set_master(struct net_device *dev, struct net_device *master)
|
||||
extern int netdev_set_bond_master(struct net_device *dev,
|
||||
struct net_device *master);
|
||||
extern int skb_checksum_help(struct sk_buff *skb);
|
||||
extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features);
|
||||
extern struct sk_buff *skb_gso_segment(struct sk_buff *skb,
|
||||
netdev_features_t features);
|
||||
#ifdef CONFIG_BUG
|
||||
extern void netdev_rx_csum_fault(struct net_device *dev);
|
||||
#else
|
||||
@@ -2536,6 +2577,8 @@ extern void net_disable_timestamp(void);
|
||||
extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
|
||||
extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
|
||||
extern void dev_seq_stop(struct seq_file *seq, void *v);
|
||||
extern int dev_seq_open_ops(struct inode *inode, struct file *file,
|
||||
const struct seq_operations *ops);
|
||||
#endif
|
||||
|
||||
extern int netdev_class_create_file(struct class_attribute *class_attr);
|
||||
@@ -2547,11 +2590,13 @@ extern const char *netdev_drivername(const struct net_device *dev);
|
||||
|
||||
extern void linkwatch_run_queue(void);
|
||||
|
||||
static inline u32 netdev_get_wanted_features(struct net_device *dev)
|
||||
static inline netdev_features_t netdev_get_wanted_features(
|
||||
struct net_device *dev)
|
||||
{
|
||||
return (dev->features & ~dev->hw_features) | dev->wanted_features;
|
||||
}
|
||||
u32 netdev_increment_features(u32 all, u32 one, u32 mask);
|
||||
netdev_features_t netdev_increment_features(netdev_features_t all,
|
||||
netdev_features_t one, netdev_features_t 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);
|
||||
@@ -2559,21 +2604,31 @@ void netdev_change_features(struct net_device *dev);
|
||||
void netif_stacked_transfer_operstate(const struct net_device *rootdev,
|
||||
struct net_device *dev);
|
||||
|
||||
u32 netif_skb_features(struct sk_buff *skb);
|
||||
netdev_features_t netif_skb_features(struct sk_buff *skb);
|
||||
|
||||
static inline int net_gso_ok(u32 features, int gso_type)
|
||||
static inline int net_gso_ok(netdev_features_t features, int gso_type)
|
||||
{
|
||||
int feature = gso_type << NETIF_F_GSO_SHIFT;
|
||||
netdev_features_t feature = 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_UDP != (NETIF_F_UFO >> 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_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
|
||||
BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
|
||||
|
||||
return (features & feature) == feature;
|
||||
}
|
||||
|
||||
static inline int skb_gso_ok(struct sk_buff *skb, u32 features)
|
||||
static inline int 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 int netif_needs_gso(struct sk_buff *skb, int features)
|
||||
static inline int 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));
|
||||
@@ -2592,22 +2647,6 @@ static inline int netif_is_bond_slave(struct net_device *dev)
|
||||
|
||||
extern struct pernet_operations __net_initdata loopback_net_ops;
|
||||
|
||||
static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
|
||||
{
|
||||
if (dev->features & NETIF_F_RXCSUM)
|
||||
return 1;
|
||||
if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
|
||||
return 0;
|
||||
return dev->ethtool_ops->get_rx_csum(dev);
|
||||
}
|
||||
|
||||
static inline u32 dev_ethtool_get_flags(struct net_device *dev)
|
||||
{
|
||||
if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
|
||||
return 0;
|
||||
return dev->ethtool_ops->get_flags(dev);
|
||||
}
|
||||
|
||||
/* Logging, debugging and troubleshooting/diagnostic helpers. */
|
||||
|
||||
/* netdev_printk helpers, similar to dev_printk */
|
||||
|
@@ -162,6 +162,24 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
|
||||
|
||||
extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
|
||||
|
||||
#if defined(CONFIG_JUMP_LABEL)
|
||||
#include <linux/jump_label.h>
|
||||
extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
|
||||
static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
|
||||
{
|
||||
if (__builtin_constant_p(pf) &&
|
||||
__builtin_constant_p(hook))
|
||||
return static_branch(&nf_hooks_needed[pf][hook]);
|
||||
|
||||
return !list_empty(&nf_hooks[pf][hook]);
|
||||
}
|
||||
#else
|
||||
static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
|
||||
{
|
||||
return !list_empty(&nf_hooks[pf][hook]);
|
||||
}
|
||||
#endif
|
||||
|
||||
int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *indev, struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *), int thresh);
|
||||
@@ -179,11 +197,9 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
|
||||
struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *), int thresh)
|
||||
{
|
||||
#ifndef CONFIG_NETFILTER_DEBUG
|
||||
if (list_empty(&nf_hooks[pf][hook]))
|
||||
return 1;
|
||||
#endif
|
||||
return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
|
||||
if (nf_hooks_active(pf, hook))
|
||||
return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
|
@@ -5,7 +5,9 @@ header-y += nf_conntrack_ftp.h
|
||||
header-y += nf_conntrack_sctp.h
|
||||
header-y += nf_conntrack_tcp.h
|
||||
header-y += nf_conntrack_tuple_common.h
|
||||
header-y += nf_nat.h
|
||||
header-y += nfnetlink.h
|
||||
header-y += nfnetlink_acct.h
|
||||
header-y += nfnetlink_compat.h
|
||||
header-y += nfnetlink_conntrack.h
|
||||
header-y += nfnetlink_log.h
|
||||
@@ -21,6 +23,7 @@ header-y += xt_DSCP.h
|
||||
header-y += xt_IDLETIMER.h
|
||||
header-y += xt_LED.h
|
||||
header-y += xt_MARK.h
|
||||
header-y += xt_nfacct.h
|
||||
header-y += xt_NFLOG.h
|
||||
header-y += xt_NFQUEUE.h
|
||||
header-y += xt_RATEEST.h
|
||||
@@ -40,6 +43,7 @@ header-y += xt_cpu.h
|
||||
header-y += xt_dccp.h
|
||||
header-y += xt_devgroup.h
|
||||
header-y += xt_dscp.h
|
||||
header-y += xt_ecn.h
|
||||
header-y += xt_esp.h
|
||||
header-y += xt_hashlimit.h
|
||||
header-y += xt_helper.h
|
||||
|
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
|
||||
/* Conntrack is a fake untracked entry */
|
||||
IPS_UNTRACKED_BIT = 12,
|
||||
IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
|
||||
|
||||
/* Conntrack has a userspace helper. */
|
||||
IPS_USERSPACE_HELPER_BIT = 13,
|
||||
IPS_USERSPACE_HELPER = (1 << IPS_USERSPACE_HELPER_BIT),
|
||||
};
|
||||
|
||||
/* Connection tracking event types */
|
||||
|
@@ -7,6 +7,33 @@ enum ip_conntrack_dir {
|
||||
IP_CT_DIR_MAX
|
||||
};
|
||||
|
||||
/* The protocol-specific manipulable parts of the tuple: always in
|
||||
* network order
|
||||
*/
|
||||
union nf_conntrack_man_proto {
|
||||
/* Add other protocols here. */
|
||||
__be16 all;
|
||||
|
||||
struct {
|
||||
__be16 port;
|
||||
} tcp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} udp;
|
||||
struct {
|
||||
__be16 id;
|
||||
} icmp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} dccp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} sctp;
|
||||
struct {
|
||||
__be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
|
||||
} gre;
|
||||
};
|
||||
|
||||
#define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
|
||||
|
||||
#endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
|
||||
|
25
include/linux/netfilter/nf_nat.h
Normal file
25
include/linux/netfilter/nf_nat.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _NETFILTER_NF_NAT_H
|
||||
#define _NETFILTER_NF_NAT_H
|
||||
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netfilter/nf_conntrack_tuple_common.h>
|
||||
|
||||
#define NF_NAT_RANGE_MAP_IPS 1
|
||||
#define NF_NAT_RANGE_PROTO_SPECIFIED 2
|
||||
#define NF_NAT_RANGE_PROTO_RANDOM 4
|
||||
#define NF_NAT_RANGE_PERSISTENT 8
|
||||
|
||||
struct nf_nat_ipv4_range {
|
||||
unsigned int flags;
|
||||
__be32 min_ip;
|
||||
__be32 max_ip;
|
||||
union nf_conntrack_man_proto min;
|
||||
union nf_conntrack_man_proto max;
|
||||
};
|
||||
|
||||
struct nf_nat_ipv4_multi_range_compat {
|
||||
unsigned int rangesize;
|
||||
struct nf_nat_ipv4_range range[1];
|
||||
};
|
||||
|
||||
#endif /* _NETFILTER_NF_NAT_H */
|
@@ -48,7 +48,8 @@ struct nfgenmsg {
|
||||
#define NFNL_SUBSYS_ULOG 4
|
||||
#define NFNL_SUBSYS_OSF 5
|
||||
#define NFNL_SUBSYS_IPSET 6
|
||||
#define NFNL_SUBSYS_COUNT 7
|
||||
#define NFNL_SUBSYS_ACCT 7
|
||||
#define NFNL_SUBSYS_COUNT 8
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
36
include/linux/netfilter/nfnetlink_acct.h
Normal file
36
include/linux/netfilter/nfnetlink_acct.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef _NFNL_ACCT_H_
|
||||
#define _NFNL_ACCT_H_
|
||||
|
||||
#ifndef NFACCT_NAME_MAX
|
||||
#define NFACCT_NAME_MAX 32
|
||||
#endif
|
||||
|
||||
enum nfnl_acct_msg_types {
|
||||
NFNL_MSG_ACCT_NEW,
|
||||
NFNL_MSG_ACCT_GET,
|
||||
NFNL_MSG_ACCT_GET_CTRZERO,
|
||||
NFNL_MSG_ACCT_DEL,
|
||||
NFNL_MSG_ACCT_MAX
|
||||
};
|
||||
|
||||
enum nfnl_acct_type {
|
||||
NFACCT_UNSPEC,
|
||||
NFACCT_NAME,
|
||||
NFACCT_PKTS,
|
||||
NFACCT_BYTES,
|
||||
NFACCT_USE,
|
||||
__NFACCT_MAX
|
||||
};
|
||||
#define NFACCT_MAX (__NFACCT_MAX - 1)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct nf_acct;
|
||||
|
||||
extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
|
||||
extern void nfnl_acct_put(struct nf_acct *acct);
|
||||
extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _NFNL_ACCT_H */
|
@@ -3,7 +3,8 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define XT_CT_NOTRACK 0x1
|
||||
#define XT_CT_NOTRACK 0x1
|
||||
#define XT_CT_USERSPACE_HELPER 0x2
|
||||
|
||||
struct xt_ct_target_info {
|
||||
__u16 flags;
|
||||
|
35
include/linux/netfilter/xt_ecn.h
Normal file
35
include/linux/netfilter/xt_ecn.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/* iptables module for matching the ECN header in IPv4 and TCP header
|
||||
*
|
||||
* (C) 2002 Harald Welte <laforge@gnumonks.org>
|
||||
*
|
||||
* This software is distributed under GNU GPL v2, 1991
|
||||
*
|
||||
* ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
|
||||
*/
|
||||
#ifndef _XT_ECN_H
|
||||
#define _XT_ECN_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netfilter/xt_dscp.h>
|
||||
|
||||
#define XT_ECN_IP_MASK (~XT_DSCP_MASK)
|
||||
|
||||
#define XT_ECN_OP_MATCH_IP 0x01
|
||||
#define XT_ECN_OP_MATCH_ECE 0x10
|
||||
#define XT_ECN_OP_MATCH_CWR 0x20
|
||||
|
||||
#define XT_ECN_OP_MATCH_MASK 0xce
|
||||
|
||||
/* match info */
|
||||
struct xt_ecn_info {
|
||||
__u8 operation;
|
||||
__u8 invert;
|
||||
__u8 ip_ect;
|
||||
union {
|
||||
struct {
|
||||
__u8 ect;
|
||||
} tcp;
|
||||
} proto;
|
||||
};
|
||||
|
||||
#endif /* _XT_ECN_H */
|
13
include/linux/netfilter/xt_nfacct.h
Normal file
13
include/linux/netfilter/xt_nfacct.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _XT_NFACCT_MATCH_H
|
||||
#define _XT_NFACCT_MATCH_H
|
||||
|
||||
#include <linux/netfilter/nfnetlink_acct.h>
|
||||
|
||||
struct nf_acct;
|
||||
|
||||
struct xt_nfacct_match_info {
|
||||
char name[NFACCT_NAME_MAX];
|
||||
struct nf_acct *nfacct;
|
||||
};
|
||||
|
||||
#endif /* _XT_NFACCT_MATCH_H */
|
23
include/linux/netfilter/xt_rpfilter.h
Normal file
23
include/linux/netfilter/xt_rpfilter.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _XT_RPATH_H
|
||||
#define _XT_RPATH_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
enum {
|
||||
XT_RPFILTER_LOOSE = 1 << 0,
|
||||
XT_RPFILTER_VALID_MARK = 1 << 1,
|
||||
XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
|
||||
XT_RPFILTER_INVERT = 1 << 3,
|
||||
#ifdef __KERNEL__
|
||||
XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
|
||||
XT_RPFILTER_VALID_MARK |
|
||||
XT_RPFILTER_ACCEPT_LOCAL |
|
||||
XT_RPFILTER_INVERT,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct xt_rpfilter_info {
|
||||
__u8 flags;
|
||||
};
|
||||
|
||||
#endif
|
@@ -12,4 +12,3 @@ header-y += ipt_ah.h
|
||||
header-y += ipt_ecn.h
|
||||
header-y += ipt_realm.h
|
||||
header-y += ipt_ttl.h
|
||||
header-y += nf_nat.h
|
||||
|
@@ -1,35 +1,15 @@
|
||||
/* iptables module for matching the ECN header in IPv4 and TCP header
|
||||
*
|
||||
* (C) 2002 Harald Welte <laforge@gnumonks.org>
|
||||
*
|
||||
* This software is distributed under GNU GPL v2, 1991
|
||||
*
|
||||
* ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
|
||||
*/
|
||||
#ifndef _IPT_ECN_H
|
||||
#define _IPT_ECN_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netfilter/xt_dscp.h>
|
||||
#include <linux/netfilter/xt_ecn.h>
|
||||
#define ipt_ecn_info xt_ecn_info
|
||||
|
||||
#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
|
||||
|
||||
#define IPT_ECN_OP_MATCH_IP 0x01
|
||||
#define IPT_ECN_OP_MATCH_ECE 0x10
|
||||
#define IPT_ECN_OP_MATCH_CWR 0x20
|
||||
|
||||
#define IPT_ECN_OP_MATCH_MASK 0xce
|
||||
|
||||
/* match info */
|
||||
struct ipt_ecn_info {
|
||||
__u8 operation;
|
||||
__u8 invert;
|
||||
__u8 ip_ect;
|
||||
union {
|
||||
struct {
|
||||
__u8 ect;
|
||||
} tcp;
|
||||
} proto;
|
||||
enum {
|
||||
IPT_ECN_IP_MASK = XT_ECN_IP_MASK,
|
||||
IPT_ECN_OP_MATCH_IP = XT_ECN_OP_MATCH_IP,
|
||||
IPT_ECN_OP_MATCH_ECE = XT_ECN_OP_MATCH_ECE,
|
||||
IPT_ECN_OP_MATCH_CWR = XT_ECN_OP_MATCH_CWR,
|
||||
IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
|
||||
};
|
||||
|
||||
#endif /* _IPT_ECN_H */
|
||||
#endif /* IPT_ECN_H */
|
||||
|
@@ -1,58 +0,0 @@
|
||||
#ifndef _LINUX_NF_NAT_H
|
||||
#define _LINUX_NF_NAT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define IP_NAT_RANGE_MAP_IPS 1
|
||||
#define IP_NAT_RANGE_PROTO_SPECIFIED 2
|
||||
#define IP_NAT_RANGE_PROTO_RANDOM 4
|
||||
#define IP_NAT_RANGE_PERSISTENT 8
|
||||
|
||||
/* The protocol-specific manipulable parts of the tuple. */
|
||||
union nf_conntrack_man_proto {
|
||||
/* Add other protocols here. */
|
||||
__be16 all;
|
||||
|
||||
struct {
|
||||
__be16 port;
|
||||
} tcp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} udp;
|
||||
struct {
|
||||
__be16 id;
|
||||
} icmp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} dccp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} sctp;
|
||||
struct {
|
||||
__be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
|
||||
} gre;
|
||||
};
|
||||
|
||||
/* Single range specification. */
|
||||
struct nf_nat_range {
|
||||
/* Set to OR of flags above. */
|
||||
unsigned int flags;
|
||||
|
||||
/* Inclusive: network order. */
|
||||
__be32 min_ip, max_ip;
|
||||
|
||||
/* Inclusive: network order */
|
||||
union nf_conntrack_man_proto min, max;
|
||||
};
|
||||
|
||||
/* For backwards compat: don't use in modern code. */
|
||||
struct nf_nat_multi_range_compat {
|
||||
unsigned int rangesize; /* Must be 1. */
|
||||
|
||||
/* hangs off end. */
|
||||
struct nf_nat_range range[1];
|
||||
};
|
||||
|
||||
#define nf_nat_multi_range nf_nat_multi_range_compat
|
||||
|
||||
#endif
|
@@ -8,7 +8,7 @@
|
||||
#define NETLINK_UNUSED 1 /* Unused number */
|
||||
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
|
||||
#define NETLINK_FIREWALL 3 /* Firewalling hook */
|
||||
#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
|
||||
#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
|
||||
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
|
||||
#define NETLINK_XFRM 6 /* ipsec */
|
||||
#define NETLINK_SELINUX 7 /* SELinux event notifications */
|
||||
@@ -27,6 +27,8 @@
|
||||
#define NETLINK_RDMA 20
|
||||
#define NETLINK_CRYPTO 21 /* Crypto layer */
|
||||
|
||||
#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
|
||||
|
||||
#define MAX_LINKS 32
|
||||
|
||||
struct sockaddr_nl {
|
||||
|
@@ -62,6 +62,8 @@ enum nfc_commands {
|
||||
NFC_CMD_GET_DEVICE,
|
||||
NFC_CMD_DEV_UP,
|
||||
NFC_CMD_DEV_DOWN,
|
||||
NFC_CMD_DEP_LINK_UP,
|
||||
NFC_CMD_DEP_LINK_DOWN,
|
||||
NFC_CMD_START_POLL,
|
||||
NFC_CMD_STOP_POLL,
|
||||
NFC_CMD_GET_TARGET,
|
||||
@@ -86,6 +88,9 @@ enum nfc_commands {
|
||||
* @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
|
||||
* @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
|
||||
* target is not NFC-Forum compliant)
|
||||
* @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
|
||||
* @NFC_ATTR_COMM_MODE: Passive or active mode
|
||||
* @NFC_ATTR_RF_MODE: Initiator or target
|
||||
*/
|
||||
enum nfc_attrs {
|
||||
NFC_ATTR_UNSPEC,
|
||||
@@ -95,6 +100,9 @@ enum nfc_attrs {
|
||||
NFC_ATTR_TARGET_INDEX,
|
||||
NFC_ATTR_TARGET_SENS_RES,
|
||||
NFC_ATTR_TARGET_SEL_RES,
|
||||
NFC_ATTR_TARGET_NFCID1,
|
||||
NFC_ATTR_COMM_MODE,
|
||||
NFC_ATTR_RF_MODE,
|
||||
/* private: internal use only */
|
||||
__NFC_ATTR_AFTER_LAST
|
||||
};
|
||||
@@ -111,6 +119,14 @@ enum nfc_attrs {
|
||||
|
||||
#define NFC_PROTO_MAX 6
|
||||
|
||||
/* NFC communication modes */
|
||||
#define NFC_COMM_ACTIVE 0
|
||||
#define NFC_COMM_PASSIVE 1
|
||||
|
||||
/* NFC RF modes */
|
||||
#define NFC_RF_INITIATOR 0
|
||||
#define NFC_RF_TARGET 1
|
||||
|
||||
/* NFC protocols masks used in bitsets */
|
||||
#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
|
||||
#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
|
||||
@@ -125,9 +141,22 @@ struct sockaddr_nfc {
|
||||
__u32 nfc_protocol;
|
||||
};
|
||||
|
||||
#define NFC_LLCP_MAX_SERVICE_NAME 63
|
||||
struct sockaddr_nfc_llcp {
|
||||
sa_family_t sa_family;
|
||||
__u32 dev_idx;
|
||||
__u32 target_idx;
|
||||
__u32 nfc_protocol;
|
||||
__u8 dsap; /* Destination SAP, if known */
|
||||
__u8 ssap; /* Source SAP to be bound to */
|
||||
char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
|
||||
size_t service_name_len;
|
||||
};
|
||||
|
||||
/* NFC socket protocols */
|
||||
#define NFC_SOCKPROTO_RAW 0
|
||||
#define NFC_SOCKPROTO_MAX 1
|
||||
#define NFC_SOCKPROTO_LLCP 1
|
||||
#define NFC_SOCKPROTO_MAX 2
|
||||
|
||||
#define NFC_HEADER_SIZE 1
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user