aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h1
-rw-r--r--include/acpi/actypes.h15
-rw-r--r--include/acpi/video.h11
-rw-r--r--include/drm/drmP.h40
-rw-r--r--include/drm/drm_crtc.h37
-rw-r--r--include/drm/drm_fixed.h94
-rw-r--r--include/drm/drm_gem_cma_helper.h12
-rw-r--r--include/drm/drm_mm.h38
-rw-r--r--include/drm/drm_os_linux.h16
-rw-r--r--include/drm/drm_pciids.h24
-rw-r--r--include/drm/drm_rect.h167
-rw-r--r--include/drm/i915_powerwell.h36
-rw-r--r--include/drm/ttm/ttm_bo_api.h37
-rw-r--r--include/drm/ttm/ttm_bo_driver.h169
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h12
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/bcma/bcma.h1
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h55
-rw-r--r--include/linux/bio.h4
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/cgroup.h2
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpu_cooling.h4
-rw-r--r--include/linux/cpufreq.h2
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/device-mapper.h6
-rw-r--r--include/linux/device.h37
-rw-r--r--include/linux/drbd.h6
-rw-r--r--include/linux/drbd_genl.h2
-rw-r--r--include/linux/drbd_limits.h9
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h4
-rw-r--r--include/linux/firewire.h2
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/ftrace.h9
-rw-r--r--include/linux/i2c/twl.h31
-rw-r--r--include/linux/ieee80211.h10
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_macvlan.h12
-rw-r--r--include/linux/if_team.h11
-rw-r--r--include/linux/if_vlan.h5
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/iio.h4
-rw-r--r--include/linux/inetdevice.h5
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/io.h25
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/ktime.h13
-rw-r--r--include/linux/list.h11
-rw-r--r--include/linux/llist.h19
-rw-r--r--include/linux/marvell_phy.h2
-rw-r--r--include/linux/mfd/88pm80x.h17
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/core.h2
-rw-r--r--include/linux/mfd/davinci_voicecodec.h4
-rw-r--r--include/linux/mfd/kempld.h125
-rw-r--r--include/linux/mfd/max8998-private.h7
-rw-r--r--include/linux/mfd/max8998.h20
-rw-r--r--include/linux/mfd/palmas.h14
-rw-r--r--include/linux/mfd/rtsx_pci.h1
-rw-r--r--include/linux/mfd/samsung/core.h6
-rw-r--r--include/linux/mfd/samsung/s2mps11.h1
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h35
-rw-r--r--include/linux/mfd/tmio.h5
-rw-r--r--include/linux/mfd/wm8994/core.h2
-rw-r--r--include/linux/mfd/wm8994/pdata.h5
-rw-r--r--include/linux/mlx4/cmd.h3
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mlx4/qp.h36
-rw-r--r--include/linux/mlx5/cmd.h51
-rw-r--r--include/linux/mlx5/cq.h165
-rw-r--r--include/linux/mlx5/device.h893
-rw-r--r--include/linux/mlx5/doorbell.h79
-rw-r--r--include/linux/mlx5/driver.h769
-rw-r--r--include/linux/mlx5/qp.h467
-rw-r--r--include/linux/mlx5/srq.h41
-rw-r--r--include/linux/mm_types.h3
-rw-r--r--include/linux/mmc/card.h11
-rw-r--r--include/linux/mmc/core.h5
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mutex.h358
-rw-r--r--include/linux/mv643xx_eth.h2
-rw-r--r--include/linux/net.h6
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h85
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--include/linux/netlink.h27
-rw-r--r--include/linux/netpoll.h4
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h5
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/net-cw1200.h81
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/rcar-du.h54
-rw-r--r--include/linux/platform_data/remoteproc-omap.h2
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/pm_wakeup.h4
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/pwm.h29
-rw-r--r--include/linux/reservation.h62
-rw-r--r--include/linux/sched.h11
-rw-r--r--include/linux/skbuff.h137
-rw-r--r--include/linux/slab.h57
-rw-r--r--include/linux/slob_def.h8
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/ssb/ssb_driver_mips.h15
-rw-r--r--include/linux/ssb/ssb_regs.h1
-rw-r--r--include/linux/stmmac.h4
-rw-r--r--include/linux/sunrpc/cache.h49
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h4
-rw-r--r--include/linux/sunrpc/svcauth.h11
-rw-r--r--include/linux/sysfs.h64
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/linux/virtio.h4
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/ww_mutex.h378
-rw-r--r--include/linux/zbud.h22
-rw-r--r--include/media/davinci/vpbe_osd.h4
-rw-r--r--include/media/media-device.h9
-rw-r--r--include/media/media-entity.h5
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/s5p_fimc.h58
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/sh_mobile_csi2.h2
-rw-r--r--include/media/soc_camera.h43
-rw-r--r--include/media/ths7303.h2
-rw-r--r--include/media/tveeprom.h11
-rw-r--r--include/media/tvp7002.h46
-rw-r--r--include/media/v4l2-async.h105
-rw-r--r--include/media/v4l2-chip-ident.h352
-rw-r--r--include/media/v4l2-clk.h54
-rw-r--r--include/media/v4l2-common.h10
-rw-r--r--include/media/v4l2-dev.h5
-rw-r--r--include/media/v4l2-int-device.h3
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-subdev.h14
-rw-r--r--include/net/9p/transport.h6
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h29
-rw-r--r--include/net/bluetooth/l2cap.h2
-rw-r--r--include/net/busy_poll.h185
-rw-r--r--include/net/cfg80211.h236
-rw-r--r--include/net/gen_stats.h10
-rw-r--r--include/net/gre.h31
-rw-r--r--include/net/ieee80211_radiotap.h7
-rw-r--r--include/net/if_inet6.h13
-rw-r--r--include/net/inet_ecn.h6
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--include/net/ip_tunnels.h36
-rw-r--r--include/net/ip_vs.h92
-rw-r--r--include/net/ipv6.h10
-rw-r--r--include/net/mac80211.h27
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/net_namespace.h13
-rw-r--r--include/net/netfilter/xt_rateest.h2
-rw-r--r--include/net/netns/x_tables.h6
-rw-r--r--include/net/nfc/hci.h7
-rw-r--r--include/net/nfc/nci_core.h58
-rw-r--r--include/net/nfc/nfc.h35
-rw-r--r--include/net/ping.h65
-rw-r--r--include/net/sch_generic.h17
-rw-r--r--include/net/sctp/checksum.h5
-rw-r--r--include/net/sctp/sctp.h111
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sock.h21
-rw-r--r--include/net/tcp.h29
-rw-r--r--include/net/transp_v6.h79
-rw-r--r--include/net/udp.h8
-rw-r--r--include/rdma/ib.h89
-rw-r--r--include/rdma/ib_addr.h6
-rw-r--r--include/rdma/ib_sa.h7
-rw-r--r--include/rdma/ib_verbs.h35
-rw-r--r--include/rdma/rdma_cm.h13
-rw-r--r--include/target/iscsi/iscsi_transport.h21
-rw-r--r--include/target/target_core_base.h23
-rw-r--r--include/target/target_core_configfs.h1
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/target/target_core_fabric_configfs.h11
-rw-r--r--include/trace/events/bcache.h381
-rw-r--r--include/trace/events/target.h214
-rw-r--r--include/trace/ftrace.h4
-rw-r--r--include/trace/syscall.h1
-rw-r--r--include/uapi/asm-generic/fcntl.h8
-rw-r--r--include/uapi/asm-generic/poll.h2
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/drm/drm.h1
-rw-r--r--include/uapi/drm/drm_mode.h13
-rw-r--r--include/uapi/drm/i915_drm.h3
-rw-r--r--include/uapi/drm/tegra_drm.h2
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/bcm933xx_hcs.h24
-rw-r--r--include/uapi/linux/dm-ioctl.h4
-rw-r--r--include/uapi/linux/ethtool.h4
-rw-r--r--include/uapi/linux/gen_stats.h11
-rw-r--r--include/uapi/linux/if_arp.h1
-rw-r--r--include/uapi/linux/if_link.h15
-rw-r--r--include/uapi/linux/if_pppox.h4
-rw-r--r--include/uapi/linux/if_tun.h2
-rw-r--r--include/uapi/linux/ip_vs.h6
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_queue.h2
-rw-r--r--include/uapi/linux/netfilter/xt_socket.h7
-rw-r--r--include/uapi/linux/nfc.h18
-rw-r--r--include/uapi/linux/nl80211.h37
-rw-r--r--include/uapi/linux/openvswitch.h20
-rw-r--r--include/uapi/linux/rtnetlink.h2
-rw-r--r--include/uapi/linux/snmp.h2
-rw-r--r--include/uapi/linux/tipc.h2
-rw-r--r--include/uapi/linux/tipc_config.h2
-rw-r--r--include/uapi/linux/v4l2-controls.h4
-rw-r--r--include/uapi/linux/vfio.h8
-rw-r--r--include/uapi/linux/videodev2.h27
-rw-r--r--include/uapi/linux/virtio_config.h3
-rw-r--r--include/uapi/rdma/rdma_user_cm.h73
-rw-r--r--include/video/display_timing.h1
-rw-r--r--include/video/of_display_timing.h3
-rw-r--r--include/video/omap-panel-data.h209
-rw-r--r--include/video/omapdss.h293
-rw-r--r--include/video/uvesafb.h1
-rw-r--r--include/xen/interface/io/blkif.h53
-rw-r--r--include/xen/interface/io/netif.h12
-rw-r--r--include/xen/interface/io/ring.h5
231 files changed, 7000 insertions, 2009 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 1b09300810e6..22d497ee6ef9 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -62,6 +62,7 @@ extern u32 acpi_current_gpe_count;
62extern struct acpi_table_fadt acpi_gbl_FADT; 62extern struct acpi_table_fadt acpi_gbl_FADT;
63extern u8 acpi_gbl_system_awake_and_running; 63extern u8 acpi_gbl_system_awake_and_running;
64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ 64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
65extern u8 acpi_gbl_osi_data;
65 66
66/* Runtime configuration of debug print levels */ 67/* Runtime configuration of debug print levels */
67 68
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index a64adcc29ae5..22b03c9286e9 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1144,4 +1144,19 @@ struct acpi_memory_list {
1144#endif 1144#endif
1145}; 1145};
1146 1146
1147/* Definitions for _OSI support */
1148
1149#define ACPI_OSI_WIN_2000 0x01
1150#define ACPI_OSI_WIN_XP 0x02
1151#define ACPI_OSI_WIN_XP_SP1 0x03
1152#define ACPI_OSI_WINSRV_2003 0x04
1153#define ACPI_OSI_WIN_XP_SP2 0x05
1154#define ACPI_OSI_WINSRV_2003_SP1 0x06
1155#define ACPI_OSI_WIN_VISTA 0x07
1156#define ACPI_OSI_WINSRV_2008 0x08
1157#define ACPI_OSI_WIN_VISTA_SP1 0x09
1158#define ACPI_OSI_WIN_VISTA_SP2 0x0A
1159#define ACPI_OSI_WIN_7 0x0B
1160#define ACPI_OSI_WIN_8 0x0C
1161
1147#endif /* __ACTYPES_H__ */ 1162#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/video.h b/include/acpi/video.h
index 61109f2609fc..b26dc4fb7ba8 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -17,12 +17,21 @@ struct acpi_device;
17#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 17#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
18 18
19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
20extern int acpi_video_register(void); 20extern int __acpi_video_register(bool backlight_quirks);
21static inline int acpi_video_register(void)
22{
23 return __acpi_video_register(false);
24}
25static inline int acpi_video_register_with_quirks(void)
26{
27 return __acpi_video_register(true);
28}
21extern void acpi_video_unregister(void); 29extern void acpi_video_unregister(void);
22extern int acpi_video_get_edid(struct acpi_device *device, int type, 30extern int acpi_video_get_edid(struct acpi_device *device, int type,
23 int device_id, void **edid); 31 int device_id, void **edid);
24#else 32#else
25static inline int acpi_video_register(void) { return 0; } 33static inline int acpi_video_register(void) { return 0; }
34static inline int acpi_video_register_with_quirks(void) { return 0; }
26static inline void acpi_video_unregister(void) { return; } 35static inline void acpi_video_unregister(void) { return; }
27static inline int acpi_video_get_edid(struct acpi_device *device, int type, 36static inline int acpi_video_get_edid(struct acpi_device *device, int type,
28 int device_id, void **edid) 37 int device_id, void **edid)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 63d17ee9eb48..12083dc862a9 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -55,16 +55,13 @@
55#include <linux/mm.h> 55#include <linux/mm.h>
56#include <linux/cdev.h> 56#include <linux/cdev.h>
57#include <linux/mutex.h> 57#include <linux/mutex.h>
58#include <linux/io.h>
58#include <linux/slab.h> 59#include <linux/slab.h>
59#if defined(__alpha__) || defined(__powerpc__) 60#if defined(__alpha__) || defined(__powerpc__)
60#include <asm/pgtable.h> /* For pte_wrprotect */ 61#include <asm/pgtable.h> /* For pte_wrprotect */
61#endif 62#endif
62#include <asm/io.h>
63#include <asm/mman.h> 63#include <asm/mman.h>
64#include <asm/uaccess.h> 64#include <asm/uaccess.h>
65#ifdef CONFIG_MTRR
66#include <asm/mtrr.h>
67#endif
68#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) 65#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
69#include <linux/types.h> 66#include <linux/types.h>
70#include <linux/agp_backend.h> 67#include <linux/agp_backend.h>
@@ -933,12 +930,15 @@ struct drm_driver {
933 struct dma_buf *dma_buf); 930 struct dma_buf *dma_buf);
934 /* low-level interface used by drm_gem_prime_{import,export} */ 931 /* low-level interface used by drm_gem_prime_{import,export} */
935 int (*gem_prime_pin)(struct drm_gem_object *obj); 932 int (*gem_prime_pin)(struct drm_gem_object *obj);
933 void (*gem_prime_unpin)(struct drm_gem_object *obj);
936 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); 934 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
937 struct drm_gem_object *(*gem_prime_import_sg_table)( 935 struct drm_gem_object *(*gem_prime_import_sg_table)(
938 struct drm_device *dev, size_t size, 936 struct drm_device *dev, size_t size,
939 struct sg_table *sgt); 937 struct sg_table *sgt);
940 void *(*gem_prime_vmap)(struct drm_gem_object *obj); 938 void *(*gem_prime_vmap)(struct drm_gem_object *obj);
941 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); 939 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
940 int (*gem_prime_mmap)(struct drm_gem_object *obj,
941 struct vm_area_struct *vma);
942 942
943 /* vga arb irq handler */ 943 /* vga arb irq handler */
944 void (*vgaarb_irq)(struct drm_device *dev, bool state); 944 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1250,37 +1250,8 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
1250{ 1250{
1251 return drm_core_check_feature(dev, DRIVER_USE_MTRR); 1251 return drm_core_check_feature(dev, DRIVER_USE_MTRR);
1252} 1252}
1253
1254#define DRM_MTRR_WC MTRR_TYPE_WRCOMB
1255
1256static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
1257 unsigned int flags)
1258{
1259 return mtrr_add(offset, size, flags, 1);
1260}
1261
1262static inline int drm_mtrr_del(int handle, unsigned long offset,
1263 unsigned long size, unsigned int flags)
1264{
1265 return mtrr_del(handle, offset, size);
1266}
1267
1268#else 1253#else
1269#define drm_core_has_MTRR(dev) (0) 1254#define drm_core_has_MTRR(dev) (0)
1270
1271#define DRM_MTRR_WC 0
1272
1273static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
1274 unsigned int flags)
1275{
1276 return 0;
1277}
1278
1279static inline int drm_mtrr_del(int handle, unsigned long offset,
1280 unsigned long size, unsigned int flags)
1281{
1282 return 0;
1283}
1284#endif 1255#endif
1285 1256
1286static inline void drm_device_set_unplugged(struct drm_device *dev) 1257static inline void drm_device_set_unplugged(struct drm_device *dev)
@@ -1630,7 +1601,6 @@ extern void drm_sysfs_destroy(void);
1630extern int drm_sysfs_device_add(struct drm_minor *minor); 1601extern int drm_sysfs_device_add(struct drm_minor *minor);
1631extern void drm_sysfs_hotplug_event(struct drm_device *dev); 1602extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1632extern void drm_sysfs_device_remove(struct drm_minor *minor); 1603extern void drm_sysfs_device_remove(struct drm_minor *minor);
1633extern char *drm_get_connector_status_name(enum drm_connector_status status);
1634extern int drm_sysfs_connector_add(struct drm_connector *connector); 1604extern int drm_sysfs_connector_add(struct drm_connector *connector);
1635extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1605extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1636 1606
@@ -1648,6 +1618,8 @@ int drm_gem_private_object_init(struct drm_device *dev,
1648void drm_gem_object_handle_free(struct drm_gem_object *obj); 1618void drm_gem_object_handle_free(struct drm_gem_object *obj);
1649void drm_gem_vm_open(struct vm_area_struct *vma); 1619void drm_gem_vm_open(struct vm_area_struct *vma);
1650void drm_gem_vm_close(struct vm_area_struct *vma); 1620void drm_gem_vm_close(struct vm_area_struct *vma);
1621int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
1622 struct vm_area_struct *vma);
1651int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1623int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1652 1624
1653#include <drm/drm_global.h> 1625#include <drm/drm_global.h>
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b625f6..fa12a2fa4293 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -339,6 +339,9 @@ struct drm_crtc_funcs {
339 /* cursor controls */ 339 /* cursor controls */
340 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 340 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
341 uint32_t handle, uint32_t width, uint32_t height); 341 uint32_t handle, uint32_t width, uint32_t height);
342 int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv,
343 uint32_t handle, uint32_t width, uint32_t height,
344 int32_t hot_x, int32_t hot_y);
342 int (*cursor_move)(struct drm_crtc *crtc, int x, int y); 345 int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
343 346
344 /* Set gamma on the CRTC */ 347 /* Set gamma on the CRTC */
@@ -409,6 +412,10 @@ struct drm_crtc {
409 /* framebuffer the connector is currently bound to */ 412 /* framebuffer the connector is currently bound to */
410 struct drm_framebuffer *fb; 413 struct drm_framebuffer *fb;
411 414
415 /* Temporary tracking of the old fb while a modeset is ongoing. Used
416 * by drm_mode_set_config_internal to implement correct refcounting. */
417 struct drm_framebuffer *old_fb;
418
412 bool enabled; 419 bool enabled;
413 420
414 /* Requested mode from modesetting. */ 421 /* Requested mode from modesetting. */
@@ -654,11 +661,7 @@ struct drm_plane_funcs {
654 * @format_count: number of formats supported 661 * @format_count: number of formats supported
655 * @crtc: currently bound CRTC 662 * @crtc: currently bound CRTC
656 * @fb: currently bound fb 663 * @fb: currently bound fb
657 * @gamma_size: size of gamma table
658 * @gamma_store: gamma correction table
659 * @enabled: enabled flag
660 * @funcs: helper functions 664 * @funcs: helper functions
661 * @helper_private: storage for drver layer
662 * @properties: property tracking for this plane 665 * @properties: property tracking for this plane
663 */ 666 */
664struct drm_plane { 667struct drm_plane {
@@ -674,14 +677,7 @@ struct drm_plane {
674 struct drm_crtc *crtc; 677 struct drm_crtc *crtc;
675 struct drm_framebuffer *fb; 678 struct drm_framebuffer *fb;
676 679
677 /* CRTC gamma size for reporting to userspace */
678 uint32_t gamma_size;
679 uint16_t *gamma_store;
680
681 bool enabled;
682
683 const struct drm_plane_funcs *funcs; 680 const struct drm_plane_funcs *funcs;
684 void *helper_private;
685 681
686 struct drm_object_properties properties; 682 struct drm_object_properties properties;
687}; 683};
@@ -894,15 +890,17 @@ extern int drm_plane_init(struct drm_device *dev,
894 const uint32_t *formats, uint32_t format_count, 890 const uint32_t *formats, uint32_t format_count,
895 bool priv); 891 bool priv);
896extern void drm_plane_cleanup(struct drm_plane *plane); 892extern void drm_plane_cleanup(struct drm_plane *plane);
893extern void drm_plane_force_disable(struct drm_plane *plane);
897 894
898extern void drm_encoder_cleanup(struct drm_encoder *encoder); 895extern void drm_encoder_cleanup(struct drm_encoder *encoder);
899 896
900extern char *drm_get_connector_name(struct drm_connector *connector); 897extern const char *drm_get_connector_name(const struct drm_connector *connector);
901extern char *drm_get_dpms_name(int val); 898extern const char *drm_get_connector_status_name(enum drm_connector_status status);
902extern char *drm_get_dvi_i_subconnector_name(int val); 899extern const char *drm_get_dpms_name(int val);
903extern char *drm_get_dvi_i_select_name(int val); 900extern const char *drm_get_dvi_i_subconnector_name(int val);
904extern char *drm_get_tv_subconnector_name(int val); 901extern const char *drm_get_dvi_i_select_name(int val);
905extern char *drm_get_tv_select_name(int val); 902extern const char *drm_get_tv_subconnector_name(int val);
903extern const char *drm_get_tv_select_name(int val);
906extern void drm_fb_release(struct drm_file *file_priv); 904extern void drm_fb_release(struct drm_file *file_priv);
907extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 905extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
908extern bool drm_probe_ddc(struct i2c_adapter *adapter); 906extern bool drm_probe_ddc(struct i2c_adapter *adapter);
@@ -994,7 +992,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
994extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 992extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
995extern int drm_mode_create_dithering_property(struct drm_device *dev); 993extern int drm_mode_create_dithering_property(struct drm_device *dev);
996extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 994extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
997extern char *drm_get_encoder_name(struct drm_encoder *encoder); 995extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
998 996
999extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 997extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1000 struct drm_encoder *encoder); 998 struct drm_encoder *encoder);
@@ -1022,6 +1020,8 @@ extern int drm_mode_setplane(struct drm_device *dev,
1022 void *data, struct drm_file *file_priv); 1020 void *data, struct drm_file *file_priv);
1023extern int drm_mode_cursor_ioctl(struct drm_device *dev, 1021extern int drm_mode_cursor_ioctl(struct drm_device *dev,
1024 void *data, struct drm_file *file_priv); 1022 void *data, struct drm_file *file_priv);
1023extern int drm_mode_cursor2_ioctl(struct drm_device *dev,
1024 void *data, struct drm_file *file_priv);
1025extern int drm_mode_addfb(struct drm_device *dev, 1025extern int drm_mode_addfb(struct drm_device *dev,
1026 void *data, struct drm_file *file_priv); 1026 void *data, struct drm_file *file_priv);
1027extern int drm_mode_addfb2(struct drm_device *dev, 1027extern int drm_mode_addfb2(struct drm_device *dev,
@@ -1094,5 +1094,6 @@ extern int drm_format_num_planes(uint32_t format);
1094extern int drm_format_plane_cpp(uint32_t format, int plane); 1094extern int drm_format_plane_cpp(uint32_t format, int plane);
1095extern int drm_format_horz_chroma_subsampling(uint32_t format); 1095extern int drm_format_horz_chroma_subsampling(uint32_t format);
1096extern int drm_format_vert_chroma_subsampling(uint32_t format); 1096extern int drm_format_vert_chroma_subsampling(uint32_t format);
1097extern const char *drm_get_format_name(uint32_t format);
1097 1098
1098#endif /* __DRM_CRTC_H__ */ 1099#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 0ead502e17d2..f5e1168c7647 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -20,10 +20,13 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Dave Airlie 22 * Authors: Dave Airlie
23 * Christian König
23 */ 24 */
24#ifndef DRM_FIXED_H 25#ifndef DRM_FIXED_H
25#define DRM_FIXED_H 26#define DRM_FIXED_H
26 27
28#include <linux/math64.h>
29
27typedef union dfixed { 30typedef union dfixed {
28 u32 full; 31 u32 full;
29} fixed20_12; 32} fixed20_12;
@@ -65,4 +68,95 @@ static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
65 tmp /= 2; 68 tmp /= 2;
66 return lower_32_bits(tmp); 69 return lower_32_bits(tmp);
67} 70}
71
72#define DRM_FIXED_POINT 32
73#define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)
74#define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)
75#define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK)
76
77static inline s64 drm_int2fixp(int a)
78{
79 return ((s64)a) << DRM_FIXED_POINT;
80}
81
82static inline int drm_fixp2int(int64_t a)
83{
84 return ((s64)a) >> DRM_FIXED_POINT;
85}
86
87static inline s64 drm_fixp_msbset(int64_t a)
88{
89 unsigned shift, sign = (a >> 63) & 1;
90
91 for (shift = 62; shift > 0; --shift)
92 if ((a >> shift) != sign)
93 return shift;
94
95 return 0;
96}
97
98static inline s64 drm_fixp_mul(s64 a, s64 b)
99{
100 unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b);
101 s64 result;
102
103 if (shift > 63) {
104 shift = shift - 63;
105 a >>= shift >> 1;
106 b >>= shift >> 1;
107 } else
108 shift = 0;
109
110 result = a * b;
111
112 if (shift > DRM_FIXED_POINT)
113 return result << (shift - DRM_FIXED_POINT);
114
115 if (shift < DRM_FIXED_POINT)
116 return result >> (DRM_FIXED_POINT - shift);
117
118 return result;
119}
120
121static inline s64 drm_fixp_div(s64 a, s64 b)
122{
123 unsigned shift = 63 - drm_fixp_msbset(a);
124 s64 result;
125
126 a <<= shift;
127
128 if (shift < DRM_FIXED_POINT)
129 b >>= (DRM_FIXED_POINT - shift);
130
131 result = div64_s64(a, b);
132
133 if (shift > DRM_FIXED_POINT)
134 return result >> (shift - DRM_FIXED_POINT);
135
136 return result;
137}
138
139static inline s64 drm_fixp_exp(s64 x)
140{
141 s64 tolerance = div64_s64(DRM_FIXED_ONE, 1000000);
142 s64 sum = DRM_FIXED_ONE, term, y = x;
143 u64 count = 1;
144
145 if (x < 0)
146 y = -1 * x;
147
148 term = y;
149
150 while (term >= tolerance) {
151 sum = sum + term;
152 count = count + 1;
153 term = drm_fixp_mul(term, div64_s64(y, count));
154 }
155
156 if (x < 0)
157 sum = drm_fixp_div(1, sum);
158
159 return sum;
160}
161
68#endif 162#endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 63397ced9254..c34f27f80bcc 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -4,6 +4,9 @@
4struct drm_gem_cma_object { 4struct drm_gem_cma_object {
5 struct drm_gem_object base; 5 struct drm_gem_object base;
6 dma_addr_t paddr; 6 dma_addr_t paddr;
7 struct sg_table *sgt;
8
9 /* For objects with DMA memory allocated by GEM CMA */
7 void *vaddr; 10 void *vaddr;
8}; 11};
9 12
@@ -45,4 +48,13 @@ extern const struct vm_operations_struct drm_gem_cma_vm_ops;
45void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); 48void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
46#endif 49#endif
47 50
51struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj);
52struct drm_gem_object *
53drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size,
54 struct sg_table *sgt);
55int drm_gem_cma_prime_mmap(struct drm_gem_object *obj,
56 struct vm_area_struct *vma);
57void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj);
58void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
59
48#endif /* __DRM_GEM_CMA_HELPER_H__ */ 60#endif /* __DRM_GEM_CMA_HELPER_H__ */
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 88591ef8fa24..4d06edb56d5f 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -177,17 +177,6 @@ static inline struct drm_mm_node *drm_mm_get_block_range(
177 return drm_mm_get_block_range_generic(parent, size, alignment, 0, 177 return drm_mm_get_block_range_generic(parent, size, alignment, 0,
178 start, end, 0); 178 start, end, 0);
179} 179}
180static inline struct drm_mm_node *drm_mm_get_color_block_range(
181 struct drm_mm_node *parent,
182 unsigned long size,
183 unsigned alignment,
184 unsigned long color,
185 unsigned long start,
186 unsigned long end)
187{
188 return drm_mm_get_block_range_generic(parent, size, alignment, color,
189 start, end, 0);
190}
191static inline struct drm_mm_node *drm_mm_get_block_atomic_range( 180static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
192 struct drm_mm_node *parent, 181 struct drm_mm_node *parent,
193 unsigned long size, 182 unsigned long size,
@@ -255,29 +244,10 @@ static inline struct drm_mm_node *drm_mm_search_free_in_range(
255 return drm_mm_search_free_in_range_generic(mm, size, alignment, 0, 244 return drm_mm_search_free_in_range_generic(mm, size, alignment, 0,
256 start, end, best_match); 245 start, end, best_match);
257} 246}
258static inline struct drm_mm_node *drm_mm_search_free_color(const struct drm_mm *mm, 247
259 unsigned long size, 248extern void drm_mm_init(struct drm_mm *mm,
260 unsigned alignment, 249 unsigned long start,
261 unsigned long color, 250 unsigned long size);
262 bool best_match)
263{
264 return drm_mm_search_free_generic(mm,size, alignment, color, best_match);
265}
266static inline struct drm_mm_node *drm_mm_search_free_in_range_color(
267 const struct drm_mm *mm,
268 unsigned long size,
269 unsigned alignment,
270 unsigned long color,
271 unsigned long start,
272 unsigned long end,
273 bool best_match)
274{
275 return drm_mm_search_free_in_range_generic(mm, size, alignment, color,
276 start, end, best_match);
277}
278extern int drm_mm_init(struct drm_mm *mm,
279 unsigned long start,
280 unsigned long size);
281extern void drm_mm_takedown(struct drm_mm *mm); 251extern void drm_mm_takedown(struct drm_mm *mm);
282extern int drm_mm_clean(struct drm_mm *mm); 252extern int drm_mm_clean(struct drm_mm *mm);
283extern int drm_mm_pre_get(struct drm_mm *mm); 253extern int drm_mm_pre_get(struct drm_mm *mm);
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 675ddf4b441f..815fafc6b4ad 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -65,22 +65,6 @@ struct no_agp_kern {
65#define DRM_AGP_KERN struct no_agp_kern 65#define DRM_AGP_KERN struct no_agp_kern
66#endif 66#endif
67 67
68#if !(__OS_HAS_MTRR)
69static __inline__ int mtrr_add(unsigned long base, unsigned long size,
70 unsigned int type, char increment)
71{
72 return -ENODEV;
73}
74
75static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
76{
77 return -ENODEV;
78}
79
80#define MTRR_TYPE_WRCOMB 1
81
82#endif
83
84/** Other copying of data to kernel space */ 68/** Other copying of data to kernel space */
85#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ 69#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
86 copy_from_user(arg1, arg2, arg3) 70 copy_from_user(arg1, arg2, arg3)
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index bb1bc485390b..34efaf64cc87 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -152,6 +152,14 @@
152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 163 {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 164 {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 165 {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -580,6 +588,22 @@
580 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 588 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
581 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 589 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
582 {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 590 {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
591 {0x1002, 0x9830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
592 {0x1002, 0x9831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
593 {0x1002, 0x9832, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
594 {0x1002, 0x9833, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
595 {0x1002, 0x9834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
596 {0x1002, 0x9835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
597 {0x1002, 0x9836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
598 {0x1002, 0x9837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
599 {0x1002, 0x9838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
600 {0x1002, 0x9839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
601 {0x1002, 0x983a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
602 {0x1002, 0x983b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
603 {0x1002, 0x983c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
604 {0x1002, 0x983d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
605 {0x1002, 0x983e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
606 {0x1002, 0x983f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
583 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 607 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
584 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 608 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
585 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 609 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
new file mode 100644
index 000000000000..d1286297567b
--- /dev/null
+++ b/include/drm/drm_rect.h
@@ -0,0 +1,167 @@
1/*
2 * Copyright (C) 2011-2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24#ifndef DRM_RECT_H
25#define DRM_RECT_H
26
27/**
28 * DOC: rect utils
29 *
30 * Utility functions to help manage rectangular areas for
31 * clipping, scaling, etc. calculations.
32 */
33
34/**
35 * struct drm_rect - two dimensional rectangle
36 * @x1: horizontal starting coordinate (inclusive)
37 * @x2: horizontal ending coordinate (exclusive)
38 * @y1: vertical starting coordinate (inclusive)
39 * @y2: vertical ending coordinate (exclusive)
40 */
41struct drm_rect {
42 int x1, y1, x2, y2;
43};
44
45/**
46 * drm_rect_adjust_size - adjust the size of the rectangle
47 * @r: rectangle to be adjusted
48 * @dw: horizontal adjustment
49 * @dh: vertical adjustment
50 *
51 * Change the size of rectangle @r by @dw in the horizontal direction,
52 * and by @dh in the vertical direction, while keeping the center
53 * of @r stationary.
54 *
55 * Positive @dw and @dh increase the size, negative values decrease it.
56 */
57static inline void drm_rect_adjust_size(struct drm_rect *r, int dw, int dh)
58{
59 r->x1 -= dw >> 1;
60 r->y1 -= dh >> 1;
61 r->x2 += (dw + 1) >> 1;
62 r->y2 += (dh + 1) >> 1;
63}
64
65/**
66 * drm_rect_translate - translate the rectangle
67 * @r: rectangle to be tranlated
68 * @dx: horizontal translation
69 * @dy: vertical translation
70 *
71 * Move rectangle @r by @dx in the horizontal direction,
72 * and by @dy in the vertical direction.
73 */
74static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy)
75{
76 r->x1 += dx;
77 r->y1 += dy;
78 r->x2 += dx;
79 r->y2 += dy;
80}
81
82/**
83 * drm_rect_downscale - downscale a rectangle
84 * @r: rectangle to be downscaled
85 * @horz: horizontal downscale factor
86 * @vert: vertical downscale factor
87 *
88 * Divide the coordinates of rectangle @r by @horz and @vert.
89 */
90static inline void drm_rect_downscale(struct drm_rect *r, int horz, int vert)
91{
92 r->x1 /= horz;
93 r->y1 /= vert;
94 r->x2 /= horz;
95 r->y2 /= vert;
96}
97
98/**
99 * drm_rect_width - determine the rectangle width
100 * @r: rectangle whose width is returned
101 *
102 * RETURNS:
103 * The width of the rectangle.
104 */
105static inline int drm_rect_width(const struct drm_rect *r)
106{
107 return r->x2 - r->x1;
108}
109
110/**
111 * drm_rect_height - determine the rectangle height
112 * @r: rectangle whose height is returned
113 *
114 * RETURNS:
115 * The height of the rectangle.
116 */
117static inline int drm_rect_height(const struct drm_rect *r)
118{
119 return r->y2 - r->y1;
120}
121
122/**
123 * drm_rect_visible - determine if the the rectangle is visible
124 * @r: rectangle whose visibility is returned
125 *
126 * RETURNS:
127 * %true if the rectangle is visible, %false otherwise.
128 */
129static inline bool drm_rect_visible(const struct drm_rect *r)
130{
131 return drm_rect_width(r) > 0 && drm_rect_height(r) > 0;
132}
133
134/**
135 * drm_rect_equals - determine if two rectangles are equal
136 * @r1: first rectangle
137 * @r2: second rectangle
138 *
139 * RETURNS:
140 * %true if the rectangles are equal, %false otherwise.
141 */
142static inline bool drm_rect_equals(const struct drm_rect *r1,
143 const struct drm_rect *r2)
144{
145 return r1->x1 == r2->x1 && r1->x2 == r2->x2 &&
146 r1->y1 == r2->y1 && r1->y2 == r2->y2;
147}
148
149bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip);
150bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
151 const struct drm_rect *clip,
152 int hscale, int vscale);
153int drm_rect_calc_hscale(const struct drm_rect *src,
154 const struct drm_rect *dst,
155 int min_hscale, int max_hscale);
156int drm_rect_calc_vscale(const struct drm_rect *src,
157 const struct drm_rect *dst,
158 int min_vscale, int max_vscale);
159int drm_rect_calc_hscale_relaxed(struct drm_rect *src,
160 struct drm_rect *dst,
161 int min_hscale, int max_hscale);
162int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
163 struct drm_rect *dst,
164 int min_vscale, int max_vscale);
165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
166
167#endif
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h
new file mode 100644
index 000000000000..cfdc884405b7
--- /dev/null
+++ b/include/drm/i915_powerwell.h
@@ -0,0 +1,36 @@
1/**************************************************************************
2 *
3 * Copyright 2013 Intel Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28
29#ifndef _I915_POWERWELL_H_
30#define _I915_POWERWELL_H_
31
32/* For use by hda_i915 driver */
33extern void i915_request_power_well(void);
34extern void i915_release_power_well(void);
35
36#endif /* _I915_POWERWELL_H_ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 3cb5d848fb66..8a6aa56ece52 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -39,6 +39,7 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/rbtree.h> 40#include <linux/rbtree.h>
41#include <linux/bitmap.h> 41#include <linux/bitmap.h>
42#include <linux/reservation.h>
42 43
43struct ttm_bo_device; 44struct ttm_bo_device;
44 45
@@ -153,7 +154,6 @@ struct ttm_tt;
153 * Lru lists may keep one refcount, the delayed delete list, and kref != 0 154 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
154 * keeps one refcount. When this refcount reaches zero, 155 * keeps one refcount. When this refcount reaches zero,
155 * the object is destroyed. 156 * the object is destroyed.
156 * @event_queue: Queue for processes waiting on buffer object status change.
157 * @mem: structure describing current placement. 157 * @mem: structure describing current placement.
158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers 158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
159 * pinned in physical memory. If this behaviour is not desired, this member 159 * pinned in physical memory. If this behaviour is not desired, this member
@@ -164,12 +164,6 @@ struct ttm_tt;
164 * @lru: List head for the lru list. 164 * @lru: List head for the lru list.
165 * @ddestroy: List head for the delayed destroy list. 165 * @ddestroy: List head for the delayed destroy list.
166 * @swap: List head for swap LRU list. 166 * @swap: List head for swap LRU list.
167 * @val_seq: Sequence of the validation holding the @reserved lock.
168 * Used to avoid starvation when many processes compete to validate the
169 * buffer. This member is protected by the bo_device::lru_lock.
170 * @seq_valid: The value of @val_seq is valid. This value is protected by
171 * the bo_device::lru_lock.
172 * @reserved: Deadlock-free lock used for synchronization state transitions.
173 * @sync_obj: Pointer to a synchronization object. 167 * @sync_obj: Pointer to a synchronization object.
174 * @priv_flags: Flags describing buffer object internal state. 168 * @priv_flags: Flags describing buffer object internal state.
175 * @vm_rb: Rb node for the vm rb tree. 169 * @vm_rb: Rb node for the vm rb tree.
@@ -209,10 +203,9 @@ struct ttm_buffer_object {
209 203
210 struct kref kref; 204 struct kref kref;
211 struct kref list_kref; 205 struct kref list_kref;
212 wait_queue_head_t event_queue;
213 206
214 /** 207 /**
215 * Members protected by the bo::reserved lock. 208 * Members protected by the bo::resv::reserved lock.
216 */ 209 */
217 210
218 struct ttm_mem_reg mem; 211 struct ttm_mem_reg mem;
@@ -234,15 +227,6 @@ struct ttm_buffer_object {
234 struct list_head ddestroy; 227 struct list_head ddestroy;
235 struct list_head swap; 228 struct list_head swap;
236 struct list_head io_reserve_lru; 229 struct list_head io_reserve_lru;
237 uint32_t val_seq;
238 bool seq_valid;
239
240 /**
241 * Members protected by the bdev::lru_lock
242 * only when written to.
243 */
244
245 atomic_t reserved;
246 230
247 /** 231 /**
248 * Members protected by struct buffer_object_device::fence_lock 232 * Members protected by struct buffer_object_device::fence_lock
@@ -272,6 +256,9 @@ struct ttm_buffer_object {
272 uint32_t cur_placement; 256 uint32_t cur_placement;
273 257
274 struct sg_table *sg; 258 struct sg_table *sg;
259
260 struct reservation_object *resv;
261 struct reservation_object ttm_resv;
275}; 262};
276 263
277/** 264/**
@@ -725,18 +712,4 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
725 712
726extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); 713extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
727 714
728/**
729 * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved
730 *
731 * @bo: The buffer object to check.
732 *
733 * This function returns an indication if a bo is reserved or not, and should
734 * only be used to print an error when it is not from incorrect api usage, since
735 * there's no guarantee that it is the caller that is holding the reservation.
736 */
737static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo)
738{
739 return atomic_read(&bo->reserved);
740}
741
742#endif 715#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 9c8dca79808e..984fc2d571a1 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -33,11 +33,13 @@
33#include <ttm/ttm_bo_api.h> 33#include <ttm/ttm_bo_api.h>
34#include <ttm/ttm_memory.h> 34#include <ttm/ttm_memory.h>
35#include <ttm/ttm_module.h> 35#include <ttm/ttm_module.h>
36#include <ttm/ttm_placement.h>
36#include <drm/drm_mm.h> 37#include <drm/drm_mm.h>
37#include <drm/drm_global.h> 38#include <drm/drm_global.h>
38#include <linux/workqueue.h> 39#include <linux/workqueue.h>
39#include <linux/fs.h> 40#include <linux/fs.h>
40#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#include <linux/reservation.h>
41 43
42struct ttm_backend_func { 44struct ttm_backend_func {
43 /** 45 /**
@@ -771,6 +773,55 @@ extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man,
771 bool interruptible); 773 bool interruptible);
772extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); 774extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
773 775
776extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo);
777extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
778
779/**
780 * ttm_bo_reserve_nolru:
781 *
782 * @bo: A pointer to a struct ttm_buffer_object.
783 * @interruptible: Sleep interruptible if waiting.
784 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
785 * @use_ticket: If @bo is already reserved, Only sleep waiting for
786 * it to become unreserved if @ticket->stamp is older.
787 *
788 * Will not remove reserved buffers from the lru lists.
789 * Otherwise identical to ttm_bo_reserve.
790 *
791 * Returns:
792 * -EDEADLK: The reservation may cause a deadlock.
793 * Release all buffer reservations, wait for @bo to become unreserved and
794 * try again. (only if use_sequence == 1).
795 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
796 * a signal. Release all buffer reservations and return to user-space.
797 * -EBUSY: The function needed to sleep, but @no_wait was true
798 * -EALREADY: Bo already reserved using @ticket. This error code will only
799 * be returned if @use_ticket is set to true.
800 */
801static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
802 bool interruptible,
803 bool no_wait, bool use_ticket,
804 struct ww_acquire_ctx *ticket)
805{
806 int ret = 0;
807
808 if (no_wait) {
809 bool success;
810 if (WARN_ON(ticket))
811 return -EBUSY;
812
813 success = ww_mutex_trylock(&bo->resv->lock);
814 return success ? 0 : -EBUSY;
815 }
816
817 if (interruptible)
818 ret = ww_mutex_lock_interruptible(&bo->resv->lock, ticket);
819 else
820 ret = ww_mutex_lock(&bo->resv->lock, ticket);
821 if (ret == -EINTR)
822 return -ERESTARTSYS;
823 return ret;
824}
774 825
775/** 826/**
776 * ttm_bo_reserve: 827 * ttm_bo_reserve:
@@ -778,8 +829,8 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
778 * @bo: A pointer to a struct ttm_buffer_object. 829 * @bo: A pointer to a struct ttm_buffer_object.
779 * @interruptible: Sleep interruptible if waiting. 830 * @interruptible: Sleep interruptible if waiting.
780 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. 831 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
781 * @use_sequence: If @bo is already reserved, Only sleep waiting for 832 * @use_ticket: If @bo is already reserved, Only sleep waiting for
782 * it to become unreserved if @sequence < (@bo)->sequence. 833 * it to become unreserved if @ticket->stamp is older.
783 * 834 *
784 * Locks a buffer object for validation. (Or prevents other processes from 835 * Locks a buffer object for validation. (Or prevents other processes from
785 * locking it for validation) and removes it from lru lists, while taking 836 * locking it for validation) and removes it from lru lists, while taking
@@ -793,7 +844,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
793 * Processes attempting to reserve multiple buffers other than for eviction, 844 * Processes attempting to reserve multiple buffers other than for eviction,
794 * (typically execbuf), should first obtain a unique 32-bit 845 * (typically execbuf), should first obtain a unique 32-bit
795 * validation sequence number, 846 * validation sequence number,
796 * and call this function with @use_sequence == 1 and @sequence == the unique 847 * and call this function with @use_ticket == 1 and @ticket->stamp == the unique
797 * sequence number. If upon call of this function, the buffer object is already 848 * sequence number. If upon call of this function, the buffer object is already
798 * reserved, the validation sequence is checked against the validation 849 * reserved, the validation sequence is checked against the validation
799 * sequence of the process currently reserving the buffer, 850 * sequence of the process currently reserving the buffer,
@@ -808,36 +859,31 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
808 * will eventually succeed, preventing both deadlocks and starvation. 859 * will eventually succeed, preventing both deadlocks and starvation.
809 * 860 *
810 * Returns: 861 * Returns:
811 * -EAGAIN: The reservation may cause a deadlock. 862 * -EDEADLK: The reservation may cause a deadlock.
812 * Release all buffer reservations, wait for @bo to become unreserved and 863 * Release all buffer reservations, wait for @bo to become unreserved and
813 * try again. (only if use_sequence == 1). 864 * try again. (only if use_sequence == 1).
814 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by 865 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
815 * a signal. Release all buffer reservations and return to user-space. 866 * a signal. Release all buffer reservations and return to user-space.
816 * -EBUSY: The function needed to sleep, but @no_wait was true 867 * -EBUSY: The function needed to sleep, but @no_wait was true
817 * -EDEADLK: Bo already reserved using @sequence. This error code will only 868 * -EALREADY: Bo already reserved using @ticket. This error code will only
818 * be returned if @use_sequence is set to true. 869 * be returned if @use_ticket is set to true.
819 */ 870 */
820extern int ttm_bo_reserve(struct ttm_buffer_object *bo, 871static inline int ttm_bo_reserve(struct ttm_buffer_object *bo,
821 bool interruptible, 872 bool interruptible,
822 bool no_wait, bool use_sequence, uint32_t sequence); 873 bool no_wait, bool use_ticket,
874 struct ww_acquire_ctx *ticket)
875{
876 int ret;
823 877
824/** 878 WARN_ON(!atomic_read(&bo->kref.refcount));
825 * ttm_bo_reserve_slowpath_nolru:
826 * @bo: A pointer to a struct ttm_buffer_object.
827 * @interruptible: Sleep interruptible if waiting.
828 * @sequence: Set (@bo)->sequence to this value after lock
829 *
830 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
831 * from all our other reservations. Because there are no other reservations
832 * held by us, this function cannot deadlock any more.
833 *
834 * Will not remove reserved buffers from the lru lists.
835 * Otherwise identical to ttm_bo_reserve_slowpath.
836 */
837extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
838 bool interruptible,
839 uint32_t sequence);
840 879
880 ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket,
881 ticket);
882 if (likely(ret == 0))
883 ttm_bo_del_sub_from_lru(bo);
884
885 return ret;
886}
841 887
842/** 888/**
843 * ttm_bo_reserve_slowpath: 889 * ttm_bo_reserve_slowpath:
@@ -849,54 +895,57 @@ extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
849 * from all our other reservations. Because there are no other reservations 895 * from all our other reservations. Because there are no other reservations
850 * held by us, this function cannot deadlock any more. 896 * held by us, this function cannot deadlock any more.
851 */ 897 */
852extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, 898static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
853 bool interruptible, uint32_t sequence); 899 bool interruptible,
900 struct ww_acquire_ctx *ticket)
901{
902 int ret = 0;
854 903
855/** 904 WARN_ON(!atomic_read(&bo->kref.refcount));
856 * ttm_bo_reserve_nolru: 905
857 * 906 if (interruptible)
858 * @bo: A pointer to a struct ttm_buffer_object. 907 ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
859 * @interruptible: Sleep interruptible if waiting. 908 ticket);
860 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. 909 else
861 * @use_sequence: If @bo is already reserved, Only sleep waiting for 910 ww_mutex_lock_slow(&bo->resv->lock, ticket);
862 * it to become unreserved if @sequence < (@bo)->sequence. 911
863 * 912 if (likely(ret == 0))
864 * Will not remove reserved buffers from the lru lists. 913 ttm_bo_del_sub_from_lru(bo);
865 * Otherwise identical to ttm_bo_reserve. 914 else if (ret == -EINTR)
866 * 915 ret = -ERESTARTSYS;
867 * Returns: 916
868 * -EAGAIN: The reservation may cause a deadlock. 917 return ret;
869 * Release all buffer reservations, wait for @bo to become unreserved and 918}
870 * try again. (only if use_sequence == 1).
871 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
872 * a signal. Release all buffer reservations and return to user-space.
873 * -EBUSY: The function needed to sleep, but @no_wait was true
874 * -EDEADLK: Bo already reserved using @sequence. This error code will only
875 * be returned if @use_sequence is set to true.
876 */
877extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
878 bool interruptible,
879 bool no_wait, bool use_sequence,
880 uint32_t sequence);
881 919
882/** 920/**
883 * ttm_bo_unreserve 921 * ttm_bo_unreserve_ticket
884 *
885 * @bo: A pointer to a struct ttm_buffer_object. 922 * @bo: A pointer to a struct ttm_buffer_object.
923 * @ticket: ww_acquire_ctx used for reserving
886 * 924 *
887 * Unreserve a previous reservation of @bo. 925 * Unreserve a previous reservation of @bo made with @ticket.
888 */ 926 */
889extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); 927static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
928 struct ww_acquire_ctx *t)
929{
930 if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
931 spin_lock(&bo->glob->lru_lock);
932 ttm_bo_add_to_lru(bo);
933 spin_unlock(&bo->glob->lru_lock);
934 }
935 ww_mutex_unlock(&bo->resv->lock);
936}
890 937
891/** 938/**
892 * ttm_bo_unreserve_locked 939 * ttm_bo_unreserve
893 * 940 *
894 * @bo: A pointer to a struct ttm_buffer_object. 941 * @bo: A pointer to a struct ttm_buffer_object.
895 * 942 *
896 * Unreserve a previous reservation of @bo. 943 * Unreserve a previous reservation of @bo.
897 * Needs to be called with struct ttm_bo_global::lru_lock held.
898 */ 944 */
899extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); 945static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
946{
947 ttm_bo_unreserve_ticket(bo, NULL);
948}
900 949
901/* 950/*
902 * ttm_bo_util.c 951 * ttm_bo_util.c
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 547e19f06e57..ec8a1d306510 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -57,17 +57,20 @@ struct ttm_validate_buffer {
57/** 57/**
58 * function ttm_eu_backoff_reservation 58 * function ttm_eu_backoff_reservation
59 * 59 *
60 * @ticket: ww_acquire_ctx from reserve call
60 * @list: thread private list of ttm_validate_buffer structs. 61 * @list: thread private list of ttm_validate_buffer structs.
61 * 62 *
62 * Undoes all buffer validation reservations for bos pointed to by 63 * Undoes all buffer validation reservations for bos pointed to by
63 * the list entries. 64 * the list entries.
64 */ 65 */
65 66
66extern void ttm_eu_backoff_reservation(struct list_head *list); 67extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
68 struct list_head *list);
67 69
68/** 70/**
69 * function ttm_eu_reserve_buffers 71 * function ttm_eu_reserve_buffers
70 * 72 *
73 * @ticket: [out] ww_acquire_ctx returned by call.
71 * @list: thread private list of ttm_validate_buffer structs. 74 * @list: thread private list of ttm_validate_buffer structs.
72 * 75 *
73 * Tries to reserve bos pointed to by the list entries for validation. 76 * Tries to reserve bos pointed to by the list entries for validation.
@@ -90,11 +93,13 @@ extern void ttm_eu_backoff_reservation(struct list_head *list);
90 * has failed. 93 * has failed.
91 */ 94 */
92 95
93extern int ttm_eu_reserve_buffers(struct list_head *list); 96extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
97 struct list_head *list);
94 98
95/** 99/**
96 * function ttm_eu_fence_buffer_objects. 100 * function ttm_eu_fence_buffer_objects.
97 * 101 *
102 * @ticket: ww_acquire_ctx from reserve call
98 * @list: thread private list of ttm_validate_buffer structs. 103 * @list: thread private list of ttm_validate_buffer structs.
99 * @sync_obj: The new sync object for the buffers. 104 * @sync_obj: The new sync object for the buffers.
100 * 105 *
@@ -104,6 +109,7 @@ extern int ttm_eu_reserve_buffers(struct list_head *list);
104 * 109 *
105 */ 110 */
106 111
107extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj); 112extern void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
113 struct list_head *list, void *sync_obj);
108 114
109#endif 115#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba256f368..6ad72f92469c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -191,6 +191,7 @@ extern bool wmi_has_guid(const char *guid);
191#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 191#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200
192#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 192#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400
193#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 193#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
194#define ACPI_VIDEO_SKIP_BACKLIGHT 0x1000
194 195
195#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) 196#if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
196 197
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 2e34db82a643..622fc505d3e1 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -144,6 +144,7 @@ struct bcma_host_ops {
144 144
145/* Chip IDs of PCIe devices */ 145/* Chip IDs of PCIe devices */
146#define BCMA_CHIP_ID_BCM4313 0x4313 146#define BCMA_CHIP_ID_BCM4313 0x4313
147#define BCMA_CHIP_ID_BCM43142 43142
147#define BCMA_CHIP_ID_BCM43224 43224 148#define BCMA_CHIP_ID_BCM43224 43224
148#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 149#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
149#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 150#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index b8b09eac60a4..c49e1a159e6e 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -330,6 +330,8 @@
330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */ 330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */ 331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */ 332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
333#define BCMA_CC_PMU_STAT_EXT_LPO_AVAIL 0x00000100
334#define BCMA_CC_PMU_STAT_WDRESET 0x00000080
333#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ 335#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
334#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ 336#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
335#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ 337#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
@@ -355,6 +357,11 @@
355#define BCMA_CC_REGCTL_DATA 0x065C 357#define BCMA_CC_REGCTL_DATA 0x065C
356#define BCMA_CC_PLLCTL_ADDR 0x0660 358#define BCMA_CC_PLLCTL_ADDR 0x0660
357#define BCMA_CC_PLLCTL_DATA 0x0664 359#define BCMA_CC_PLLCTL_DATA 0x0664
360#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
361#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
362#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
363#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_MASK 0x80000000
364#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT 31
358#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 365#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
359/* NAND flash MLC controller registers (corerev >= 38) */ 366/* NAND flash MLC controller registers (corerev >= 38) */
360#define BCMA_CC_NAND_REVISION 0x0C00 367#define BCMA_CC_NAND_REVISION 0x0C00
@@ -435,6 +442,23 @@
435#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007 442#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007
436#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0 443#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0
437 444
445/* PMU rev 15 */
446#define BCMA_CC_PMU15_PLL_PLLCTL0 0
447#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
448#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_SHIFT 0
449#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK 0x003FFFFC
450#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT 2
451#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_MASK 0x00C00000
452#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_SHIFT 22
453#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_MASK 0x07000000
454#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_SHIFT 24
455#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_MASK 0x38000000
456#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_SHIFT 27
457#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_MASK 0x40000000
458#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_SHIFT 30
459#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_MASK 0x80000000
460#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_SHIFT 31
461
438/* ALP clock on pre-PMU chips */ 462/* ALP clock on pre-PMU chips */
439#define BCMA_CC_PMU_ALP_CLOCK 20000000 463#define BCMA_CC_PMU_ALP_CLOCK 20000000
440/* HT clock for systems with PMU-enabled chipcommon */ 464/* HT clock for systems with PMU-enabled chipcommon */
@@ -507,6 +531,37 @@
507#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18) 531#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
508#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19) 532#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
509 533
534#define BCMA_RES_4314_LPLDO_PU BIT(0)
535#define BCMA_RES_4314_PMU_SLEEP_DIS BIT(1)
536#define BCMA_RES_4314_PMU_BG_PU BIT(2)
537#define BCMA_RES_4314_CBUCK_LPOM_PU BIT(3)
538#define BCMA_RES_4314_CBUCK_PFM_PU BIT(4)
539#define BCMA_RES_4314_CLDO_PU BIT(5)
540#define BCMA_RES_4314_LPLDO2_LVM BIT(6)
541#define BCMA_RES_4314_WL_PMU_PU BIT(7)
542#define BCMA_RES_4314_LNLDO_PU BIT(8)
543#define BCMA_RES_4314_LDO3P3_PU BIT(9)
544#define BCMA_RES_4314_OTP_PU BIT(10)
545#define BCMA_RES_4314_XTAL_PU BIT(11)
546#define BCMA_RES_4314_WL_PWRSW_PU BIT(12)
547#define BCMA_RES_4314_LQ_AVAIL BIT(13)
548#define BCMA_RES_4314_LOGIC_RET BIT(14)
549#define BCMA_RES_4314_MEM_SLEEP BIT(15)
550#define BCMA_RES_4314_MACPHY_RET BIT(16)
551#define BCMA_RES_4314_WL_CORE_READY BIT(17)
552#define BCMA_RES_4314_ILP_REQ BIT(18)
553#define BCMA_RES_4314_ALP_AVAIL BIT(19)
554#define BCMA_RES_4314_MISC_PWRSW_PU BIT(20)
555#define BCMA_RES_4314_SYNTH_PWRSW_PU BIT(21)
556#define BCMA_RES_4314_RX_PWRSW_PU BIT(22)
557#define BCMA_RES_4314_RADIO_PU BIT(23)
558#define BCMA_RES_4314_VCO_LDO_PU BIT(24)
559#define BCMA_RES_4314_AFE_LDO_PU BIT(25)
560#define BCMA_RES_4314_RX_LDO_PU BIT(26)
561#define BCMA_RES_4314_TX_LDO_PU BIT(27)
562#define BCMA_RES_4314_HT_AVAIL BIT(28)
563#define BCMA_RES_4314_MACPHY_CLK_AVAIL BIT(29)
564
510/* Data for the PMU, if available. 565/* Data for the PMU, if available.
511 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 566 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
512 */ 567 */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ef24466d8f82..ec48bac5b039 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -97,11 +97,11 @@ static inline void *bio_data(struct bio *bio)
97 * permanent PIO fall back, user is probably better off disabling highmem 97 * permanent PIO fall back, user is probably better off disabling highmem
98 * I/O completely on that queue (see ide-dma for example) 98 * I/O completely on that queue (see ide-dma for example)
99 */ 99 */
100#define __bio_kmap_atomic(bio, idx, kmtype) \ 100#define __bio_kmap_atomic(bio, idx) \
101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ 101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
102 bio_iovec_idx((bio), (idx))->bv_offset) 102 bio_iovec_idx((bio), (idx))->bv_offset)
103 103
104#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) 104#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
105 105
106/* 106/*
107 * merge helpers etc 107 * merge helpers etc
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
deleted file mode 100644
index 72b713ab57e9..000000000000
--- a/include/linux/can/platform/flexcan.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 21cfaff7e002..e9ac882868c0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -278,6 +278,8 @@ enum {
278 * 278 *
279 * - memcg: use_hierarchy is on by default and the cgroup file for 279 * - memcg: use_hierarchy is on by default and the cgroup file for
280 * the flag is not created. 280 * the flag is not created.
281 *
282 * - blkcg: blk-throttle becomes properly hierarchical.
281 */ 283 */
282 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), 284 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
283 285
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 944f283f01c4..ab0eade73039 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -114,7 +114,7 @@ enum {
114/* Need to know about CPUs going up/down? */ 114/* Need to know about CPUs going up/down? */
115#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 115#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
116#define cpu_notifier(fn, pri) { \ 116#define cpu_notifier(fn, pri) { \
117 static struct notifier_block fn##_nb __cpuinitdata = \ 117 static struct notifier_block fn##_nb = \
118 { .notifier_call = fn, .priority = pri }; \ 118 { .notifier_call = fn, .priority = pri }; \
119 register_cpu_notifier(&fn##_nb); \ 119 register_cpu_notifier(&fn##_nb); \
120} 120}
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 282e27028418..a5d52eea8232 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -41,7 +41,7 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus);
41 */ 41 */
42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
43 43
44unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); 44unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device * 46static inline struct thermal_cooling_device *
47cpufreq_cooling_register(const struct cpumask *clip_cpus) 47cpufreq_cooling_register(const struct cpumask *clip_cpus)
@@ -54,7 +54,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
54 return; 54 return;
55} 55}
56static inline 56static inline
57unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) 57unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
58{ 58{
59 return THERMAL_CSTATE_INVALID; 59 return THERMAL_CSTATE_INVALID;
60} 60}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4d7390bc1727..90d5a15120d5 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -119,7 +119,7 @@ struct cpufreq_policy {
119 119
120 struct kobject kobj; 120 struct kobject kobj;
121 struct completion kobj_unregister; 121 struct completion kobj_unregister;
122 bool transition_ongoing; /* Tracks transition status */ 122 int transition_ongoing; /* Tracks transition status */
123}; 123};
124 124
125#define CPUFREQ_ADJUST (0) 125#define CPUFREQ_ADJUST (0)
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3092df3614ae..b90337c9d468 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -324,7 +324,7 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
324 return ret; 324 return ret;
325} 325}
326 326
327static inline unsigned d_count(struct dentry *dentry) 327static inline unsigned d_count(const struct dentry *dentry)
328{ 328{
329 return dentry->d_count; 329 return dentry->d_count;
330} 330}
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 3cd32478f2fd..e151d4c9298d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -446,9 +446,9 @@ int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
446/* 446/*
447 * Table reference counting. 447 * Table reference counting.
448 */ 448 */
449struct dm_table *dm_get_live_table(struct mapped_device *md); 449struct dm_table *dm_get_live_table(struct mapped_device *md, int *srcu_idx);
450void dm_table_get(struct dm_table *t); 450void dm_put_live_table(struct mapped_device *md, int srcu_idx);
451void dm_table_put(struct dm_table *t); 451void dm_sync_table(struct mapped_device *md);
452 452
453/* 453/*
454 * Queries 454 * Queries
diff --git a/include/linux/device.h b/include/linux/device.h
index bcf8c0d4cd98..22b546a58591 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,7 +47,11 @@ struct bus_attribute {
47}; 47};
48 48
49#define BUS_ATTR(_name, _mode, _show, _store) \ 49#define BUS_ATTR(_name, _mode, _show, _store) \
50struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 50 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
51#define BUS_ATTR_RW(_name) \
52 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
53#define BUS_ATTR_RO(_name) \
54 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
51 55
52extern int __must_check bus_create_file(struct bus_type *, 56extern int __must_check bus_create_file(struct bus_type *,
53 struct bus_attribute *); 57 struct bus_attribute *);
@@ -261,9 +265,12 @@ struct driver_attribute {
261 size_t count); 265 size_t count);
262}; 266};
263 267
264#define DRIVER_ATTR(_name, _mode, _show, _store) \ 268#define DRIVER_ATTR(_name, _mode, _show, _store) \
265struct driver_attribute driver_attr_##_name = \ 269 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
266 __ATTR(_name, _mode, _show, _store) 270#define DRIVER_ATTR_RW(_name) \
271 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
272#define DRIVER_ATTR_RO(_name) \
273 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
267 274
268extern int __must_check driver_create_file(struct device_driver *driver, 275extern int __must_check driver_create_file(struct device_driver *driver,
269 const struct driver_attribute *attr); 276 const struct driver_attribute *attr);
@@ -313,6 +320,7 @@ int subsys_virtual_register(struct bus_type *subsys,
313 * @name: Name of the class. 320 * @name: Name of the class.
314 * @owner: The module owner. 321 * @owner: The module owner.
315 * @class_attrs: Default attributes of this class. 322 * @class_attrs: Default attributes of this class.
323 * @dev_groups: Default attributes of the devices that belong to the class.
316 * @dev_attrs: Default attributes of the devices belong to the class. 324 * @dev_attrs: Default attributes of the devices belong to the class.
317 * @dev_bin_attrs: Default binary attributes of the devices belong to the class. 325 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
318 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 326 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
@@ -342,7 +350,8 @@ struct class {
342 struct module *owner; 350 struct module *owner;
343 351
344 struct class_attribute *class_attrs; 352 struct class_attribute *class_attrs;
345 struct device_attribute *dev_attrs; 353 struct device_attribute *dev_attrs; /* use dev_groups instead */
354 const struct attribute_group **dev_groups;
346 struct bin_attribute *dev_bin_attrs; 355 struct bin_attribute *dev_bin_attrs;
347 struct kobject *dev_kobj; 356 struct kobject *dev_kobj;
348 357
@@ -414,8 +423,12 @@ struct class_attribute {
414 const struct class_attribute *attr); 423 const struct class_attribute *attr);
415}; 424};
416 425
417#define CLASS_ATTR(_name, _mode, _show, _store) \ 426#define CLASS_ATTR(_name, _mode, _show, _store) \
418struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 427 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
428#define CLASS_ATTR_RW(_name) \
429 struct class_attribute class_attr_##_name = __ATTR_RW(_name)
430#define CLASS_ATTR_RO(_name) \
431 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
419 432
420extern int __must_check class_create_file(struct class *class, 433extern int __must_check class_create_file(struct class *class,
421 const struct class_attribute *attr); 434 const struct class_attribute *attr);
@@ -423,7 +436,6 @@ extern void class_remove_file(struct class *class,
423 const struct class_attribute *attr); 436 const struct class_attribute *attr);
424 437
425/* Simple class attribute that is just a static string */ 438/* Simple class attribute that is just a static string */
426
427struct class_attribute_string { 439struct class_attribute_string {
428 struct class_attribute attr; 440 struct class_attribute attr;
429 char *str; 441 char *str;
@@ -512,6 +524,10 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
512 524
513#define DEVICE_ATTR(_name, _mode, _show, _store) \ 525#define DEVICE_ATTR(_name, _mode, _show, _store) \
514 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 526 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
527#define DEVICE_ATTR_RW(_name) \
528 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
529#define DEVICE_ATTR_RO(_name) \
530 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
515#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 531#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
516 struct dev_ext_attribute dev_attr_##_name = \ 532 struct dev_ext_attribute dev_attr_##_name = \
517 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 533 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -924,6 +940,11 @@ extern __printf(5, 6)
924struct device *device_create(struct class *cls, struct device *parent, 940struct device *device_create(struct class *cls, struct device *parent,
925 dev_t devt, void *drvdata, 941 dev_t devt, void *drvdata,
926 const char *fmt, ...); 942 const char *fmt, ...);
943extern __printf(6, 7)
944struct device *device_create_with_groups(struct class *cls,
945 struct device *parent, dev_t devt, void *drvdata,
946 const struct attribute_group **groups,
947 const char *fmt, ...);
927extern void device_destroy(struct class *cls, dev_t devt); 948extern void device_destroy(struct class *cls, dev_t devt);
928 949
929/* 950/*
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 1b4d4ee1168f..de7d74ab3de6 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -177,7 +177,11 @@ enum drbd_ret_code {
177 ERR_NEED_APV_100 = 163, 177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164, 178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165, 179 ERR_MD_UNCLEAN = 165,
180 180 ERR_MD_LAYOUT_CONNECTED = 166,
181 ERR_MD_LAYOUT_TOO_BIG = 167,
182 ERR_MD_LAYOUT_TOO_SMALL = 168,
183 ERR_MD_LAYOUT_NO_FIT = 169,
184 ERR_IMPLICIT_SHRINK = 170,
181 /* insert new ones above this line */ 185 /* insert new ones above this line */
182 AFTER_LAST_ERR_CODE 186 AFTER_LAST_ERR_CODE
183}; 187};
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index d0d8fac8a6e4..e8c44572b8cb 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -181,6 +181,8 @@ GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) 181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) 182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) 183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184 __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF)
185 __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF)
184) 186)
185 187
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, 188GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 1fedf2b17cc8..17e50bb00521 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -215,4 +215,13 @@
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217 217
218#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024
220#define DRBD_AL_STRIPES_DEF 1
221#define DRBD_AL_STRIPES_SCALE '1'
222
223#define DRBD_AL_STRIPE_SIZE_MIN 4
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
218#endif 227#endif
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index acd0312d46fb..306dd8cd0b6f 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
8 8
9struct io_cq; 9struct io_cq;
10struct elevator_type;
10 11
11typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 12typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
12 struct bio *); 13 struct bio *);
@@ -35,7 +36,8 @@ typedef void (elevator_put_req_fn) (struct request *);
35typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 36typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
36typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 37typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
37 38
38typedef int (elevator_init_fn) (struct request_queue *); 39typedef int (elevator_init_fn) (struct request_queue *,
40 struct elevator_type *e);
39typedef void (elevator_exit_fn) (struct elevator_queue *); 41typedef void (elevator_exit_fn) (struct elevator_queue *);
40 42
41struct elevator_ops 43struct elevator_ops
@@ -155,6 +157,8 @@ extern int elevator_init(struct request_queue *, char *);
155extern void elevator_exit(struct elevator_queue *); 157extern void elevator_exit(struct elevator_queue *);
156extern int elevator_change(struct request_queue *, const char *); 158extern int elevator_change(struct request_queue *, const char *);
157extern bool elv_rq_merge_ok(struct request *, struct bio *); 159extern bool elv_rq_merge_ok(struct request *, struct bio *);
160extern struct elevator_queue *elevator_alloc(struct request_queue *,
161 struct elevator_type *);
158 162
159/* 163/*
160 * Helper functions. 164 * Helper functions.
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d49c60f5aa4c..ffac70aab3e9 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -624,7 +624,7 @@ extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u3
624extern void fb_set_suspend(struct fb_info *info, int state); 624extern void fb_set_suspend(struct fb_info *info, int state);
625extern int fb_get_color_depth(struct fb_var_screeninfo *var, 625extern int fb_get_color_depth(struct fb_var_screeninfo *var,
626 struct fb_fix_screeninfo *fix); 626 struct fb_fix_screeninfo *fix);
627extern int fb_get_options(char *name, char **option); 627extern int fb_get_options(const char *name, char **option);
628extern int fb_new_modelist(struct fb_info *info); 628extern int fb_new_modelist(struct fb_info *info);
629 629
630extern struct fb_info *registered_fb[FB_MAX]; 630extern struct fb_info *registered_fb[FB_MAX];
diff --git a/include/linux/filter.h b/include/linux/filter.h
index f65f5a69db8f..a6ac84871d6d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -59,10 +59,10 @@ extern void bpf_jit_free(struct sk_filter *fp);
59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
60 u32 pass, void *image) 60 u32 pass, void *image)
61{ 61{
62 pr_err("flen=%u proglen=%u pass=%u image=%p\n", 62 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
63 flen, proglen, pass, image); 63 flen, proglen, pass, image);
64 if (image) 64 if (image)
65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, 65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
66 16, 1, image, proglen, false); 66 16, 1, image, proglen, false);
67} 67}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 191501afd7fb..3b0e820375ab 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -251,8 +251,10 @@ struct ieee1394_device_id;
251 251
252struct fw_driver { 252struct fw_driver {
253 struct device_driver driver; 253 struct device_driver driver;
254 int (*probe)(struct fw_unit *unit, const struct ieee1394_device_id *id);
254 /* Called when the parent device sits through a bus reset. */ 255 /* Called when the parent device sits through a bus reset. */
255 void (*update)(struct fw_unit *unit); 256 void (*update)(struct fw_unit *unit);
257 void (*remove)(struct fw_unit *unit);
256 const struct ieee1394_device_id *id_table; 258 const struct ieee1394_device_id *id_table;
257}; 259};
258 260
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a35b10e9a680..981874773e85 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,7 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/llist.h>
13#include <linux/radix-tree.h> 14#include <linux/radix-tree.h>
14#include <linux/rbtree.h> 15#include <linux/rbtree.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -768,6 +769,7 @@ struct file {
768 */ 769 */
769 union { 770 union {
770 struct list_head fu_list; 771 struct list_head fu_list;
772 struct llist_node fu_llist;
771 struct rcu_head fu_rcuhead; 773 struct rcu_head fu_rcuhead;
772 } f_u; 774 } f_u;
773 struct path f_path; 775 struct path f_path;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 99d0fbcbaf79..9f15c0064c50 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -566,10 +566,6 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
566 size_t cnt, loff_t *ppos) { return -ENODEV; } 566 size_t cnt, loff_t *ppos) { return -ENODEV; }
567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
568 size_t cnt, loff_t *ppos) { return -ENODEV; } 568 size_t cnt, loff_t *ppos) { return -ENODEV; }
569static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
570{
571 return -ENODEV;
572}
573static inline int 569static inline int
574ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 570ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
575#endif /* CONFIG_DYNAMIC_FTRACE */ 571#endif /* CONFIG_DYNAMIC_FTRACE */
@@ -828,10 +824,15 @@ enum ftrace_dump_mode;
828 824
829extern enum ftrace_dump_mode ftrace_dump_on_oops; 825extern enum ftrace_dump_mode ftrace_dump_on_oops;
830 826
827extern void disable_trace_on_warning(void);
828extern int __disable_trace_on_warning;
829
831#ifdef CONFIG_PREEMPT 830#ifdef CONFIG_PREEMPT
832#define INIT_TRACE_RECURSION .trace_recursion = 0, 831#define INIT_TRACE_RECURSION .trace_recursion = 0,
833#endif 832#endif
834 833
834#else /* CONFIG_TRACING */
835static inline void disable_trace_on_warning(void) { }
835#endif /* CONFIG_TRACING */ 836#endif /* CONFIG_TRACING */
836 837
837#ifndef INIT_TRACE_RECURSION 838#ifndef INIT_TRACE_RECURSION
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 488debbef895..81cbbdb96aae 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -658,7 +658,6 @@ struct twl4030_power_data {
658 bool use_poweroff; /* Board is wired for TWL poweroff */ 658 bool use_poweroff; /* Board is wired for TWL poweroff */
659}; 659};
660 660
661extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
662extern int twl4030_remove_script(u8 flags); 661extern int twl4030_remove_script(u8 flags);
663extern void twl4030_power_off(void); 662extern void twl4030_power_off(void);
664 663
@@ -726,7 +725,7 @@ struct twl4030_platform_data {
726 struct regulator_init_data *clk32kg; 725 struct regulator_init_data *clk32kg;
727 struct regulator_init_data *v1v8; 726 struct regulator_init_data *v1v8;
728 struct regulator_init_data *v2v1; 727 struct regulator_init_data *v2v1;
729 /* TWL6025 LDO regulators */ 728 /* TWL6032 LDO regulators */
730 struct regulator_init_data *ldo1; 729 struct regulator_init_data *ldo1;
731 struct regulator_init_data *ldo2; 730 struct regulator_init_data *ldo2;
732 struct regulator_init_data *ldo3; 731 struct regulator_init_data *ldo3;
@@ -736,7 +735,7 @@ struct twl4030_platform_data {
736 struct regulator_init_data *ldo7; 735 struct regulator_init_data *ldo7;
737 struct regulator_init_data *ldoln; 736 struct regulator_init_data *ldoln;
738 struct regulator_init_data *ldousb; 737 struct regulator_init_data *ldousb;
739 /* TWL6025 DCDC regulators */ 738 /* TWL6032 DCDC regulators */
740 struct regulator_init_data *smps3; 739 struct regulator_init_data *smps3;
741 struct regulator_init_data *smps4; 740 struct regulator_init_data *smps4;
742 struct regulator_init_data *vio6025; 741 struct regulator_init_data *vio6025;
@@ -753,7 +752,7 @@ struct twl_regulator_driver_data {
753#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ 752#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
754#define TWL5031 BIT(2) /* twl5031 has different registers */ 753#define TWL5031 BIT(2) /* twl5031 has different registers */
755#define TWL6030_CLASS BIT(3) /* TWL6030 class */ 754#define TWL6030_CLASS BIT(3) /* TWL6030 class */
756#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 755#define TWL6032_SUBCLASS BIT(4) /* TWL6032 has changed registers */
757#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible 756#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
758 * but not officially supported. 757 * but not officially supported.
759 * This flag is necessary to 758 * This flag is necessary to
@@ -840,20 +839,20 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
840#define TWL6030_REG_CLK32KG 48 839#define TWL6030_REG_CLK32KG 48
841 840
842/* LDOs on 6025 have different names */ 841/* LDOs on 6025 have different names */
843#define TWL6025_REG_LDO2 49 842#define TWL6032_REG_LDO2 49
844#define TWL6025_REG_LDO4 50 843#define TWL6032_REG_LDO4 50
845#define TWL6025_REG_LDO3 51 844#define TWL6032_REG_LDO3 51
846#define TWL6025_REG_LDO5 52 845#define TWL6032_REG_LDO5 52
847#define TWL6025_REG_LDO1 53 846#define TWL6032_REG_LDO1 53
848#define TWL6025_REG_LDO7 54 847#define TWL6032_REG_LDO7 54
849#define TWL6025_REG_LDO6 55 848#define TWL6032_REG_LDO6 55
850#define TWL6025_REG_LDOLN 56 849#define TWL6032_REG_LDOLN 56
851#define TWL6025_REG_LDOUSB 57 850#define TWL6032_REG_LDOUSB 57
852 851
853/* 6025 DCDC supplies */ 852/* 6025 DCDC supplies */
854#define TWL6025_REG_SMPS3 58 853#define TWL6032_REG_SMPS3 58
855#define TWL6025_REG_SMPS4 59 854#define TWL6032_REG_SMPS4 59
856#define TWL6025_REG_VIO 60 855#define TWL6032_REG_VIO 60
857 856
858 857
859#endif /* End of __TWL4030_H */ 858#endif /* End of __TWL4030_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 06b0ed0154a4..b0dc87a2a376 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -146,6 +146,7 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
146#define IEEE80211_MAX_RTS_THRESHOLD 2353 146#define IEEE80211_MAX_RTS_THRESHOLD 2353
147#define IEEE80211_MAX_AID 2007 147#define IEEE80211_MAX_AID 2007
148#define IEEE80211_MAX_TIM_LEN 251 148#define IEEE80211_MAX_TIM_LEN 251
149#define IEEE80211_MAX_MESH_PEERINGS 63
149/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 150/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
150 6.2.1.1.2. 151 6.2.1.1.2.
151 152
@@ -1829,6 +1830,15 @@ enum ieee80211_key_len {
1829 WLAN_KEY_LEN_AES_CMAC = 16, 1830 WLAN_KEY_LEN_AES_CMAC = 16,
1830}; 1831};
1831 1832
1833#define IEEE80211_WEP_IV_LEN 4
1834#define IEEE80211_WEP_ICV_LEN 4
1835#define IEEE80211_CCMP_HDR_LEN 8
1836#define IEEE80211_CCMP_MIC_LEN 8
1837#define IEEE80211_CCMP_PN_LEN 6
1838#define IEEE80211_TKIP_IV_LEN 8
1839#define IEEE80211_TKIP_ICV_LEN 4
1840#define IEEE80211_CMAC_PN_LEN 6
1841
1832/* Public action codes */ 1842/* Public action codes */
1833enum ieee80211_pub_actioncode { 1843enum ieee80211_pub_actioncode {
1834 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 1844 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c3f817c3eb45..a86784dec3d3 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -12,5 +12,6 @@ struct ifla_vf_info {
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate; 13 __u32 tx_rate;
14 __u32 spoofchk; 14 __u32 spoofchk;
15 __u32 linkstate;
15}; 16};
16#endif /* _LINUX_IF_LINK_H */ 17#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 84dde1dd1da4..ddd33fd5904d 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -8,7 +8,7 @@
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h> 9#include <linux/u64_stats_sync.h>
10 10
11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if IS_ENABLED(CONFIG_MACVTAP)
12struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
13#else 13#else
14#include <linux/err.h> 14#include <linux/err.h>
@@ -50,7 +50,7 @@ struct macvlan_pcpu_stats {
50 * Maximum times a macvtap device can be opened. This can be used to 50 * Maximum times a macvtap device can be opened. This can be used to
51 * configure the number of receive queue, e.g. for multiqueue virtio. 51 * configure the number of receive queue, e.g. for multiqueue virtio.
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES 16
54 54
55#define MACVLAN_MC_FILTER_BITS 8 55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) 56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
@@ -65,12 +65,18 @@ struct macvlan_dev {
65 65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67 67
68 netdev_features_t set_features;
68 enum macvlan_mode mode; 69 enum macvlan_mode mode;
69 u16 flags; 70 u16 flags;
70 int (*receive)(struct sk_buff *skb); 71 int (*receive)(struct sk_buff *skb);
71 int (*forward)(struct net_device *dev, struct sk_buff *skb); 72 int (*forward)(struct net_device *dev, struct sk_buff *skb);
72 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 73 /* This array tracks active taps. */
74 struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
75 /* This list tracks all taps (both enabled and disabled) */
76 struct list_head queue_list;
73 int numvtaps; 77 int numvtaps;
78 int numqueues;
79 netdev_features_t tap_features;
74 int minor; 80 int minor;
75}; 81};
76 82
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 16fae6436d0e..f6156f91eb1c 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -69,6 +69,7 @@ struct team_port {
69 s32 priority; /* lower number ~ higher priority */ 69 s32 priority; /* lower number ~ higher priority */
70 u16 queue_id; 70 u16 queue_id;
71 struct list_head qom_list; /* node in queue override mapping list */ 71 struct list_head qom_list; /* node in queue override mapping list */
72 struct rcu_head rcu;
72 long mode_priv[0]; 73 long mode_priv[0];
73}; 74};
74 75
@@ -228,6 +229,16 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228 return port; 229 return port;
229 return NULL; 230 return NULL;
230} 231}
232
233static inline int team_num_to_port_index(struct team *team, int num)
234{
235 int en_port_count = ACCESS_ONCE(team->en_port_count);
236
237 if (unlikely(!en_port_count))
238 return 0;
239 return num % en_port_count;
240}
241
231static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 242static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
232 int port_index) 243 int port_index)
233{ 244{
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 637fa71de0c7..715c343f7c00 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -79,9 +79,8 @@ static inline int is_vlan_dev(struct net_device *dev)
79} 79}
80 80
81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
82#define vlan_tx_nonzero_tag_present(__skb) \
83 (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
84#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 82#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
83#define vlan_tx_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
85 84
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 85#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 86
@@ -243,8 +242,6 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
243 return skb; 242 return skb;
244} 243}
245 244
246#define HAVE_VLAN_PUT_TAG
247
248/** 245/**
249 * vlan_put_tag - inserts VLAN tag according to device features 246 * vlan_put_tag - inserts VLAN tag according to device features
250 * @skb: skbuff to tag 247 * @skb: skbuff to tag
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7f2bf1518480..e3362b5f13e8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -84,6 +84,7 @@ struct ip_mc_list {
84 struct ip_mc_list *next; 84 struct ip_mc_list *next;
85 struct ip_mc_list __rcu *next_rcu; 85 struct ip_mc_list __rcu *next_rcu;
86 }; 86 };
87 struct ip_mc_list __rcu *next_hash;
87 struct timer_list timer; 88 struct timer_list timer;
88 int users; 89 int users;
89 atomic_t refcnt; 90 atomic_t refcnt;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 8d171f427632..3d35b7023591 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -211,8 +211,8 @@ struct iio_chan_spec {
211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
213{ 213{
214 return (chan->info_mask_separate & type) | 214 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & type); 215 (chan->info_mask_shared_by_type & BIT(type));
216} 216}
217 217
218#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ea1e3b863890..b99cd23f3474 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -50,12 +50,17 @@ struct ipv4_devconf {
50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX); 50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
51}; 51};
52 52
53#define MC_HASH_SZ_LOG 9
54
53struct in_device { 55struct in_device {
54 struct net_device *dev; 56 struct net_device *dev;
55 atomic_t refcnt; 57 atomic_t refcnt;
56 int dead; 58 int dead;
57 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 59 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
60
58 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ 61 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
62 struct ip_mc_list __rcu * __rcu *mc_hash;
63
59 int mc_count; /* Number of installed mcasts */ 64 int mc_count; /* Number of installed mcasts */
60 spinlock_t mc_tomb_lock; 65 spinlock_t mc_tomb_lock;
61 struct ip_mc_list *mc_tomb; 66 struct ip_mc_list *mc_tomb;
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
deleted file mode 100644
index 49269a2aa329..000000000000
--- a/include/linux/input/ti_am335x_tsc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/io.h b/include/linux/io.h
index 069e4075f872..f4f42faec686 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -76,4 +76,29 @@ void devm_ioremap_release(struct device *dev, void *res);
76#define arch_has_dev_port() (1) 76#define arch_has_dev_port() (1)
77#endif 77#endif
78 78
79/*
80 * Some systems (x86 without PAT) have a somewhat reliable way to mark a
81 * physical address range such that uncached mappings will actually
82 * end up write-combining. This facility should be used in conjunction
83 * with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has
84 * no effect if the per-page mechanisms are functional.
85 * (On x86 without PAT, these functions manipulate MTRRs.)
86 *
87 * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
88 * to have no effect.
89 */
90#ifndef arch_phys_wc_add
91static inline int __must_check arch_phys_wc_add(unsigned long base,
92 unsigned long size)
93{
94 return 0; /* It worked (i.e. did nothing). */
95}
96
97static inline void arch_phys_wc_del(int handle)
98{
99}
100
101#define arch_phys_wc_add arch_phys_wc_add
102#endif
103
79#endif /* _LINUX_IO_H */ 104#endif /* _LINUX_IO_H */
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8fb8edf12417..97ba4e78a37e 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -139,6 +139,10 @@ static inline u64 get_jiffies_64(void)
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)(a) - (__s64)(b) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \
143 (time_after_eq64(a, b) && \
144 time_before_eq64(a, c))
145
142/* 146/*
143 * These four macros compare jiffies and 'a' for convenience. 147 * These four macros compare jiffies and 'a' for convenience.
144 */ 148 */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index fc66b301b648..debf208b7611 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -324,6 +324,11 @@ static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
324 return ktime_add_ns(kt, usec * NSEC_PER_USEC); 324 return ktime_add_ns(kt, usec * NSEC_PER_USEC);
325} 325}
326 326
327static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec)
328{
329 return ktime_add_ns(kt, msec * NSEC_PER_MSEC);
330}
331
327static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) 332static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
328{ 333{
329 return ktime_sub_ns(kt, usec * NSEC_PER_USEC); 334 return ktime_sub_ns(kt, usec * NSEC_PER_USEC);
@@ -368,7 +373,15 @@ extern void ktime_get_ts(struct timespec *ts);
368static inline ktime_t ns_to_ktime(u64 ns) 373static inline ktime_t ns_to_ktime(u64 ns)
369{ 374{
370 static const ktime_t ktime_zero = { .tv64 = 0 }; 375 static const ktime_t ktime_zero = { .tv64 = 0 };
376
371 return ktime_add_ns(ktime_zero, ns); 377 return ktime_add_ns(ktime_zero, ns);
372} 378}
373 379
380static inline ktime_t ms_to_ktime(u64 ms)
381{
382 static const ktime_t ktime_zero = { .tv64 = 0 };
383
384 return ktime_add_ms(ktime_zero, ms);
385}
386
374#endif 387#endif
diff --git a/include/linux/list.h b/include/linux/list.h
index b83e5657365a..f4d8a2f12a33 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -381,17 +381,6 @@ static inline void list_splice_tail_init(struct list_head *list,
381 for (pos = (head)->next; pos != (head); pos = pos->next) 381 for (pos = (head)->next; pos != (head); pos = pos->next)
382 382
383/** 383/**
384 * __list_for_each - iterate over a list
385 * @pos: the &struct list_head to use as a loop cursor.
386 * @head: the head for your list.
387 *
388 * This variant doesn't differ from list_for_each() any more.
389 * We don't do prefetching in either case.
390 */
391#define __list_for_each(pos, head) \
392 for (pos = (head)->next; pos != (head); pos = pos->next)
393
394/**
395 * list_for_each_prev - iterate over a list backwards 384 * list_for_each_prev - iterate over a list backwards
396 * @pos: the &struct list_head to use as a loop cursor. 385 * @pos: the &struct list_head to use as a loop cursor.
397 * @head: the head for your list. 386 * @head: the head for your list.
diff --git a/include/linux/llist.h b/include/linux/llist.h
index a5199f6d0e82..cdaa7f023899 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -142,6 +142,9 @@ static inline struct llist_node *llist_next(struct llist_node *node)
142 return node->next; 142 return node->next;
143} 143}
144 144
145extern bool llist_add_batch(struct llist_node *new_first,
146 struct llist_node *new_last,
147 struct llist_head *head);
145/** 148/**
146 * llist_add - add a new entry 149 * llist_add - add a new entry
147 * @new: new entry to be added 150 * @new: new entry to be added
@@ -151,18 +154,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
151 */ 154 */
152static inline bool llist_add(struct llist_node *new, struct llist_head *head) 155static inline bool llist_add(struct llist_node *new, struct llist_head *head)
153{ 156{
154 struct llist_node *entry, *old_entry; 157 return llist_add_batch(new, new, head);
155
156 entry = head->first;
157 for (;;) {
158 old_entry = entry;
159 new->next = entry;
160 entry = cmpxchg(&head->first, old_entry, new);
161 if (entry == old_entry)
162 break;
163 }
164
165 return old_entry == NULL;
166} 158}
167 159
168/** 160/**
@@ -178,9 +170,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
178 return xchg(&head->first, NULL); 170 return xchg(&head->first, NULL);
179} 171}
180 172
181extern bool llist_add_batch(struct llist_node *new_first,
182 struct llist_node *new_last,
183 struct llist_head *head);
184extern struct llist_node *llist_del_first(struct llist_head *head); 173extern struct llist_node *llist_del_first(struct llist_head *head);
185 174
186#endif /* LLIST_H */ 175#endif /* LLIST_H */
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index dd3c34ebca9a..8e9a029e093d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -14,6 +14,8 @@
14#define MARVELL_PHY_ID_88E1149R 0x01410e50 14#define MARVELL_PHY_ID_88E1149R 0x01410e50
15#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0
17 19
18/* struct phy_device dev_flags definitions */ 20/* struct phy_device dev_flags definitions */
19#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index e94537befabd..97cb283cc8e1 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -17,7 +17,6 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19 19
20#define PM80X_VERSION_MASK (0xFF) /* 80X chip ID mask */
21enum { 20enum {
22 CHIP_INVALID = 0, 21 CHIP_INVALID = 0,
23 CHIP_PM800, 22 CHIP_PM800,
@@ -299,8 +298,7 @@ struct pm80x_chip {
299 struct regmap *regmap; 298 struct regmap *regmap;
300 struct regmap_irq_chip *regmap_irq_chip; 299 struct regmap_irq_chip *regmap_irq_chip;
301 struct regmap_irq_chip_data *irq_data; 300 struct regmap_irq_chip_data *irq_data;
302 unsigned char version; 301 int type;
303 int id;
304 int irq; 302 int irq;
305 int irq_mode; 303 int irq_mode;
306 unsigned long wu_flag; 304 unsigned long wu_flag;
@@ -309,8 +307,14 @@ struct pm80x_chip {
309 307
310struct pm80x_platform_data { 308struct pm80x_platform_data {
311 struct pm80x_rtc_pdata *rtc; 309 struct pm80x_rtc_pdata *rtc;
312 unsigned short power_page_addr; /* power page I2C address */ 310 /*
313 unsigned short gpadc_page_addr; /* gpadc page I2C address */ 311 * For the regulator not defined, set regulators[not_defined] to be
312 * NULL. num_regulators are the number of regulators supposed to be
313 * initialized. If all regulators are not defined, set num_regulators
314 * to be 0.
315 */
316 struct regulator_init_data *regulators[PM800_ID_RG_MAX];
317 unsigned int num_regulators;
314 int irq_mode; /* Clear interrupt by read/write(0/1) */ 318 int irq_mode; /* Clear interrupt by read/write(0/1) */
315 int batt_det; /* enable/disable */ 319 int batt_det; /* enable/disable */
316 int (*plat_config)(struct pm80x_chip *chip, 320 int (*plat_config)(struct pm80x_chip *chip,
@@ -363,7 +367,6 @@ static inline int pm80x_dev_resume(struct device *dev)
363} 367}
364#endif 368#endif
365 369
366extern int pm80x_init(struct i2c_client *client, 370extern int pm80x_init(struct i2c_client *client);
367 const struct i2c_device_id *id);
368extern int pm80x_deinit(void); 371extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 372#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 0390d5943ed6..f4acd898dac9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,6 +291,8 @@ enum ab8500_version {
291#define AB8540_INT_FSYNC2R 213 291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214 292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215 293#define AB8540_INT_BITCLK2R 215
294/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
295#define AB8540_INT_RTC_1S 216
294 296
295/* 297/*
296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 298 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index f797bb9b8b56..5cf8b91ce996 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -23,6 +23,7 @@
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3,
26}; 27};
27 28
28#define ARIZONA_IRQ_GP1 0 29#define ARIZONA_IRQ_GP1 0
@@ -121,5 +122,6 @@ int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
121 122
122int wm5102_patch(struct arizona *arizona); 123int wm5102_patch(struct arizona *arizona);
123int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona);
124 126
125#endif 127#endif
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 7dd6524d2aac..13a1ee95a233 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -28,6 +28,8 @@
28#include <linux/mfd/core.h> 28#include <linux/mfd/core.h>
29#include <linux/platform_data/edma.h> 29#include <linux/platform_data/edma.h>
30 30
31#include <mach/hardware.h>
32
31/* 33/*
32 * Register values. 34 * Register values.
33 */ 35 */
@@ -111,8 +113,6 @@ struct davinci_vc {
111 113
112 /* Memory resources */ 114 /* Memory resources */
113 void __iomem *base; 115 void __iomem *base;
114 resource_size_t pbase;
115 size_t base_size;
116 116
117 /* MFD cells */ 117 /* MFD cells */
118 struct mfd_cell cells[DAVINCI_VC_CELLS]; 118 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
new file mode 100644
index 000000000000..b911ef3add03
--- /dev/null
+++ b/include/linux/mfd/kempld.h
@@ -0,0 +1,125 @@
1/*
2 * Kontron PLD driver definitions
3 *
4 * Copyright (c) 2010-2012 Kontron Europe GmbH
5 * Author: Michael Brunner <michael.brunner@kontron.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 2 as published
9 * by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_KEMPLD_H_
13#define _LINUX_MFD_KEMPLD_H_
14
15/* kempld register definitions */
16#define KEMPLD_IOINDEX 0xa80
17#define KEMPLD_IODATA 0xa81
18#define KEMPLD_MUTEX_KEY 0x80
19#define KEMPLD_VERSION 0x00
20#define KEMPLD_VERSION_LSB 0x00
21#define KEMPLD_VERSION_MSB 0x01
22#define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
23#define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
24#define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
25#define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
26#define KEMPLD_BUILDNR 0x02
27#define KEMPLD_BUILDNR_LSB 0x02
28#define KEMPLD_BUILDNR_MSB 0x03
29#define KEMPLD_FEATURE 0x04
30#define KEMPLD_FEATURE_LSB 0x04
31#define KEMPLD_FEATURE_MSB 0x05
32#define KEMPLD_FEATURE_BIT_I2C (1 << 0)
33#define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
34#define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
35#define KEMPLD_FEATURE_MASK_UART (7 << 3)
36#define KEMPLD_FEATURE_BIT_NMI (1 << 8)
37#define KEMPLD_FEATURE_BIT_SMI (1 << 9)
38#define KEMPLD_FEATURE_BIT_SCI (1 << 10)
39#define KEMPLD_SPEC 0x06
40#define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
41#define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
42#define KEMPLD_IRQ_GPIO 0x35
43#define KEMPLD_IRQ_I2C 0x36
44#define KEMPLD_CFG 0x37
45#define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
46#define KEMPLD_CFG_BIOS_WP (1 << 7)
47
48#define KEMPLD_CLK 33333333
49
50#define KEMPLD_TYPE_RELEASE 0x0
51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2
53
54/**
55 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision
57 * @minor: PLD minor revision
58 * @buildnr: PLD build number
59 * @number: PLD board specific index
60 * @type: PLD type
61 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision
63 */
64struct kempld_info {
65 unsigned int major;
66 unsigned int minor;
67 unsigned int buildnr;
68 unsigned int number;
69 unsigned int type;
70 unsigned int spec_major;
71 unsigned int spec_minor;
72};
73
74/**
75 * struct kempld_device_data - Internal representation of the PLD device
76 * @io_base: Pointer to the IO memory
77 * @io_index: Pointer to the IO index register
78 * @io_data: Pointer to the IO data register
79 * @pld_clock: PLD clock frequency
80 * @feature_mask: PLD feature mask
81 * @dev: Pointer to kernel device structure
82 * @info: KEMPLD info structure
83 * @lock: PLD mutex
84 */
85struct kempld_device_data {
86 void __iomem *io_base;
87 void __iomem *io_index;
88 void __iomem *io_data;
89 u32 pld_clock;
90 u32 feature_mask;
91 struct device *dev;
92 struct kempld_info info;
93 struct mutex lock;
94};
95
96/**
97 * struct kempld_platform_data - PLD hardware configuration structure
98 * @pld_clock: PLD clock frequency
99 * @gpio_base GPIO base pin number
100 * @ioresource: IO addresses of the PLD
101 * @get_mutex: PLD specific get_mutex callback
102 * @release_mutex: PLD specific release_mutex callback
103 * @get_info: PLD specific get_info callback
104 * @register_cells: PLD specific register_cells callback
105 */
106struct kempld_platform_data {
107 u32 pld_clock;
108 int gpio_base;
109 struct resource *ioresource;
110 void (*get_hardware_mutex) (struct kempld_device_data *);
111 void (*release_hardware_mutex) (struct kempld_device_data *);
112 int (*get_info) (struct kempld_device_data *);
113 int (*register_cells) (struct kempld_device_data *);
114};
115
116extern void kempld_get_mutex(struct kempld_device_data *pld);
117extern void kempld_release_mutex(struct kempld_device_data *pld);
118extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
119extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
120extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
121extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
122extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
123extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
124
125#endif /* _LINUX_MFD_KEMPLD_H_ */
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index effa5d3b96ae..84844e0a5704 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -132,9 +132,12 @@ enum {
132 132
133#define MAX8998_ENRAMP (1 << 4) 133#define MAX8998_ENRAMP (1 << 4)
134 134
135struct irq_domain;
136
135/** 137/**
136 * struct max8998_dev - max8998 master device for sub-drivers 138 * struct max8998_dev - max8998 master device for sub-drivers
137 * @dev: master device of the chip (can be used to access platform data) 139 * @dev: master device of the chip (can be used to access platform data)
140 * @pdata: platform data for the driver and subdrivers
138 * @i2c: i2c client private data for regulator 141 * @i2c: i2c client private data for regulator
139 * @rtc: i2c client private data for rtc 142 * @rtc: i2c client private data for rtc
140 * @iolock: mutex for serializing io access 143 * @iolock: mutex for serializing io access
@@ -148,12 +151,14 @@ enum {
148 */ 151 */
149struct max8998_dev { 152struct max8998_dev {
150 struct device *dev; 153 struct device *dev;
154 struct max8998_platform_data *pdata;
151 struct i2c_client *i2c; 155 struct i2c_client *i2c;
152 struct i2c_client *rtc; 156 struct i2c_client *rtc;
153 struct mutex iolock; 157 struct mutex iolock;
154 struct mutex irqlock; 158 struct mutex irqlock;
155 159
156 int irq_base; 160 unsigned int irq_base;
161 struct irq_domain *irq_domain;
157 int irq; 162 int irq;
158 int ono; 163 int ono;
159 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; 164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 6823548d0c0a..e3956a654cbc 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -58,10 +58,12 @@ enum {
58 * max8998_regulator_data - regulator data 58 * max8998_regulator_data - regulator data
59 * @id: regulator id 59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...) 60 * @initdata: regulator init data (contraints, supplies, ...)
61 * @reg_node: DT node of regulator (unused on non-DT platforms)
61 */ 62 */
62struct max8998_regulator_data { 63struct max8998_regulator_data {
63 int id; 64 int id;
64 struct regulator_init_data *initdata; 65 struct regulator_init_data *initdata;
66 struct device_node *reg_node;
65}; 67};
66 68
67/** 69/**
@@ -73,12 +75,8 @@ struct max8998_regulator_data {
73 * @buck_voltage_lock: Do NOT change the values of the following six 75 * @buck_voltage_lock: Do NOT change the values of the following six
74 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot 76 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
75 * be other than the preset values. 77 * be other than the preset values.
76 * @buck1_voltage1: BUCK1 DVS mode 1 voltage register 78 * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
77 * @buck1_voltage2: BUCK1 DVS mode 2 voltage register 79 * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
78 * @buck1_voltage3: BUCK1 DVS mode 3 voltage register
79 * @buck1_voltage4: BUCK1 DVS mode 4 voltage register
80 * @buck2_voltage1: BUCK2 DVS mode 1 voltage register
81 * @buck2_voltage2: BUCK2 DVS mode 2 voltage register
82 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage 80 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
83 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage 81 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
84 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2 82 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
@@ -100,15 +98,11 @@ struct max8998_regulator_data {
100struct max8998_platform_data { 98struct max8998_platform_data {
101 struct max8998_regulator_data *regulators; 99 struct max8998_regulator_data *regulators;
102 int num_regulators; 100 int num_regulators;
103 int irq_base; 101 unsigned int irq_base;
104 int ono; 102 int ono;
105 bool buck_voltage_lock; 103 bool buck_voltage_lock;
106 int buck1_voltage1; 104 int buck1_voltage[4];
107 int buck1_voltage2; 105 int buck2_voltage[2];
108 int buck1_voltage3;
109 int buck1_voltage4;
110 int buck2_voltage1;
111 int buck2_voltage2;
112 int buck1_set1; 106 int buck1_set1;
113 int buck1_set2; 107 int buck1_set2;
114 int buck1_default_idx; 108 int buck1_default_idx;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9b81b2bdc46b..1a8dd7afe084 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -34,6 +34,19 @@
34 ((a) == PALMAS_CHIP_ID)) 34 ((a) == PALMAS_CHIP_ID))
35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
36 36
37/**
38 * Palmas PMIC feature types
39 *
40 * PALMAS_PMIC_FEATURE_SMPS10_BOOST - used when the PMIC provides SMPS10_BOOST
41 * regulator.
42 *
43 * PALMAS_PMIC_HAS(b, f) - macro to check if a bandgap device is capable of a
44 * specific feature (above) or not. Return non-zero, if yes.
45 */
46#define PALMAS_PMIC_FEATURE_SMPS10_BOOST BIT(0)
47#define PALMAS_PMIC_HAS(b, f) \
48 ((b)->features & PALMAS_PMIC_FEATURE_ ## f)
49
37struct palmas_pmic; 50struct palmas_pmic;
38struct palmas_gpadc; 51struct palmas_gpadc;
39struct palmas_resource; 52struct palmas_resource;
@@ -54,6 +67,7 @@ struct palmas {
54 /* Stored chip id */ 67 /* Stored chip id */
55 int id; 68 int id;
56 69
70 unsigned int features;
57 /* IRQ Data */ 71 /* IRQ Data */
58 int irq; 72 int irq;
59 u32 irq_mask; 73 u32 irq_mask;
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 86bc635f8385..7a9f7089435d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -575,6 +575,7 @@
575 575
576#define CARD_PWR_CTL 0xFD50 576#define CARD_PWR_CTL 0xFD50
577#define CARD_CLK_SWITCH 0xFD51 577#define CARD_CLK_SWITCH 0xFD51
578#define RTL8411B_PACKAGE_MODE 0xFD51
578#define CARD_SHARE_MODE 0xFD52 579#define CARD_SHARE_MODE 0xFD52
579#define CARD_DRIVE_SEL 0xFD53 580#define CARD_DRIVE_SEL 0xFD53
580#define CARD_STOP 0xFD54 581#define CARD_STOP 0xFD54
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index f0f4de3b4ccc..378ae8a04c6a 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,8 +14,6 @@
14#ifndef __LINUX_MFD_SEC_CORE_H 14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H 15#define __LINUX_MFD_SEC_CORE_H
16 16
17#define NUM_IRQ_REGS 4
18
19enum sec_device_type { 17enum sec_device_type {
20 S5M8751X, 18 S5M8751X,
21 S5M8763X, 19 S5M8763X,
@@ -44,8 +42,6 @@ struct sec_pmic_dev {
44 struct regmap *regmap; 42 struct regmap *regmap;
45 struct i2c_client *i2c; 43 struct i2c_client *i2c;
46 struct i2c_client *rtc; 44 struct i2c_client *rtc;
47 struct mutex iolock;
48 struct mutex irqlock;
49 45
50 int device_type; 46 int device_type;
51 int irq_base; 47 int irq_base;
@@ -53,8 +49,6 @@ struct sec_pmic_dev {
53 struct regmap_irq_chip_data *irq_data; 49 struct regmap_irq_chip_data *irq_data;
54 50
55 int ono; 51 int ono;
56 u8 irq_masks_cur[NUM_IRQ_REGS];
57 u8 irq_masks_cache[NUM_IRQ_REGS];
58 int type; 52 int type;
59 bool wakeup; 53 bool wakeup;
60}; 54};
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index ad2252f239d7..4e94dc65f987 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -189,6 +189,7 @@ enum s2mps11_regulators {
189#define S2MPS11_ENABLE_SHIFT 0x06 189#define S2MPS11_ENABLE_SHIFT 0x06
190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) 190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
192 193
193#define S2MPS11_PMIC_EN_SHIFT 6 194#define S2MPS11_PMIC_EN_SHIFT 6
194#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3) 195#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index c79ad5d2f271..8d73fe29796a 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -30,8 +30,8 @@
30#define REG_IDLECONFIG 0x058 30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C 31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060 32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) 33#define REG_STEPCONFIG(n) (0x64 + ((n) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) 34#define REG_STEPDELAY(n) (0x68 + ((n) * 8))
35#define REG_FIFO0CNT 0xE4 35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8 36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0 37#define REG_FIFO1CNT 0xF0
@@ -46,8 +46,6 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51 49
52/* IRQ enable */ 50/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0) 51#define IRQENB_HW_PEN BIT(0)
@@ -73,8 +71,6 @@
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8) 71#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19) 72#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19) 73#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4) 74#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8) 75#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26) 76#define STEPCONFIG_FIFO1 BIT(26)
@@ -96,7 +92,6 @@
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1) 92#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19) 93#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19) 94#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23) 95#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23) 96#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1) 97#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
@@ -125,22 +120,17 @@
125 120
126#define TSCADC_CELLS 2 121#define TSCADC_CELLS 2
127 122
128enum tscadc_cells {
129 TSC_CELL,
130 ADC_CELL,
131};
132
133struct mfd_tscadc_board {
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137
138struct ti_tscadc_dev { 123struct ti_tscadc_dev {
139 struct device *dev; 124 struct device *dev;
140 struct regmap *regmap_tscadc; 125 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base; 126 void __iomem *tscadc_base;
142 int irq; 127 int irq;
128 int used_cells; /* 1-2 */
129 int tsc_cell; /* -1 if not used */
130 int adc_cell; /* -1 if not used */
143 struct mfd_cell cells[TSCADC_CELLS]; 131 struct mfd_cell cells[TSCADC_CELLS];
132 u32 reg_se_cache;
133 spinlock_t reg_lock;
144 134
145 /* tsc device */ 135 /* tsc device */
146 struct titsc *tsc; 136 struct titsc *tsc;
@@ -149,4 +139,15 @@ struct ti_tscadc_dev {
149 struct adc_device *adc; 139 struct adc_device *adc;
150}; 140};
151 141
142static inline struct ti_tscadc_dev *ti_tscadc_dev_get(struct platform_device *p)
143{
144 struct ti_tscadc_dev **tscadc_dev = p->dev.platform_data;
145
146 return *tscadc_dev;
147}
148
149void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc);
150void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val);
151void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val);
152
152#endif 153#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 99bf3e665997..ce3511326f80 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -81,10 +81,15 @@ int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
83 83
84struct dma_chan;
85
84struct tmio_mmc_dma { 86struct tmio_mmc_dma {
85 void *chan_priv_tx; 87 void *chan_priv_tx;
86 void *chan_priv_rx; 88 void *chan_priv_rx;
89 int slave_id_tx;
90 int slave_id_rx;
87 int alignment_shift; 91 int alignment_shift;
92 bool (*filter)(struct dma_chan *chan, void *arg);
88}; 93};
89 94
90struct tmio_mmc_host; 95struct tmio_mmc_host;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index ae5c249530b4..40854ac0ba3d 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -29,6 +29,7 @@ enum wm8994_type {
29 29
30struct regulator_dev; 30struct regulator_dev;
31struct regulator_bulk_data; 31struct regulator_bulk_data;
32struct irq_domain;
32 33
33#define WM8994_NUM_GPIO_REGS 11 34#define WM8994_NUM_GPIO_REGS 11
34#define WM8994_NUM_LDO_REGS 2 35#define WM8994_NUM_LDO_REGS 2
@@ -73,6 +74,7 @@ struct wm8994 {
73 74
74 int irq; 75 int irq;
75 struct regmap_irq_chip_data *irq_data; 76 struct regmap_irq_chip_data *irq_data;
77 struct irq_domain *edge_irq;
76 78
77 /* Used over suspend/resume */ 79 /* Used over suspend/resume */
78 bool suspended; 80 bool suspended;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index b5046f6313a9..90c60524a496 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -228,6 +228,11 @@ struct wm8994_pdata {
228 * lines is mastered. 228 * lines is mastered.
229 */ 229 */
230 int max_channels_clocked[WM8994_NUM_AIF]; 230 int max_channels_clocked[WM8994_NUM_AIF];
231
232 /**
233 * GPIO for the IRQ pin if host only supports edge triggering
234 */
235 int irq_gpio;
231}; 236};
232 237
233#endif 238#endif
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index adf6e0648f20..bb1c8096a7eb 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -111,6 +111,7 @@ enum {
111 MLX4_CMD_INIT2INIT_QP = 0x2d, 111 MLX4_CMD_INIT2INIT_QP = 0x2d,
112 MLX4_CMD_SUSPEND_QP = 0x32, 112 MLX4_CMD_SUSPEND_QP = 0x32,
113 MLX4_CMD_UNSUSPEND_QP = 0x33, 113 MLX4_CMD_UNSUSPEND_QP = 0x33,
114 MLX4_CMD_UPDATE_QP = 0x61,
114 /* special QP and management commands */ 115 /* special QP and management commands */
115 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 116 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
116 MLX4_CMD_MAD_IFC = 0x24, 117 MLX4_CMD_MAD_IFC = 0x24,
@@ -237,7 +238,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
237int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 238int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
238int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 239int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
239int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 240int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
240 241int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
241 242
242#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 243#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
243 244
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a51b0134ce18..52c23a892bab 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -157,7 +157,8 @@ enum {
157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4,
158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
161 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8
161}; 162};
162 163
163enum { 164enum {
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 352eec9df1b8..262deac02c9e 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -152,6 +152,8 @@ enum { /* fl */
152}; 152};
153enum { /* vlan_control */ 153enum { /* vlan_control */
154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6, 154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
155 MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED = 1 << 5, /* 802.1p priority tag */
156 MLX4_VLAN_CTRL_ETH_TX_BLOCK_UNTAGGED = 1 << 4,
155 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2, 157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
156 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */ 158 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0 159 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
@@ -206,6 +208,40 @@ struct mlx4_qp_context {
206 u32 reserved5[10]; 208 u32 reserved5[10];
207}; 209};
208 210
211struct mlx4_update_qp_context {
212 __be64 qp_mask;
213 __be64 primary_addr_path_mask;
214 __be64 secondary_addr_path_mask;
215 u64 reserved1;
216 struct mlx4_qp_context qp_context;
217 u64 reserved2[58];
218};
219
220enum {
221 MLX4_UPD_QP_MASK_PM_STATE = 32,
222 MLX4_UPD_QP_MASK_VSD = 33,
223};
224
225enum {
226 MLX4_UPD_QP_PATH_MASK_PKEY_INDEX = 0 + 32,
227 MLX4_UPD_QP_PATH_MASK_FSM = 1 + 32,
228 MLX4_UPD_QP_PATH_MASK_MAC_INDEX = 2 + 32,
229 MLX4_UPD_QP_PATH_MASK_FVL = 3 + 32,
230 MLX4_UPD_QP_PATH_MASK_CV = 4 + 32,
231 MLX4_UPD_QP_PATH_MASK_VLAN_INDEX = 5 + 32,
232 MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN = 6 + 32,
233 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_UNTAGGED = 7 + 32,
234 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_1P = 8 + 32,
235 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_TAGGED = 9 + 32,
236 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_UNTAGGED = 10 + 32,
237 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_1P = 11 + 32,
238 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_TAGGED = 12 + 32,
239 MLX4_UPD_QP_PATH_MASK_FEUP = 13 + 32,
240 MLX4_UPD_QP_PATH_MASK_SCHED_QUEUE = 14 + 32,
241 MLX4_UPD_QP_PATH_MASK_IF_COUNTER_INDEX = 15 + 32,
242 MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
243};
244
209enum { /* param3 */ 245enum { /* param3 */
210 MLX4_STRIP_VLAN = 1 << 30 246 MLX4_STRIP_VLAN = 1 << 30
211}; 247};
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
new file mode 100644
index 000000000000..2826a4b6071e
--- /dev/null
+++ b/include/linux/mlx5/cmd.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CMD_H
34#define MLX5_CMD_H
35
36#include <linux/types.h>
37
38struct manage_pages_layout {
39 u64 ptr;
40 u32 reserved;
41 u16 num_entries;
42 u16 func_id;
43};
44
45
46struct mlx5_cmd_alloc_uar_imm_out {
47 u32 rsvd[3];
48 u32 uarn;
49};
50
51#endif /* MLX5_CMD_H */
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
new file mode 100644
index 000000000000..3db67f73d96d
--- /dev/null
+++ b/include/linux/mlx5/cq.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CORE_CQ_H
34#define MLX5_CORE_CQ_H
35
36#include <rdma/ib_verbs.h>
37#include <linux/mlx5/driver.h>
38
39
40struct mlx5_core_cq {
41 u32 cqn;
42 int cqe_sz;
43 __be32 *set_ci_db;
44 __be32 *arm_db;
45 atomic_t refcount;
46 struct completion free;
47 unsigned vector;
48 int irqn;
49 void (*comp) (struct mlx5_core_cq *);
50 void (*event) (struct mlx5_core_cq *, enum mlx5_event);
51 struct mlx5_uar *uar;
52 u32 cons_index;
53 unsigned arm_sn;
54 struct mlx5_rsc_debug *dbg;
55 int pid;
56};
57
58
59enum {
60 MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR = 0x01,
61 MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR = 0x02,
62 MLX5_CQE_SYNDROME_LOCAL_PROT_ERR = 0x04,
63 MLX5_CQE_SYNDROME_WR_FLUSH_ERR = 0x05,
64 MLX5_CQE_SYNDROME_MW_BIND_ERR = 0x06,
65 MLX5_CQE_SYNDROME_BAD_RESP_ERR = 0x10,
66 MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR = 0x11,
67 MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12,
68 MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR = 0x13,
69 MLX5_CQE_SYNDROME_REMOTE_OP_ERR = 0x14,
70 MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR = 0x15,
71 MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR = 0x16,
72 MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
73};
74
75enum {
76 MLX5_CQE_OWNER_MASK = 1,
77 MLX5_CQE_REQ = 0,
78 MLX5_CQE_RESP_WR_IMM = 1,
79 MLX5_CQE_RESP_SEND = 2,
80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 0xff, /* TBD */
83 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14,
85};
86
87enum {
88 MLX5_CQ_MODIFY_RESEIZE = 0,
89 MLX5_CQ_MODIFY_MODER = 1,
90 MLX5_CQ_MODIFY_MAPPING = 2,
91};
92
93struct mlx5_cq_modify_params {
94 int type;
95 union {
96 struct {
97 u32 page_offset;
98 u8 log_cq_size;
99 } resize;
100
101 struct {
102 } moder;
103
104 struct {
105 } mapping;
106 } params;
107};
108
109enum {
110 CQE_SIZE_64 = 0,
111 CQE_SIZE_128 = 1,
112};
113
114static inline int cqe_sz_to_mlx_sz(u8 size)
115{
116 return size == 64 ? CQE_SIZE_64 : CQE_SIZE_128;
117}
118
119static inline void mlx5_cq_set_ci(struct mlx5_core_cq *cq)
120{
121 *cq->set_ci_db = cpu_to_be32(cq->cons_index & 0xffffff);
122}
123
124enum {
125 MLX5_CQ_DB_REQ_NOT_SOL = 1 << 24,
126 MLX5_CQ_DB_REQ_NOT = 0 << 24
127};
128
129static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
130 void __iomem *uar_page,
131 spinlock_t *doorbell_lock)
132{
133 __be32 doorbell[2];
134 u32 sn;
135 u32 ci;
136
137 sn = cq->arm_sn & 3;
138 ci = cq->cons_index & 0xffffff;
139
140 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
141
142 /* Make sure that the doorbell record in host memory is
143 * written before ringing the doorbell via PCI MMIO.
144 */
145 wmb();
146
147 doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
148 doorbell[1] = cpu_to_be32(cq->cqn);
149
150 mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, doorbell_lock);
151}
152
153int mlx5_init_cq_table(struct mlx5_core_dev *dev);
154void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
155int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
156 struct mlx5_create_cq_mbox_in *in, int inlen);
157int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
158int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
159 struct mlx5_query_cq_mbox_out *out);
160int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
161 int type, struct mlx5_cq_modify_params *params);
162int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
163void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
164
165#endif /* MLX5_CORE_CQ_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
new file mode 100644
index 000000000000..8de8d8f22384
--- /dev/null
+++ b/include/linux/mlx5/device.h
@@ -0,0 +1,893 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DEVICE_H
34#define MLX5_DEVICE_H
35
36#include <linux/types.h>
37#include <rdma/ib_verbs.h>
38
39#if defined(__LITTLE_ENDIAN)
40#define MLX5_SET_HOST_ENDIANNESS 0
41#elif defined(__BIG_ENDIAN)
42#define MLX5_SET_HOST_ENDIANNESS 0x80
43#else
44#error Host endianness not defined
45#endif
46
47enum {
48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7,
51};
52
53enum {
54 MLX5_EXTENDED_UD_AV = 0x80000000,
55};
56
57enum {
58 MLX5_CQ_STATE_ARMED = 9,
59 MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
60 MLX5_CQ_STATE_FIRED = 0xa,
61};
62
63enum {
64 MLX5_STAT_RATE_OFFSET = 5,
65};
66
67enum {
68 MLX5_INLINE_SEG = 0x80000000,
69};
70
71enum {
72 MLX5_PERM_LOCAL_READ = 1 << 2,
73 MLX5_PERM_LOCAL_WRITE = 1 << 3,
74 MLX5_PERM_REMOTE_READ = 1 << 4,
75 MLX5_PERM_REMOTE_WRITE = 1 << 5,
76 MLX5_PERM_ATOMIC = 1 << 6,
77 MLX5_PERM_UMR_EN = 1 << 7,
78};
79
80enum {
81 MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
82 MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
83 MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
84 MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
85 MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
86};
87
88enum {
89 MLX5_ACCESS_MODE_PA = 0,
90 MLX5_ACCESS_MODE_MTT = 1,
91 MLX5_ACCESS_MODE_KLM = 2
92};
93
94enum {
95 MLX5_MKEY_REMOTE_INVAL = 1 << 24,
96 MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
97 MLX5_MKEY_BSF_EN = 1 << 30,
98 MLX5_MKEY_LEN64 = 1 << 31,
99};
100
101enum {
102 MLX5_EN_RD = (u64)1,
103 MLX5_EN_WR = (u64)2
104};
105
106enum {
107 MLX5_BF_REGS_PER_PAGE = 4,
108 MLX5_MAX_UAR_PAGES = 1 << 8,
109 MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_BF_REGS_PER_PAGE,
110};
111
112enum {
113 MLX5_MKEY_MASK_LEN = 1ull << 0,
114 MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
115 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
116 MLX5_MKEY_MASK_PD = 1ull << 7,
117 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
118 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
119 MLX5_MKEY_MASK_KEY = 1ull << 13,
120 MLX5_MKEY_MASK_QPN = 1ull << 14,
121 MLX5_MKEY_MASK_LR = 1ull << 17,
122 MLX5_MKEY_MASK_LW = 1ull << 18,
123 MLX5_MKEY_MASK_RR = 1ull << 19,
124 MLX5_MKEY_MASK_RW = 1ull << 20,
125 MLX5_MKEY_MASK_A = 1ull << 21,
126 MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
127 MLX5_MKEY_MASK_FREE = 1ull << 29,
128};
129
130enum mlx5_event {
131 MLX5_EVENT_TYPE_COMP = 0x0,
132
133 MLX5_EVENT_TYPE_PATH_MIG = 0x01,
134 MLX5_EVENT_TYPE_COMM_EST = 0x02,
135 MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
136 MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
137 MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
138
139 MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
140 MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
141 MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
142 MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
143 MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
144 MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
145
146 MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
147 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
148 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
149 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
150
151 MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
152 MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
153
154 MLX5_EVENT_TYPE_CMD = 0x0a,
155 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
156};
157
158enum {
159 MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
160 MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
161 MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
162 MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
163 MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
164 MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
165 MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
166};
167
168enum {
169 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
170 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
171 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
172 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
173 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
174 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
175 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
176 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
177 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
178 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
179 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
180 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46,
185};
186
187enum {
188 MLX5_OPCODE_NOP = 0x00,
189 MLX5_OPCODE_SEND_INVAL = 0x01,
190 MLX5_OPCODE_RDMA_WRITE = 0x08,
191 MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
192 MLX5_OPCODE_SEND = 0x0a,
193 MLX5_OPCODE_SEND_IMM = 0x0b,
194 MLX5_OPCODE_RDMA_READ = 0x10,
195 MLX5_OPCODE_ATOMIC_CS = 0x11,
196 MLX5_OPCODE_ATOMIC_FA = 0x12,
197 MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
198 MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
199 MLX5_OPCODE_BIND_MW = 0x18,
200 MLX5_OPCODE_CONFIG_CMD = 0x1f,
201
202 MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
203 MLX5_RECV_OPCODE_SEND = 0x01,
204 MLX5_RECV_OPCODE_SEND_IMM = 0x02,
205 MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
206
207 MLX5_CQE_OPCODE_ERROR = 0x1e,
208 MLX5_CQE_OPCODE_RESIZE = 0x16,
209
210 MLX5_OPCODE_SET_PSV = 0x20,
211 MLX5_OPCODE_GET_PSV = 0x21,
212 MLX5_OPCODE_CHECK_PSV = 0x22,
213 MLX5_OPCODE_RGET_PSV = 0x26,
214 MLX5_OPCODE_RCHECK_PSV = 0x27,
215
216 MLX5_OPCODE_UMR = 0x25,
217
218};
219
220enum {
221 MLX5_SET_PORT_RESET_QKEY = 0,
222 MLX5_SET_PORT_GUID0 = 16,
223 MLX5_SET_PORT_NODE_GUID = 17,
224 MLX5_SET_PORT_SYS_GUID = 18,
225 MLX5_SET_PORT_GID_TABLE = 19,
226 MLX5_SET_PORT_PKEY_TABLE = 20,
227};
228
229enum {
230 MLX5_MAX_PAGE_SHIFT = 31
231};
232
233struct mlx5_inbox_hdr {
234 __be16 opcode;
235 u8 rsvd[4];
236 __be16 opmod;
237};
238
239struct mlx5_outbox_hdr {
240 u8 status;
241 u8 rsvd[3];
242 __be32 syndrome;
243};
244
245struct mlx5_cmd_query_adapter_mbox_in {
246 struct mlx5_inbox_hdr hdr;
247 u8 rsvd[8];
248};
249
250struct mlx5_cmd_query_adapter_mbox_out {
251 struct mlx5_outbox_hdr hdr;
252 u8 rsvd0[24];
253 u8 intapin;
254 u8 rsvd1[13];
255 __be16 vsd_vendor_id;
256 u8 vsd[208];
257 u8 vsd_psid[16];
258};
259
260struct mlx5_hca_cap {
261 u8 rsvd1[16];
262 u8 log_max_srq_sz;
263 u8 log_max_qp_sz;
264 u8 rsvd2;
265 u8 log_max_qp;
266 u8 log_max_strq_sz;
267 u8 log_max_srqs;
268 u8 rsvd4[2];
269 u8 rsvd5;
270 u8 log_max_cq_sz;
271 u8 rsvd6;
272 u8 log_max_cq;
273 u8 log_max_eq_sz;
274 u8 log_max_mkey;
275 u8 rsvd7;
276 u8 log_max_eq;
277 u8 max_indirection;
278 u8 log_max_mrw_sz;
279 u8 log_max_bsf_list_sz;
280 u8 log_max_klm_list_sz;
281 u8 rsvd_8_0;
282 u8 log_max_ra_req_dc;
283 u8 rsvd_8_1;
284 u8 log_max_ra_res_dc;
285 u8 rsvd9;
286 u8 log_max_ra_req_qp;
287 u8 rsvd10;
288 u8 log_max_ra_res_qp;
289 u8 rsvd11[4];
290 __be16 max_qp_count;
291 __be16 rsvd12;
292 u8 rsvd13;
293 u8 local_ca_ack_delay;
294 u8 rsvd14;
295 u8 num_ports;
296 u8 log_max_msg;
297 u8 rsvd15[3];
298 __be16 stat_rate_support;
299 u8 rsvd16[2];
300 __be64 flags;
301 u8 rsvd17;
302 u8 uar_sz;
303 u8 rsvd18;
304 u8 log_pg_sz;
305 __be16 bf_log_bf_reg_size;
306 u8 rsvd19[4];
307 __be16 max_desc_sz_sq;
308 u8 rsvd20[2];
309 __be16 max_desc_sz_rq;
310 u8 rsvd21[2];
311 __be16 max_desc_sz_sq_dc;
312 u8 rsvd22[4];
313 __be16 max_qp_mcg;
314 u8 rsvd23;
315 u8 log_max_mcg;
316 u8 rsvd24;
317 u8 log_max_pd;
318 u8 rsvd25;
319 u8 log_max_xrcd;
320 u8 rsvd26[42];
321 __be16 log_uar_page_sz;
322 u8 rsvd27[28];
323 u8 log_msx_atomic_size_qp;
324 u8 rsvd28[2];
325 u8 log_msx_atomic_size_dc;
326 u8 rsvd29[76];
327};
328
329
330struct mlx5_cmd_query_hca_cap_mbox_in {
331 struct mlx5_inbox_hdr hdr;
332 u8 rsvd[8];
333};
334
335
336struct mlx5_cmd_query_hca_cap_mbox_out {
337 struct mlx5_outbox_hdr hdr;
338 u8 rsvd0[8];
339 struct mlx5_hca_cap hca_cap;
340};
341
342
343struct mlx5_cmd_set_hca_cap_mbox_in {
344 struct mlx5_inbox_hdr hdr;
345 u8 rsvd[8];
346 struct mlx5_hca_cap hca_cap;
347};
348
349
350struct mlx5_cmd_set_hca_cap_mbox_out {
351 struct mlx5_outbox_hdr hdr;
352 u8 rsvd0[8];
353};
354
355
356struct mlx5_cmd_init_hca_mbox_in {
357 struct mlx5_inbox_hdr hdr;
358 u8 rsvd0[2];
359 __be16 profile;
360 u8 rsvd1[4];
361};
362
363struct mlx5_cmd_init_hca_mbox_out {
364 struct mlx5_outbox_hdr hdr;
365 u8 rsvd[8];
366};
367
368struct mlx5_cmd_teardown_hca_mbox_in {
369 struct mlx5_inbox_hdr hdr;
370 u8 rsvd0[2];
371 __be16 profile;
372 u8 rsvd1[4];
373};
374
375struct mlx5_cmd_teardown_hca_mbox_out {
376 struct mlx5_outbox_hdr hdr;
377 u8 rsvd[8];
378};
379
380struct mlx5_cmd_layout {
381 u8 type;
382 u8 rsvd0[3];
383 __be32 inlen;
384 __be64 in_ptr;
385 __be32 in[4];
386 __be32 out[4];
387 __be64 out_ptr;
388 __be32 outlen;
389 u8 token;
390 u8 sig;
391 u8 rsvd1;
392 u8 status_own;
393};
394
395
396struct health_buffer {
397 __be32 assert_var[5];
398 __be32 rsvd0[3];
399 __be32 assert_exit_ptr;
400 __be32 assert_callra;
401 __be32 rsvd1[2];
402 __be32 fw_ver;
403 __be32 hw_id;
404 __be32 rsvd2;
405 u8 irisc_index;
406 u8 synd;
407 __be16 ext_sync;
408};
409
410struct mlx5_init_seg {
411 __be32 fw_rev;
412 __be32 cmdif_rev_fw_sub;
413 __be32 rsvd0[2];
414 __be32 cmdq_addr_h;
415 __be32 cmdq_addr_l_sz;
416 __be32 cmd_dbell;
417 __be32 rsvd1[121];
418 struct health_buffer health;
419 __be32 rsvd2[884];
420 __be32 health_counter;
421 __be32 rsvd3[1023];
422 __be64 ieee1588_clk;
423 __be32 ieee1588_clk_type;
424 __be32 clr_intx;
425};
426
427struct mlx5_eqe_comp {
428 __be32 reserved[6];
429 __be32 cqn;
430};
431
432struct mlx5_eqe_qp_srq {
433 __be32 reserved[6];
434 __be32 qp_srq_n;
435};
436
437struct mlx5_eqe_cq_err {
438 __be32 cqn;
439 u8 reserved1[7];
440 u8 syndrome;
441};
442
443struct mlx5_eqe_dropped_packet {
444};
445
446struct mlx5_eqe_port_state {
447 u8 reserved0[8];
448 u8 port;
449};
450
451struct mlx5_eqe_gpio {
452 __be32 reserved0[2];
453 __be64 gpio_event;
454};
455
456struct mlx5_eqe_congestion {
457 u8 type;
458 u8 rsvd0;
459 u8 congestion_level;
460};
461
462struct mlx5_eqe_stall_vl {
463 u8 rsvd0[3];
464 u8 port_vl;
465};
466
467struct mlx5_eqe_cmd {
468 __be32 vector;
469 __be32 rsvd[6];
470};
471
472struct mlx5_eqe_page_req {
473 u8 rsvd0[2];
474 __be16 func_id;
475 u8 rsvd1[2];
476 __be16 num_pages;
477 __be32 rsvd2[5];
478};
479
480union ev_data {
481 __be32 raw[7];
482 struct mlx5_eqe_cmd cmd;
483 struct mlx5_eqe_comp comp;
484 struct mlx5_eqe_qp_srq qp_srq;
485 struct mlx5_eqe_cq_err cq_err;
486 struct mlx5_eqe_dropped_packet dp;
487 struct mlx5_eqe_port_state port;
488 struct mlx5_eqe_gpio gpio;
489 struct mlx5_eqe_congestion cong;
490 struct mlx5_eqe_stall_vl stall_vl;
491 struct mlx5_eqe_page_req req_pages;
492} __packed;
493
494struct mlx5_eqe {
495 u8 rsvd0;
496 u8 type;
497 u8 rsvd1;
498 u8 sub_type;
499 __be32 rsvd2[7];
500 union ev_data data;
501 __be16 rsvd3;
502 u8 signature;
503 u8 owner;
504} __packed;
505
506struct mlx5_cmd_prot_block {
507 u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
508 u8 rsvd0[48];
509 __be64 next;
510 __be32 block_num;
511 u8 rsvd1;
512 u8 token;
513 u8 ctrl_sig;
514 u8 sig;
515};
516
517struct mlx5_err_cqe {
518 u8 rsvd0[32];
519 __be32 srqn;
520 u8 rsvd1[18];
521 u8 vendor_err_synd;
522 u8 syndrome;
523 __be32 s_wqe_opcode_qpn;
524 __be16 wqe_counter;
525 u8 signature;
526 u8 op_own;
527};
528
529struct mlx5_cqe64 {
530 u8 rsvd0[17];
531 u8 ml_path;
532 u8 rsvd20[4];
533 __be16 slid;
534 __be32 flags_rqpn;
535 u8 rsvd28[4];
536 __be32 srqn;
537 __be32 imm_inval_pkey;
538 u8 rsvd40[4];
539 __be32 byte_cnt;
540 __be64 timestamp;
541 __be32 sop_drop_qpn;
542 __be16 wqe_counter;
543 u8 signature;
544 u8 op_own;
545};
546
547struct mlx5_wqe_srq_next_seg {
548 u8 rsvd0[2];
549 __be16 next_wqe_index;
550 u8 signature;
551 u8 rsvd1[11];
552};
553
554union mlx5_ext_cqe {
555 struct ib_grh grh;
556 u8 inl[64];
557};
558
559struct mlx5_cqe128 {
560 union mlx5_ext_cqe inl_grh;
561 struct mlx5_cqe64 cqe64;
562};
563
564struct mlx5_srq_ctx {
565 u8 state_log_sz;
566 u8 rsvd0[3];
567 __be32 flags_xrcd;
568 __be32 pgoff_cqn;
569 u8 rsvd1[4];
570 u8 log_pg_sz;
571 u8 rsvd2[7];
572 __be32 pd;
573 __be16 lwm;
574 __be16 wqe_cnt;
575 u8 rsvd3[8];
576 __be64 db_record;
577};
578
579struct mlx5_create_srq_mbox_in {
580 struct mlx5_inbox_hdr hdr;
581 __be32 input_srqn;
582 u8 rsvd0[4];
583 struct mlx5_srq_ctx ctx;
584 u8 rsvd1[208];
585 __be64 pas[0];
586};
587
588struct mlx5_create_srq_mbox_out {
589 struct mlx5_outbox_hdr hdr;
590 __be32 srqn;
591 u8 rsvd[4];
592};
593
594struct mlx5_destroy_srq_mbox_in {
595 struct mlx5_inbox_hdr hdr;
596 __be32 srqn;
597 u8 rsvd[4];
598};
599
600struct mlx5_destroy_srq_mbox_out {
601 struct mlx5_outbox_hdr hdr;
602 u8 rsvd[8];
603};
604
605struct mlx5_query_srq_mbox_in {
606 struct mlx5_inbox_hdr hdr;
607 __be32 srqn;
608 u8 rsvd0[4];
609};
610
611struct mlx5_query_srq_mbox_out {
612 struct mlx5_outbox_hdr hdr;
613 u8 rsvd0[8];
614 struct mlx5_srq_ctx ctx;
615 u8 rsvd1[32];
616 __be64 pas[0];
617};
618
619struct mlx5_arm_srq_mbox_in {
620 struct mlx5_inbox_hdr hdr;
621 __be32 srqn;
622 __be16 rsvd;
623 __be16 lwm;
624};
625
626struct mlx5_arm_srq_mbox_out {
627 struct mlx5_outbox_hdr hdr;
628 u8 rsvd[8];
629};
630
631struct mlx5_cq_context {
632 u8 status;
633 u8 cqe_sz_flags;
634 u8 st;
635 u8 rsvd3;
636 u8 rsvd4[6];
637 __be16 page_offset;
638 __be32 log_sz_usr_page;
639 __be16 cq_period;
640 __be16 cq_max_count;
641 __be16 rsvd20;
642 __be16 c_eqn;
643 u8 log_pg_sz;
644 u8 rsvd25[7];
645 __be32 last_notified_index;
646 __be32 solicit_producer_index;
647 __be32 consumer_counter;
648 __be32 producer_counter;
649 u8 rsvd48[8];
650 __be64 db_record_addr;
651};
652
653struct mlx5_create_cq_mbox_in {
654 struct mlx5_inbox_hdr hdr;
655 __be32 input_cqn;
656 u8 rsvdx[4];
657 struct mlx5_cq_context ctx;
658 u8 rsvd6[192];
659 __be64 pas[0];
660};
661
662struct mlx5_create_cq_mbox_out {
663 struct mlx5_outbox_hdr hdr;
664 __be32 cqn;
665 u8 rsvd0[4];
666};
667
668struct mlx5_destroy_cq_mbox_in {
669 struct mlx5_inbox_hdr hdr;
670 __be32 cqn;
671 u8 rsvd0[4];
672};
673
674struct mlx5_destroy_cq_mbox_out {
675 struct mlx5_outbox_hdr hdr;
676 u8 rsvd0[8];
677};
678
679struct mlx5_query_cq_mbox_in {
680 struct mlx5_inbox_hdr hdr;
681 __be32 cqn;
682 u8 rsvd0[4];
683};
684
685struct mlx5_query_cq_mbox_out {
686 struct mlx5_outbox_hdr hdr;
687 u8 rsvd0[8];
688 struct mlx5_cq_context ctx;
689 u8 rsvd6[16];
690 __be64 pas[0];
691};
692
693struct mlx5_eq_context {
694 u8 status;
695 u8 ec_oi;
696 u8 st;
697 u8 rsvd2[7];
698 __be16 page_pffset;
699 __be32 log_sz_usr_page;
700 u8 rsvd3[7];
701 u8 intr;
702 u8 log_page_size;
703 u8 rsvd4[15];
704 __be32 consumer_counter;
705 __be32 produser_counter;
706 u8 rsvd5[16];
707};
708
709struct mlx5_create_eq_mbox_in {
710 struct mlx5_inbox_hdr hdr;
711 u8 rsvd0[3];
712 u8 input_eqn;
713 u8 rsvd1[4];
714 struct mlx5_eq_context ctx;
715 u8 rsvd2[8];
716 __be64 events_mask;
717 u8 rsvd3[176];
718 __be64 pas[0];
719};
720
721struct mlx5_create_eq_mbox_out {
722 struct mlx5_outbox_hdr hdr;
723 u8 rsvd0[3];
724 u8 eq_number;
725 u8 rsvd1[4];
726};
727
728struct mlx5_destroy_eq_mbox_in {
729 struct mlx5_inbox_hdr hdr;
730 u8 rsvd0[3];
731 u8 eqn;
732 u8 rsvd1[4];
733};
734
735struct mlx5_destroy_eq_mbox_out {
736 struct mlx5_outbox_hdr hdr;
737 u8 rsvd[8];
738};
739
740struct mlx5_map_eq_mbox_in {
741 struct mlx5_inbox_hdr hdr;
742 __be64 mask;
743 u8 mu;
744 u8 rsvd0[2];
745 u8 eqn;
746 u8 rsvd1[24];
747};
748
749struct mlx5_map_eq_mbox_out {
750 struct mlx5_outbox_hdr hdr;
751 u8 rsvd[8];
752};
753
754struct mlx5_query_eq_mbox_in {
755 struct mlx5_inbox_hdr hdr;
756 u8 rsvd0[3];
757 u8 eqn;
758 u8 rsvd1[4];
759};
760
761struct mlx5_query_eq_mbox_out {
762 struct mlx5_outbox_hdr hdr;
763 u8 rsvd[8];
764 struct mlx5_eq_context ctx;
765};
766
767struct mlx5_mkey_seg {
768 /* This is a two bit field occupying bits 31-30.
769 * bit 31 is always 0,
770 * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
771 */
772 u8 status;
773 u8 pcie_control;
774 u8 flags;
775 u8 version;
776 __be32 qpn_mkey7_0;
777 u8 rsvd1[4];
778 __be32 flags_pd;
779 __be64 start_addr;
780 __be64 len;
781 __be32 bsfs_octo_size;
782 u8 rsvd2[16];
783 __be32 xlt_oct_size;
784 u8 rsvd3[3];
785 u8 log2_page_size;
786 u8 rsvd4[4];
787};
788
789struct mlx5_query_special_ctxs_mbox_in {
790 struct mlx5_inbox_hdr hdr;
791 u8 rsvd[8];
792};
793
794struct mlx5_query_special_ctxs_mbox_out {
795 struct mlx5_outbox_hdr hdr;
796 __be32 dump_fill_mkey;
797 __be32 reserved_lkey;
798};
799
800struct mlx5_create_mkey_mbox_in {
801 struct mlx5_inbox_hdr hdr;
802 __be32 input_mkey_index;
803 u8 rsvd0[4];
804 struct mlx5_mkey_seg seg;
805 u8 rsvd1[16];
806 __be32 xlat_oct_act_size;
807 __be32 bsf_coto_act_size;
808 u8 rsvd2[168];
809 __be64 pas[0];
810};
811
812struct mlx5_create_mkey_mbox_out {
813 struct mlx5_outbox_hdr hdr;
814 __be32 mkey;
815 u8 rsvd[4];
816};
817
818struct mlx5_destroy_mkey_mbox_in {
819 struct mlx5_inbox_hdr hdr;
820 __be32 mkey;
821 u8 rsvd[4];
822};
823
824struct mlx5_destroy_mkey_mbox_out {
825 struct mlx5_outbox_hdr hdr;
826 u8 rsvd[8];
827};
828
829struct mlx5_query_mkey_mbox_in {
830 struct mlx5_inbox_hdr hdr;
831 __be32 mkey;
832};
833
834struct mlx5_query_mkey_mbox_out {
835 struct mlx5_outbox_hdr hdr;
836 __be64 pas[0];
837};
838
839struct mlx5_modify_mkey_mbox_in {
840 struct mlx5_inbox_hdr hdr;
841 __be32 mkey;
842 __be64 pas[0];
843};
844
845struct mlx5_modify_mkey_mbox_out {
846 struct mlx5_outbox_hdr hdr;
847};
848
849struct mlx5_dump_mkey_mbox_in {
850 struct mlx5_inbox_hdr hdr;
851};
852
853struct mlx5_dump_mkey_mbox_out {
854 struct mlx5_outbox_hdr hdr;
855 __be32 mkey;
856};
857
858struct mlx5_mad_ifc_mbox_in {
859 struct mlx5_inbox_hdr hdr;
860 __be16 remote_lid;
861 u8 rsvd0;
862 u8 port;
863 u8 rsvd1[4];
864 u8 data[256];
865};
866
867struct mlx5_mad_ifc_mbox_out {
868 struct mlx5_outbox_hdr hdr;
869 u8 rsvd[8];
870 u8 data[256];
871};
872
873struct mlx5_access_reg_mbox_in {
874 struct mlx5_inbox_hdr hdr;
875 u8 rsvd0[2];
876 __be16 register_id;
877 __be32 arg;
878 __be32 data[0];
879};
880
881struct mlx5_access_reg_mbox_out {
882 struct mlx5_outbox_hdr hdr;
883 u8 rsvd[8];
884 __be32 data[0];
885};
886
887#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
888
889enum {
890 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
891};
892
893#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
new file mode 100644
index 000000000000..163a818411e7
--- /dev/null
+++ b/include/linux/mlx5/doorbell.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DOORBELL_H
34#define MLX5_DOORBELL_H
35
36#define MLX5_BF_OFFSET 0x800
37#define MLX5_CQ_DOORBELL 0x20
38
39#if BITS_PER_LONG == 64
40/* Assume that we can just write a 64-bit doorbell atomically. s390
41 * actually doesn't have writeq() but S/390 systems don't even have
42 * PCI so we won't worry about it.
43 */
44
45#define MLX5_DECLARE_DOORBELL_LOCK(name)
46#define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0)
47#define MLX5_GET_DOORBELL_LOCK(ptr) (NULL)
48
49static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
50 spinlock_t *doorbell_lock)
51{
52 __raw_writeq(*(u64 *)val, dest);
53}
54
55#else
56
57/* Just fall back to a spinlock to protect the doorbell if
58 * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit
59 * MMIO writes.
60 */
61
62#define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name;
63#define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr)
64#define MLX5_GET_DOORBELL_LOCK(ptr) (ptr)
65
66static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
67 spinlock_t *doorbell_lock)
68{
69 unsigned long flags;
70
71 spin_lock_irqsave(doorbell_lock, flags);
72 __raw_writel((__force u32) val[0], dest);
73 __raw_writel((__force u32) val[1], dest + 4);
74 spin_unlock_irqrestore(doorbell_lock, flags);
75}
76
77#endif
78
79#endif /* MLX5_DOORBELL_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
new file mode 100644
index 000000000000..f22e4419839b
--- /dev/null
+++ b/include/linux/mlx5/driver.h
@@ -0,0 +1,769 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DRIVER_H
34#define MLX5_DRIVER_H
35
36#include <linux/kernel.h>
37#include <linux/completion.h>
38#include <linux/pci.h>
39#include <linux/spinlock_types.h>
40#include <linux/semaphore.h>
41#include <linux/vmalloc.h>
42#include <linux/radix-tree.h>
43#include <linux/mlx5/device.h>
44#include <linux/mlx5/doorbell.h>
45
46enum {
47 MLX5_BOARD_ID_LEN = 64,
48 MLX5_MAX_NAME_LEN = 16,
49};
50
51enum {
52 /* one minute for the sake of bringup. Generally, commands must always
53 * complete and we may need to increase this timeout value
54 */
55 MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000,
56 MLX5_CMD_WQ_MAX_NAME = 32,
57};
58
59enum {
60 CMD_OWNER_SW = 0x0,
61 CMD_OWNER_HW = 0x1,
62 CMD_STATUS_SUCCESS = 0,
63};
64
65enum mlx5_sqp_t {
66 MLX5_SQP_SMI = 0,
67 MLX5_SQP_GSI = 1,
68 MLX5_SQP_IEEE_1588 = 2,
69 MLX5_SQP_SNIFFER = 3,
70 MLX5_SQP_SYNC_UMR = 4,
71};
72
73enum {
74 MLX5_MAX_PORTS = 2,
75};
76
77enum {
78 MLX5_EQ_VEC_PAGES = 0,
79 MLX5_EQ_VEC_CMD = 1,
80 MLX5_EQ_VEC_ASYNC = 2,
81 MLX5_EQ_VEC_COMP_BASE,
82};
83
84enum {
85 MLX5_MAX_EQ_NAME = 20
86};
87
88enum {
89 MLX5_ATOMIC_MODE_IB_COMP = 1 << 16,
90 MLX5_ATOMIC_MODE_CX = 2 << 16,
91 MLX5_ATOMIC_MODE_8B = 3 << 16,
92 MLX5_ATOMIC_MODE_16B = 4 << 16,
93 MLX5_ATOMIC_MODE_32B = 5 << 16,
94 MLX5_ATOMIC_MODE_64B = 6 << 16,
95 MLX5_ATOMIC_MODE_128B = 7 << 16,
96 MLX5_ATOMIC_MODE_256B = 8 << 16,
97};
98
99enum {
100 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
101 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
102 MLX5_CMD_OP_INIT_HCA = 0x102,
103 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
104 MLX5_CMD_OP_QUERY_PAGES = 0x107,
105 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
106 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
107
108 MLX5_CMD_OP_CREATE_MKEY = 0x200,
109 MLX5_CMD_OP_QUERY_MKEY = 0x201,
110 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
111 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
112
113 MLX5_CMD_OP_CREATE_EQ = 0x301,
114 MLX5_CMD_OP_DESTROY_EQ = 0x302,
115 MLX5_CMD_OP_QUERY_EQ = 0x303,
116
117 MLX5_CMD_OP_CREATE_CQ = 0x400,
118 MLX5_CMD_OP_DESTROY_CQ = 0x401,
119 MLX5_CMD_OP_QUERY_CQ = 0x402,
120 MLX5_CMD_OP_MODIFY_CQ = 0x403,
121
122 MLX5_CMD_OP_CREATE_QP = 0x500,
123 MLX5_CMD_OP_DESTROY_QP = 0x501,
124 MLX5_CMD_OP_RST2INIT_QP = 0x502,
125 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
126 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
127 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
128 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
129 MLX5_CMD_OP_2ERR_QP = 0x507,
130 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
131 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
132 MLX5_CMD_OP_2RST_QP = 0x50a,
133 MLX5_CMD_OP_QUERY_QP = 0x50b,
134 MLX5_CMD_OP_CONF_SQP = 0x50c,
135 MLX5_CMD_OP_MAD_IFC = 0x50d,
136 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
137 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
138 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
139 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
140 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
141 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
142 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
143
144 MLX5_CMD_OP_CREATE_PSV = 0x600,
145 MLX5_CMD_OP_DESTROY_PSV = 0x601,
146 MLX5_CMD_OP_QUERY_PSV = 0x602,
147 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
148 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
149
150 MLX5_CMD_OP_CREATE_SRQ = 0x700,
151 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
152 MLX5_CMD_OP_QUERY_SRQ = 0x702,
153 MLX5_CMD_OP_ARM_RQ = 0x703,
154 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
155
156 MLX5_CMD_OP_ALLOC_PD = 0x800,
157 MLX5_CMD_OP_DEALLOC_PD = 0x801,
158 MLX5_CMD_OP_ALLOC_UAR = 0x802,
159 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
160
161 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
162 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
163
164
165 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
166 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
167
168 MLX5_CMD_OP_ACCESS_REG = 0x805,
169 MLX5_CMD_OP_MAX = 0x810,
170};
171
172enum {
173 MLX5_REG_PCAP = 0x5001,
174 MLX5_REG_PMTU = 0x5003,
175 MLX5_REG_PTYS = 0x5004,
176 MLX5_REG_PAOS = 0x5006,
177 MLX5_REG_PMAOS = 0x5012,
178 MLX5_REG_PUDE = 0x5009,
179 MLX5_REG_PMPE = 0x5010,
180 MLX5_REG_PELC = 0x500e,
181 MLX5_REG_PMLP = 0, /* TBD */
182 MLX5_REG_NODE_DESC = 0x6001,
183 MLX5_REG_HOST_ENDIANNESS = 0x7004,
184};
185
186enum dbg_rsc_type {
187 MLX5_DBG_RSC_QP,
188 MLX5_DBG_RSC_EQ,
189 MLX5_DBG_RSC_CQ,
190};
191
192struct mlx5_field_desc {
193 struct dentry *dent;
194 int i;
195};
196
197struct mlx5_rsc_debug {
198 struct mlx5_core_dev *dev;
199 void *object;
200 enum dbg_rsc_type type;
201 struct dentry *root;
202 struct mlx5_field_desc fields[0];
203};
204
205enum mlx5_dev_event {
206 MLX5_DEV_EVENT_SYS_ERROR,
207 MLX5_DEV_EVENT_PORT_UP,
208 MLX5_DEV_EVENT_PORT_DOWN,
209 MLX5_DEV_EVENT_PORT_INITIALIZED,
210 MLX5_DEV_EVENT_LID_CHANGE,
211 MLX5_DEV_EVENT_PKEY_CHANGE,
212 MLX5_DEV_EVENT_GUID_CHANGE,
213 MLX5_DEV_EVENT_CLIENT_REREG,
214};
215
216struct mlx5_uuar_info {
217 struct mlx5_uar *uars;
218 int num_uars;
219 int num_low_latency_uuars;
220 unsigned long *bitmap;
221 unsigned int *count;
222 struct mlx5_bf *bfs;
223
224 /*
225 * protect uuar allocation data structs
226 */
227 struct mutex lock;
228};
229
230struct mlx5_bf {
231 void __iomem *reg;
232 void __iomem *regreg;
233 int buf_size;
234 struct mlx5_uar *uar;
235 unsigned long offset;
236 int need_lock;
237 /* protect blue flame buffer selection when needed
238 */
239 spinlock_t lock;
240
241 /* serialize 64 bit writes when done as two 32 bit accesses
242 */
243 spinlock_t lock32;
244 int uuarn;
245};
246
247struct mlx5_cmd_first {
248 __be32 data[4];
249};
250
251struct mlx5_cmd_msg {
252 struct list_head list;
253 struct cache_ent *cache;
254 u32 len;
255 struct mlx5_cmd_first first;
256 struct mlx5_cmd_mailbox *next;
257};
258
259struct mlx5_cmd_debug {
260 struct dentry *dbg_root;
261 struct dentry *dbg_in;
262 struct dentry *dbg_out;
263 struct dentry *dbg_outlen;
264 struct dentry *dbg_status;
265 struct dentry *dbg_run;
266 void *in_msg;
267 void *out_msg;
268 u8 status;
269 u16 inlen;
270 u16 outlen;
271};
272
273struct cache_ent {
274 /* protect block chain allocations
275 */
276 spinlock_t lock;
277 struct list_head head;
278};
279
280struct cmd_msg_cache {
281 struct cache_ent large;
282 struct cache_ent med;
283
284};
285
286struct mlx5_cmd_stats {
287 u64 sum;
288 u64 n;
289 struct dentry *root;
290 struct dentry *avg;
291 struct dentry *count;
292 /* protect command average calculations */
293 spinlock_t lock;
294};
295
296struct mlx5_cmd {
297 void *cmd_buf;
298 dma_addr_t dma;
299 u16 cmdif_rev;
300 u8 log_sz;
301 u8 log_stride;
302 int max_reg_cmds;
303 int events;
304 u32 __iomem *vector;
305
306 /* protect command queue allocations
307 */
308 spinlock_t alloc_lock;
309
310 /* protect token allocations
311 */
312 spinlock_t token_lock;
313 u8 token;
314 unsigned long bitmask;
315 char wq_name[MLX5_CMD_WQ_MAX_NAME];
316 struct workqueue_struct *wq;
317 struct semaphore sem;
318 struct semaphore pages_sem;
319 int mode;
320 struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
321 struct pci_pool *pool;
322 struct mlx5_cmd_debug dbg;
323 struct cmd_msg_cache cache;
324 int checksum_disabled;
325 struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
326};
327
328struct mlx5_port_caps {
329 int gid_table_len;
330 int pkey_table_len;
331};
332
333struct mlx5_caps {
334 u8 log_max_eq;
335 u8 log_max_cq;
336 u8 log_max_qp;
337 u8 log_max_mkey;
338 u8 log_max_pd;
339 u8 log_max_srq;
340 u32 max_cqes;
341 int max_wqes;
342 int max_sq_desc_sz;
343 int max_rq_desc_sz;
344 u64 flags;
345 u16 stat_rate_support;
346 int log_max_msg;
347 int num_ports;
348 int max_ra_res_qp;
349 int max_ra_req_qp;
350 int max_srq_wqes;
351 int bf_reg_size;
352 int bf_regs_per_page;
353 struct mlx5_port_caps port[MLX5_MAX_PORTS];
354 u8 ext_port_cap[MLX5_MAX_PORTS];
355 int max_vf;
356 u32 reserved_lkey;
357 u8 local_ca_ack_delay;
358 u8 log_max_mcg;
359 u16 max_qp_mcg;
360 int min_page_sz;
361};
362
363struct mlx5_cmd_mailbox {
364 void *buf;
365 dma_addr_t dma;
366 struct mlx5_cmd_mailbox *next;
367};
368
369struct mlx5_buf_list {
370 void *buf;
371 dma_addr_t map;
372};
373
374struct mlx5_buf {
375 struct mlx5_buf_list direct;
376 struct mlx5_buf_list *page_list;
377 int nbufs;
378 int npages;
379 int page_shift;
380 int size;
381};
382
383struct mlx5_eq {
384 struct mlx5_core_dev *dev;
385 __be32 __iomem *doorbell;
386 u32 cons_index;
387 struct mlx5_buf buf;
388 int size;
389 u8 irqn;
390 u8 eqn;
391 int nent;
392 u64 mask;
393 char name[MLX5_MAX_EQ_NAME];
394 struct list_head list;
395 int index;
396 struct mlx5_rsc_debug *dbg;
397};
398
399
400struct mlx5_core_mr {
401 u64 iova;
402 u64 size;
403 u32 key;
404 u32 pd;
405 u32 access;
406};
407
408struct mlx5_core_srq {
409 u32 srqn;
410 int max;
411 int max_gs;
412 int max_avail_gather;
413 int wqe_shift;
414 void (*event) (struct mlx5_core_srq *, enum mlx5_event);
415
416 atomic_t refcount;
417 struct completion free;
418};
419
420struct mlx5_eq_table {
421 void __iomem *update_ci;
422 void __iomem *update_arm_ci;
423 struct list_head *comp_eq_head;
424 struct mlx5_eq pages_eq;
425 struct mlx5_eq async_eq;
426 struct mlx5_eq cmd_eq;
427 struct msix_entry *msix_arr;
428 int num_comp_vectors;
429 /* protect EQs list
430 */
431 spinlock_t lock;
432};
433
434struct mlx5_uar {
435 u32 index;
436 struct list_head bf_list;
437 unsigned free_bf_bmap;
438 void __iomem *wc_map;
439 void __iomem *map;
440};
441
442
443struct mlx5_core_health {
444 struct health_buffer __iomem *health;
445 __be32 __iomem *health_counter;
446 struct timer_list timer;
447 struct list_head list;
448 u32 prev;
449 int miss_counter;
450};
451
452struct mlx5_cq_table {
453 /* protect radix tree
454 */
455 spinlock_t lock;
456 struct radix_tree_root tree;
457};
458
459struct mlx5_qp_table {
460 /* protect radix tree
461 */
462 spinlock_t lock;
463 struct radix_tree_root tree;
464};
465
466struct mlx5_srq_table {
467 /* protect radix tree
468 */
469 spinlock_t lock;
470 struct radix_tree_root tree;
471};
472
473struct mlx5_priv {
474 char name[MLX5_MAX_NAME_LEN];
475 struct mlx5_eq_table eq_table;
476 struct mlx5_uuar_info uuari;
477 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
478
479 /* pages stuff */
480 struct workqueue_struct *pg_wq;
481 struct rb_root page_root;
482 int fw_pages;
483 int reg_pages;
484
485 struct mlx5_core_health health;
486
487 struct mlx5_srq_table srq_table;
488
489 /* start: qp staff */
490 struct mlx5_qp_table qp_table;
491 struct dentry *qp_debugfs;
492 struct dentry *eq_debugfs;
493 struct dentry *cq_debugfs;
494 struct dentry *cmdif_debugfs;
495 /* end: qp staff */
496
497 /* start: cq staff */
498 struct mlx5_cq_table cq_table;
499 /* end: cq staff */
500
501 /* start: alloc staff */
502 struct mutex pgdir_mutex;
503 struct list_head pgdir_list;
504 /* end: alloc staff */
505 struct dentry *dbg_root;
506
507 /* protect mkey key part */
508 spinlock_t mkey_lock;
509 u8 mkey_key;
510};
511
512struct mlx5_core_dev {
513 struct pci_dev *pdev;
514 u8 rev_id;
515 char board_id[MLX5_BOARD_ID_LEN];
516 struct mlx5_cmd cmd;
517 struct mlx5_caps caps;
518 phys_addr_t iseg_base;
519 struct mlx5_init_seg __iomem *iseg;
520 void (*event) (struct mlx5_core_dev *dev,
521 enum mlx5_dev_event event,
522 void *data);
523 struct mlx5_priv priv;
524 struct mlx5_profile *profile;
525 atomic_t num_qps;
526};
527
528struct mlx5_db {
529 __be32 *db;
530 union {
531 struct mlx5_db_pgdir *pgdir;
532 struct mlx5_ib_user_db_page *user_page;
533 } u;
534 dma_addr_t dma;
535 int index;
536};
537
538enum {
539 MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES,
540};
541
542enum {
543 MLX5_COMP_EQ_SIZE = 1024,
544};
545
546struct mlx5_db_pgdir {
547 struct list_head list;
548 DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE);
549 __be32 *db_page;
550 dma_addr_t db_dma;
551};
552
553typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
554
555struct mlx5_cmd_work_ent {
556 struct mlx5_cmd_msg *in;
557 struct mlx5_cmd_msg *out;
558 mlx5_cmd_cbk_t callback;
559 void *context;
560 int idx;
561 struct completion done;
562 struct mlx5_cmd *cmd;
563 struct work_struct work;
564 struct mlx5_cmd_layout *lay;
565 int ret;
566 int page_queue;
567 u8 status;
568 u8 token;
569 struct timespec ts1;
570 struct timespec ts2;
571};
572
573struct mlx5_pas {
574 u64 pa;
575 u8 log_sz;
576};
577
578static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset)
579{
580 if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1))
581 return buf->direct.buf + offset;
582 else
583 return buf->page_list[offset >> PAGE_SHIFT].buf +
584 (offset & (PAGE_SIZE - 1));
585}
586
587extern struct workqueue_struct *mlx5_core_wq;
588
589#define STRUCT_FIELD(header, field) \
590 .struct_offset_bytes = offsetof(struct ib_unpacked_ ## header, field), \
591 .struct_size_bytes = sizeof((struct ib_unpacked_ ## header *)0)->field
592
593struct ib_field {
594 size_t struct_offset_bytes;
595 size_t struct_size_bytes;
596 int offset_bits;
597 int size_bits;
598};
599
600static inline struct mlx5_core_dev *pci2mlx5_core_dev(struct pci_dev *pdev)
601{
602 return pci_get_drvdata(pdev);
603}
604
605extern struct dentry *mlx5_debugfs_root;
606
607static inline u16 fw_rev_maj(struct mlx5_core_dev *dev)
608{
609 return ioread32be(&dev->iseg->fw_rev) & 0xffff;
610}
611
612static inline u16 fw_rev_min(struct mlx5_core_dev *dev)
613{
614 return ioread32be(&dev->iseg->fw_rev) >> 16;
615}
616
617static inline u16 fw_rev_sub(struct mlx5_core_dev *dev)
618{
619 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) & 0xffff;
620}
621
622static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
623{
624 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
625}
626
627static inline void *mlx5_vzalloc(unsigned long size)
628{
629 void *rtn;
630
631 rtn = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
632 if (!rtn)
633 rtn = vzalloc(size);
634 return rtn;
635}
636
637static inline void mlx5_vfree(const void *addr)
638{
639 if (addr && is_vmalloc_addr(addr))
640 vfree(addr);
641 else
642 kfree(addr);
643}
644
645int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
646void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
647int mlx5_cmd_init(struct mlx5_core_dev *dev);
648void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
649void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
650void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
651int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
652int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
653 int out_size);
654int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
655int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
656int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
657int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
658void mlx5_health_cleanup(void);
659void __init mlx5_health_init(void);
660void mlx5_start_health_poll(struct mlx5_core_dev *dev);
661void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
662int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
663 struct mlx5_buf *buf);
664void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf);
665struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev,
666 gfp_t flags, int npages);
667void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
668 struct mlx5_cmd_mailbox *head);
669int mlx5_core_create_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
670 struct mlx5_create_srq_mbox_in *in, int inlen);
671int mlx5_core_destroy_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq);
672int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
673 struct mlx5_query_srq_mbox_out *out);
674int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
675 u16 lwm, int is_srq);
676int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
677 struct mlx5_create_mkey_mbox_in *in, int inlen);
678int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr);
679int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
680 struct mlx5_query_mkey_mbox_out *out, int outlen);
681int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
682 u32 *mkey);
683int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
684int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
685int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
686 u16 opmod, int port);
687void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
688void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
689int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
690void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
691void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
692 s16 npages);
693int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev);
694int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
695void mlx5_register_debugfs(void);
696void mlx5_unregister_debugfs(void);
697int mlx5_eq_init(struct mlx5_core_dev *dev);
698void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
699void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
700void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
701void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type);
702void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
703struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
704void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
705void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
706int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
707 int nent, u64 mask, const char *name, struct mlx5_uar *uar);
708int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
709int mlx5_start_eqs(struct mlx5_core_dev *dev);
710int mlx5_stop_eqs(struct mlx5_core_dev *dev);
711int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
712int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
713
714int mlx5_qp_debugfs_init(struct mlx5_core_dev *dev);
715void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
716int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
717 int size_in, void *data_out, int size_out,
718 u16 reg_num, int arg, int write);
719int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps);
720
721int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
722void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
723int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
724 struct mlx5_query_eq_mbox_out *out, int outlen);
725int mlx5_eq_debugfs_init(struct mlx5_core_dev *dev);
726void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev);
727int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev);
728void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
729int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
730void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
731
732typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size);
733int mlx5_register_health_report_handler(health_handler_t handler);
734void mlx5_unregister_health_report_handler(void);
735const char *mlx5_command_str(int command);
736int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
737void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
738
739static inline u32 mlx5_mkey_to_idx(u32 mkey)
740{
741 return mkey >> 8;
742}
743
744static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
745{
746 return mkey_idx << 8;
747}
748
749enum {
750 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
751 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1,
752 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
753};
754
755enum {
756 MAX_MR_CACHE_ENTRIES = 16,
757};
758
759struct mlx5_profile {
760 u64 mask;
761 u32 log_max_qp;
762 int cmdif_csum;
763 struct {
764 int size;
765 int limit;
766 } mr_cache[MAX_MR_CACHE_ENTRIES];
767};
768
769#endif /* MLX5_DRIVER_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
new file mode 100644
index 000000000000..d9e3eacb3a7f
--- /dev/null
+++ b/include/linux/mlx5/qp.h
@@ -0,0 +1,467 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_QP_H
34#define MLX5_QP_H
35
36#include <linux/mlx5/device.h>
37#include <linux/mlx5/driver.h>
38
39#define MLX5_INVALID_LKEY 0x100
40
41enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
43 MLX5_QP_OPTPAR_RRE = 1 << 1,
44 MLX5_QP_OPTPAR_RAE = 1 << 2,
45 MLX5_QP_OPTPAR_RWE = 1 << 3,
46 MLX5_QP_OPTPAR_PKEY_INDEX = 1 << 4,
47 MLX5_QP_OPTPAR_Q_KEY = 1 << 5,
48 MLX5_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
49 MLX5_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
50 MLX5_QP_OPTPAR_SRA_MAX = 1 << 8,
51 MLX5_QP_OPTPAR_RRA_MAX = 1 << 9,
52 MLX5_QP_OPTPAR_PM_STATE = 1 << 10,
53 MLX5_QP_OPTPAR_RETRY_COUNT = 1 << 12,
54 MLX5_QP_OPTPAR_RNR_RETRY = 1 << 13,
55 MLX5_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
56 MLX5_QP_OPTPAR_PRI_PORT = 1 << 16,
57 MLX5_QP_OPTPAR_SRQN = 1 << 18,
58 MLX5_QP_OPTPAR_CQN_RCV = 1 << 19,
59 MLX5_QP_OPTPAR_DC_HS = 1 << 20,
60 MLX5_QP_OPTPAR_DC_KEY = 1 << 21,
61};
62
63enum mlx5_qp_state {
64 MLX5_QP_STATE_RST = 0,
65 MLX5_QP_STATE_INIT = 1,
66 MLX5_QP_STATE_RTR = 2,
67 MLX5_QP_STATE_RTS = 3,
68 MLX5_QP_STATE_SQER = 4,
69 MLX5_QP_STATE_SQD = 5,
70 MLX5_QP_STATE_ERR = 6,
71 MLX5_QP_STATE_SQ_DRAINING = 7,
72 MLX5_QP_STATE_SUSPENDED = 9,
73 MLX5_QP_NUM_STATE
74};
75
76enum {
77 MLX5_QP_ST_RC = 0x0,
78 MLX5_QP_ST_UC = 0x1,
79 MLX5_QP_ST_UD = 0x2,
80 MLX5_QP_ST_XRC = 0x3,
81 MLX5_QP_ST_MLX = 0x4,
82 MLX5_QP_ST_DCI = 0x5,
83 MLX5_QP_ST_DCT = 0x6,
84 MLX5_QP_ST_QP0 = 0x7,
85 MLX5_QP_ST_QP1 = 0x8,
86 MLX5_QP_ST_RAW_ETHERTYPE = 0x9,
87 MLX5_QP_ST_RAW_IPV6 = 0xa,
88 MLX5_QP_ST_SNIFFER = 0xb,
89 MLX5_QP_ST_SYNC_UMR = 0xe,
90 MLX5_QP_ST_PTP_1588 = 0xd,
91 MLX5_QP_ST_REG_UMR = 0xc,
92 MLX5_QP_ST_MAX
93};
94
95enum {
96 MLX5_QP_PM_MIGRATED = 0x3,
97 MLX5_QP_PM_ARMED = 0x0,
98 MLX5_QP_PM_REARM = 0x1
99};
100
101enum {
102 MLX5_NON_ZERO_RQ = 0 << 24,
103 MLX5_SRQ_RQ = 1 << 24,
104 MLX5_CRQ_RQ = 2 << 24,
105 MLX5_ZERO_LEN_RQ = 3 << 24
106};
107
108enum {
109 /* params1 */
110 MLX5_QP_BIT_SRE = 1 << 15,
111 MLX5_QP_BIT_SWE = 1 << 14,
112 MLX5_QP_BIT_SAE = 1 << 13,
113 /* params2 */
114 MLX5_QP_BIT_RRE = 1 << 15,
115 MLX5_QP_BIT_RWE = 1 << 14,
116 MLX5_QP_BIT_RAE = 1 << 13,
117 MLX5_QP_BIT_RIC = 1 << 4,
118};
119
120enum {
121 MLX5_WQE_CTRL_CQ_UPDATE = 2 << 2,
122 MLX5_WQE_CTRL_SOLICITED = 1 << 1,
123};
124
125enum {
126 MLX5_SEND_WQE_BB = 64,
127};
128
129enum {
130 MLX5_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
131 MLX5_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
132 MLX5_WQE_FMR_PERM_REMOTE_READ = 1 << 29,
133 MLX5_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30,
134 MLX5_WQE_FMR_PERM_ATOMIC = 1 << 31
135};
136
137enum {
138 MLX5_FENCE_MODE_NONE = 0 << 5,
139 MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
140 MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
141 MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
142};
143
144enum {
145 MLX5_QP_LAT_SENSITIVE = 1 << 28,
146 MLX5_QP_ENABLE_SIG = 1 << 31,
147};
148
149enum {
150 MLX5_RCV_DBR = 0,
151 MLX5_SND_DBR = 1,
152};
153
154struct mlx5_wqe_fmr_seg {
155 __be32 flags;
156 __be32 mem_key;
157 __be64 buf_list;
158 __be64 start_addr;
159 __be64 reg_len;
160 __be32 offset;
161 __be32 page_size;
162 u32 reserved[2];
163};
164
165struct mlx5_wqe_ctrl_seg {
166 __be32 opmod_idx_opcode;
167 __be32 qpn_ds;
168 u8 signature;
169 u8 rsvd[2];
170 u8 fm_ce_se;
171 __be32 imm;
172};
173
174struct mlx5_wqe_xrc_seg {
175 __be32 xrc_srqn;
176 u8 rsvd[12];
177};
178
179struct mlx5_wqe_masked_atomic_seg {
180 __be64 swap_add;
181 __be64 compare;
182 __be64 swap_add_mask;
183 __be64 compare_mask;
184};
185
186struct mlx5_av {
187 union {
188 struct {
189 __be32 qkey;
190 __be32 reserved;
191 } qkey;
192 __be64 dc_key;
193 } key;
194 __be32 dqp_dct;
195 u8 stat_rate_sl;
196 u8 fl_mlid;
197 __be16 rlid;
198 u8 reserved0[10];
199 u8 tclass;
200 u8 hop_limit;
201 __be32 grh_gid_fl;
202 u8 rgid[16];
203};
204
205struct mlx5_wqe_datagram_seg {
206 struct mlx5_av av;
207};
208
209struct mlx5_wqe_raddr_seg {
210 __be64 raddr;
211 __be32 rkey;
212 u32 reserved;
213};
214
215struct mlx5_wqe_atomic_seg {
216 __be64 swap_add;
217 __be64 compare;
218};
219
220struct mlx5_wqe_data_seg {
221 __be32 byte_count;
222 __be32 lkey;
223 __be64 addr;
224};
225
226struct mlx5_wqe_umr_ctrl_seg {
227 u8 flags;
228 u8 rsvd0[3];
229 __be16 klm_octowords;
230 __be16 bsf_octowords;
231 __be64 mkey_mask;
232 u8 rsvd1[32];
233};
234
235struct mlx5_seg_set_psv {
236 __be32 psv_num;
237 __be16 syndrome;
238 __be16 status;
239 __be32 transient_sig;
240 __be32 ref_tag;
241};
242
243struct mlx5_seg_get_psv {
244 u8 rsvd[19];
245 u8 num_psv;
246 __be32 l_key;
247 __be64 va;
248 __be32 psv_index[4];
249};
250
251struct mlx5_seg_check_psv {
252 u8 rsvd0[2];
253 __be16 err_coalescing_op;
254 u8 rsvd1[2];
255 __be16 xport_err_op;
256 u8 rsvd2[2];
257 __be16 xport_err_mask;
258 u8 rsvd3[7];
259 u8 num_psv;
260 __be32 l_key;
261 __be64 va;
262 __be32 psv_index[4];
263};
264
265struct mlx5_rwqe_sig {
266 u8 rsvd0[4];
267 u8 signature;
268 u8 rsvd1[11];
269};
270
271struct mlx5_wqe_signature_seg {
272 u8 rsvd0[4];
273 u8 signature;
274 u8 rsvd1[11];
275};
276
277struct mlx5_wqe_inline_seg {
278 __be32 byte_count;
279};
280
281struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int);
283 int qpn;
284 atomic_t refcount;
285 struct completion free;
286 struct mlx5_rsc_debug *dbg;
287 int pid;
288};
289
290struct mlx5_qp_path {
291 u8 fl;
292 u8 rsvd3;
293 u8 free_ar;
294 u8 pkey_index;
295 u8 rsvd0;
296 u8 grh_mlid;
297 __be16 rlid;
298 u8 ackto_lt;
299 u8 mgid_index;
300 u8 static_rate;
301 u8 hop_limit;
302 __be32 tclass_flowlabel;
303 u8 rgid[16];
304 u8 rsvd1[4];
305 u8 sl;
306 u8 port;
307 u8 rsvd2[6];
308};
309
310struct mlx5_qp_context {
311 __be32 flags;
312 __be32 flags_pd;
313 u8 mtu_msgmax;
314 u8 rq_size_stride;
315 __be16 sq_crq_size;
316 __be32 qp_counter_set_usr_page;
317 __be32 wire_qpn;
318 __be32 log_pg_sz_remote_qpn;
319 struct mlx5_qp_path pri_path;
320 struct mlx5_qp_path alt_path;
321 __be32 params1;
322 u8 reserved2[4];
323 __be32 next_send_psn;
324 __be32 cqn_send;
325 u8 reserved3[8];
326 __be32 last_acked_psn;
327 __be32 ssn;
328 __be32 params2;
329 __be32 rnr_nextrecvpsn;
330 __be32 xrcd;
331 __be32 cqn_recv;
332 __be64 db_rec_addr;
333 __be32 qkey;
334 __be32 rq_type_srqn;
335 __be32 rmsn;
336 __be16 hw_sq_wqe_counter;
337 __be16 sw_sq_wqe_counter;
338 __be16 hw_rcyclic_byte_counter;
339 __be16 hw_rq_counter;
340 __be16 sw_rcyclic_byte_counter;
341 __be16 sw_rq_counter;
342 u8 rsvd0[5];
343 u8 cgs;
344 u8 cs_req;
345 u8 cs_res;
346 __be64 dc_access_key;
347 u8 rsvd1[24];
348};
349
350struct mlx5_create_qp_mbox_in {
351 struct mlx5_inbox_hdr hdr;
352 __be32 input_qpn;
353 u8 rsvd0[4];
354 __be32 opt_param_mask;
355 u8 rsvd1[4];
356 struct mlx5_qp_context ctx;
357 u8 rsvd3[16];
358 __be64 pas[0];
359};
360
361struct mlx5_create_qp_mbox_out {
362 struct mlx5_outbox_hdr hdr;
363 __be32 qpn;
364 u8 rsvd0[4];
365};
366
367struct mlx5_destroy_qp_mbox_in {
368 struct mlx5_inbox_hdr hdr;
369 __be32 qpn;
370 u8 rsvd0[4];
371};
372
373struct mlx5_destroy_qp_mbox_out {
374 struct mlx5_outbox_hdr hdr;
375 u8 rsvd0[8];
376};
377
378struct mlx5_modify_qp_mbox_in {
379 struct mlx5_inbox_hdr hdr;
380 __be32 qpn;
381 u8 rsvd1[4];
382 __be32 optparam;
383 u8 rsvd0[4];
384 struct mlx5_qp_context ctx;
385};
386
387struct mlx5_modify_qp_mbox_out {
388 struct mlx5_outbox_hdr hdr;
389 u8 rsvd0[8];
390};
391
392struct mlx5_query_qp_mbox_in {
393 struct mlx5_inbox_hdr hdr;
394 __be32 qpn;
395 u8 rsvd[4];
396};
397
398struct mlx5_query_qp_mbox_out {
399 struct mlx5_outbox_hdr hdr;
400 u8 rsvd1[8];
401 __be32 optparam;
402 u8 rsvd0[4];
403 struct mlx5_qp_context ctx;
404 u8 rsvd2[16];
405 __be64 pas[0];
406};
407
408struct mlx5_conf_sqp_mbox_in {
409 struct mlx5_inbox_hdr hdr;
410 __be32 qpn;
411 u8 rsvd[3];
412 u8 type;
413};
414
415struct mlx5_conf_sqp_mbox_out {
416 struct mlx5_outbox_hdr hdr;
417 u8 rsvd[8];
418};
419
420struct mlx5_alloc_xrcd_mbox_in {
421 struct mlx5_inbox_hdr hdr;
422 u8 rsvd[8];
423};
424
425struct mlx5_alloc_xrcd_mbox_out {
426 struct mlx5_outbox_hdr hdr;
427 __be32 xrcdn;
428 u8 rsvd[4];
429};
430
431struct mlx5_dealloc_xrcd_mbox_in {
432 struct mlx5_inbox_hdr hdr;
433 __be32 xrcdn;
434 u8 rsvd[4];
435};
436
437struct mlx5_dealloc_xrcd_mbox_out {
438 struct mlx5_outbox_hdr hdr;
439 u8 rsvd[8];
440};
441
442static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u32 qpn)
443{
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445}
446
447int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in,
450 int inlen);
451int mlx5_core_qp_modify(struct mlx5_core_dev *dev, enum mlx5_qp_state cur_state,
452 enum mlx5_qp_state new_state,
453 struct mlx5_modify_qp_mbox_in *in, int sqd_event,
454 struct mlx5_core_qp *qp);
455int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,
456 struct mlx5_core_qp *qp);
457int mlx5_core_qp_query(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
458 struct mlx5_query_qp_mbox_out *out, int outlen);
459
460int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn);
461int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
462void mlx5_init_qp_table(struct mlx5_core_dev *dev);
463void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev);
464int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
465void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
466
467#endif /* MLX5_QP_H */
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
new file mode 100644
index 000000000000..e1a363a33663
--- /dev/null
+++ b/include/linux/mlx5/srq.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_SRQ_H
34#define MLX5_SRQ_H
35
36#include <linux/mlx5/driver.h>
37
38void mlx5_init_srq_table(struct mlx5_core_dev *dev);
39void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev);
40
41#endif /* MLX5_SRQ_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ace9a5f01c64..fb425aa16c01 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -330,12 +330,9 @@ struct mm_struct {
330 unsigned long (*get_unmapped_area) (struct file *filp, 330 unsigned long (*get_unmapped_area) (struct file *filp,
331 unsigned long addr, unsigned long len, 331 unsigned long addr, unsigned long len,
332 unsigned long pgoff, unsigned long flags); 332 unsigned long pgoff, unsigned long flags);
333 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
334#endif 333#endif
335 unsigned long mmap_base; /* base of mmap area */ 334 unsigned long mmap_base; /* base of mmap area */
336 unsigned long task_size; /* size of task vm space */ 335 unsigned long task_size; /* size of task vm space */
337 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
338 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
339 unsigned long highest_vm_end; /* highest vma end address */ 336 unsigned long highest_vm_end; /* highest vma end address */
340 pgd_t * pgd; 337 pgd_t * pgd;
341 atomic_t mm_users; /* How many users with user space? */ 338 atomic_t mm_users; /* How many users with user space? */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f31725ba49f3..842de3e21e70 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -94,7 +94,11 @@ struct mmc_ext_csd {
94 u8 raw_ext_csd_structure; /* 194 */ 94 u8 raw_ext_csd_structure; /* 194 */
95 u8 raw_card_type; /* 196 */ 95 u8 raw_card_type; /* 196 */
96 u8 out_of_int_time; /* 198 */ 96 u8 out_of_int_time; /* 198 */
97 u8 raw_s_a_timeout; /* 217 */ 97 u8 raw_pwr_cl_52_195; /* 200 */
98 u8 raw_pwr_cl_26_195; /* 201 */
99 u8 raw_pwr_cl_52_360; /* 202 */
100 u8 raw_pwr_cl_26_360; /* 203 */
101 u8 raw_s_a_timeout; /* 217 */
98 u8 raw_hc_erase_gap_size; /* 221 */ 102 u8 raw_hc_erase_gap_size; /* 221 */
99 u8 raw_erase_timeout_mult; /* 223 */ 103 u8 raw_erase_timeout_mult; /* 223 */
100 u8 raw_hc_erase_grp_size; /* 224 */ 104 u8 raw_hc_erase_grp_size; /* 224 */
@@ -102,6 +106,10 @@ struct mmc_ext_csd {
102 u8 raw_sec_erase_mult; /* 230 */ 106 u8 raw_sec_erase_mult; /* 230 */
103 u8 raw_sec_feature_support;/* 231 */ 107 u8 raw_sec_feature_support;/* 231 */
104 u8 raw_trim_mult; /* 232 */ 108 u8 raw_trim_mult; /* 232 */
109 u8 raw_pwr_cl_200_195; /* 236 */
110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
105 u8 raw_bkops_status; /* 246 */ 113 u8 raw_bkops_status; /* 246 */
106 u8 raw_sectors[4]; /* 212 - 4 bytes */ 114 u8 raw_sectors[4]; /* 212 - 4 bytes */
107 115
@@ -512,6 +520,7 @@ struct mmc_driver {
512 void (*remove)(struct mmc_card *); 520 void (*remove)(struct mmc_card *);
513 int (*suspend)(struct mmc_card *); 521 int (*suspend)(struct mmc_card *);
514 int (*resume)(struct mmc_card *); 522 int (*resume)(struct mmc_card *);
523 void (*shutdown)(struct mmc_card *);
515}; 524};
516 525
517extern int mmc_register_driver(struct mmc_driver *); 526extern int mmc_register_driver(struct mmc_driver *);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 39613b9a6fc5..443243b241d5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -96,6 +96,8 @@ struct mmc_command {
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int cmd_timeout_ms; /* in milliseconds */
99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy;
99 101
100 struct mmc_data *data; /* data segment associated with cmd */ 102 struct mmc_data *data; /* data segment associated with cmd */
101 struct mmc_request *mrq; /* associated request */ 103 struct mmc_request *mrq; /* associated request */
@@ -188,6 +190,9 @@ extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
188extern void mmc_release_host(struct mmc_host *host); 190extern void mmc_release_host(struct mmc_host *host);
189extern int mmc_try_claim_host(struct mmc_host *host); 191extern int mmc_try_claim_host(struct mmc_host *host);
190 192
193extern void mmc_get_card(struct mmc_card *card);
194extern void mmc_put_card(struct mmc_card *card);
195
191extern int mmc_flush_cache(struct mmc_card *); 196extern int mmc_flush_cache(struct mmc_card *);
192 197
193extern int mmc_detect_card_removed(struct mmc_host *host); 198extern int mmc_detect_card_removed(struct mmc_host *host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index e326ae2882a0..3b0c33ae13e1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -239,7 +239,7 @@ struct mmc_host {
239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
242 242#define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -264,7 +264,7 @@ struct mmc_host {
264 264
265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
267#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */ 269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
@@ -272,7 +272,6 @@ struct mmc_host {
272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
273 MMC_CAP2_HS200_1_2V_SDR) 273 MMC_CAP2_HS200_1_2V_SDR)
274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
275#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 275#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 276#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 277#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,6 +280,7 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 280#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 281 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 282#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
284 284
285 mmc_pm_flag_t pm_caps; /* supported pm features */ 285 mmc_pm_flag_t pm_caps; /* supported pm features */
286 286
@@ -369,7 +369,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
369int mmc_add_host(struct mmc_host *); 369int mmc_add_host(struct mmc_host *);
370void mmc_remove_host(struct mmc_host *); 370void mmc_remove_host(struct mmc_host *);
371void mmc_free_host(struct mmc_host *); 371void mmc_free_host(struct mmc_host *);
372void mmc_of_parse(struct mmc_host *host); 372int mmc_of_parse(struct mmc_host *host);
373 373
374static inline void *mmc_priv(struct mmc_host *host) 374static inline void *mmc_priv(struct mmc_host *host)
375{ 375{
@@ -425,10 +425,6 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
425} 425}
426#endif 426#endif
427 427
428int mmc_card_awake(struct mmc_host *host);
429int mmc_card_sleep(struct mmc_host *host);
430int mmc_card_can_sleep(struct mmc_host *host);
431
432int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 428int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
433 429
434/* Module parameter */ 430/* Module parameter */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index b838ffc49e4a..e3c6a74d980a 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -95,6 +95,9 @@ struct sdhci_host {
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3) 97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
98#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
99/* Controller has a non-standard host control register */
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
98 101
99 int irq; /* Device IRQ */ 102 int irq; /* Device IRQ */
100 void __iomem *ioaddr; /* Mapped address */ 103 void __iomem *ioaddr; /* Mapped address */
@@ -126,7 +129,7 @@ struct sdhci_host {
126#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 129#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
127#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 130#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
128#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 131#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
129#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */ 132#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
130#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 133#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
131 134
132 unsigned int version; /* SDHCI spec. version */ 135 unsigned int version; /* SDHCI spec. version */
@@ -139,6 +142,7 @@ struct sdhci_host {
139 u8 pwr; /* Current voltage */ 142 u8 pwr; /* Current voltage */
140 143
141 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
145 bool bus_on; /* Bus power prevents runtime suspend */
142 146
143 struct mmc_request *mrq; /* Current request */ 147 struct mmc_request *mrq; /* Current request */
144 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 137b4198fc03..27d9da3f86ff 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -439,7 +439,7 @@ extern struct kernel_param_ops param_ops_string;
439extern int param_set_copystring(const char *val, const struct kernel_param *); 439extern int param_set_copystring(const char *val, const struct kernel_param *);
440extern int param_get_string(char *buffer, const struct kernel_param *kp); 440extern int param_get_string(char *buffer, const struct kernel_param *kp);
441 441
442/* for exporting parameters in /sys/parameters */ 442/* for exporting parameters in /sys/module/.../parameters */
443 443
444struct module; 444struct module;
445 445
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 3793ed7feeeb..ccd4260834c5 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -78,40 +78,6 @@ struct mutex_waiter {
78#endif 78#endif
79}; 79};
80 80
81struct ww_class {
82 atomic_long_t stamp;
83 struct lock_class_key acquire_key;
84 struct lock_class_key mutex_key;
85 const char *acquire_name;
86 const char *mutex_name;
87};
88
89struct ww_acquire_ctx {
90 struct task_struct *task;
91 unsigned long stamp;
92 unsigned acquired;
93#ifdef CONFIG_DEBUG_MUTEXES
94 unsigned done_acquire;
95 struct ww_class *ww_class;
96 struct ww_mutex *contending_lock;
97#endif
98#ifdef CONFIG_DEBUG_LOCK_ALLOC
99 struct lockdep_map dep_map;
100#endif
101#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
102 unsigned deadlock_inject_interval;
103 unsigned deadlock_inject_countdown;
104#endif
105};
106
107struct ww_mutex {
108 struct mutex base;
109 struct ww_acquire_ctx *ctx;
110#ifdef CONFIG_DEBUG_MUTEXES
111 struct ww_class *ww_class;
112#endif
113};
114
115#ifdef CONFIG_DEBUG_MUTEXES 81#ifdef CONFIG_DEBUG_MUTEXES
116# include <linux/mutex-debug.h> 82# include <linux/mutex-debug.h>
117#else 83#else
@@ -136,11 +102,8 @@ static inline void mutex_destroy(struct mutex *lock) {}
136#ifdef CONFIG_DEBUG_LOCK_ALLOC 102#ifdef CONFIG_DEBUG_LOCK_ALLOC
137# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ 103# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
138 , .dep_map = { .name = #lockname } 104 , .dep_map = { .name = #lockname }
139# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
140 , .ww_class = &ww_class
141#else 105#else
142# define __DEP_MAP_MUTEX_INITIALIZER(lockname) 106# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
143# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
144#endif 107#endif
145 108
146#define __MUTEX_INITIALIZER(lockname) \ 109#define __MUTEX_INITIALIZER(lockname) \
@@ -150,49 +113,13 @@ static inline void mutex_destroy(struct mutex *lock) {}
150 __DEBUG_MUTEX_INITIALIZER(lockname) \ 113 __DEBUG_MUTEX_INITIALIZER(lockname) \
151 __DEP_MAP_MUTEX_INITIALIZER(lockname) } 114 __DEP_MAP_MUTEX_INITIALIZER(lockname) }
152 115
153#define __WW_CLASS_INITIALIZER(ww_class) \
154 { .stamp = ATOMIC_LONG_INIT(0) \
155 , .acquire_name = #ww_class "_acquire" \
156 , .mutex_name = #ww_class "_mutex" }
157
158#define __WW_MUTEX_INITIALIZER(lockname, class) \
159 { .base = { \__MUTEX_INITIALIZER(lockname) } \
160 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
161
162#define DEFINE_MUTEX(mutexname) \ 116#define DEFINE_MUTEX(mutexname) \
163 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) 117 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
164 118
165#define DEFINE_WW_CLASS(classname) \
166 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
167
168#define DEFINE_WW_MUTEX(mutexname, ww_class) \
169 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
170
171
172extern void __mutex_init(struct mutex *lock, const char *name, 119extern void __mutex_init(struct mutex *lock, const char *name,
173 struct lock_class_key *key); 120 struct lock_class_key *key);
174 121
175/** 122/**
176 * ww_mutex_init - initialize the w/w mutex
177 * @lock: the mutex to be initialized
178 * @ww_class: the w/w class the mutex should belong to
179 *
180 * Initialize the w/w mutex to unlocked state and associate it with the given
181 * class.
182 *
183 * It is not allowed to initialize an already locked mutex.
184 */
185static inline void ww_mutex_init(struct ww_mutex *lock,
186 struct ww_class *ww_class)
187{
188 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
189 lock->ctx = NULL;
190#ifdef CONFIG_DEBUG_MUTEXES
191 lock->ww_class = ww_class;
192#endif
193}
194
195/**
196 * mutex_is_locked - is the mutex locked 123 * mutex_is_locked - is the mutex locked
197 * @lock: the mutex to be queried 124 * @lock: the mutex to be queried
198 * 125 *
@@ -246,291 +173,6 @@ extern int __must_check mutex_lock_killable(struct mutex *lock);
246extern int mutex_trylock(struct mutex *lock); 173extern int mutex_trylock(struct mutex *lock);
247extern void mutex_unlock(struct mutex *lock); 174extern void mutex_unlock(struct mutex *lock);
248 175
249/**
250 * ww_acquire_init - initialize a w/w acquire context
251 * @ctx: w/w acquire context to initialize
252 * @ww_class: w/w class of the context
253 *
254 * Initializes an context to acquire multiple mutexes of the given w/w class.
255 *
256 * Context-based w/w mutex acquiring can be done in any order whatsoever within
257 * a given lock class. Deadlocks will be detected and handled with the
258 * wait/wound logic.
259 *
260 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
261 * result in undetected deadlocks and is so forbidden. Mixing different contexts
262 * for the same w/w class when acquiring mutexes can also result in undetected
263 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
264 * enabling CONFIG_PROVE_LOCKING.
265 *
266 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
267 * to the usual locking rules between different lock classes.
268 *
269 * An acquire context must be released with ww_acquire_fini by the same task
270 * before the memory is freed. It is recommended to allocate the context itself
271 * on the stack.
272 */
273static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
274 struct ww_class *ww_class)
275{
276 ctx->task = current;
277 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
278 ctx->acquired = 0;
279#ifdef CONFIG_DEBUG_MUTEXES
280 ctx->ww_class = ww_class;
281 ctx->done_acquire = 0;
282 ctx->contending_lock = NULL;
283#endif
284#ifdef CONFIG_DEBUG_LOCK_ALLOC
285 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
286 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
287 &ww_class->acquire_key, 0);
288 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
289#endif
290#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
291 ctx->deadlock_inject_interval = 1;
292 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
293#endif
294}
295
296/**
297 * ww_acquire_done - marks the end of the acquire phase
298 * @ctx: the acquire context
299 *
300 * Marks the end of the acquire phase, any further w/w mutex lock calls using
301 * this context are forbidden.
302 *
303 * Calling this function is optional, it is just useful to document w/w mutex
304 * code and clearly designated the acquire phase from actually using the locked
305 * data structures.
306 */
307static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
308{
309#ifdef CONFIG_DEBUG_MUTEXES
310 lockdep_assert_held(ctx);
311
312 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
313 ctx->done_acquire = 1;
314#endif
315}
316
317/**
318 * ww_acquire_fini - releases a w/w acquire context
319 * @ctx: the acquire context to free
320 *
321 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
322 * mutexes have been released with ww_mutex_unlock.
323 */
324static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
325{
326#ifdef CONFIG_DEBUG_MUTEXES
327 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
328
329 DEBUG_LOCKS_WARN_ON(ctx->acquired);
330 if (!config_enabled(CONFIG_PROVE_LOCKING))
331 /*
332 * lockdep will normally handle this,
333 * but fail without anyway
334 */
335 ctx->done_acquire = 1;
336
337 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
338 /* ensure ww_acquire_fini will still fail if called twice */
339 ctx->acquired = ~0U;
340#endif
341}
342
343extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
344 struct ww_acquire_ctx *ctx);
345extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
346 struct ww_acquire_ctx *ctx);
347
348/**
349 * ww_mutex_lock - acquire the w/w mutex
350 * @lock: the mutex to be acquired
351 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
352 *
353 * Lock the w/w mutex exclusively for this task.
354 *
355 * Deadlocks within a given w/w class of locks are detected and handled with the
356 * wait/wound algorithm. If the lock isn't immediately avaiable this function
357 * will either sleep until it is (wait case). Or it selects the current context
358 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
359 * same lock with the same context twice is also detected and signalled by
360 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
361 *
362 * In the wound case the caller must release all currently held w/w mutexes for
363 * the given context and then wait for this contending lock to be available by
364 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
365 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
366 * scanning through lru lists trying to free resources).
367 *
368 * The mutex must later on be released by the same task that
369 * acquired it. The task may not exit without first unlocking the mutex. Also,
370 * kernel memory where the mutex resides must not be freed with the mutex still
371 * locked. The mutex must first be initialized (or statically defined) before it
372 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
373 * of the same w/w lock class as was used to initialize the acquire context.
374 *
375 * A mutex acquired with this function must be released with ww_mutex_unlock.
376 */
377static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
378{
379 if (ctx)
380 return __ww_mutex_lock(lock, ctx);
381 else {
382 mutex_lock(&lock->base);
383 return 0;
384 }
385}
386
387/**
388 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
389 * @lock: the mutex to be acquired
390 * @ctx: w/w acquire context
391 *
392 * Lock the w/w mutex exclusively for this task.
393 *
394 * Deadlocks within a given w/w class of locks are detected and handled with the
395 * wait/wound algorithm. If the lock isn't immediately avaiable this function
396 * will either sleep until it is (wait case). Or it selects the current context
397 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
398 * same lock with the same context twice is also detected and signalled by
399 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
400 * signal arrives while waiting for the lock then this function returns -EINTR.
401 *
402 * In the wound case the caller must release all currently held w/w mutexes for
403 * the given context and then wait for this contending lock to be available by
404 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
405 * not acquire this lock and proceed with trying to acquire further w/w mutexes
406 * (e.g. when scanning through lru lists trying to free resources).
407 *
408 * The mutex must later on be released by the same task that
409 * acquired it. The task may not exit without first unlocking the mutex. Also,
410 * kernel memory where the mutex resides must not be freed with the mutex still
411 * locked. The mutex must first be initialized (or statically defined) before it
412 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
413 * of the same w/w lock class as was used to initialize the acquire context.
414 *
415 * A mutex acquired with this function must be released with ww_mutex_unlock.
416 */
417static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
418 struct ww_acquire_ctx *ctx)
419{
420 if (ctx)
421 return __ww_mutex_lock_interruptible(lock, ctx);
422 else
423 return mutex_lock_interruptible(&lock->base);
424}
425
426/**
427 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
428 * @lock: the mutex to be acquired
429 * @ctx: w/w acquire context
430 *
431 * Acquires a w/w mutex with the given context after a wound case. This function
432 * will sleep until the lock becomes available.
433 *
434 * The caller must have released all w/w mutexes already acquired with the
435 * context and then call this function on the contended lock.
436 *
437 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
438 * needs with ww_mutex_lock. Note that the -EALREADY return code from
439 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
440 *
441 * It is forbidden to call this function with any other w/w mutexes associated
442 * with the context held. It is forbidden to call this on anything else than the
443 * contending mutex.
444 *
445 * Note that the slowpath lock acquiring can also be done by calling
446 * ww_mutex_lock directly. This function here is simply to help w/w mutex
447 * locking code readability by clearly denoting the slowpath.
448 */
449static inline void
450ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
451{
452 int ret;
453#ifdef CONFIG_DEBUG_MUTEXES
454 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
455#endif
456 ret = ww_mutex_lock(lock, ctx);
457 (void)ret;
458}
459
460/**
461 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex,
462 * interruptible
463 * @lock: the mutex to be acquired
464 * @ctx: w/w acquire context
465 *
466 * Acquires a w/w mutex with the given context after a wound case. This function
467 * will sleep until the lock becomes available and returns 0 when the lock has
468 * been acquired. If a signal arrives while waiting for the lock then this
469 * function returns -EINTR.
470 *
471 * The caller must have released all w/w mutexes already acquired with the
472 * context and then call this function on the contended lock.
473 *
474 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
475 * needs with ww_mutex_lock. Note that the -EALREADY return code from
476 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
477 *
478 * It is forbidden to call this function with any other w/w mutexes associated
479 * with the given context held. It is forbidden to call this on anything else
480 * than the contending mutex.
481 *
482 * Note that the slowpath lock acquiring can also be done by calling
483 * ww_mutex_lock_interruptible directly. This function here is simply to help
484 * w/w mutex locking code readability by clearly denoting the slowpath.
485 */
486static inline int __must_check
487ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
488 struct ww_acquire_ctx *ctx)
489{
490#ifdef CONFIG_DEBUG_MUTEXES
491 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
492#endif
493 return ww_mutex_lock_interruptible(lock, ctx);
494}
495
496extern void ww_mutex_unlock(struct ww_mutex *lock);
497
498/**
499 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
500 * @lock: mutex to lock
501 *
502 * Trylocks a mutex without acquire context, so no deadlock detection is
503 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
504 */
505static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
506{
507 return mutex_trylock(&lock->base);
508}
509
510/***
511 * ww_mutex_destroy - mark a w/w mutex unusable
512 * @lock: the mutex to be destroyed
513 *
514 * This function marks the mutex uninitialized, and any subsequent
515 * use of the mutex is forbidden. The mutex must not be locked when
516 * this function is called.
517 */
518static inline void ww_mutex_destroy(struct ww_mutex *lock)
519{
520 mutex_destroy(&lock->base);
521}
522
523/**
524 * ww_mutex_is_locked - is the w/w mutex locked
525 * @lock: the mutex to be queried
526 *
527 * Returns 1 if the mutex is locked, 0 if unlocked.
528 */
529static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
530{
531 return mutex_is_locked(&lock->base);
532}
533
534extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
535 177
536#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 141d395bbb5f..6e8215b15998 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -30,6 +30,7 @@ struct mv643xx_eth_shared_platform_data {
30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) 30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
31#define MV643XX_ETH_PHY_NONE 0xff 31#define MV643XX_ETH_PHY_NONE 0xff
32 32
33struct device_node;
33struct mv643xx_eth_platform_data { 34struct mv643xx_eth_platform_data {
34 /* 35 /*
35 * Pointer back to our parent instance, and our port number. 36 * Pointer back to our parent instance, and our port number.
@@ -41,6 +42,7 @@ struct mv643xx_eth_platform_data {
41 * Whether a PHY is present, and if yes, at which address. 42 * Whether a PHY is present, and if yes, at which address.
42 */ 43 */
43 int phy_addr; 44 int phy_addr;
45 struct device_node *phy_node;
44 46
45 /* 47 /*
46 * Use this MAC address if it is valid, overriding the 48 * Use this MAC address if it is valid, overriding the
diff --git a/include/linux/net.h b/include/linux/net.h
index 99c9f0c103c2..4f27575ce1d6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -79,9 +79,9 @@ enum sock_type {
79#endif /* ARCH_HAS_SOCKET_TYPES */ 79#endif /* ARCH_HAS_SOCKET_TYPES */
80 80
81enum sock_shutdown_cmd { 81enum sock_shutdown_cmd {
82 SHUT_RD = 0, 82 SHUT_RD,
83 SHUT_WR = 1, 83 SHUT_WR,
84 SHUT_RDWR = 2, 84 SHUT_RDWR,
85}; 85};
86 86
87struct socket_wq { 87struct socket_wq {
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 09906b7ca47d..a2a89a5c7be5 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -43,8 +43,9 @@ enum {
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
46 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 47 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, 48 NETIF_F_GSO_MPLS_BIT,
48 49
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 50 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 51 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -107,6 +108,7 @@ enum {
107#define NETIF_F_RXALL __NETIF_F(RXALL) 108#define NETIF_F_RXALL __NETIF_F(RXALL)
108#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 109#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
109#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 110#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
111#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
110#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 112#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
111#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 113#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
112#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 114#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 96e4c21e15e0..0741a1e919a5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -324,12 +324,15 @@ struct napi_struct {
324 struct sk_buff *gro_list; 324 struct sk_buff *gro_list;
325 struct sk_buff *skb; 325 struct sk_buff *skb;
326 struct list_head dev_list; 326 struct list_head dev_list;
327 struct hlist_node napi_hash_node;
328 unsigned int napi_id;
327}; 329};
328 330
329enum { 331enum {
330 NAPI_STATE_SCHED, /* Poll is scheduled */ 332 NAPI_STATE_SCHED, /* Poll is scheduled */
331 NAPI_STATE_DISABLE, /* Disable pending */ 333 NAPI_STATE_DISABLE, /* Disable pending */
332 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 334 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
335 NAPI_STATE_HASHED, /* In NAPI hash */
333}; 336};
334 337
335enum gro_result { 338enum gro_result {
@@ -446,6 +449,32 @@ extern void __napi_complete(struct napi_struct *n);
446extern void napi_complete(struct napi_struct *n); 449extern void napi_complete(struct napi_struct *n);
447 450
448/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id
453 * @napi_id: hashed napi_id
454 *
455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock()
457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id);
459
460/**
461 * napi_hash_add - add a NAPI to global hashtable
462 * @napi: napi context
463 *
464 * generate a new napi_id and store a @napi under it in napi_hash
465 */
466extern void napi_hash_add(struct napi_struct *napi);
467
468/**
469 * napi_hash_del - remove a NAPI from global table
470 * @napi: napi context
471 *
472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi
474 */
475extern void napi_hash_del(struct napi_struct *napi);
476
477/**
449 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
450 * @n: napi context 479 * @n: napi context
451 * 480 *
@@ -800,6 +829,7 @@ struct netdev_fcoe_hbainfo {
800 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 829 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
801 * int (*ndo_get_vf_config)(struct net_device *dev, 830 * int (*ndo_get_vf_config)(struct net_device *dev,
802 * int vf, struct ifla_vf_info *ivf); 831 * int vf, struct ifla_vf_info *ivf);
832 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
803 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 833 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
804 * struct nlattr *port[]); 834 * struct nlattr *port[]);
805 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 835 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
@@ -943,6 +973,9 @@ struct net_device_ops {
943 gfp_t gfp); 973 gfp_t gfp);
944 void (*ndo_netpoll_cleanup)(struct net_device *dev); 974 void (*ndo_netpoll_cleanup)(struct net_device *dev);
945#endif 975#endif
976#ifdef CONFIG_NET_LL_RX_POLL
977 int (*ndo_busy_poll)(struct napi_struct *dev);
978#endif
946 int (*ndo_set_vf_mac)(struct net_device *dev, 979 int (*ndo_set_vf_mac)(struct net_device *dev,
947 int queue, u8 *mac); 980 int queue, u8 *mac);
948 int (*ndo_set_vf_vlan)(struct net_device *dev, 981 int (*ndo_set_vf_vlan)(struct net_device *dev,
@@ -954,6 +987,8 @@ struct net_device_ops {
954 int (*ndo_get_vf_config)(struct net_device *dev, 987 int (*ndo_get_vf_config)(struct net_device *dev,
955 int vf, 988 int vf,
956 struct ifla_vf_info *ivf); 989 struct ifla_vf_info *ivf);
990 int (*ndo_set_vf_link_state)(struct net_device *dev,
991 int vf, int link_state);
957 int (*ndo_set_vf_port)(struct net_device *dev, 992 int (*ndo_set_vf_port)(struct net_device *dev,
958 int vf, 993 int vf,
959 struct nlattr *port[]); 994 struct nlattr *port[]);
@@ -1088,6 +1123,8 @@ struct net_device {
1088 * need to set them appropriately. 1123 * need to set them appropriately.
1089 */ 1124 */
1090 netdev_features_t hw_enc_features; 1125 netdev_features_t hw_enc_features;
1126 /* mask of fetures inheritable by MPLS */
1127 netdev_features_t mpls_features;
1091 1128
1092 /* Interface index. Unique device identifier */ 1129 /* Interface index. Unique device identifier */
1093 int ifindex; 1130 int ifindex;
@@ -1140,8 +1177,10 @@ struct net_device {
1140 unsigned char addr_assign_type; /* hw address assignment type */ 1177 unsigned char addr_assign_type; /* hw address assignment type */
1141 unsigned char addr_len; /* hardware address length */ 1178 unsigned char addr_len; /* hardware address length */
1142 unsigned char neigh_priv_len; 1179 unsigned char neigh_priv_len;
1143 unsigned short dev_id; /* for shared network cards */ 1180 unsigned short dev_id; /* Used to differentiate devices
1144 1181 * that share the same link
1182 * layer address
1183 */
1145 spinlock_t addr_list_lock; 1184 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1185 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1186 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1593,9 +1632,34 @@ struct packet_offload {
1593#define NETDEV_RELEASE 0x0012 1632#define NETDEV_RELEASE 0x0012
1594#define NETDEV_NOTIFY_PEERS 0x0013 1633#define NETDEV_NOTIFY_PEERS 0x0013
1595#define NETDEV_JOIN 0x0014 1634#define NETDEV_JOIN 0x0014
1635#define NETDEV_CHANGEUPPER 0x0015
1596 1636
1597extern int register_netdevice_notifier(struct notifier_block *nb); 1637extern int register_netdevice_notifier(struct notifier_block *nb);
1598extern int unregister_netdevice_notifier(struct notifier_block *nb); 1638extern int unregister_netdevice_notifier(struct notifier_block *nb);
1639
1640struct netdev_notifier_info {
1641 struct net_device *dev;
1642};
1643
1644struct netdev_notifier_change_info {
1645 struct netdev_notifier_info info; /* must be first */
1646 unsigned int flags_changed;
1647};
1648
1649static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
1650 struct net_device *dev)
1651{
1652 info->dev = dev;
1653}
1654
1655static inline struct net_device *
1656netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1657{
1658 return info->dev;
1659}
1660
1661extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1662 struct netdev_notifier_info *info);
1599extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1663extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1600 1664
1601 1665
@@ -1779,6 +1843,19 @@ static inline int unregister_gifconf(unsigned int family)
1779 return register_gifconf(family, NULL); 1843 return register_gifconf(family, NULL);
1780} 1844}
1781 1845
1846#ifdef CONFIG_NET_FLOW_LIMIT
1847#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
1848struct sd_flow_limit {
1849 u64 count;
1850 unsigned int num_buckets;
1851 unsigned int history_head;
1852 u16 history[FLOW_LIMIT_HISTORY];
1853 u8 buckets[];
1854};
1855
1856extern int netdev_flow_limit_table_len;
1857#endif /* CONFIG_NET_FLOW_LIMIT */
1858
1782/* 1859/*
1783 * Incoming packets are placed on per-cpu queues 1860 * Incoming packets are placed on per-cpu queues
1784 */ 1861 */
@@ -1808,6 +1885,10 @@ struct softnet_data {
1808 unsigned int dropped; 1885 unsigned int dropped;
1809 struct sk_buff_head input_pkt_queue; 1886 struct sk_buff_head input_pkt_queue;
1810 struct napi_struct backlog; 1887 struct napi_struct backlog;
1888
1889#ifdef CONFIG_NET_FLOW_LIMIT
1890 struct sd_flow_limit __rcu *flow_limit;
1891#endif
1811}; 1892};
1812 1893
1813static inline void input_queue_head_incr(struct softnet_data *sd) 1894static inline void input_queue_head_incr(struct softnet_data *sd)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0060fde3160e..de70f7b45b68 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,7 +35,7 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern void netfilter_init(void); 38extern int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6358da5eeee8..7a6c396a263b 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -46,6 +46,7 @@ struct netlink_kernel_cfg {
46 void (*input)(struct sk_buff *skb); 46 void (*input)(struct sk_buff *skb);
47 struct mutex *cb_mutex; 47 struct mutex *cb_mutex;
48 void (*bind)(int group); 48 void (*bind)(int group);
49 bool (*compare)(struct net *net, struct sock *sk);
49}; 50};
50 51
51extern struct sock *__netlink_kernel_create(struct net *net, int unit, 52extern struct sock *__netlink_kernel_create(struct net *net, int unit,
@@ -84,6 +85,22 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
84void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 85void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
85int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 86int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
86 87
88static inline struct sk_buff *
89netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
90{
91 struct sk_buff *nskb;
92
93 nskb = skb_clone(skb, gfp_mask);
94 if (!nskb)
95 return NULL;
96
97 /* This is a large skb, set destructor callback to release head */
98 if (is_vmalloc_addr(skb->head))
99 nskb->destructor = skb->destructor;
100
101 return nskb;
102}
103
87/* 104/*
88 * skb should fit one page. This choice is good for headerless malloc. 105 * skb should fit one page. This choice is good for headerless malloc.
89 * But we should limit to 8K so that userspace does not have to 106 * But we should limit to 8K so that userspace does not have to
@@ -144,4 +161,14 @@ static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
144 return __netlink_dump_start(ssk, skb, nlh, control); 161 return __netlink_dump_start(ssk, skb, nlh, control);
145} 162}
146 163
164struct netlink_tap {
165 struct net_device *dev;
166 struct module *module;
167 struct list_head list;
168};
169
170extern int netlink_add_tap(struct netlink_tap *nt);
171extern int __netlink_remove_tap(struct netlink_tap *nt);
172extern int netlink_remove_tap(struct netlink_tap *nt);
173
147#endif /* __LINUX_NETLINK_H */ 174#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fa2cb76a7029..f3c7c24bec1c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -53,10 +53,10 @@ struct netpoll_info {
53}; 53};
54 54
55#ifdef CONFIG_NETPOLL 55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev); 56extern void netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev); 57extern void netpoll_rx_enable(struct net_device *dev);
58#else 58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; } 59static inline void netpoll_rx_disable(struct net_device *dev) { return; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; } 60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif 61#endif
62 62
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 0b176297aaf6..7125cef74164 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -348,6 +348,7 @@ extern int nfs_permission(struct inode *, int);
348extern int nfs_open(struct inode *, struct file *); 348extern int nfs_open(struct inode *, struct file *);
349extern int nfs_release(struct inode *, struct file *); 349extern int nfs_release(struct inode *, struct file *);
350extern int nfs_attribute_timeout(struct inode *inode); 350extern int nfs_attribute_timeout(struct inode *inode);
351extern int nfs_attribute_cache_expired(struct inode *inode);
351extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 352extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
352extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 353extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
353extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 354extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index db50840e6355..6a45fb583ff1 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -46,7 +46,7 @@ static inline bool trigger_all_cpu_backtrace(void)
46#ifdef CONFIG_LOCKUP_DETECTOR 46#ifdef CONFIG_LOCKUP_DETECTOR
47int hw_nmi_is_cpu_stuck(struct pt_regs *); 47int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 48u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_enabled; 49extern int watchdog_user_enabled;
50extern int watchdog_thresh; 50extern int watchdog_thresh;
51struct ctl_table; 51struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 52extern int proc_dowatchdog(struct ctl_table *, int ,
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8873f82c7baa..c43f6eabad5b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -826,7 +826,7 @@ static inline void perf_restore_debug_store(void) { }
826 */ 826 */
827#define perf_cpu_notifier(fn) \ 827#define perf_cpu_notifier(fn) \
828do { \ 828do { \
829 static struct notifier_block fn##_nb __cpuinitdata = \ 829 static struct notifier_block fn##_nb = \
830 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 830 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
831 unsigned long cpu = smp_processor_id(); \ 831 unsigned long cpu = smp_processor_id(); \
832 unsigned long flags; \ 832 unsigned long flags; \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9e11039dd7a3..64ab823f7b74 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -49,6 +49,7 @@
49 49
50#define PHY_HAS_INTERRUPT 0x00000001 50#define PHY_HAS_INTERRUPT 0x00000001
51#define PHY_HAS_MAGICANEG 0x00000002 51#define PHY_HAS_MAGICANEG 0x00000002
52#define PHY_IS_INTERNAL 0x00000004
52 53
53/* Interface Mode definitions */ 54/* Interface Mode definitions */
54typedef enum { 55typedef enum {
@@ -57,6 +58,7 @@ typedef enum {
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
59 PHY_INTERFACE_MODE_TBI, 60 PHY_INTERFACE_MODE_TBI,
61 PHY_INTERFACE_MODE_REVMII,
60 PHY_INTERFACE_MODE_RMII, 62 PHY_INTERFACE_MODE_RMII,
61 PHY_INTERFACE_MODE_RGMII, 63 PHY_INTERFACE_MODE_RGMII,
62 PHY_INTERFACE_MODE_RGMII_ID, 64 PHY_INTERFACE_MODE_RGMII_ID,
@@ -261,6 +263,7 @@ struct phy_c45_device_ids {
261 * phy_id: UID for this device found during discovery 263 * phy_id: UID for this device found during discovery
262 * c45_ids: 802.3-c45 Device Identifers if is_c45. 264 * c45_ids: 802.3-c45 Device Identifers if is_c45.
263 * is_c45: Set to true if this phy uses clause 45 addressing. 265 * is_c45: Set to true if this phy uses clause 45 addressing.
266 * is_internal: Set to true if this phy is internal to a MAC.
264 * state: state of the PHY for management purposes 267 * state: state of the PHY for management purposes
265 * dev_flags: Device-specific flags used by the PHY driver. 268 * dev_flags: Device-specific flags used by the PHY driver.
266 * addr: Bus address of PHY 269 * addr: Bus address of PHY
@@ -298,6 +301,7 @@ struct phy_device {
298 301
299 struct phy_c45_device_ids c45_ids; 302 struct phy_c45_device_ids c45_ids;
300 bool is_c45; 303 bool is_c45;
304 bool is_internal;
301 305
302 enum phy_state state; 306 enum phy_state state;
303 307
@@ -508,6 +512,27 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
508 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 512 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
509} 513}
510 514
515/**
516 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
517 * @phydev: the phy_device struct
518 *
519 * NOTE: must be kept in sync with addition/removal of PHY_POLL and
520 * PHY_IGNORE_INTERRUPT
521 */
522static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
523{
524 return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
525}
526
527/**
528 * phy_is_internal - Convenience function for testing if a PHY is internal
529 * @phydev: the phy_device struct
530 */
531static inline bool phy_is_internal(struct phy_device *phydev)
532{
533 return phydev->is_internal;
534}
535
511struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 536struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
512 bool is_c45, struct phy_c45_device_ids *c45_ids); 537 bool is_c45, struct phy_c45_device_ids *c45_ids);
513struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); 538struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
@@ -545,6 +570,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);
545int phy_driver_register(struct phy_driver *new_driver); 570int phy_driver_register(struct phy_driver *new_driver);
546int phy_drivers_register(struct phy_driver *new_driver, int n); 571int phy_drivers_register(struct phy_driver *new_driver, int n);
547void phy_state_machine(struct work_struct *work); 572void phy_state_machine(struct work_struct *work);
573void phy_change(struct work_struct *work);
574void phy_mac_interrupt(struct phy_device *phydev, int new_link);
548void phy_start_machine(struct phy_device *phydev, 575void phy_start_machine(struct phy_device *phydev,
549 void (*handler)(struct net_device *)); 576 void (*handler)(struct net_device *));
550void phy_stop_machine(struct phy_device *phydev); 577void phy_stop_machine(struct phy_device *phydev);
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
index 1ade657d5fc1..b7174998c24a 100644
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -90,6 +90,10 @@ void __init brcmfmac_init_pdata(void)
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are 90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function. 91 * used for registering the irq using request_irq function.
92 * 92 *
93 * broken_sg_support: flag for broken sg list support of SDIO host controller.
94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item.
96 *
93 * power_on: This function is called by the brcmfmac when the module gets 97 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform 98 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device. 99 * spcific routine may for example decide to power up the complete device.
@@ -116,6 +120,7 @@ struct brcmfmac_sdio_platform_data {
116 bool oob_irq_supported; 120 bool oob_irq_supported;
117 unsigned int oob_irq_nr; 121 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags; 122 unsigned long oob_irq_flags;
123 bool broken_sg_support;
119 void (*power_on)(void); 124 void (*power_on)(void);
120 void (*power_off)(void); 125 void (*power_off)(void);
121 void (*reset)(void); 126 void (*reset)(void);
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index b4a0521ce411..d44912d81578 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,5 +40,6 @@ struct esdhc_platform_data {
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width; 42 int max_bus_width;
43 unsigned int f_max;
43}; 44};
44#endif /* __ASM_ARCH_IMX_ESDHC_H */ 45#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/net-cw1200.h b/include/linux/platform_data/net-cw1200.h
new file mode 100644
index 000000000000..c6fbc3ce4ab0
--- /dev/null
+++ b/include/linux/platform_data/net-cw1200.h
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CW1200_PLAT_H_INCLUDED
9#define CW1200_PLAT_H_INCLUDED
10
11struct cw1200_platform_data_spi {
12 u8 spi_bits_per_word; /* REQUIRED */
13 u16 ref_clk; /* REQUIRED (in KHz) */
14
15 /* All others are optional */
16 bool have_5ghz;
17 int reset; /* GPIO to RSTn signal (0 disables) */
18 int powerup; /* GPIO to POWERUP signal (0 disables) */
19 int (*power_ctrl)(const struct cw1200_platform_data_spi *pdata,
20 bool enable); /* Control 3v3 / 1v8 supply */
21 int (*clk_ctrl)(const struct cw1200_platform_data_spi *pdata,
22 bool enable); /* Control CLK32K */
23 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
24 const char *sdd_file; /* if NULL, will use default for detected hw type */
25};
26
27struct cw1200_platform_data_sdio {
28 u16 ref_clk; /* REQUIRED (in KHz) */
29
30 /* All others are optional */
31 bool have_5ghz;
32 bool no_nptb; /* SDIO hardware does not support non-power-of-2-blocksizes */
33 int reset; /* GPIO to RSTn signal (0 disables) */
34 int powerup; /* GPIO to POWERUP signal (0 disables) */
35 int irq; /* IRQ line or 0 to use SDIO IRQ */
36 int (*power_ctrl)(const struct cw1200_platform_data_sdio *pdata,
37 bool enable); /* Control 3v3 / 1v8 supply */
38 int (*clk_ctrl)(const struct cw1200_platform_data_sdio *pdata,
39 bool enable); /* Control CLK32K */
40 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
41 const char *sdd_file; /* if NULL, will use default for detected hw type */
42};
43
44
45/* An example of SPI support in your board setup file:
46
47 static struct cw1200_platform_data_spi cw1200_platform_data = {
48 .ref_clk = 38400,
49 .spi_bits_per_word = 16,
50 .reset = GPIO_RF_RESET,
51 .powerup = GPIO_RF_POWERUP,
52 .macaddr = wifi_mac_addr,
53 .sdd_file = "sdd_sagrad_1091_1098.bin",
54 };
55 static struct spi_board_info myboard_spi_devices[] __initdata = {
56 {
57 .modalias = "cw1200_wlan_spi",
58 .max_speed_hz = 52000000,
59 .bus_num = 0,
60 .irq = WIFI_IRQ,
61 .platform_data = &cw1200_platform_data,
62 .chip_select = 0,
63 },
64 };
65
66 */
67
68/* An example of SDIO support in your board setup file:
69
70 static struct cw1200_platform_data_sdio my_cw1200_platform_data = {
71 .ref_clk = 38400,
72 .have_5ghz = false,
73 .sdd_file = "sdd_myplatform.bin",
74 };
75 cw1200_sdio_set_platform_data(&my_cw1200_platform_data);
76
77 */
78
79void __init cw1200_sdio_set_platform_data(struct cw1200_platform_data_sdio *pdata);
80
81#endif /* CW1200_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
new file mode 100644
index 000000000000..a7220b10ddab
--- /dev/null
+++ b/include/linux/platform_data/pwm-renesas-tpu.h
@@ -0,0 +1,16 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
new file mode 100644
index 000000000000..80587fdbba3e
--- /dev/null
+++ b/include/linux/platform_data/rcar-du.h
@@ -0,0 +1,54 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <drm/drm_mode.h>
18
19enum rcar_du_encoder_type {
20 RCAR_DU_ENCODER_UNUSED = 0,
21 RCAR_DU_ENCODER_VGA,
22 RCAR_DU_ENCODER_LVDS,
23};
24
25struct rcar_du_panel_data {
26 unsigned int width_mm; /* Panel width in mm */
27 unsigned int height_mm; /* Panel height in mm */
28 struct drm_mode_modeinfo mode;
29};
30
31struct rcar_du_encoder_lvds_data {
32 struct rcar_du_panel_data panel;
33};
34
35struct rcar_du_encoder_vga_data {
36 /* TODO: Add DDC information for EDID retrieval */
37};
38
39struct rcar_du_encoder_data {
40 enum rcar_du_encoder_type encoder;
41 unsigned int output;
42
43 union {
44 struct rcar_du_encoder_lvds_data lvds;
45 struct rcar_du_encoder_vga_data vga;
46 } u;
47};
48
49struct rcar_du_platform_data {
50 struct rcar_du_encoder_data *encoders;
51 unsigned int num_encoders;
52};
53
54#endif /* __RCAR_DU_H__ */
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h
index 3c1c6444ec4b..bfbd12b41162 100644
--- a/include/linux/platform_data/remoteproc-omap.h
+++ b/include/linux/platform_data/remoteproc-omap.h
@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
50 50
51#else 51#else
52 52
53void __init omap_rproc_reserve_cma(void) 53static inline void __init omap_rproc_reserve_cma(void)
54{ 54{
55} 55}
56 56
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
deleted file mode 100644
index e41d5834cb84..000000000000
--- a/include/linux/platform_data/ti_am335x_adc.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 569781faa504..a0f70808d7f4 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -36,8 +36,8 @@
36 * @last_time: Monotonic clock when the wakeup source's was touched last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep. 37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
38 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
39 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup source was activated.
40 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup source was deactivated.
41 * @expire_count: Number of times the wakeup source's timeout has expired. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend. 42 * @wakeup_count: Number of times the wakeup source might abort suspend.
43 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3828cefb4f65..804b90643a85 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -162,6 +162,8 @@ union power_supply_propval {
162 const char *strval; 162 const char *strval;
163}; 163};
164 164
165struct device_node;
166
165struct power_supply { 167struct power_supply {
166 const char *name; 168 const char *name;
167 enum power_supply_type type; 169 enum power_supply_type type;
@@ -173,9 +175,7 @@ struct power_supply {
173 175
174 char **supplied_from; 176 char **supplied_from;
175 size_t num_supplies; 177 size_t num_supplies;
176#ifdef CONFIG_OF
177 struct device_node *of_node; 178 struct device_node *of_node;
178#endif
179 179
180 int (*get_property)(struct power_supply *psy, 180 int (*get_property)(struct power_supply *psy,
181 enum power_supply_property psp, 181 enum power_supply_property psp,
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a4df2042b79c..f0feafd184a0 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -76,6 +76,7 @@ enum pwm_polarity {
76enum { 76enum {
77 PWMF_REQUESTED = 1 << 0, 77 PWMF_REQUESTED = 1 << 0,
78 PWMF_ENABLED = 1 << 1, 78 PWMF_ENABLED = 1 << 1,
79 PWMF_EXPORTED = 1 << 2,
79}; 80};
80 81
81struct pwm_device { 82struct pwm_device {
@@ -86,7 +87,9 @@ struct pwm_device {
86 struct pwm_chip *chip; 87 struct pwm_chip *chip;
87 void *chip_data; 88 void *chip_data;
88 89
89 unsigned int period; /* in nanoseconds */ 90 unsigned int period; /* in nanoseconds */
91 unsigned int duty_cycle; /* in nanoseconds */
92 enum pwm_polarity polarity;
90}; 93};
91 94
92static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) 95static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period)
@@ -100,6 +103,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
100 return pwm ? pwm->period : 0; 103 return pwm ? pwm->period : 0;
101} 104}
102 105
106static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
107{
108 if (pwm)
109 pwm->duty_cycle = duty;
110}
111
112static inline unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
113{
114 return pwm ? pwm->duty_cycle : 0;
115}
116
103/* 117/*
104 * pwm_set_polarity - configure the polarity of a PWM signal 118 * pwm_set_polarity - configure the polarity of a PWM signal
105 */ 119 */
@@ -278,4 +292,17 @@ static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
278} 292}
279#endif 293#endif
280 294
295#ifdef CONFIG_PWM_SYSFS
296void pwmchip_sysfs_export(struct pwm_chip *chip);
297void pwmchip_sysfs_unexport(struct pwm_chip *chip);
298#else
299static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
300{
301}
302
303static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip)
304{
305}
306#endif /* CONFIG_PWM_SYSFS */
307
281#endif /* __LINUX_PWM_H */ 308#endif /* __LINUX_PWM_H */
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
new file mode 100644
index 000000000000..813dae960ebd
--- /dev/null
+++ b/include/linux/reservation.h
@@ -0,0 +1,62 @@
1/*
2 * Header file for reservations for dma-buf and ttm
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Copyright (C) 2012-2013 Canonical Ltd
6 * Copyright (C) 2012 Texas Instruments
7 *
8 * Authors:
9 * Rob Clark <rob.clark@linaro.org>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 *
13 * Based on bo.c which bears the following copyright notice,
14 * but is dual licensed:
15 *
16 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
17 * All Rights Reserved.
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining a
20 * copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sub license, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice (including the
28 * next paragraph) shall be included in all copies or substantial portions
29 * of the Software.
30 *
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
34 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
35 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
36 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
37 * USE OR OTHER DEALINGS IN THE SOFTWARE.
38 */
39#ifndef _LINUX_RESERVATION_H
40#define _LINUX_RESERVATION_H
41
42#include <linux/ww_mutex.h>
43
44extern struct ww_class reservation_ww_class;
45
46struct reservation_object {
47 struct ww_mutex lock;
48};
49
50static inline void
51reservation_object_init(struct reservation_object *obj)
52{
53 ww_mutex_init(&obj->lock, &reservation_ww_class);
54}
55
56static inline void
57reservation_object_fini(struct reservation_object *obj)
58{
59 ww_mutex_destroy(&obj->lock);
60}
61
62#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 75324d8157e3..50d04b92ceda 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -322,8 +322,6 @@ extern unsigned long
322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
323 unsigned long len, unsigned long pgoff, 323 unsigned long len, unsigned long pgoff,
324 unsigned long flags); 324 unsigned long flags);
325extern void arch_unmap_area(struct mm_struct *, unsigned long);
326extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
327#else 325#else
328static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} 326static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
329#endif 327#endif
@@ -2434,6 +2432,15 @@ extern int __cond_resched_softirq(void);
2434 __cond_resched_softirq(); \ 2432 __cond_resched_softirq(); \
2435}) 2433})
2436 2434
2435static inline void cond_resched_rcu(void)
2436{
2437#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
2438 rcu_read_unlock();
2439 cond_resched();
2440 rcu_read_lock();
2441#endif
2442}
2443
2437/* 2444/*
2438 * Does a critical section need to be broken due to another 2445 * Does a critical section need to be broken due to another
2439 * task waiting?: (technically does not depend on CONFIG_PREEMPT, 2446 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dec1748cd002..5afefa01a13c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -319,6 +319,8 @@ enum {
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_UDP_TUNNEL = 1 << 7,
322
323 SKB_GSO_MPLS = 1 << 8,
322}; 324};
323 325
324#if BITS_PER_LONG > 32 326#if BITS_PER_LONG > 32
@@ -384,11 +386,13 @@ typedef unsigned char *sk_buff_data_t;
384 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 386 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
385 * @dma_cookie: a cookie to one of several possible DMA operations 387 * @dma_cookie: a cookie to one of several possible DMA operations
386 * done by skb DMA functions 388 * done by skb DMA functions
389 * @napi_id: id of the NAPI struct this skb came from
387 * @secmark: security marking 390 * @secmark: security marking
388 * @mark: Generic packet mark 391 * @mark: Generic packet mark
389 * @dropcount: total number of sk_receive_queue overflows 392 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol 393 * @vlan_proto: vlan encapsulation protocol
391 * @vlan_tci: vlan tag control information 394 * @vlan_tci: vlan tag control information
395 * @inner_protocol: Protocol (encapsulation)
392 * @inner_transport_header: Inner transport layer header (encapsulation) 396 * @inner_transport_header: Inner transport layer header (encapsulation)
393 * @inner_network_header: Network layer header (encapsulation) 397 * @inner_network_header: Network layer header (encapsulation)
394 * @inner_mac_header: Link layer header (encapsulation) 398 * @inner_mac_header: Link layer header (encapsulation)
@@ -497,8 +501,11 @@ struct sk_buff {
497 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */
498 kmemcheck_bitfield_end(flags2); 502 kmemcheck_bitfield_end(flags2);
499 503
500#ifdef CONFIG_NET_DMA 504#if defined CONFIG_NET_DMA || defined CONFIG_NET_LL_RX_POLL
501 dma_cookie_t dma_cookie; 505 union {
506 unsigned int napi_id;
507 dma_cookie_t dma_cookie;
508 };
502#endif 509#endif
503#ifdef CONFIG_NETWORK_SECMARK 510#ifdef CONFIG_NETWORK_SECMARK
504 __u32 secmark; 511 __u32 secmark;
@@ -509,12 +516,13 @@ struct sk_buff {
509 __u32 reserved_tailroom; 516 __u32 reserved_tailroom;
510 }; 517 };
511 518
512 sk_buff_data_t inner_transport_header; 519 __be16 inner_protocol;
513 sk_buff_data_t inner_network_header; 520 __u16 inner_transport_header;
514 sk_buff_data_t inner_mac_header; 521 __u16 inner_network_header;
515 sk_buff_data_t transport_header; 522 __u16 inner_mac_header;
516 sk_buff_data_t network_header; 523 __u16 transport_header;
517 sk_buff_data_t mac_header; 524 __u16 network_header;
525 __u16 mac_header;
518 /* These elements must be at the end, see alloc_skb() for details. */ 526 /* These elements must be at the end, see alloc_skb() for details. */
519 sk_buff_data_t tail; 527 sk_buff_data_t tail;
520 sk_buff_data_t end; 528 sk_buff_data_t end;
@@ -1388,6 +1396,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1388 skb_reset_tail_pointer(skb); 1396 skb_reset_tail_pointer(skb);
1389 skb->tail += offset; 1397 skb->tail += offset;
1390} 1398}
1399
1391#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1400#else /* NET_SKBUFF_DATA_USES_OFFSET */
1392static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 1401static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
1393{ 1402{
@@ -1528,7 +1537,6 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)
1528 skb->mac_len = skb->network_header - skb->mac_header; 1537 skb->mac_len = skb->network_header - skb->mac_header;
1529} 1538}
1530 1539
1531#ifdef NET_SKBUFF_DATA_USES_OFFSET
1532static inline unsigned char *skb_inner_transport_header(const struct sk_buff 1540static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1533 *skb) 1541 *skb)
1534{ 1542{
@@ -1582,7 +1590,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1582} 1590}
1583static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1591static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1584{ 1592{
1585 return skb->transport_header != ~0U; 1593 return skb->transport_header != (typeof(skb->transport_header))~0U;
1586} 1594}
1587 1595
1588static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1596static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1625,7 +1633,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1625 1633
1626static inline int skb_mac_header_was_set(const struct sk_buff *skb) 1634static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1627{ 1635{
1628 return skb->mac_header != ~0U; 1636 return skb->mac_header != (typeof(skb->mac_header))~0U;
1629} 1637}
1630 1638
1631static inline void skb_reset_mac_header(struct sk_buff *skb) 1639static inline void skb_reset_mac_header(struct sk_buff *skb)
@@ -1639,112 +1647,6 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1639 skb->mac_header += offset; 1647 skb->mac_header += offset;
1640} 1648}
1641 1649
1642#else /* NET_SKBUFF_DATA_USES_OFFSET */
1643static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1644 *skb)
1645{
1646 return skb->inner_transport_header;
1647}
1648
1649static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1650{
1651 skb->inner_transport_header = skb->data;
1652}
1653
1654static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1655 const int offset)
1656{
1657 skb->inner_transport_header = skb->data + offset;
1658}
1659
1660static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1661{
1662 return skb->inner_network_header;
1663}
1664
1665static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1666{
1667 skb->inner_network_header = skb->data;
1668}
1669
1670static inline void skb_set_inner_network_header(struct sk_buff *skb,
1671 const int offset)
1672{
1673 skb->inner_network_header = skb->data + offset;
1674}
1675
1676static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1677{
1678 return skb->inner_mac_header;
1679}
1680
1681static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1682{
1683 skb->inner_mac_header = skb->data;
1684}
1685
1686static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1687 const int offset)
1688{
1689 skb->inner_mac_header = skb->data + offset;
1690}
1691static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1692{
1693 return skb->transport_header != NULL;
1694}
1695
1696static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1697{
1698 return skb->transport_header;
1699}
1700
1701static inline void skb_reset_transport_header(struct sk_buff *skb)
1702{
1703 skb->transport_header = skb->data;
1704}
1705
1706static inline void skb_set_transport_header(struct sk_buff *skb,
1707 const int offset)
1708{
1709 skb->transport_header = skb->data + offset;
1710}
1711
1712static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1713{
1714 return skb->network_header;
1715}
1716
1717static inline void skb_reset_network_header(struct sk_buff *skb)
1718{
1719 skb->network_header = skb->data;
1720}
1721
1722static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1723{
1724 skb->network_header = skb->data + offset;
1725}
1726
1727static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1728{
1729 return skb->mac_header;
1730}
1731
1732static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1733{
1734 return skb->mac_header != NULL;
1735}
1736
1737static inline void skb_reset_mac_header(struct sk_buff *skb)
1738{
1739 skb->mac_header = skb->data;
1740}
1741
1742static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1743{
1744 skb->mac_header = skb->data + offset;
1745}
1746#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1747
1748static inline void skb_probe_transport_header(struct sk_buff *skb, 1650static inline void skb_probe_transport_header(struct sk_buff *skb,
1749 const int offset_hint) 1651 const int offset_hint)
1750{ 1652{
@@ -2483,6 +2385,7 @@ extern void skb_split(struct sk_buff *skb,
2483 struct sk_buff *skb1, const u32 len); 2385 struct sk_buff *skb1, const u32 len);
2484extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2386extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2485 int shiftlen); 2387 int shiftlen);
2388extern void skb_scrub_packet(struct sk_buff *skb);
2486 2389
2487extern struct sk_buff *skb_segment(struct sk_buff *skb, 2390extern struct sk_buff *skb_segment(struct sk_buff *skb,
2488 netdev_features_t features); 2391 netdev_features_t features);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c621752caa6..6c5cc0ea8713 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -169,11 +169,7 @@ struct kmem_cache {
169 struct list_head list; /* List of all slab caches on the system */ 169 struct list_head list; /* List of all slab caches on the system */
170}; 170};
171 171
172#define KMALLOC_MAX_SIZE (1UL << 30) 172#endif /* CONFIG_SLOB */
173
174#include <linux/slob_def.h>
175
176#else /* CONFIG_SLOB */
177 173
178/* 174/*
179 * Kmalloc array related definitions 175 * Kmalloc array related definitions
@@ -195,7 +191,9 @@ struct kmem_cache {
195#ifndef KMALLOC_SHIFT_LOW 191#ifndef KMALLOC_SHIFT_LOW
196#define KMALLOC_SHIFT_LOW 5 192#define KMALLOC_SHIFT_LOW 5
197#endif 193#endif
198#else 194#endif
195
196#ifdef CONFIG_SLUB
199/* 197/*
200 * SLUB allocates up to order 2 pages directly and otherwise 198 * SLUB allocates up to order 2 pages directly and otherwise
201 * passes the request to the page allocator. 199 * passes the request to the page allocator.
@@ -207,6 +205,19 @@ struct kmem_cache {
207#endif 205#endif
208#endif 206#endif
209 207
208#ifdef CONFIG_SLOB
209/*
210 * SLOB passes all page size and larger requests to the page allocator.
211 * No kmalloc array is necessary since objects of different sizes can
212 * be allocated from the same page.
213 */
214#define KMALLOC_SHIFT_MAX 30
215#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
216#ifndef KMALLOC_SHIFT_LOW
217#define KMALLOC_SHIFT_LOW 3
218#endif
219#endif
220
210/* Maximum allocatable size */ 221/* Maximum allocatable size */
211#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) 222#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
212/* Maximum size for which we actually use a slab cache */ 223/* Maximum size for which we actually use a slab cache */
@@ -221,6 +232,7 @@ struct kmem_cache {
221#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 232#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
222#endif 233#endif
223 234
235#ifndef CONFIG_SLOB
224extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 236extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
225#ifdef CONFIG_ZONE_DMA 237#ifdef CONFIG_ZONE_DMA
226extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; 238extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
@@ -275,13 +287,18 @@ static __always_inline int kmalloc_index(size_t size)
275 /* Will never be reached. Needed because the compiler may complain */ 287 /* Will never be reached. Needed because the compiler may complain */
276 return -1; 288 return -1;
277} 289}
290#endif /* !CONFIG_SLOB */
278 291
279#ifdef CONFIG_SLAB 292#ifdef CONFIG_SLAB
280#include <linux/slab_def.h> 293#include <linux/slab_def.h>
281#elif defined(CONFIG_SLUB) 294#endif
295
296#ifdef CONFIG_SLUB
282#include <linux/slub_def.h> 297#include <linux/slub_def.h>
283#else 298#endif
284#error "Unknown slab allocator" 299
300#ifdef CONFIG_SLOB
301#include <linux/slob_def.h>
285#endif 302#endif
286 303
287/* 304/*
@@ -291,6 +308,7 @@ static __always_inline int kmalloc_index(size_t size)
291 */ 308 */
292static __always_inline int kmalloc_size(int n) 309static __always_inline int kmalloc_size(int n)
293{ 310{
311#ifndef CONFIG_SLOB
294 if (n > 2) 312 if (n > 2)
295 return 1 << n; 313 return 1 << n;
296 314
@@ -299,10 +317,9 @@ static __always_inline int kmalloc_size(int n)
299 317
300 if (n == 2 && KMALLOC_MIN_SIZE <= 64) 318 if (n == 2 && KMALLOC_MIN_SIZE <= 64)
301 return 192; 319 return 192;
302 320#endif
303 return 0; 321 return 0;
304} 322}
305#endif /* !CONFIG_SLOB */
306 323
307/* 324/*
308 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 325 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
@@ -356,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
356void print_slabinfo_header(struct seq_file *m); 373void print_slabinfo_header(struct seq_file *m);
357 374
358/** 375/**
359 * kmalloc_array - allocate memory for an array. 376 * kmalloc - allocate memory
360 * @n: number of elements. 377 * @size: how many bytes of memory are required.
361 * @size: element size.
362 * @flags: the type of memory to allocate. 378 * @flags: the type of memory to allocate.
363 * 379 *
364 * The @flags argument may be one of: 380 * The @flags argument may be one of:
@@ -405,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m);
405 * There are other flags available as well, but these are not intended 421 * There are other flags available as well, but these are not intended
406 * for general use, and so are not documented here. For a full list of 422 * for general use, and so are not documented here. For a full list of
407 * potential flags, always refer to linux/gfp.h. 423 * potential flags, always refer to linux/gfp.h.
424 *
425 * kmalloc is the normal method of allocating memory
426 * in the kernel.
427 */
428static __always_inline void *kmalloc(size_t size, gfp_t flags);
429
430/**
431 * kmalloc_array - allocate memory for an array.
432 * @n: number of elements.
433 * @size: element size.
434 * @flags: the type of memory to allocate (see kmalloc).
408 */ 435 */
409static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 436static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
410{ 437{
@@ -428,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
428/** 455/**
429 * kmalloc_node - allocate memory from a specific node 456 * kmalloc_node - allocate memory from a specific node
430 * @size: how many bytes of memory are required. 457 * @size: how many bytes of memory are required.
431 * @flags: the type of memory to allocate (see kcalloc). 458 * @flags: the type of memory to allocate (see kmalloc).
432 * @node: node to allocate from. 459 * @node: node to allocate from.
433 * 460 *
434 * kmalloc() for non-local nodes, used to allocate from a specific node 461 * kmalloc() for non-local nodes, used to allocate from a specific node
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index f28e14a12e3f..095a5a4a8516 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
18 return __kmalloc_node(size, flags, node); 18 return __kmalloc_node(size, flags, node);
19} 19}
20 20
21/**
22 * kmalloc - allocate memory
23 * @size: how many bytes of memory are required.
24 * @flags: the type of memory to allocate (see kcalloc).
25 *
26 * kmalloc is the normal method of allocating memory
27 * in the kernel.
28 */
29static __always_inline void *kmalloc(size_t size, gfp_t flags) 21static __always_inline void *kmalloc(size_t size, gfp_t flags)
30{ 22{
31 return __kmalloc_node(size, flags, NUMA_NO_NODE); 23 return __kmalloc_node(size, flags, NUMA_NO_NODE);
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b10ce4b341ea..230c04bda3e2 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -167,6 +167,7 @@ struct ucred {
167#define AF_PPPOX 24 /* PPPoX sockets */ 167#define AF_PPPOX 24 /* PPPoX sockets */
168#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 168#define AF_WANPIPE 25 /* Wanpipe API Sockets */
169#define AF_LLC 26 /* Linux LLC */ 169#define AF_LLC 26 /* Linux LLC */
170#define AF_IB 27 /* Native InfiniBand address */
170#define AF_CAN 29 /* Controller Area Network */ 171#define AF_CAN 29 /* Controller Area Network */
171#define AF_TIPC 30 /* TIPC sockets */ 172#define AF_TIPC 30 /* TIPC sockets */
172#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 173#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -211,6 +212,7 @@ struct ucred {
211#define PF_PPPOX AF_PPPOX 212#define PF_PPPOX AF_PPPOX
212#define PF_WANPIPE AF_WANPIPE 213#define PF_WANPIPE AF_WANPIPE
213#define PF_LLC AF_LLC 214#define PF_LLC AF_LLC
215#define PF_IB AF_IB
214#define PF_CAN AF_CAN 216#define PF_CAN AF_CAN
215#define PF_TIPC AF_TIPC 217#define PF_TIPC AF_TIPC
216#define PF_BLUETOOTH AF_BLUETOOTH 218#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d40a99e..6535e4718fde 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -20,6 +20,18 @@ struct ssb_pflash {
20 u32 window_size; 20 u32 window_size;
21}; 21};
22 22
23#ifdef CONFIG_SSB_SFLASH
24struct ssb_sflash {
25 bool present;
26 u32 window;
27 u32 blocksize;
28 u16 numblocks;
29 u32 size;
30
31 void *priv;
32};
33#endif
34
23struct ssb_mipscore { 35struct ssb_mipscore {
24 struct ssb_device *dev; 36 struct ssb_device *dev;
25 37
@@ -27,6 +39,9 @@ struct ssb_mipscore {
27 struct ssb_serial_port serial_ports[4]; 39 struct ssb_serial_port serial_ports[4];
28 40
29 struct ssb_pflash pflash; 41 struct ssb_pflash pflash;
42#ifdef CONFIG_SSB_SFLASH
43 struct ssb_sflash sflash;
44#endif
30}; 45};
31 46
32extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 47extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 3a7256955b10..f9f931c89e3e 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -172,6 +172,7 @@
172#define SSB_SPROMSIZE_WORDS_R4 220 172#define SSB_SPROMSIZE_WORDS_R4 220
173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
175#define SSB_SPROMSIZE_WORDS_R10 230
175#define SSB_SPROM_BASE1 0x1000 176#define SSB_SPROM_BASE1 0x1000
176#define SSB_SPROM_BASE31 0x0800 177#define SSB_SPROM_BASE31 0x0800
177#define SSB_SPROM_REVISION 0x007E 178#define SSB_SPROM_REVISION 0x007E
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index c1b3ed3fb787..9e495d31516e 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -80,6 +80,10 @@ struct stmmac_mdio_bus_data {
80 unsigned int phy_mask; 80 unsigned int phy_mask;
81 int *irqs; 81 int *irqs;
82 int probed_phy_irq; 82 int probed_phy_irq;
83#ifdef CONFIG_OF
84 int reset_gpio, active_low;
85 u32 delays[3];
86#endif
83}; 87};
84 88
85struct stmmac_dma_cfg { 89struct stmmac_dma_cfg {
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 303399b1ba59..6ce690de447f 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -57,6 +57,7 @@ struct cache_head {
57#define CACHE_VALID 0 /* Entry contains valid data */ 57#define CACHE_VALID 0 /* Entry contains valid data */
58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */ 58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */
59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/ 59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/
60#define CACHE_CLEANED 3 /* Entry has been cleaned from cache */
60 61
61#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 62#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
62 63
@@ -148,6 +149,24 @@ struct cache_deferred_req {
148 int too_many); 149 int too_many);
149}; 150};
150 151
152/*
153 * timestamps kept in the cache are expressed in seconds
154 * since boot. This is the best for measuring differences in
155 * real time.
156 */
157static inline time_t seconds_since_boot(void)
158{
159 struct timespec boot;
160 getboottime(&boot);
161 return get_seconds() - boot.tv_sec;
162}
163
164static inline time_t convert_to_wallclock(time_t sinceboot)
165{
166 struct timespec boot;
167 getboottime(&boot);
168 return boot.tv_sec + sinceboot;
169}
151 170
152extern const struct file_operations cache_file_operations_pipefs; 171extern const struct file_operations cache_file_operations_pipefs;
153extern const struct file_operations content_file_operations_pipefs; 172extern const struct file_operations content_file_operations_pipefs;
@@ -181,15 +200,10 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
181 kref_put(&h->ref, cd->cache_put); 200 kref_put(&h->ref, cd->cache_put);
182} 201}
183 202
184static inline int cache_valid(struct cache_head *h) 203static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
185{ 204{
186 /* If an item has been unhashed pending removal when 205 return (h->expiry_time < seconds_since_boot()) ||
187 * the refcount drops to 0, the expiry_time will be 206 (detail->flush_time > h->last_refresh);
188 * set to 0. We don't want to consider such items
189 * valid in this context even though CACHE_VALID is
190 * set.
191 */
192 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
193} 207}
194 208
195extern int cache_check(struct cache_detail *detail, 209extern int cache_check(struct cache_detail *detail,
@@ -250,25 +264,6 @@ static inline int get_uint(char **bpp, unsigned int *anint)
250 return 0; 264 return 0;
251} 265}
252 266
253/*
254 * timestamps kept in the cache are expressed in seconds
255 * since boot. This is the best for measuring differences in
256 * real time.
257 */
258static inline time_t seconds_since_boot(void)
259{
260 struct timespec boot;
261 getboottime(&boot);
262 return get_seconds() - boot.tv_sec;
263}
264
265static inline time_t convert_to_wallclock(time_t sinceboot)
266{
267 struct timespec boot;
268 getboottime(&boot);
269 return boot.tv_sec + sinceboot;
270}
271
272static inline time_t get_expiry(char **bpp) 267static inline time_t get_expiry(char **bpp)
273{ 268{
274 int rv; 269 int rv;
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 161463e59624..1f911ccb2a75 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
151/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153 153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 156/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
155 * corresponding call to gss_mech_put. */ 157 * corresponding call to gss_mech_put. */
156void gss_mech_put(struct gss_api_mech *); 158void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a7b422b33eda..aa5b582cc471 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -73,12 +73,12 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 74
75struct rpc_clnt; 75struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 76extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 77extern int rpc_remove_client_dir(struct dentry *);
78 78
79struct cache_detail; 79struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 80extern struct dentry *rpc_create_cache_dir(struct dentry *,
81 struct qstr *, 81 const char *,
82 umode_t umode, 82 umode_t umode,
83 struct cache_detail *); 83 struct cache_detail *);
84extern void rpc_remove_cache_dir(struct dentry *); 84extern void rpc_remove_cache_dir(struct dentry *);
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..8d71d6577459 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/cache.h> 16#include <linux/sunrpc/cache.h>
17#include <linux/sunrpc/gss_api.h>
17#include <linux/hash.h> 18#include <linux/hash.h>
18#include <linux/cred.h> 19#include <linux/cred.h>
19 20
@@ -23,13 +24,23 @@ struct svc_cred {
23 struct group_info *cr_group_info; 24 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 25 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 26 char *cr_principal; /* for gss */
27 struct gss_api_mech *cr_gss_mech;
26}; 28};
27 29
30static inline void init_svc_cred(struct svc_cred *cred)
31{
32 cred->cr_group_info = NULL;
33 cred->cr_principal = NULL;
34 cred->cr_gss_mech = NULL;
35}
36
28static inline void free_svc_cred(struct svc_cred *cred) 37static inline void free_svc_cred(struct svc_cred *cred)
29{ 38{
30 if (cred->cr_group_info) 39 if (cred->cr_group_info)
31 put_group_info(cred->cr_group_info); 40 put_group_info(cred->cr_group_info);
32 kfree(cred->cr_principal); 41 kfree(cred->cr_principal);
42 gss_mech_put(cred->cr_gss_mech);
43 init_svc_cred(cred);
33} 44}
34 45
35struct svc_rqst; /* forward decl */ 46struct svc_rqst; /* forward decl */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index e2cee22f578a..9e8a9b555ad6 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -17,10 +17,12 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h> 19#include <linux/kobject_ns.h>
20#include <linux/stat.h>
20#include <linux/atomic.h> 21#include <linux/atomic.h>
21 22
22struct kobject; 23struct kobject;
23struct module; 24struct module;
25struct bin_attribute;
24enum kobj_ns_type; 26enum kobj_ns_type;
25 27
26struct attribute { 28struct attribute {
@@ -59,26 +61,28 @@ struct attribute_group {
59 umode_t (*is_visible)(struct kobject *, 61 umode_t (*is_visible)(struct kobject *,
60 struct attribute *, int); 62 struct attribute *, int);
61 struct attribute **attrs; 63 struct attribute **attrs;
64 struct bin_attribute **bin_attrs;
62}; 65};
63 66
64
65
66/** 67/**
67 * Use these macros to make defining attributes easier. See include/linux/device.h 68 * Use these macros to make defining attributes easier. See include/linux/device.h
68 * for examples.. 69 * for examples..
69 */ 70 */
70 71
71#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name,_mode,_show,_store) { \
72 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
73 .show = _show, \ 74 .show = _show, \
74 .store = _store, \ 75 .store = _store, \
75} 76}
76 77
77#define __ATTR_RO(_name) { \ 78#define __ATTR_RO(_name) { \
78 .attr = { .name = __stringify(_name), .mode = 0444 }, \ 79 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
79 .show = _name##_show, \ 80 .show = _name##_show, \
80} 81}
81 82
83#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
84 _name##_show, _name##_store)
85
82#define __ATTR_NULL { .attr = { .name = NULL } } 86#define __ATTR_NULL { .attr = { .name = NULL } }
83 87
84#ifdef CONFIG_DEBUG_LOCK_ALLOC 88#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -92,6 +96,18 @@ struct attribute_group {
92#define __ATTR_IGNORE_LOCKDEP __ATTR 96#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif 97#endif
94 98
99#define __ATTRIBUTE_GROUPS(_name) \
100static const struct attribute_group *_name##_groups[] = { \
101 &_name##_group, \
102 NULL, \
103}
104
105#define ATTRIBUTE_GROUPS(_name) \
106static const struct attribute_group _name##_group = { \
107 .attrs = _name##_attrs, \
108}; \
109__ATTRIBUTE_GROUPS(_name)
110
95#define attr_name(_attr) (_attr).attr.name 111#define attr_name(_attr) (_attr).attr.name
96 112
97struct file; 113struct file;
@@ -121,6 +137,36 @@ struct bin_attribute {
121 */ 137 */
122#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) 138#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
123 139
140/* macros to create static binary attributes easier */
141#define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
142 .attr = { .name = __stringify(_name), .mode = _mode }, \
143 .read = _read, \
144 .write = _write, \
145 .size = _size, \
146}
147
148#define __BIN_ATTR_RO(_name, _size) { \
149 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
150 .read = _name##_read, \
151 .size = _size, \
152}
153
154#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
155 (S_IWUSR | S_IRUGO), _name##_read, \
156 _name##_write)
157
158#define __BIN_ATTR_NULL __ATTR_NULL
159
160#define BIN_ATTR(_name, _mode, _read, _write, _size) \
161struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
162 _write, _size)
163
164#define BIN_ATTR_RO(_name, _size) \
165struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
166
167#define BIN_ATTR_RW(_name, _size) \
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
169
124struct sysfs_ops { 170struct sysfs_ops {
125 ssize_t (*show)(struct kobject *, struct attribute *,char *); 171 ssize_t (*show)(struct kobject *, struct attribute *,char *);
126 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 172 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 5adbc33d1ab3..472120b4fac5 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -246,7 +246,6 @@ struct tcp_sock {
246 246
247 /* from STCP, retrans queue hinting */ 247 /* from STCP, retrans queue hinting */
248 struct sk_buff* lost_skb_hint; 248 struct sk_buff* lost_skb_hint;
249 struct sk_buff *scoreboard_skb_hint;
250 struct sk_buff *retransmit_skb_hint; 249 struct sk_buff *retransmit_skb_hint;
251 250
252 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 251 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e94c75ded111..36d36cc89329 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -63,6 +63,10 @@ void virtqueue_disable_cb(struct virtqueue *vq);
63 63
64bool virtqueue_enable_cb(struct virtqueue *vq); 64bool virtqueue_enable_cb(struct virtqueue *vq);
65 65
66unsigned virtqueue_enable_cb_prepare(struct virtqueue *vq);
67
68bool virtqueue_poll(struct virtqueue *vq, unsigned);
69
66bool virtqueue_enable_cb_delayed(struct virtqueue *vq); 70bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
67 71
68void *virtqueue_detach_unused_buf(struct virtqueue *vq); 72void *virtqueue_detach_unused_buf(struct virtqueue *vq);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ca3ad41c2c82..b300787af8e0 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_VIRTIO_RING_H 1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H 2#define _LINUX_VIRTIO_RING_H
3 3
4#include <asm/barrier.h>
4#include <linux/irqreturn.h> 5#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h> 6#include <uapi/linux/virtio_ring.h>
6 7
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
new file mode 100644
index 000000000000..760399a470bd
--- /dev/null
+++ b/include/linux/ww_mutex.h
@@ -0,0 +1,378 @@
1/*
2 * Wound/Wait Mutexes: blocking mutual exclusion locks with deadlock avoidance
3 *
4 * Original mutex implementation started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * Wound/wait implementation:
9 * Copyright (C) 2013 Canonical Ltd.
10 *
11 * This file contains the main data structure and API definitions.
12 */
13
14#ifndef __LINUX_WW_MUTEX_H
15#define __LINUX_WW_MUTEX_H
16
17#include <linux/mutex.h>
18
19struct ww_class {
20 atomic_long_t stamp;
21 struct lock_class_key acquire_key;
22 struct lock_class_key mutex_key;
23 const char *acquire_name;
24 const char *mutex_name;
25};
26
27struct ww_acquire_ctx {
28 struct task_struct *task;
29 unsigned long stamp;
30 unsigned acquired;
31#ifdef CONFIG_DEBUG_MUTEXES
32 unsigned done_acquire;
33 struct ww_class *ww_class;
34 struct ww_mutex *contending_lock;
35#endif
36#ifdef CONFIG_DEBUG_LOCK_ALLOC
37 struct lockdep_map dep_map;
38#endif
39#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
40 unsigned deadlock_inject_interval;
41 unsigned deadlock_inject_countdown;
42#endif
43};
44
45struct ww_mutex {
46 struct mutex base;
47 struct ww_acquire_ctx *ctx;
48#ifdef CONFIG_DEBUG_MUTEXES
49 struct ww_class *ww_class;
50#endif
51};
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
55 , .ww_class = &ww_class
56#else
57# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
58#endif
59
60#define __WW_CLASS_INITIALIZER(ww_class) \
61 { .stamp = ATOMIC_LONG_INIT(0) \
62 , .acquire_name = #ww_class "_acquire" \
63 , .mutex_name = #ww_class "_mutex" }
64
65#define __WW_MUTEX_INITIALIZER(lockname, class) \
66 { .base = { \__MUTEX_INITIALIZER(lockname) } \
67 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
68
69#define DEFINE_WW_CLASS(classname) \
70 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
71
72#define DEFINE_WW_MUTEX(mutexname, ww_class) \
73 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
74
75/**
76 * ww_mutex_init - initialize the w/w mutex
77 * @lock: the mutex to be initialized
78 * @ww_class: the w/w class the mutex should belong to
79 *
80 * Initialize the w/w mutex to unlocked state and associate it with the given
81 * class.
82 *
83 * It is not allowed to initialize an already locked mutex.
84 */
85static inline void ww_mutex_init(struct ww_mutex *lock,
86 struct ww_class *ww_class)
87{
88 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
89 lock->ctx = NULL;
90#ifdef CONFIG_DEBUG_MUTEXES
91 lock->ww_class = ww_class;
92#endif
93}
94
95/**
96 * ww_acquire_init - initialize a w/w acquire context
97 * @ctx: w/w acquire context to initialize
98 * @ww_class: w/w class of the context
99 *
100 * Initializes an context to acquire multiple mutexes of the given w/w class.
101 *
102 * Context-based w/w mutex acquiring can be done in any order whatsoever within
103 * a given lock class. Deadlocks will be detected and handled with the
104 * wait/wound logic.
105 *
106 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
107 * result in undetected deadlocks and is so forbidden. Mixing different contexts
108 * for the same w/w class when acquiring mutexes can also result in undetected
109 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
110 * enabling CONFIG_PROVE_LOCKING.
111 *
112 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
113 * to the usual locking rules between different lock classes.
114 *
115 * An acquire context must be released with ww_acquire_fini by the same task
116 * before the memory is freed. It is recommended to allocate the context itself
117 * on the stack.
118 */
119static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
120 struct ww_class *ww_class)
121{
122 ctx->task = current;
123 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
124 ctx->acquired = 0;
125#ifdef CONFIG_DEBUG_MUTEXES
126 ctx->ww_class = ww_class;
127 ctx->done_acquire = 0;
128 ctx->contending_lock = NULL;
129#endif
130#ifdef CONFIG_DEBUG_LOCK_ALLOC
131 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
132 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
133 &ww_class->acquire_key, 0);
134 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
135#endif
136#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
137 ctx->deadlock_inject_interval = 1;
138 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
139#endif
140}
141
142/**
143 * ww_acquire_done - marks the end of the acquire phase
144 * @ctx: the acquire context
145 *
146 * Marks the end of the acquire phase, any further w/w mutex lock calls using
147 * this context are forbidden.
148 *
149 * Calling this function is optional, it is just useful to document w/w mutex
150 * code and clearly designated the acquire phase from actually using the locked
151 * data structures.
152 */
153static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
154{
155#ifdef CONFIG_DEBUG_MUTEXES
156 lockdep_assert_held(ctx);
157
158 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
159 ctx->done_acquire = 1;
160#endif
161}
162
163/**
164 * ww_acquire_fini - releases a w/w acquire context
165 * @ctx: the acquire context to free
166 *
167 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
168 * mutexes have been released with ww_mutex_unlock.
169 */
170static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
171{
172#ifdef CONFIG_DEBUG_MUTEXES
173 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
174
175 DEBUG_LOCKS_WARN_ON(ctx->acquired);
176 if (!config_enabled(CONFIG_PROVE_LOCKING))
177 /*
178 * lockdep will normally handle this,
179 * but fail without anyway
180 */
181 ctx->done_acquire = 1;
182
183 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
184 /* ensure ww_acquire_fini will still fail if called twice */
185 ctx->acquired = ~0U;
186#endif
187}
188
189extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
190 struct ww_acquire_ctx *ctx);
191extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
192 struct ww_acquire_ctx *ctx);
193
194/**
195 * ww_mutex_lock - acquire the w/w mutex
196 * @lock: the mutex to be acquired
197 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
198 *
199 * Lock the w/w mutex exclusively for this task.
200 *
201 * Deadlocks within a given w/w class of locks are detected and handled with the
202 * wait/wound algorithm. If the lock isn't immediately avaiable this function
203 * will either sleep until it is (wait case). Or it selects the current context
204 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
205 * same lock with the same context twice is also detected and signalled by
206 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
207 *
208 * In the wound case the caller must release all currently held w/w mutexes for
209 * the given context and then wait for this contending lock to be available by
210 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
211 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
212 * scanning through lru lists trying to free resources).
213 *
214 * The mutex must later on be released by the same task that
215 * acquired it. The task may not exit without first unlocking the mutex. Also,
216 * kernel memory where the mutex resides must not be freed with the mutex still
217 * locked. The mutex must first be initialized (or statically defined) before it
218 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
219 * of the same w/w lock class as was used to initialize the acquire context.
220 *
221 * A mutex acquired with this function must be released with ww_mutex_unlock.
222 */
223static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
224{
225 if (ctx)
226 return __ww_mutex_lock(lock, ctx);
227
228 mutex_lock(&lock->base);
229 return 0;
230}
231
232/**
233 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
234 * @lock: the mutex to be acquired
235 * @ctx: w/w acquire context
236 *
237 * Lock the w/w mutex exclusively for this task.
238 *
239 * Deadlocks within a given w/w class of locks are detected and handled with the
240 * wait/wound algorithm. If the lock isn't immediately avaiable this function
241 * will either sleep until it is (wait case). Or it selects the current context
242 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
243 * same lock with the same context twice is also detected and signalled by
244 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
245 * signal arrives while waiting for the lock then this function returns -EINTR.
246 *
247 * In the wound case the caller must release all currently held w/w mutexes for
248 * the given context and then wait for this contending lock to be available by
249 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
250 * not acquire this lock and proceed with trying to acquire further w/w mutexes
251 * (e.g. when scanning through lru lists trying to free resources).
252 *
253 * The mutex must later on be released by the same task that
254 * acquired it. The task may not exit without first unlocking the mutex. Also,
255 * kernel memory where the mutex resides must not be freed with the mutex still
256 * locked. The mutex must first be initialized (or statically defined) before it
257 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
258 * of the same w/w lock class as was used to initialize the acquire context.
259 *
260 * A mutex acquired with this function must be released with ww_mutex_unlock.
261 */
262static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
263 struct ww_acquire_ctx *ctx)
264{
265 if (ctx)
266 return __ww_mutex_lock_interruptible(lock, ctx);
267 else
268 return mutex_lock_interruptible(&lock->base);
269}
270
271/**
272 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
273 * @lock: the mutex to be acquired
274 * @ctx: w/w acquire context
275 *
276 * Acquires a w/w mutex with the given context after a wound case. This function
277 * will sleep until the lock becomes available.
278 *
279 * The caller must have released all w/w mutexes already acquired with the
280 * context and then call this function on the contended lock.
281 *
282 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
283 * needs with ww_mutex_lock. Note that the -EALREADY return code from
284 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
285 *
286 * It is forbidden to call this function with any other w/w mutexes associated
287 * with the context held. It is forbidden to call this on anything else than the
288 * contending mutex.
289 *
290 * Note that the slowpath lock acquiring can also be done by calling
291 * ww_mutex_lock directly. This function here is simply to help w/w mutex
292 * locking code readability by clearly denoting the slowpath.
293 */
294static inline void
295ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
296{
297 int ret;
298#ifdef CONFIG_DEBUG_MUTEXES
299 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
300#endif
301 ret = ww_mutex_lock(lock, ctx);
302 (void)ret;
303}
304
305/**
306 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex, interruptible
307 * @lock: the mutex to be acquired
308 * @ctx: w/w acquire context
309 *
310 * Acquires a w/w mutex with the given context after a wound case. This function
311 * will sleep until the lock becomes available and returns 0 when the lock has
312 * been acquired. If a signal arrives while waiting for the lock then this
313 * function returns -EINTR.
314 *
315 * The caller must have released all w/w mutexes already acquired with the
316 * context and then call this function on the contended lock.
317 *
318 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
319 * needs with ww_mutex_lock. Note that the -EALREADY return code from
320 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
321 *
322 * It is forbidden to call this function with any other w/w mutexes associated
323 * with the given context held. It is forbidden to call this on anything else
324 * than the contending mutex.
325 *
326 * Note that the slowpath lock acquiring can also be done by calling
327 * ww_mutex_lock_interruptible directly. This function here is simply to help
328 * w/w mutex locking code readability by clearly denoting the slowpath.
329 */
330static inline int __must_check
331ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
332 struct ww_acquire_ctx *ctx)
333{
334#ifdef CONFIG_DEBUG_MUTEXES
335 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
336#endif
337 return ww_mutex_lock_interruptible(lock, ctx);
338}
339
340extern void ww_mutex_unlock(struct ww_mutex *lock);
341
342/**
343 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
344 * @lock: mutex to lock
345 *
346 * Trylocks a mutex without acquire context, so no deadlock detection is
347 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
348 */
349static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
350{
351 return mutex_trylock(&lock->base);
352}
353
354/***
355 * ww_mutex_destroy - mark a w/w mutex unusable
356 * @lock: the mutex to be destroyed
357 *
358 * This function marks the mutex uninitialized, and any subsequent
359 * use of the mutex is forbidden. The mutex must not be locked when
360 * this function is called.
361 */
362static inline void ww_mutex_destroy(struct ww_mutex *lock)
363{
364 mutex_destroy(&lock->base);
365}
366
367/**
368 * ww_mutex_is_locked - is the w/w mutex locked
369 * @lock: the mutex to be queried
370 *
371 * Returns 1 if the mutex is locked, 0 if unlocked.
372 */
373static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
374{
375 return mutex_is_locked(&lock->base);
376}
377
378#endif
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
new file mode 100644
index 000000000000..2571a5cfa5fc
--- /dev/null
+++ b/include/linux/zbud.h
@@ -0,0 +1,22 @@
1#ifndef _ZBUD_H_
2#define _ZBUD_H_
3
4#include <linux/types.h>
5
6struct zbud_pool;
7
8struct zbud_ops {
9 int (*evict)(struct zbud_pool *pool, unsigned long handle);
10};
11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
18void *zbud_map(struct zbud_pool *pool, unsigned long handle);
19void zbud_unmap(struct zbud_pool *pool, unsigned long handle);
20u64 zbud_get_pool_size(struct zbud_pool *pool);
21
22#endif /* _ZBUD_H_ */
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h
index 42628fcfe1bd..de59364d7ed2 100644
--- a/include/media/davinci/vpbe_osd.h
+++ b/include/media/davinci/vpbe_osd.h
@@ -82,9 +82,9 @@ enum osd_pix_format {
82 PIXFMT_4BPP, 82 PIXFMT_4BPP,
83 PIXFMT_8BPP, 83 PIXFMT_8BPP,
84 PIXFMT_RGB565, 84 PIXFMT_RGB565,
85 PIXFMT_YCbCrI, 85 PIXFMT_YCBCRI,
86 PIXFMT_RGB888, 86 PIXFMT_RGB888,
87 PIXFMT_YCrCbI, 87 PIXFMT_YCRCBI,
88 PIXFMT_NV12, 88 PIXFMT_NV12,
89 PIXFMT_OSD_ATTR, 89 PIXFMT_OSD_ATTR,
90}; 90};
diff --git a/include/media/media-device.h b/include/media/media-device.h
index eaade9815bb6..12155a9596c4 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -45,6 +45,7 @@ struct device;
45 * @entities: List of registered entities 45 * @entities: List of registered entities
46 * @lock: Entities list lock 46 * @lock: Entities list lock
47 * @graph_mutex: Entities graph operation lock 47 * @graph_mutex: Entities graph operation lock
48 * @link_notify: Link state change notification callback
48 * 49 *
49 * This structure represents an abstract high-level media device. It allows easy 50 * This structure represents an abstract high-level media device. It allows easy
50 * access to entities and provides basic media device-level support. The 51 * access to entities and provides basic media device-level support. The
@@ -75,10 +76,14 @@ struct media_device {
75 /* Serializes graph operations. */ 76 /* Serializes graph operations. */
76 struct mutex graph_mutex; 77 struct mutex graph_mutex;
77 78
78 int (*link_notify)(struct media_pad *source, 79 int (*link_notify)(struct media_link *link, u32 flags,
79 struct media_pad *sink, u32 flags); 80 unsigned int notification);
80}; 81};
81 82
83/* Supported link_notify @notification values. */
84#define MEDIA_DEV_NOTIFY_PRE_LINK_CH 0
85#define MEDIA_DEV_NOTIFY_POST_LINK_CH 1
86
82/* media_devnode to media_device */ 87/* media_devnode to media_device */
83#define to_media_device(node) container_of(node, struct media_device, devnode) 88#define to_media_device(node) container_of(node, struct media_device, devnode)
84 89
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 0c16f518ee09..06bacf937d61 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -128,11 +128,14 @@ void media_entity_cleanup(struct media_entity *entity);
128 128
129int media_entity_create_link(struct media_entity *source, u16 source_pad, 129int media_entity_create_link(struct media_entity *source, u16 source_pad,
130 struct media_entity *sink, u16 sink_pad, u32 flags); 130 struct media_entity *sink, u16 sink_pad, u32 flags);
131void __media_entity_remove_links(struct media_entity *entity);
132void media_entity_remove_links(struct media_entity *entity);
133
131int __media_entity_setup_link(struct media_link *link, u32 flags); 134int __media_entity_setup_link(struct media_link *link, u32 flags);
132int media_entity_setup_link(struct media_link *link, u32 flags); 135int media_entity_setup_link(struct media_link *link, u32 flags);
133struct media_link *media_entity_find_link(struct media_pad *source, 136struct media_link *media_entity_find_link(struct media_pad *source,
134 struct media_pad *sink); 137 struct media_pad *sink);
135struct media_pad *media_entity_remote_source(struct media_pad *pad); 138struct media_pad *media_entity_remote_pad(struct media_pad *pad);
136 139
137struct media_entity *media_entity_get(struct media_entity *entity); 140struct media_entity *media_entity_get(struct media_entity *entity);
138void media_entity_put(struct media_entity *entity); 141void media_entity_put(struct media_entity *entity);
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 5d5d3a30f04a..6628f5d01f52 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -111,6 +111,7 @@ void rc_map_init(void);
111#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" 111#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
112#define RC_MAP_CINERGY_1400 "rc-cinergy-1400" 112#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
113#define RC_MAP_CINERGY "rc-cinergy" 113#define RC_MAP_CINERGY "rc-cinergy"
114#define RC_MAP_DELOCK_61959 "rc-delock-61959"
114#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec" 115#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec"
115#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5" 116#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5"
116#define RC_MAP_DIGITALNOW_TINYTWIN "rc-digitalnow-tinytwin" 117#define RC_MAP_DIGITALNOW_TINYTWIN "rc-digitalnow-tinytwin"
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index f50969025ef3..b975c285c8a9 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -13,6 +13,7 @@
13#define S5P_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15#include <media/media-entity.h> 15#include <media/media-entity.h>
16#include <media/v4l2-dev.h>
16#include <media/v4l2-mediabus.h> 17#include <media/v4l2-mediabus.h>
17 18
18/* 19/*
@@ -115,6 +116,7 @@ struct s5p_platform_fimc {
115 * @color: the driver's private color format id 116 * @color: the driver's private color format id
116 * @memplanes: number of physically non-contiguous data planes 117 * @memplanes: number of physically non-contiguous data planes
117 * @colplanes: number of physically contiguous data planes 118 * @colplanes: number of physically contiguous data planes
119 * @colorspace: v4l2 colorspace (V4L2_COLORSPACE_*)
118 * @depth: per plane driver's private 'number of bits per pixel' 120 * @depth: per plane driver's private 'number of bits per pixel'
119 * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no) 121 * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no)
120 * @flags: flags indicating which operation mode format applies to 122 * @flags: flags indicating which operation mode format applies to
@@ -126,6 +128,7 @@ struct fimc_fmt {
126 u32 color; 128 u32 color;
127 u16 memplanes; 129 u16 memplanes;
128 u16 colplanes; 130 u16 colplanes;
131 u8 colorspace;
129 u8 depth[FIMC_MAX_PLANES]; 132 u8 depth[FIMC_MAX_PLANES];
130 u16 mdataplanes; 133 u16 mdataplanes;
131 u16 flags; 134 u16 flags;
@@ -140,37 +143,40 @@ struct fimc_fmt {
140#define FMT_FLAGS_YUV (1 << 7) 143#define FMT_FLAGS_YUV (1 << 7)
141}; 144};
142 145
143enum fimc_subdev_index { 146struct exynos_media_pipeline;
144 IDX_SENSOR,
145 IDX_CSIS,
146 IDX_FLITE,
147 IDX_IS_ISP,
148 IDX_FIMC,
149 IDX_MAX,
150};
151 147
152struct media_pipeline; 148/*
153struct v4l2_subdev; 149 * Media pipeline operations to be called from within a video node, i.e. the
150 * last entity within the pipeline. Implemented by related media device driver.
151 */
152struct exynos_media_pipeline_ops {
153 int (*prepare)(struct exynos_media_pipeline *p,
154 struct media_entity *me);
155 int (*unprepare)(struct exynos_media_pipeline *p);
156 int (*open)(struct exynos_media_pipeline *p, struct media_entity *me,
157 bool resume);
158 int (*close)(struct exynos_media_pipeline *p);
159 int (*set_stream)(struct exynos_media_pipeline *p, bool state);
160};
154 161
155struct fimc_pipeline { 162struct exynos_video_entity {
156 struct v4l2_subdev *subdevs[IDX_MAX]; 163 struct video_device vdev;
157 struct media_pipeline *m_pipeline; 164 struct exynos_media_pipeline *pipe;
158}; 165};
159 166
160/* 167struct exynos_media_pipeline {
161 * Media pipeline operations to be called from within the fimc(-lite) 168 struct media_pipeline mp;
162 * video node when it is the last entity of the pipeline. Implemented 169 const struct exynos_media_pipeline_ops *ops;
163 * by corresponding media device driver.
164 */
165struct fimc_pipeline_ops {
166 int (*open)(struct fimc_pipeline *p, struct media_entity *me,
167 bool resume);
168 int (*close)(struct fimc_pipeline *p);
169 int (*set_stream)(struct fimc_pipeline *p, bool state);
170}; 170};
171 171
172#define fimc_pipeline_call(f, op, p, args...) \ 172static inline struct exynos_video_entity *vdev_to_exynos_video_entity(
173 (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \ 173 struct video_device *vdev)
174 (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD)) 174{
175 return container_of(vdev, struct exynos_video_entity, vdev);
176}
177
178#define fimc_pipeline_call(ent, op, args...) \
179 (!(ent) ? -ENOENT : (((ent)->pipe->ops && (ent)->pipe->ops->op) ? \
180 (ent)->pipe->ops->op(((ent)->pipe), ##args) : -ENOIOCTLCMD)) \
175 181
176#endif /* S5P_FIMC_H_ */ 182#endif /* S5P_FIMC_H_ */
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 6fdb6adf6b2b..7f57056c22ba 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -22,6 +22,8 @@ struct sh_mobile_ceu_info {
22 int max_width; 22 int max_width;
23 int max_height; 23 int max_height;
24 struct sh_mobile_ceu_companion *csi2; 24 struct sh_mobile_ceu_companion *csi2;
25 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
26 unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */
25}; 27};
26 28
27#endif /* __ASM_SH_MOBILE_CEU_H__ */ 29#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/sh_mobile_csi2.h b/include/media/sh_mobile_csi2.h
index c586c4f7f16b..14030db51f13 100644
--- a/include/media/sh_mobile_csi2.h
+++ b/include/media/sh_mobile_csi2.h
@@ -33,6 +33,7 @@ struct sh_csi2_client_config {
33 unsigned char lanes; /* bitmask[3:0] */ 33 unsigned char lanes; /* bitmask[3:0] */
34 unsigned char channel; /* 0..3 */ 34 unsigned char channel; /* 0..3 */
35 struct platform_device *pdev; /* client platform device */ 35 struct platform_device *pdev; /* client platform device */
36 const char *name; /* async matching: client name */
36}; 37};
37 38
38struct v4l2_device; 39struct v4l2_device;
@@ -42,7 +43,6 @@ struct sh_csi2_pdata {
42 unsigned int flags; 43 unsigned int flags;
43 struct sh_csi2_client_config *clients; 44 struct sh_csi2_client_config *clients;
44 int num_clients; 45 int num_clients;
45 struct v4l2_device *v4l2_dev;
46}; 46};
47 47
48#endif 48#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index ff77d08c30fd..34d2414f2b8c 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -19,11 +19,13 @@
19#include <linux/videodev2.h> 19#include <linux/videodev2.h>
20#include <media/videobuf-core.h> 20#include <media/videobuf-core.h>
21#include <media/videobuf2-core.h> 21#include <media/videobuf2-core.h>
22#include <media/v4l2-async.h>
22#include <media/v4l2-ctrls.h> 23#include <media/v4l2-ctrls.h>
23#include <media/v4l2-device.h> 24#include <media/v4l2-device.h>
24 25
25struct file; 26struct file;
26struct soc_camera_desc; 27struct soc_camera_desc;
28struct soc_camera_async_client;
27 29
28struct soc_camera_device { 30struct soc_camera_device {
29 struct list_head list; /* list of all registered devices */ 31 struct list_head list; /* list of all registered devices */
@@ -49,6 +51,10 @@ struct soc_camera_device {
49 /* soc_camera.c private count. Only accessed with .host_lock held */ 51 /* soc_camera.c private count. Only accessed with .host_lock held */
50 int use_count; 52 int use_count;
51 struct file *streamer; /* stream owner */ 53 struct file *streamer; /* stream owner */
54 struct v4l2_clk *clk;
55 /* Asynchronous subdevice management */
56 struct soc_camera_async_client *sasc;
57 /* video buffer queue */
52 union { 58 union {
53 struct videobuf_queue vb_vidq; 59 struct videobuf_queue vb_vidq;
54 struct vb2_queue vb2_vidq; 60 struct vb2_queue vb2_vidq;
@@ -58,21 +64,38 @@ struct soc_camera_device {
58/* Host supports programmable stride */ 64/* Host supports programmable stride */
59#define SOCAM_HOST_CAP_STRIDE (1 << 0) 65#define SOCAM_HOST_CAP_STRIDE (1 << 0)
60 66
67enum soc_camera_subdev_role {
68 SOCAM_SUBDEV_DATA_SOURCE = 1,
69 SOCAM_SUBDEV_DATA_SINK,
70 SOCAM_SUBDEV_DATA_PROCESSOR,
71};
72
73struct soc_camera_async_subdev {
74 struct v4l2_async_subdev asd;
75 enum soc_camera_subdev_role role;
76};
77
61struct soc_camera_host { 78struct soc_camera_host {
62 struct v4l2_device v4l2_dev; 79 struct v4l2_device v4l2_dev;
63 struct list_head list; 80 struct list_head list;
64 struct mutex host_lock; /* Protect pipeline modifications */ 81 struct mutex host_lock; /* Main synchronisation lock */
82 struct mutex clk_lock; /* Protect pipeline modifications */
65 unsigned char nr; /* Host number */ 83 unsigned char nr; /* Host number */
66 u32 capabilities; 84 u32 capabilities;
85 struct soc_camera_device *icd; /* Currently attached client */
67 void *priv; 86 void *priv;
68 const char *drv_name; 87 const char *drv_name;
69 struct soc_camera_host_ops *ops; 88 struct soc_camera_host_ops *ops;
89 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
90 unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */
70}; 91};
71 92
72struct soc_camera_host_ops { 93struct soc_camera_host_ops {
73 struct module *owner; 94 struct module *owner;
74 int (*add)(struct soc_camera_device *); 95 int (*add)(struct soc_camera_device *);
75 void (*remove)(struct soc_camera_device *); 96 void (*remove)(struct soc_camera_device *);
97 int (*clock_start)(struct soc_camera_host *);
98 void (*clock_stop)(struct soc_camera_host *);
76 /* 99 /*
77 * .get_formats() is called for each client device format, but 100 * .get_formats() is called for each client device format, but
78 * .put_formats() is only called once. Further, if any of the calls to 101 * .put_formats() is only called once. Further, if any of the calls to
@@ -157,6 +180,7 @@ struct soc_camera_host_desc {
157}; 180};
158 181
159/* 182/*
183 * Platform data for "soc-camera-pdrv"
160 * This MUST be kept binary-identical to struct soc_camera_link below, until 184 * This MUST be kept binary-identical to struct soc_camera_link below, until
161 * it is completely replaced by this one, after which we can split it into its 185 * it is completely replaced by this one, after which we can split it into its
162 * two components. 186 * two components.
@@ -322,14 +346,17 @@ static inline void soc_camera_limit_side(int *start, int *length,
322unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, 346unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd,
323 const struct v4l2_mbus_config *cfg); 347 const struct v4l2_mbus_config *cfg);
324 348
325int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd); 349int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd);
326int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd); 350int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
351 struct v4l2_clk *clk);
352int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd,
353 struct v4l2_clk *clk);
327 354
328static inline int soc_camera_set_power(struct device *dev, 355static inline int soc_camera_set_power(struct device *dev,
329 struct soc_camera_subdev_desc *ssdd, bool on) 356 struct soc_camera_subdev_desc *ssdd, struct v4l2_clk *clk, bool on)
330{ 357{
331 return on ? soc_camera_power_on(dev, ssdd) 358 return on ? soc_camera_power_on(dev, ssdd, clk)
332 : soc_camera_power_off(dev, ssdd); 359 : soc_camera_power_off(dev, ssdd, clk);
333} 360}
334 361
335/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 362/* This is only temporary here - until v4l2-subdev begins to link to video_device */
@@ -346,9 +373,9 @@ static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct
346 return client->dev.platform_data; 373 return client->dev.platform_data;
347} 374}
348 375
349static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev) 376static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev)
350{ 377{
351 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); 378 struct soc_camera_device *icd = video_get_drvdata(vdev);
352 return soc_camera_to_subdev(icd); 379 return soc_camera_to_subdev(icd);
353} 380}
354 381
diff --git a/include/media/ths7303.h b/include/media/ths7303.h
index 980ec51d574d..a7b49297da82 100644
--- a/include/media/ths7303.h
+++ b/include/media/ths7303.h
@@ -30,13 +30,11 @@
30 * @ch_1: Bias value for channel one. 30 * @ch_1: Bias value for channel one.
31 * @ch_2: Bias value for channel two. 31 * @ch_2: Bias value for channel two.
32 * @ch_3: Bias value for channel three. 32 * @ch_3: Bias value for channel three.
33 * @init_enable: initalize on init.
34 */ 33 */
35struct ths7303_platform_data { 34struct ths7303_platform_data {
36 u8 ch_1; 35 u8 ch_1;
37 u8 ch_2; 36 u8 ch_2;
38 u8 ch_3; 37 u8 ch_3;
39 u8 init_enable;
40}; 38};
41 39
42#endif 40#endif
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index a8ad75a9152a..4a1191abd936 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -1,6 +1,17 @@
1/* 1/*
2 */ 2 */
3 3
4enum tveeprom_audio_processor {
5 /* No audio processor present */
6 TVEEPROM_AUDPROC_NONE,
7 /* The audio processor is internal to the video processor */
8 TVEEPROM_AUDPROC_INTERNAL,
9 /* The audio processor is a MSPXXXX device */
10 TVEEPROM_AUDPROC_MSP,
11 /* The audio processor is another device */
12 TVEEPROM_AUDPROC_OTHER,
13};
14
4struct tveeprom { 15struct tveeprom {
5 u32 has_radio; 16 u32 has_radio;
6 /* If has_ir == 0, then it is unknown what the IR capabilities are, 17 /* If has_ir == 0, then it is unknown what the IR capabilities are,
diff --git a/include/media/tvp7002.h b/include/media/tvp7002.h
index ee4353459ef5..fadb6afe9ef0 100644
--- a/include/media/tvp7002.h
+++ b/include/media/tvp7002.h
@@ -26,31 +26,29 @@
26#ifndef _TVP7002_H_ 26#ifndef _TVP7002_H_
27#define _TVP7002_H_ 27#define _TVP7002_H_
28 28
29/* Platform-dependent data 29#define TVP7002_MODULE_NAME "tvp7002"
30 * 30
31 * clk_polarity: 31/**
32 * 0 -> data clocked out on rising edge of DATACLK signal 32 * struct tvp7002_config - Platform dependent data
33 * 1 -> data clocked out on falling edge of DATACLK signal 33 *@clk_polarity: Clock polarity
34 * hs_polarity: 34 * 0 - Data clocked out on rising edge of DATACLK signal
35 * 0 -> active low HSYNC output 35 * 1 - Data clocked out on falling edge of DATACLK signal
36 * 1 -> active high HSYNC output 36 *@hs_polarity: HSYNC polarity
37 * sog_polarity: 37 * 0 - Active low HSYNC output, 1 - Active high HSYNC output
38 * 0 -> normal operation 38 *@vs_polarity: VSYNC Polarity
39 * 1 -> operation with polarity inverted 39 * 0 - Active low VSYNC output, 1 - Active high VSYNC output
40 * vs_polarity: 40 *@fid_polarity: Active-high Field ID polarity.
41 * 0 -> active low VSYNC output 41 * 0 - The field ID output is set to logic 1 for an odd field
42 * 1 -> active high VSYNC output 42 * (field 1) and set to logic 0 for an even field (field 0).
43 * fid_polarity: 43 * 1 - Operation with polarity inverted.
44 * 0 -> the field ID output is set to logic 1 for an odd 44 *@sog_polarity: Active high Sync on Green output polarity.
45 * field (field 1) and set to logic 0 for an even 45 * 0 - Normal operation, 1 - Operation with polarity inverted
46 * field (field 0).
47 * 1 -> operation with polarity inverted.
48 */ 46 */
49struct tvp7002_config { 47struct tvp7002_config {
50 u8 clk_polarity; 48 bool clk_polarity;
51 u8 hs_polarity; 49 bool hs_polarity;
52 u8 vs_polarity; 50 bool vs_polarity;
53 u8 fid_polarity; 51 bool fid_polarity;
54 u8 sog_polarity; 52 bool sog_polarity;
55}; 53};
56#endif 54#endif
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
new file mode 100644
index 000000000000..c3ec6ac75f7e
--- /dev/null
+++ b/include/media/v4l2-async.h
@@ -0,0 +1,105 @@
1/*
2 * V4L2 asynchronous subdevice registration API
3 *
4 * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef V4L2_ASYNC_H
12#define V4L2_ASYNC_H
13
14#include <linux/list.h>
15#include <linux/mutex.h>
16
17struct device;
18struct v4l2_device;
19struct v4l2_subdev;
20struct v4l2_async_notifier;
21
22/* A random max subdevice number, used to allocate an array on stack */
23#define V4L2_MAX_SUBDEVS 128U
24
25enum v4l2_async_bus_type {
26 V4L2_ASYNC_BUS_CUSTOM,
27 V4L2_ASYNC_BUS_PLATFORM,
28 V4L2_ASYNC_BUS_I2C,
29};
30
31/**
32 * struct v4l2_async_subdev - sub-device descriptor, as known to a bridge
33 * @bus_type: subdevice bus type to select the appropriate matching method
34 * @match: union of per-bus type matching data sets
35 * @list: used to link struct v4l2_async_subdev objects, waiting to be
36 * probed, to a notifier->waiting list
37 */
38struct v4l2_async_subdev {
39 enum v4l2_async_bus_type bus_type;
40 union {
41 struct {
42 const char *name;
43 } platform;
44 struct {
45 int adapter_id;
46 unsigned short address;
47 } i2c;
48 struct {
49 bool (*match)(struct device *,
50 struct v4l2_async_subdev *);
51 void *priv;
52 } custom;
53 } match;
54
55 /* v4l2-async core private: not to be used by drivers */
56 struct list_head list;
57};
58
59/**
60 * v4l2_async_subdev_list - provided by subdevices
61 * @list: links struct v4l2_async_subdev_list objects to a global list
62 * before probing, and onto notifier->done after probing
63 * @asd: pointer to respective struct v4l2_async_subdev
64 * @notifier: pointer to managing notifier
65 */
66struct v4l2_async_subdev_list {
67 struct list_head list;
68 struct v4l2_async_subdev *asd;
69 struct v4l2_async_notifier *notifier;
70};
71
72/**
73 * v4l2_async_notifier - v4l2_device notifier data
74 * @num_subdevs:number of subdevices
75 * @subdev: array of pointers to subdevice descriptors
76 * @v4l2_dev: pointer to struct v4l2_device
77 * @waiting: list of struct v4l2_async_subdev, waiting for their drivers
78 * @done: list of struct v4l2_async_subdev_list, already probed
79 * @list: member in a global list of notifiers
80 * @bound: a subdevice driver has successfully probed one of subdevices
81 * @complete: all subdevices have been probed successfully
82 * @unbind: a subdevice is leaving
83 */
84struct v4l2_async_notifier {
85 unsigned int num_subdevs;
86 struct v4l2_async_subdev **subdev;
87 struct v4l2_device *v4l2_dev;
88 struct list_head waiting;
89 struct list_head done;
90 struct list_head list;
91 int (*bound)(struct v4l2_async_notifier *notifier,
92 struct v4l2_subdev *subdev,
93 struct v4l2_async_subdev *asd);
94 int (*complete)(struct v4l2_async_notifier *notifier);
95 void (*unbind)(struct v4l2_async_notifier *notifier,
96 struct v4l2_subdev *subdev,
97 struct v4l2_async_subdev *asd);
98};
99
100int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
101 struct v4l2_async_notifier *notifier);
102void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);
103int v4l2_async_register_subdev(struct v4l2_subdev *sd);
104void v4l2_async_unregister_subdev(struct v4l2_subdev *sd);
105#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
deleted file mode 100644
index c259b36bf1e9..000000000000
--- a/include/media/v4l2-chip-ident.h
+++ /dev/null
@@ -1,352 +0,0 @@
1/*
2 v4l2 chip identifiers header
3
4 This header provides a list of chip identifiers that can be returned
5 through the VIDIOC_DBG_G_CHIP_IDENT ioctl.
6
7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef V4L2_CHIP_IDENT_H_
25#define V4L2_CHIP_IDENT_H_
26
27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
28
29/* KEEP THIS LIST ORDERED BY ID!
30 Otherwise it will be hard to see which ranges are already in use when
31 adding support to a new chip family. */
32enum {
33 /* general idents: reserved range 0-49 */
34 V4L2_IDENT_NONE = 0, /* No chip matched */
35 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
36 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
37
38 /* module tvaudio: reserved range 50-99 */
39 V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
40
41 /* Sony IMX074 */
42 V4L2_IDENT_IMX074 = 74,
43
44 /* module saa7110: just ident 100 */
45 V4L2_IDENT_SAA7110 = 100,
46
47 /* module saa7115: reserved range 101-149 */
48 V4L2_IDENT_SAA7111 = 101,
49 V4L2_IDENT_SAA7111A = 102,
50 V4L2_IDENT_SAA7113 = 103,
51 V4L2_IDENT_SAA7114 = 104,
52 V4L2_IDENT_SAA7115 = 105,
53 V4L2_IDENT_SAA7118 = 108,
54
55 /* module saa7127: reserved range 150-199 */
56 V4L2_IDENT_SAA7127 = 157,
57 V4L2_IDENT_SAA7129 = 159,
58
59 /* module cx25840: reserved range 200-249 */
60 V4L2_IDENT_CX25836 = 236,
61 V4L2_IDENT_CX25837 = 237,
62 V4L2_IDENT_CX25840 = 240,
63 V4L2_IDENT_CX25841 = 241,
64 V4L2_IDENT_CX25842 = 242,
65 V4L2_IDENT_CX25843 = 243,
66
67 /* OmniVision sensors: reserved range 250-299 */
68 V4L2_IDENT_OV7670 = 250,
69 V4L2_IDENT_OV7720 = 251,
70 V4L2_IDENT_OV7725 = 252,
71 V4L2_IDENT_OV7660 = 253,
72 V4L2_IDENT_OV9650 = 254,
73 V4L2_IDENT_OV9655 = 255,
74 V4L2_IDENT_SOI968 = 256,
75 V4L2_IDENT_OV9640 = 257,
76 V4L2_IDENT_OV6650 = 258,
77 V4L2_IDENT_OV2640 = 259,
78 V4L2_IDENT_OV9740 = 260,
79 V4L2_IDENT_OV5642 = 261,
80
81 /* module saa7146: reserved range 300-309 */
82 V4L2_IDENT_SAA7146 = 300,
83
84 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
85 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
86 V4L2_IDENT_CX23415 = 415,
87 V4L2_IDENT_CX23416 = 416,
88 V4L2_IDENT_CX23417 = 417,
89 V4L2_IDENT_CX23418 = 418,
90
91 /* module bt819: reserved range 810-819 */
92 V4L2_IDENT_BT815A = 815,
93 V4L2_IDENT_BT817A = 817,
94 V4L2_IDENT_BT819A = 819,
95
96 /* module au0828 */
97 V4L2_IDENT_AU0828 = 828,
98
99 /* module bttv: ident 848 + 849 */
100 V4L2_IDENT_BT848 = 848,
101 V4L2_IDENT_BT849 = 849,
102
103 /* module bt856: just ident 856 */
104 V4L2_IDENT_BT856 = 856,
105
106 /* module bt866: just ident 866 */
107 V4L2_IDENT_BT866 = 866,
108
109 /* module bttv: ident 878 + 879 */
110 V4L2_IDENT_BT878 = 878,
111 V4L2_IDENT_BT879 = 879,
112
113 /* module ks0127: reserved range 1120-1129 */
114 V4L2_IDENT_KS0122S = 1122,
115 V4L2_IDENT_KS0127 = 1127,
116 V4L2_IDENT_KS0127B = 1128,
117
118 /* module indycam: just ident 2000 */
119 V4L2_IDENT_INDYCAM = 2000,
120
121 /* module vp27smpx: just ident 2700 */
122 V4L2_IDENT_VP27SMPX = 2700,
123
124 /* module vpx3220: reserved range: 3210-3229 */
125 V4L2_IDENT_VPX3214C = 3214,
126 V4L2_IDENT_VPX3216B = 3216,
127 V4L2_IDENT_VPX3220A = 3220,
128
129 /* VX855 just ident 3409 */
130 /* Other via devs could use 3314, 3324, 3327, 3336, 3364, 3353 */
131 V4L2_IDENT_VIA_VX855 = 3409,
132
133 /* module tvp5150 */
134 V4L2_IDENT_TVP5150 = 5150,
135
136 /* module saa5246a: just ident 5246 */
137 V4L2_IDENT_SAA5246A = 5246,
138
139 /* module saa5249: just ident 5249 */
140 V4L2_IDENT_SAA5249 = 5249,
141
142 /* module cs5345: just ident 5345 */
143 V4L2_IDENT_CS5345 = 5345,
144
145 /* module tea6415c: just ident 6415 */
146 V4L2_IDENT_TEA6415C = 6415,
147
148 /* module tea6420: just ident 6420 */
149 V4L2_IDENT_TEA6420 = 6420,
150
151 /* module saa6588: just ident 6588 */
152 V4L2_IDENT_SAA6588 = 6588,
153
154 /* module vs6624: just ident 6624 */
155 V4L2_IDENT_VS6624 = 6624,
156
157 /* module saa6752hs: reserved range 6750-6759 */
158 V4L2_IDENT_SAA6752HS = 6752,
159 V4L2_IDENT_SAA6752HS_AC3 = 6753,
160
161 /* modules tef6862: just ident 6862 */
162 V4L2_IDENT_TEF6862 = 6862,
163
164 /* module tvp7002: just ident 7002 */
165 V4L2_IDENT_TVP7002 = 7002,
166
167 /* module adv7170: just ident 7170 */
168 V4L2_IDENT_ADV7170 = 7170,
169
170 /* module adv7175: just ident 7175 */
171 V4L2_IDENT_ADV7175 = 7175,
172
173 /* module adv7180: just ident 7180 */
174 V4L2_IDENT_ADV7180 = 7180,
175
176 /* module adv7183: just ident 7183 */
177 V4L2_IDENT_ADV7183 = 7183,
178
179 /* module saa7185: just ident 7185 */
180 V4L2_IDENT_SAA7185 = 7185,
181
182 /* module saa7191: just ident 7191 */
183 V4L2_IDENT_SAA7191 = 7191,
184
185 /* module ths7303: just ident 7303 */
186 V4L2_IDENT_THS7303 = 7303,
187
188 /* module adv7343: just ident 7343 */
189 V4L2_IDENT_ADV7343 = 7343,
190
191 /* module ths7353: just ident 7353 */
192 V4L2_IDENT_THS7353 = 7353,
193
194 /* module adv7393: just ident 7393 */
195 V4L2_IDENT_ADV7393 = 7393,
196
197 /* module adv7604: just ident 7604 */
198 V4L2_IDENT_ADV7604 = 7604,
199
200 /* module saa7706h: just ident 7706 */
201 V4L2_IDENT_SAA7706H = 7706,
202
203 /* module mt9v011, just ident 8243 */
204 V4L2_IDENT_MT9V011 = 8243,
205
206 /* module wm8739: just ident 8739 */
207 V4L2_IDENT_WM8739 = 8739,
208
209 /* module wm8775: just ident 8775 */
210 V4L2_IDENT_WM8775 = 8775,
211
212 /* Marvell controllers starting at 8801 */
213 V4L2_IDENT_CAFE = 8801,
214 V4L2_IDENT_ARMADA610 = 8802,
215
216 /* AKM AK8813/AK8814 */
217 V4L2_IDENT_AK8813 = 8813,
218 V4L2_IDENT_AK8814 = 8814,
219
220 /* module cx23885 and cx25840 */
221 V4L2_IDENT_CX23885 = 8850,
222 V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */
223 V4L2_IDENT_CX23887 = 8870,
224 V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */
225 V4L2_IDENT_CX23888 = 8880,
226 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
227 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
228
229 /* module ad9389b: just ident 9389 */
230 V4L2_IDENT_AD9389B = 9389,
231
232 /* module tda9840: just ident 9840 */
233 V4L2_IDENT_TDA9840 = 9840,
234
235 /* module tw9910: just ident 9910 */
236 V4L2_IDENT_TW9910 = 9910,
237
238 /* module sn9c20x: just ident 10000 */
239 V4L2_IDENT_SN9C20X = 10000,
240
241 /* module cx231xx and cx25840 */
242 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
243 V4L2_IDENT_CX23100 = 23100,
244 V4L2_IDENT_CX23101 = 23101,
245 V4L2_IDENT_CX23102 = 23102,
246
247 /* module msp3400: reserved range 34000-34999 for msp34xx */
248 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
249 use internally (tveeprom.c). */
250
251 V4L2_IDENT_MSP3400B = 34002,
252 V4L2_IDENT_MSP3400C = 34003,
253 V4L2_IDENT_MSP3400D = 34004,
254 V4L2_IDENT_MSP3400G = 34007,
255 V4L2_IDENT_MSP3401G = 34017,
256 V4L2_IDENT_MSP3402G = 34027,
257 V4L2_IDENT_MSP3405D = 34054,
258 V4L2_IDENT_MSP3405G = 34057,
259 V4L2_IDENT_MSP3407D = 34074,
260 V4L2_IDENT_MSP3407G = 34077,
261
262 V4L2_IDENT_MSP3410B = 34102,
263 V4L2_IDENT_MSP3410C = 34103,
264 V4L2_IDENT_MSP3410D = 34104,
265 V4L2_IDENT_MSP3410G = 34107,
266 V4L2_IDENT_MSP3411G = 34117,
267 V4L2_IDENT_MSP3412G = 34127,
268 V4L2_IDENT_MSP3415D = 34154,
269 V4L2_IDENT_MSP3415G = 34157,
270 V4L2_IDENT_MSP3417D = 34174,
271 V4L2_IDENT_MSP3417G = 34177,
272
273 V4L2_IDENT_MSP3420G = 34207,
274 V4L2_IDENT_MSP3421G = 34217,
275 V4L2_IDENT_MSP3422G = 34227,
276 V4L2_IDENT_MSP3425G = 34257,
277 V4L2_IDENT_MSP3427G = 34277,
278
279 V4L2_IDENT_MSP3430G = 34307,
280 V4L2_IDENT_MSP3431G = 34317,
281 V4L2_IDENT_MSP3435G = 34357,
282 V4L2_IDENT_MSP3437G = 34377,
283
284 V4L2_IDENT_MSP3440G = 34407,
285 V4L2_IDENT_MSP3441G = 34417,
286 V4L2_IDENT_MSP3442G = 34427,
287 V4L2_IDENT_MSP3445G = 34457,
288 V4L2_IDENT_MSP3447G = 34477,
289
290 V4L2_IDENT_MSP3450G = 34507,
291 V4L2_IDENT_MSP3451G = 34517,
292 V4L2_IDENT_MSP3452G = 34527,
293 V4L2_IDENT_MSP3455G = 34557,
294 V4L2_IDENT_MSP3457G = 34577,
295
296 V4L2_IDENT_MSP3460G = 34607,
297 V4L2_IDENT_MSP3461G = 34617,
298 V4L2_IDENT_MSP3465G = 34657,
299 V4L2_IDENT_MSP3467G = 34677,
300
301 /* module msp3400: reserved range 44000-44999 for msp44xx */
302 V4L2_IDENT_MSP4400G = 44007,
303 V4L2_IDENT_MSP4408G = 44087,
304 V4L2_IDENT_MSP4410G = 44107,
305 V4L2_IDENT_MSP4418G = 44187,
306 V4L2_IDENT_MSP4420G = 44207,
307 V4L2_IDENT_MSP4428G = 44287,
308 V4L2_IDENT_MSP4440G = 44407,
309 V4L2_IDENT_MSP4448G = 44487,
310 V4L2_IDENT_MSP4450G = 44507,
311 V4L2_IDENT_MSP4458G = 44587,
312
313 /* Micron CMOS sensor chips: 45000-45099 */
314 V4L2_IDENT_MT9M001C12ST = 45000,
315 V4L2_IDENT_MT9M001C12STM = 45005,
316 V4L2_IDENT_MT9M111 = 45007,
317 V4L2_IDENT_MT9M112 = 45008,
318 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
319 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
320 V4L2_IDENT_MT9T031 = 45020,
321 V4L2_IDENT_MT9T111 = 45021,
322 V4L2_IDENT_MT9T112 = 45022,
323 V4L2_IDENT_MT9V111 = 45031,
324 V4L2_IDENT_MT9V112 = 45032,
325
326 /* HV7131R CMOS sensor: just ident 46000 */
327 V4L2_IDENT_HV7131R = 46000,
328
329 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
330 V4L2_IDENT_RJ54N1CB0C = 51980,
331
332 /* module m52790: just ident 52790 */
333 V4L2_IDENT_M52790 = 52790,
334
335 /* module cs53132a: just ident 53132 */
336 V4L2_IDENT_CS53l32A = 53132,
337
338 /* modules upd61151 MPEG2 encoder: just ident 54000 */
339 V4L2_IDENT_UPD61161 = 54000,
340 /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
341 V4L2_IDENT_UPD61162 = 54001,
342
343 /* module upd64031a: just ident 64031 */
344 V4L2_IDENT_UPD64031A = 64031,
345
346 /* module upd64083: just ident 64083 */
347 V4L2_IDENT_UPD64083 = 64083,
348
349 /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
350};
351
352#endif
diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
new file mode 100644
index 000000000000..0503a90b48bb
--- /dev/null
+++ b/include/media/v4l2-clk.h
@@ -0,0 +1,54 @@
1/*
2 * V4L2 clock service
3 *
4 * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ATTENTION: This is a temporary API and it shall be replaced by the generic
11 * clock API, when the latter becomes widely available.
12 */
13
14#ifndef MEDIA_V4L2_CLK_H
15#define MEDIA_V4L2_CLK_H
16
17#include <linux/atomic.h>
18#include <linux/list.h>
19#include <linux/mutex.h>
20
21struct module;
22struct device;
23
24struct v4l2_clk {
25 struct list_head list;
26 const struct v4l2_clk_ops *ops;
27 const char *dev_id;
28 const char *id;
29 int enable;
30 struct mutex lock; /* Protect the enable count */
31 atomic_t use_count;
32 void *priv;
33};
34
35struct v4l2_clk_ops {
36 struct module *owner;
37 int (*enable)(struct v4l2_clk *clk);
38 void (*disable)(struct v4l2_clk *clk);
39 unsigned long (*get_rate)(struct v4l2_clk *clk);
40 int (*set_rate)(struct v4l2_clk *clk, unsigned long);
41};
42
43struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops,
44 const char *dev_name,
45 const char *name, void *priv);
46void v4l2_clk_unregister(struct v4l2_clk *clk);
47struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id);
48void v4l2_clk_put(struct v4l2_clk *clk);
49int v4l2_clk_enable(struct v4l2_clk *clk);
50void v4l2_clk_disable(struct v4l2_clk *clk);
51unsigned long v4l2_clk_get_rate(struct v4l2_clk *clk);
52int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate);
53
54#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1d93c48cb371..015ff82da73c 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -100,16 +100,6 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
100 100
101/* ------------------------------------------------------------------------- */ 101/* ------------------------------------------------------------------------- */
102 102
103/* Register/chip ident helper function */
104
105struct i2c_client; /* forward reference */
106int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match);
107int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
108 u32 ident, u32 revision);
109int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
110
111/* ------------------------------------------------------------------------- */
112
113/* I2C Helper functions */ 103/* I2C Helper functions */
114 104
115struct i2c_driver; 105struct i2c_driver;
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 95d1c91770f4..c768c9f8abc2 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -96,9 +96,9 @@ struct video_device
96 struct device dev; /* v4l device */ 96 struct device dev; /* v4l device */
97 struct cdev *cdev; /* character device */ 97 struct cdev *cdev; /* character device */
98 98
99 /* Set either parent or v4l2_dev if your driver uses v4l2_device */
100 struct device *parent; /* device parent */
101 struct v4l2_device *v4l2_dev; /* v4l2_device parent */ 99 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
100 /* Only set parent if that can't be deduced from v4l2_dev */
101 struct device *dev_parent; /* device parent */
102 102
103 /* Control handler associated with this device node. May be NULL. */ 103 /* Control handler associated with this device node. May be NULL. */
104 struct v4l2_ctrl_handler *ctrl_handler; 104 struct v4l2_ctrl_handler *ctrl_handler;
@@ -129,7 +129,6 @@ struct video_device
129 129
130 /* Video standard vars */ 130 /* Video standard vars */
131 v4l2_std_id tvnorms; /* Supported tv norms */ 131 v4l2_std_id tvnorms; /* Supported tv norms */
132 v4l2_std_id current_norm; /* Current tvnorm */
133 132
134 /* callbacks */ 133 /* callbacks */
135 void (*release)(struct video_device *vdev); 134 void (*release)(struct video_device *vdev);
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index e6aa2318367b..0286c95814ff 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -220,8 +220,6 @@ enum v4l2_int_ioctl_num {
220 vidioc_int_reset_num, 220 vidioc_int_reset_num,
221 /* VIDIOC_INT_INIT */ 221 /* VIDIOC_INT_INIT */
222 vidioc_int_init_num, 222 vidioc_int_init_num,
223 /* VIDIOC_DBG_G_CHIP_IDENT */
224 vidioc_int_g_chip_ident_num,
225 223
226 /* 224 /*
227 * 225 *
@@ -303,6 +301,5 @@ V4L2_INT_WRAPPER_1(enum_frameintervals, struct v4l2_frmivalenum, *);
303 301
304V4L2_INT_WRAPPER_0(reset); 302V4L2_INT_WRAPPER_0(reset);
305V4L2_INT_WRAPPER_0(init); 303V4L2_INT_WRAPPER_0(init);
306V4L2_INT_WRAPPER_1(g_chip_ident, int, *);
307 304
308#endif 305#endif
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 931652f0e2af..e0b74a430b3a 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -247,8 +247,6 @@ struct v4l2_ioctl_ops {
247 int (*vidioc_g_chip_info) (struct file *file, void *fh, 247 int (*vidioc_g_chip_info) (struct file *file, void *fh,
248 struct v4l2_dbg_chip_info *chip); 248 struct v4l2_dbg_chip_info *chip);
249#endif 249#endif
250 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
251 struct v4l2_dbg_chip_ident *chip);
252 250
253 int (*vidioc_enum_framesizes) (struct file *file, void *fh, 251 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
254 struct v4l2_frmsizeenum *fsize); 252 struct v4l2_frmsizeenum *fsize);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5298d678d0f3..3250cc5e7925 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -24,6 +24,7 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/v4l2-subdev.h> 25#include <linux/v4l2-subdev.h>
26#include <media/media-entity.h> 26#include <media/media-entity.h>
27#include <media/v4l2-async.h>
27#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
28#include <media/v4l2-dev.h> 29#include <media/v4l2-dev.h>
29#include <media/v4l2-fh.h> 30#include <media/v4l2-fh.h>
@@ -88,7 +89,6 @@ struct v4l2_decode_vbi_line {
88 89
89/* Core ops: it is highly recommended to implement at least these ops: 90/* Core ops: it is highly recommended to implement at least these ops:
90 91
91 g_chip_ident
92 log_status 92 log_status
93 g_register 93 g_register
94 s_register 94 s_register
@@ -145,7 +145,6 @@ struct v4l2_subdev_io_pin_config {
145 performed later. It must not sleep. *Called from an IRQ context*. 145 performed later. It must not sleep. *Called from an IRQ context*.
146 */ 146 */
147struct v4l2_subdev_core_ops { 147struct v4l2_subdev_core_ops {
148 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
149 int (*log_status)(struct v4l2_subdev *sd); 148 int (*log_status)(struct v4l2_subdev *sd);
150 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, 149 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
151 struct v4l2_subdev_io_pin_config *pincfg); 150 struct v4l2_subdev_io_pin_config *pincfg);
@@ -585,8 +584,17 @@ struct v4l2_subdev {
585 void *host_priv; 584 void *host_priv;
586 /* subdev device node */ 585 /* subdev device node */
587 struct video_device *devnode; 586 struct video_device *devnode;
587 /* pointer to the physical device, if any */
588 struct device *dev;
589 struct v4l2_async_subdev_list asdl;
588}; 590};
589 591
592static inline struct v4l2_subdev *v4l2_async_to_subdev(
593 struct v4l2_async_subdev_list *asdl)
594{
595 return container_of(asdl, struct v4l2_subdev, asdl);
596}
597
590#define media_entity_to_v4l2_subdev(ent) \ 598#define media_entity_to_v4l2_subdev(ent) \
591 container_of(ent, struct v4l2_subdev, entity) 599 container_of(ent, struct v4l2_subdev, entity)
592#define vdev_to_v4l2_subdev(vdev) \ 600#define vdev_to_v4l2_subdev(vdev) \
@@ -660,7 +668,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
660/* Call an ops of a v4l2_subdev, doing the right checks against 668/* Call an ops of a v4l2_subdev, doing the right checks against
661 NULL pointers. 669 NULL pointers.
662 670
663 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 671 Example: err = v4l2_subdev_call(sd, core, s_std, norm);
664 */ 672 */
665#define v4l2_subdev_call(sd, o, f, args...) \ 673#define v4l2_subdev_call(sd, o, f, args...) \
666 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ 674 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index adcbb20f6511..d9fa68f26c41 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,6 +26,9 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#define P9_DEF_MIN_RESVPORT (665U)
30#define P9_DEF_MAX_RESVPORT (1023U)
31
29/** 32/**
30 * struct p9_trans_module - transport module interface 33 * struct p9_trans_module - transport module interface
31 * @list: used to maintain a list of currently available transports 34 * @list: used to maintain a list of currently available transports
@@ -37,6 +40,8 @@
37 * @close: member function to discard a connection on this transport 40 * @close: member function to discard a connection on this transport
38 * @request: member function to issue a request to the transport 41 * @request: member function to issue a request to the transport
39 * @cancel: member function to cancel a request (if it hasn't been sent) 42 * @cancel: member function to cancel a request (if it hasn't been sent)
43 * @cancelled: member function to notify that a cancelled request will not
44 * not receive a reply
40 * 45 *
41 * This is the basic API for a transport module which is registered by the 46 * This is the basic API for a transport module which is registered by the
42 * transport module with the 9P core network module and used by the client 47 * transport module with the 9P core network module and used by the client
@@ -55,6 +60,7 @@ struct p9_trans_module {
55 void (*close) (struct p9_client *); 60 void (*close) (struct p9_client *);
56 int (*request) (struct p9_client *, struct p9_req_t *req); 61 int (*request) (struct p9_client *, struct p9_req_t *req);
57 int (*cancel) (struct p9_client *, struct p9_req_t *req); 62 int (*cancel) (struct p9_client *, struct p9_req_t *req);
63 int (*cancelled)(struct p9_client *, struct p9_req_t *req);
58 int (*zc_request)(struct p9_client *, struct p9_req_t *, 64 int (*zc_request)(struct p9_client *, struct p9_req_t *,
59 char *, char *, int , int, int, int); 65 char *, char *, int , int, int, int);
60}; 66};
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 06ef7e926a66..b8ffac7b6bab 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -18,7 +18,7 @@ struct tcf_common {
18 struct tcf_t tcfc_tm; 18 struct tcf_t tcfc_tm;
19 struct gnet_stats_basic_packed tcfc_bstats; 19 struct gnet_stats_basic_packed tcfc_bstats;
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est64 tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
23 struct rcu_head tcfc_rcu; 23 struct rcu_head tcfc_rcu;
24}; 24};
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 21f702704f24..c7b181cb47a6 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -86,6 +86,9 @@ extern int ipv6_dev_get_saddr(struct net *net,
86 const struct in6_addr *daddr, 86 const struct in6_addr *daddr,
87 unsigned int srcprefs, 87 unsigned int srcprefs,
88 struct in6_addr *saddr); 88 struct in6_addr *saddr);
89extern int __ipv6_get_lladdr(struct inet6_dev *idev,
90 struct in6_addr *addr,
91 unsigned char banned_flags);
89extern int ipv6_get_lladdr(struct net_device *dev, 92extern int ipv6_get_lladdr(struct net_device *dev,
90 struct in6_addr *addr, 93 struct in6_addr *addr,
91 unsigned char banned_flags); 94 unsigned char banned_flags);
@@ -155,6 +158,7 @@ extern bool ipv6_chk_mcast_addr(struct net_device *dev,
155 const struct in6_addr *group, 158 const struct in6_addr *group,
156 const struct in6_addr *src_addr); 159 const struct in6_addr *src_addr);
157 160
161extern void ipv6_mc_dad_complete(struct inet6_dev *idev);
158/* 162/*
159 * identify MLD packets for MLD filter exceptions 163 * identify MLD packets for MLD filter exceptions
160 */ 164 */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index e0512aaef4b8..3c592cf473da 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -107,7 +107,6 @@ enum {
107 HCI_MGMT, 107 HCI_MGMT,
108 HCI_PAIRABLE, 108 HCI_PAIRABLE,
109 HCI_SERVICE_CACHE, 109 HCI_SERVICE_CACHE,
110 HCI_LINK_KEYS,
111 HCI_DEBUG_KEYS, 110 HCI_DEBUG_KEYS,
112 HCI_UNREGISTER, 111 HCI_UNREGISTER,
113 112
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7cb6d360d147..f77885ea78c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -117,13 +117,6 @@ struct oob_data {
117 u8 randomizer[16]; 117 u8 randomizer[16];
118}; 118};
119 119
120struct le_scan_params {
121 u8 type;
122 u16 interval;
123 u16 window;
124 int timeout;
125};
126
127#define HCI_MAX_SHORT_NAME_LENGTH 10 120#define HCI_MAX_SHORT_NAME_LENGTH 10
128 121
129struct amp_assoc { 122struct amp_assoc {
@@ -283,9 +276,6 @@ struct hci_dev {
283 276
284 struct delayed_work le_scan_disable; 277 struct delayed_work le_scan_disable;
285 278
286 struct work_struct le_scan;
287 struct le_scan_params le_scan_params;
288
289 __s8 adv_tx_power; 279 __s8 adv_tx_power;
290 __u8 adv_data[HCI_MAX_AD_LENGTH]; 280 __u8 adv_data[HCI_MAX_AD_LENGTH];
291 __u8 adv_data_len; 281 __u8 adv_data_len;
@@ -432,6 +422,7 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
432 struct inquiry_entry *ie); 422 struct inquiry_entry *ie);
433bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, 423bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
434 bool name_known, bool *ssp); 424 bool name_known, bool *ssp);
425void hci_inquiry_cache_flush(struct hci_dev *hdev);
435 426
436/* ----- HCI Connections ----- */ 427/* ----- HCI Connections ----- */
437enum { 428enum {
@@ -1114,6 +1105,16 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1114 BIT(BDADDR_LE_PUBLIC) | \ 1105 BIT(BDADDR_LE_PUBLIC) | \
1115 BIT(BDADDR_LE_RANDOM)) 1106 BIT(BDADDR_LE_RANDOM))
1116 1107
1108/* These LE scan and inquiry parameters were chosen according to LE General
1109 * Discovery Procedure specification.
1110 */
1111#define DISCOV_LE_SCAN_WIN 0x12
1112#define DISCOV_LE_SCAN_INT 0x12
1113#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240)
1114#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120)
1115#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
1116#define DISCOV_BREDR_INQUIRY_LEN 0x08
1117
1117int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1118int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1118int mgmt_index_added(struct hci_dev *hdev); 1119int mgmt_index_added(struct hci_dev *hdev);
1119int mgmt_index_removed(struct hci_dev *hdev); 1120int mgmt_index_removed(struct hci_dev *hdev);
@@ -1169,10 +1170,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1169 u8 ssp, u8 *eir, u16 eir_len); 1170 u8 ssp, u8 *eir, u16 eir_len);
1170int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1171int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1171 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1172 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1172int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
1173int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
1174int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1173int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1175int mgmt_interleaved_discovery(struct hci_dev *hdev);
1176int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1174int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1177int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1175int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1178bool mgmt_valid_hdev(struct hci_dev *hdev); 1176bool mgmt_valid_hdev(struct hci_dev *hdev);
@@ -1212,11 +1210,6 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1212 u16 latency, u16 to_multiplier); 1210 u16 latency, u16 to_multiplier);
1213void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1211void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1214 __u8 ltk[16]); 1212 __u8 ltk[16]);
1215int hci_do_inquiry(struct hci_dev *hdev, u8 length);
1216int hci_cancel_inquiry(struct hci_dev *hdev);
1217int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1218 int timeout);
1219int hci_cancel_le_scan(struct hci_dev *hdev);
1220 1213
1221u8 bdaddr_to_le(u8 bdaddr_type); 1214u8 bdaddr_to_le(u8 bdaddr_type);
1222 1215
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index fb94cf13c777..1a966afbbfa8 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -242,7 +242,7 @@ struct l2cap_conn_rsp {
242#define L2CAP_CID_SIGNALING 0x0001 242#define L2CAP_CID_SIGNALING 0x0001
243#define L2CAP_CID_CONN_LESS 0x0002 243#define L2CAP_CID_CONN_LESS 0x0002
244#define L2CAP_CID_A2MP 0x0003 244#define L2CAP_CID_A2MP 0x0003
245#define L2CAP_CID_LE_DATA 0x0004 245#define L2CAP_CID_ATT 0x0004
246#define L2CAP_CID_LE_SIGNALING 0x0005 246#define L2CAP_CID_LE_SIGNALING 0x0005
247#define L2CAP_CID_SMP 0x0006 247#define L2CAP_CID_SMP 0x0006
248#define L2CAP_CID_DYN_START 0x0040 248#define L2CAP_CID_DYN_START 0x0040
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
new file mode 100644
index 000000000000..a14339c2985f
--- /dev/null
+++ b/include/net/busy_poll.h
@@ -0,0 +1,185 @@
1/*
2 * net busy poll support
3 * Copyright(c) 2013 Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Author: Eliezer Tamir
19 *
20 * Contact Information:
21 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
22 */
23
24#ifndef _LINUX_NET_BUSY_POLL_H
25#define _LINUX_NET_BUSY_POLL_H
26
27#include <linux/netdevice.h>
28#include <net/ip.h>
29
30#ifdef CONFIG_NET_LL_RX_POLL
31
32struct napi_struct;
33extern unsigned int sysctl_net_busy_read __read_mostly;
34extern unsigned int sysctl_net_busy_poll __read_mostly;
35
36/* return values from ndo_ll_poll */
37#define LL_FLUSH_FAILED -1
38#define LL_FLUSH_BUSY -2
39
40static inline bool net_busy_loop_on(void)
41{
42 return sysctl_net_busy_poll;
43}
44
45/* a wrapper to make debug_smp_processor_id() happy
46 * we can use sched_clock() because we don't care much about precision
47 * we only care that the average is bounded
48 */
49#ifdef CONFIG_DEBUG_PREEMPT
50static inline u64 busy_loop_us_clock(void)
51{
52 u64 rc;
53
54 preempt_disable_notrace();
55 rc = sched_clock();
56 preempt_enable_no_resched_notrace();
57
58 return rc >> 10;
59}
60#else /* CONFIG_DEBUG_PREEMPT */
61static inline u64 busy_loop_us_clock(void)
62{
63 return sched_clock() >> 10;
64}
65#endif /* CONFIG_DEBUG_PREEMPT */
66
67static inline unsigned long sk_busy_loop_end_time(struct sock *sk)
68{
69 return busy_loop_us_clock() + ACCESS_ONCE(sk->sk_ll_usec);
70}
71
72/* in poll/select we use the global sysctl_net_ll_poll value */
73static inline unsigned long busy_loop_end_time(void)
74{
75 return busy_loop_us_clock() + ACCESS_ONCE(sysctl_net_busy_poll);
76}
77
78static inline bool sk_can_busy_loop(struct sock *sk)
79{
80 return sk->sk_ll_usec && sk->sk_napi_id &&
81 !need_resched() && !signal_pending(current);
82}
83
84
85static inline bool busy_loop_timeout(unsigned long end_time)
86{
87 unsigned long now = busy_loop_us_clock();
88
89 return time_after(now, end_time);
90}
91
92/* when used in sock_poll() nonblock is known at compile time to be true
93 * so the loop and end_time will be optimized out
94 */
95static inline bool sk_busy_loop(struct sock *sk, int nonblock)
96{
97 unsigned long end_time = !nonblock ? sk_busy_loop_end_time(sk) : 0;
98 const struct net_device_ops *ops;
99 struct napi_struct *napi;
100 int rc = false;
101
102 /*
103 * rcu read lock for napi hash
104 * bh so we don't race with net_rx_action
105 */
106 rcu_read_lock_bh();
107
108 napi = napi_by_id(sk->sk_napi_id);
109 if (!napi)
110 goto out;
111
112 ops = napi->dev->netdev_ops;
113 if (!ops->ndo_busy_poll)
114 goto out;
115
116 do {
117 rc = ops->ndo_busy_poll(napi);
118
119 if (rc == LL_FLUSH_FAILED)
120 break; /* permanent failure */
121
122 if (rc > 0)
123 /* local bh are disabled so it is ok to use _BH */
124 NET_ADD_STATS_BH(sock_net(sk),
125 LINUX_MIB_LOWLATENCYRXPACKETS, rc);
126
127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
128 !need_resched() && !busy_loop_timeout(end_time));
129
130 rc = !skb_queue_empty(&sk->sk_receive_queue);
131out:
132 rcu_read_unlock_bh();
133 return rc;
134}
135
136/* used in the NIC receive handler to mark the skb */
137static inline void skb_mark_napi_id(struct sk_buff *skb,
138 struct napi_struct *napi)
139{
140 skb->napi_id = napi->napi_id;
141}
142
143/* used in the protocol hanlder to propagate the napi_id to the socket */
144static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb)
145{
146 sk->sk_napi_id = skb->napi_id;
147}
148
149#else /* CONFIG_NET_LL_RX_POLL */
150static inline unsigned long net_busy_loop_on(void)
151{
152 return 0;
153}
154
155static inline unsigned long busy_loop_end_time(void)
156{
157 return 0;
158}
159
160static inline bool sk_can_busy_loop(struct sock *sk)
161{
162 return false;
163}
164
165static inline bool sk_busy_poll(struct sock *sk, int nonblock)
166{
167 return false;
168}
169
170static inline void skb_mark_napi_id(struct sk_buff *skb,
171 struct napi_struct *napi)
172{
173}
174
175static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb)
176{
177}
178
179static inline bool busy_loop_timeout(unsigned long end_time)
180{
181 return true;
182}
183
184#endif /* CONFIG_NET_LL_RX_POLL */
185#endif /* _LINUX_NET_BUSY_POLL_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 26b5b692c22b..7b0730aeb892 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -188,6 +188,8 @@ struct ieee80211_channel {
188 * when used with 802.11g (on the 2.4 GHz band); filled by the 188 * when used with 802.11g (on the 2.4 GHz band); filled by the
189 * core code when registering the wiphy. 189 * core code when registering the wiphy.
190 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 190 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
191 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
192 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
191 */ 193 */
192enum ieee80211_rate_flags { 194enum ieee80211_rate_flags {
193 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 195 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
@@ -195,6 +197,8 @@ enum ieee80211_rate_flags {
195 IEEE80211_RATE_MANDATORY_B = 1<<2, 197 IEEE80211_RATE_MANDATORY_B = 1<<2,
196 IEEE80211_RATE_MANDATORY_G = 1<<3, 198 IEEE80211_RATE_MANDATORY_G = 1<<3,
197 IEEE80211_RATE_ERP_G = 1<<4, 199 IEEE80211_RATE_ERP_G = 1<<4,
200 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
201 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
198}; 202};
199 203
200/** 204/**
@@ -433,6 +437,30 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
433 u32 prohibited_flags); 437 u32 prohibited_flags);
434 438
435/** 439/**
440 * ieee80211_chandef_rate_flags - returns rate flags for a channel
441 *
442 * In some channel types, not all rates may be used - for example CCK
443 * rates may not be used in 5/10 MHz channels.
444 *
445 * @chandef: channel definition for the channel
446 *
447 * Returns: rate flags which apply for this channel
448 */
449static inline enum ieee80211_rate_flags
450ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
451{
452 switch (chandef->width) {
453 case NL80211_CHAN_WIDTH_5:
454 return IEEE80211_RATE_SUPPORTS_5MHZ;
455 case NL80211_CHAN_WIDTH_10:
456 return IEEE80211_RATE_SUPPORTS_10MHZ;
457 default:
458 break;
459 }
460 return 0;
461}
462
463/**
436 * enum survey_info_flags - survey information flags 464 * enum survey_info_flags - survey information flags
437 * 465 *
438 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 466 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
@@ -753,6 +781,8 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
753 * @STATION_INFO_LOCAL_PM: @local_pm filled 781 * @STATION_INFO_LOCAL_PM: @local_pm filled
754 * @STATION_INFO_PEER_PM: @peer_pm filled 782 * @STATION_INFO_PEER_PM: @peer_pm filled
755 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 783 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
784 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
785 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
756 */ 786 */
757enum station_info_flags { 787enum station_info_flags {
758 STATION_INFO_INACTIVE_TIME = 1<<0, 788 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -781,6 +811,8 @@ enum station_info_flags {
781 STATION_INFO_NONPEER_PM = 1<<23, 811 STATION_INFO_NONPEER_PM = 1<<23,
782 STATION_INFO_RX_BYTES64 = 1<<24, 812 STATION_INFO_RX_BYTES64 = 1<<24,
783 STATION_INFO_TX_BYTES64 = 1<<25, 813 STATION_INFO_TX_BYTES64 = 1<<25,
814 STATION_INFO_CHAIN_SIGNAL = 1<<26,
815 STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27,
784}; 816};
785 817
786/** 818/**
@@ -857,6 +889,8 @@ struct sta_bss_parameters {
857 u16 beacon_interval; 889 u16 beacon_interval;
858}; 890};
859 891
892#define IEEE80211_MAX_CHAINS 4
893
860/** 894/**
861 * struct station_info - station information 895 * struct station_info - station information
862 * 896 *
@@ -874,6 +908,9 @@ struct sta_bss_parameters {
874 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 908 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
875 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 909 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
876 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 910 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
911 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
912 * @chain_signal: per-chain signal strength of last received packet in dBm
913 * @chain_signal_avg: per-chain signal strength average in dBm
877 * @txrate: current unicast bitrate from this station 914 * @txrate: current unicast bitrate from this station
878 * @rxrate: current unicast bitrate to this station 915 * @rxrate: current unicast bitrate to this station
879 * @rx_packets: packets received from this station 916 * @rx_packets: packets received from this station
@@ -909,6 +946,11 @@ struct station_info {
909 u8 plink_state; 946 u8 plink_state;
910 s8 signal; 947 s8 signal;
911 s8 signal_avg; 948 s8 signal_avg;
949
950 u8 chains;
951 s8 chain_signal[IEEE80211_MAX_CHAINS];
952 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
953
912 struct rate_info txrate; 954 struct rate_info txrate;
913 struct rate_info rxrate; 955 struct rate_info rxrate;
914 u32 rx_packets; 956 u32 rx_packets;
@@ -947,6 +989,7 @@ struct station_info {
947 * @MONITOR_FLAG_CONTROL: pass control frames 989 * @MONITOR_FLAG_CONTROL: pass control frames
948 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 990 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
949 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 991 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
992 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
950 */ 993 */
951enum monitor_flags { 994enum monitor_flags {
952 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 995 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
@@ -954,6 +997,7 @@ enum monitor_flags {
954 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 997 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
955 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 998 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
956 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 999 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1000 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
957}; 1001};
958 1002
959/** 1003/**
@@ -1108,6 +1152,9 @@ struct bss_parameters {
1108 * setting for new peer links. 1152 * setting for new peer links.
1109 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 1153 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1110 * after transmitting its beacon. 1154 * after transmitting its beacon.
1155 * @plink_timeout: If no tx activity is seen from a STA we've established
1156 * peering with for longer than this time (in seconds), then remove it
1157 * from the STA's list of peers. Default is 30 minutes.
1111 */ 1158 */
1112struct mesh_config { 1159struct mesh_config {
1113 u16 dot11MeshRetryTimeout; 1160 u16 dot11MeshRetryTimeout;
@@ -1137,6 +1184,7 @@ struct mesh_config {
1137 u16 dot11MeshHWMPconfirmationInterval; 1184 u16 dot11MeshHWMPconfirmationInterval;
1138 enum nl80211_mesh_power_mode power_mode; 1185 enum nl80211_mesh_power_mode power_mode;
1139 u16 dot11MeshAwakeWindowDuration; 1186 u16 dot11MeshAwakeWindowDuration;
1187 u32 plink_timeout;
1140}; 1188};
1141 1189
1142/** 1190/**
@@ -1147,6 +1195,7 @@ struct mesh_config {
1147 * @sync_method: which synchronization method to use 1195 * @sync_method: which synchronization method to use
1148 * @path_sel_proto: which path selection protocol to use 1196 * @path_sel_proto: which path selection protocol to use
1149 * @path_metric: which metric to use 1197 * @path_metric: which metric to use
1198 * @auth_id: which authentication method this mesh is using
1150 * @ie: vendor information elements (optional) 1199 * @ie: vendor information elements (optional)
1151 * @ie_len: length of vendor information elements 1200 * @ie_len: length of vendor information elements
1152 * @is_authenticated: this mesh requires authentication 1201 * @is_authenticated: this mesh requires authentication
@@ -1155,6 +1204,7 @@ struct mesh_config {
1155 * @dtim_period: DTIM period to use 1204 * @dtim_period: DTIM period to use
1156 * @beacon_interval: beacon interval to use 1205 * @beacon_interval: beacon interval to use
1157 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1206 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1207 * @basic_rates: basic rates to use when creating the mesh
1158 * 1208 *
1159 * These parameters are fixed when the mesh is created. 1209 * These parameters are fixed when the mesh is created.
1160 */ 1210 */
@@ -1165,6 +1215,7 @@ struct mesh_setup {
1165 u8 sync_method; 1215 u8 sync_method;
1166 u8 path_sel_proto; 1216 u8 path_sel_proto;
1167 u8 path_metric; 1217 u8 path_metric;
1218 u8 auth_id;
1168 const u8 *ie; 1219 const u8 *ie;
1169 u8 ie_len; 1220 u8 ie_len;
1170 bool is_authenticated; 1221 bool is_authenticated;
@@ -1173,6 +1224,7 @@ struct mesh_setup {
1173 u8 dtim_period; 1224 u8 dtim_period;
1174 u16 beacon_interval; 1225 u16 beacon_interval;
1175 int mcast_rate[IEEE80211_NUM_BANDS]; 1226 int mcast_rate[IEEE80211_NUM_BANDS];
1227 u32 basic_rates;
1176}; 1228};
1177 1229
1178/** 1230/**
@@ -1241,6 +1293,7 @@ struct cfg80211_ssid {
1241 * @scan_start: time (in jiffies) when the scan started 1293 * @scan_start: time (in jiffies) when the scan started
1242 * @wdev: the wireless device to scan for 1294 * @wdev: the wireless device to scan for
1243 * @aborted: (internal) scan request was notified as aborted 1295 * @aborted: (internal) scan request was notified as aborted
1296 * @notified: (internal) scan request was notified as done or aborted
1244 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1297 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1245 */ 1298 */
1246struct cfg80211_scan_request { 1299struct cfg80211_scan_request {
@@ -1258,7 +1311,7 @@ struct cfg80211_scan_request {
1258 /* internal */ 1311 /* internal */
1259 struct wiphy *wiphy; 1312 struct wiphy *wiphy;
1260 unsigned long scan_start; 1313 unsigned long scan_start;
1261 bool aborted; 1314 bool aborted, notified;
1262 bool no_cck; 1315 bool no_cck;
1263 1316
1264 /* keep last */ 1317 /* keep last */
@@ -1406,7 +1459,8 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1406 * This structure provides information needed to complete IEEE 802.11 1459 * This structure provides information needed to complete IEEE 802.11
1407 * authentication. 1460 * authentication.
1408 * 1461 *
1409 * @bss: The BSS to authenticate with. 1462 * @bss: The BSS to authenticate with, the callee must obtain a reference
1463 * to it if it needs to keep it.
1410 * @auth_type: Authentication type (algorithm) 1464 * @auth_type: Authentication type (algorithm)
1411 * @ie: Extra IEs to add to Authentication frame or %NULL 1465 * @ie: Extra IEs to add to Authentication frame or %NULL
1412 * @ie_len: Length of ie buffer in octets 1466 * @ie_len: Length of ie buffer in octets
@@ -1444,11 +1498,10 @@ enum cfg80211_assoc_req_flags {
1444 * 1498 *
1445 * This structure provides information needed to complete IEEE 802.11 1499 * This structure provides information needed to complete IEEE 802.11
1446 * (re)association. 1500 * (re)association.
1447 * @bss: The BSS to associate with. If the call is successful the driver 1501 * @bss: The BSS to associate with. If the call is successful the driver is
1448 * is given a reference that it must release, normally via a call to 1502 * given a reference that it must give back to cfg80211_send_rx_assoc()
1449 * cfg80211_send_rx_assoc(), or, if association timed out, with a 1503 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1450 * call to cfg80211_put_bss() (in addition to calling 1504 * association requests while already associating must be rejected.
1451 * cfg80211_send_assoc_timeout())
1452 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1505 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1453 * @ie_len: Length of ie buffer in octets 1506 * @ie_len: Length of ie buffer in octets
1454 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1507 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1850,7 +1903,9 @@ struct cfg80211_update_ft_ies_params {
1850 * @get_mpath: get a mesh path for the given parameters 1903 * @get_mpath: get a mesh path for the given parameters
1851 * @dump_mpath: dump mesh path callback -- resume dump at index @idx 1904 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1852 * @join_mesh: join the mesh network with the specified parameters 1905 * @join_mesh: join the mesh network with the specified parameters
1906 * (invoked with the wireless_dev mutex held)
1853 * @leave_mesh: leave the current mesh network 1907 * @leave_mesh: leave the current mesh network
1908 * (invoked with the wireless_dev mutex held)
1854 * 1909 *
1855 * @get_mesh_config: Get the current mesh configuration 1910 * @get_mesh_config: Get the current mesh configuration
1856 * 1911 *
@@ -1877,20 +1932,28 @@ struct cfg80211_update_ft_ies_params {
1877 * the scan/scan_done bracket too. 1932 * the scan/scan_done bracket too.
1878 * 1933 *
1879 * @auth: Request to authenticate with the specified peer 1934 * @auth: Request to authenticate with the specified peer
1935 * (invoked with the wireless_dev mutex held)
1880 * @assoc: Request to (re)associate with the specified peer 1936 * @assoc: Request to (re)associate with the specified peer
1937 * (invoked with the wireless_dev mutex held)
1881 * @deauth: Request to deauthenticate from the specified peer 1938 * @deauth: Request to deauthenticate from the specified peer
1939 * (invoked with the wireless_dev mutex held)
1882 * @disassoc: Request to disassociate from the specified peer 1940 * @disassoc: Request to disassociate from the specified peer
1941 * (invoked with the wireless_dev mutex held)
1883 * 1942 *
1884 * @connect: Connect to the ESS with the specified parameters. When connected, 1943 * @connect: Connect to the ESS with the specified parameters. When connected,
1885 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1944 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1886 * If the connection fails for some reason, call cfg80211_connect_result() 1945 * If the connection fails for some reason, call cfg80211_connect_result()
1887 * with the status from the AP. 1946 * with the status from the AP.
1947 * (invoked with the wireless_dev mutex held)
1888 * @disconnect: Disconnect from the BSS/ESS. 1948 * @disconnect: Disconnect from the BSS/ESS.
1949 * (invoked with the wireless_dev mutex held)
1889 * 1950 *
1890 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 1951 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
1891 * cfg80211_ibss_joined(), also call that function when changing BSSID due 1952 * cfg80211_ibss_joined(), also call that function when changing BSSID due
1892 * to a merge. 1953 * to a merge.
1954 * (invoked with the wireless_dev mutex held)
1893 * @leave_ibss: Leave the IBSS. 1955 * @leave_ibss: Leave the IBSS.
1956 * (invoked with the wireless_dev mutex held)
1894 * 1957 *
1895 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 1958 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1896 * MESH mode) 1959 * MESH mode)
@@ -2307,6 +2370,7 @@ struct cfg80211_ops {
2307 * responds to probe-requests in hardware. 2370 * responds to probe-requests in hardware.
2308 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 2371 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
2309 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 2372 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
2373 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
2310 */ 2374 */
2311enum wiphy_flags { 2375enum wiphy_flags {
2312 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 2376 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
@@ -2330,6 +2394,7 @@ enum wiphy_flags {
2330 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 2394 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
2331 WIPHY_FLAG_OFFCHAN_TX = BIT(20), 2395 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
2332 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 2396 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
2397 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
2333}; 2398};
2334 2399
2335/** 2400/**
@@ -2556,6 +2621,9 @@ struct wiphy_wowlan_support {
2556 * may request, if implemented. 2621 * may request, if implemented.
2557 * 2622 *
2558 * @wowlan: WoWLAN support information 2623 * @wowlan: WoWLAN support information
2624 * @wowlan_config: current WoWLAN configuration; this should usually not be
2625 * used since access to it is necessarily racy, use the parameter passed
2626 * to the suspend() operation instead.
2559 * 2627 *
2560 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 2628 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
2561 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 2629 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
@@ -2622,7 +2690,8 @@ struct wiphy {
2622 u32 hw_version; 2690 u32 hw_version;
2623 2691
2624#ifdef CONFIG_PM 2692#ifdef CONFIG_PM
2625 struct wiphy_wowlan_support wowlan; 2693 const struct wiphy_wowlan_support *wowlan;
2694 struct cfg80211_wowlan *wowlan_config;
2626#endif 2695#endif
2627 2696
2628 u16 max_remain_on_channel_duration; 2697 u16 max_remain_on_channel_duration;
@@ -2820,7 +2889,7 @@ struct cfg80211_cached_keys;
2820 * @current_bss: (private) Used by the internal configuration code 2889 * @current_bss: (private) Used by the internal configuration code
2821 * @channel: (private) Used by the internal configuration code to track 2890 * @channel: (private) Used by the internal configuration code to track
2822 * the user-set AP, monitor and WDS channel 2891 * the user-set AP, monitor and WDS channel
2823 * @preset_chan: (private) Used by the internal configuration code to 2892 * @preset_chandef: (private) Used by the internal configuration code to
2824 * track the channel to be used for AP later 2893 * track the channel to be used for AP later
2825 * @bssid: (private) Used by the internal configuration code 2894 * @bssid: (private) Used by the internal configuration code
2826 * @ssid: (private) Used by the internal configuration code 2895 * @ssid: (private) Used by the internal configuration code
@@ -2834,14 +2903,23 @@ struct cfg80211_cached_keys;
2834 * by cfg80211 on change_interface 2903 * by cfg80211 on change_interface
2835 * @mgmt_registrations: list of registrations for management frames 2904 * @mgmt_registrations: list of registrations for management frames
2836 * @mgmt_registrations_lock: lock for the list 2905 * @mgmt_registrations_lock: lock for the list
2837 * @mtx: mutex used to lock data in this struct 2906 * @mtx: mutex used to lock data in this struct, may be used by drivers
2838 * @cleanup_work: work struct used for cleanup that can't be done directly 2907 * and some API functions require it held
2839 * @beacon_interval: beacon interval used on this device for transmitting 2908 * @beacon_interval: beacon interval used on this device for transmitting
2840 * beacons, 0 when not valid 2909 * beacons, 0 when not valid
2841 * @address: The address for this device, valid only if @netdev is %NULL 2910 * @address: The address for this device, valid only if @netdev is %NULL
2842 * @p2p_started: true if this is a P2P Device that has been started 2911 * @p2p_started: true if this is a P2P Device that has been started
2843 * @cac_started: true if DFS channel availability check has been started 2912 * @cac_started: true if DFS channel availability check has been started
2844 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 2913 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
2914 * @ps: powersave mode is enabled
2915 * @ps_timeout: dynamic powersave timeout
2916 * @ap_unexpected_nlportid: (private) netlink port ID of application
2917 * registered for unexpected class 3 frames (AP mode)
2918 * @conn: (private) cfg80211 software SME connection state machine data
2919 * @connect_keys: (private) keys to set after connection is established
2920 * @ibss_fixed: (private) IBSS is using fixed BSSID
2921 * @event_list: (private) list for internal event processing
2922 * @event_lock: (private) lock for event list
2845 */ 2923 */
2846struct wireless_dev { 2924struct wireless_dev {
2847 struct wiphy *wiphy; 2925 struct wiphy *wiphy;
@@ -2858,8 +2936,6 @@ struct wireless_dev {
2858 2936
2859 struct mutex mtx; 2937 struct mutex mtx;
2860 2938
2861 struct work_struct cleanup_work;
2862
2863 bool use_4addr, p2p_started; 2939 bool use_4addr, p2p_started;
2864 2940
2865 u8 address[ETH_ALEN] __aligned(sizeof(u16)); 2941 u8 address[ETH_ALEN] __aligned(sizeof(u16));
@@ -2867,11 +2943,6 @@ struct wireless_dev {
2867 /* currently used for IBSS and SME - might be rearranged later */ 2943 /* currently used for IBSS and SME - might be rearranged later */
2868 u8 ssid[IEEE80211_MAX_SSID_LEN]; 2944 u8 ssid[IEEE80211_MAX_SSID_LEN];
2869 u8 ssid_len, mesh_id_len, mesh_id_up_len; 2945 u8 ssid_len, mesh_id_len, mesh_id_up_len;
2870 enum {
2871 CFG80211_SME_IDLE,
2872 CFG80211_SME_CONNECTING,
2873 CFG80211_SME_CONNECTED,
2874 } sme_state;
2875 struct cfg80211_conn *conn; 2946 struct cfg80211_conn *conn;
2876 struct cfg80211_cached_keys *connect_keys; 2947 struct cfg80211_cached_keys *connect_keys;
2877 2948
@@ -2989,6 +3060,15 @@ struct ieee80211_rate *
2989ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3060ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2990 u32 basic_rates, int bitrate); 3061 u32 basic_rates, int bitrate);
2991 3062
3063/**
3064 * ieee80211_mandatory_rates - get mandatory rates for a given band
3065 * @sband: the band to look for rates in
3066 *
3067 * This function returns a bitmap of the mandatory rates for the given
3068 * band, bits are set according to the rate position in the bitrates array.
3069 */
3070u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);
3071
2992/* 3072/*
2993 * Radiotap parsing functions -- for controlled injection support 3073 * Radiotap parsing functions -- for controlled injection support
2994 * 3074 *
@@ -3392,122 +3472,87 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3392void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3472void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3393 3473
3394/** 3474/**
3395 * cfg80211_send_rx_auth - notification of processed authentication 3475 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
3396 * @dev: network device 3476 * @dev: network device
3397 * @buf: authentication frame (header + body) 3477 * @buf: authentication frame (header + body)
3398 * @len: length of the frame data 3478 * @len: length of the frame data
3399 * 3479 *
3400 * This function is called whenever an authentication has been processed in 3480 * This function is called whenever an authentication, disassociation or
3401 * station mode. The driver is required to call either this function or 3481 * deauthentication frame has been received and processed in station mode.
3402 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 3482 * After being asked to authenticate via cfg80211_ops::auth() the driver must
3403 * call. This function may sleep. 3483 * call either this function or cfg80211_auth_timeout().
3484 * After being asked to associate via cfg80211_ops::assoc() the driver must
3485 * call either this function or cfg80211_auth_timeout().
3486 * While connected, the driver must calls this for received and processed
3487 * disassociation and deauthentication frames. If the frame couldn't be used
3488 * because it was unprotected, the driver must call the function
3489 * cfg80211_rx_unprot_mlme_mgmt() instead.
3490 *
3491 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3404 */ 3492 */
3405void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 3493void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3406 3494
3407/** 3495/**
3408 * cfg80211_send_auth_timeout - notification of timed out authentication 3496 * cfg80211_auth_timeout - notification of timed out authentication
3409 * @dev: network device 3497 * @dev: network device
3410 * @addr: The MAC address of the device with which the authentication timed out 3498 * @addr: The MAC address of the device with which the authentication timed out
3411 * 3499 *
3412 * This function may sleep. 3500 * This function may sleep. The caller must hold the corresponding wdev's
3501 * mutex.
3413 */ 3502 */
3414void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 3503void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
3415 3504
3416/** 3505/**
3417 * cfg80211_send_rx_assoc - notification of processed association 3506 * cfg80211_rx_assoc_resp - notification of processed association response
3418 * @dev: network device 3507 * @dev: network device
3419 * @bss: the BSS struct association was requested for, the struct reference 3508 * @bss: the BSS that association was requested with, ownership of the pointer
3420 * is owned by cfg80211 after this call 3509 * moves to cfg80211 in this call
3421 * @buf: (re)association response frame (header + body) 3510 * @buf: authentication frame (header + body)
3422 * @len: length of the frame data 3511 * @len: length of the frame data
3423 * 3512 *
3424 * This function is called whenever a (re)association response has been 3513 * After being asked to associate via cfg80211_ops::assoc() the driver must
3425 * processed in station mode. The driver is required to call either this 3514 * call either this function or cfg80211_auth_timeout().
3426 * function or cfg80211_send_assoc_timeout() to indicate the result of 3515 *
3427 * cfg80211_ops::assoc() call. This function may sleep. 3516 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3428 */ 3517 */
3429void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, 3518void cfg80211_rx_assoc_resp(struct net_device *dev,
3519 struct cfg80211_bss *bss,
3430 const u8 *buf, size_t len); 3520 const u8 *buf, size_t len);
3431 3521
3432/** 3522/**
3433 * cfg80211_send_assoc_timeout - notification of timed out association 3523 * cfg80211_assoc_timeout - notification of timed out association
3434 * @dev: network device 3524 * @dev: network device
3435 * @addr: The MAC address of the device with which the association timed out 3525 * @bss: The BSS entry with which association timed out.
3436 * 3526 *
3437 * This function may sleep. 3527 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3438 */ 3528 */
3439void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 3529void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
3440 3530
3441/** 3531/**
3442 * cfg80211_send_deauth - notification of processed deauthentication 3532 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
3443 * @dev: network device 3533 * @dev: network device
3444 * @buf: deauthentication frame (header + body) 3534 * @buf: 802.11 frame (header + body)
3445 * @len: length of the frame data 3535 * @len: length of the frame data
3446 * 3536 *
3447 * This function is called whenever deauthentication has been processed in 3537 * This function is called whenever deauthentication has been processed in
3448 * station mode. This includes both received deauthentication frames and 3538 * station mode. This includes both received deauthentication frames and
3449 * locally generated ones. This function may sleep. 3539 * locally generated ones. This function may sleep. The caller must hold the
3450 */ 3540 * corresponding wdev's mutex.
3451void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3452
3453/**
3454 * __cfg80211_send_deauth - notification of processed deauthentication
3455 * @dev: network device
3456 * @buf: deauthentication frame (header + body)
3457 * @len: length of the frame data
3458 *
3459 * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
3460 */
3461void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3462
3463/**
3464 * cfg80211_send_disassoc - notification of processed disassociation
3465 * @dev: network device
3466 * @buf: disassociation response frame (header + body)
3467 * @len: length of the frame data
3468 *
3469 * This function is called whenever disassociation has been processed in
3470 * station mode. This includes both received disassociation frames and locally
3471 * generated ones. This function may sleep.
3472 */
3473void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3474
3475/**
3476 * __cfg80211_send_disassoc - notification of processed disassociation
3477 * @dev: network device
3478 * @buf: disassociation response frame (header + body)
3479 * @len: length of the frame data
3480 *
3481 * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
3482 */ 3541 */
3483void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 3542void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3484 size_t len);
3485 3543
3486/** 3544/**
3487 * cfg80211_send_unprot_deauth - notification of unprotected deauthentication 3545 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
3488 * @dev: network device 3546 * @dev: network device
3489 * @buf: deauthentication frame (header + body) 3547 * @buf: deauthentication frame (header + body)
3490 * @len: length of the frame data 3548 * @len: length of the frame data
3491 * 3549 *
3492 * This function is called whenever a received Deauthentication frame has been 3550 * This function is called whenever a received deauthentication or dissassoc
3493 * dropped in station mode because of MFP being used but the Deauthentication 3551 * frame has been dropped in station mode because of MFP being used but the
3494 * frame was not protected. This function may sleep. 3552 * frame was not protected. This function may sleep.
3495 */ 3553 */
3496void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, 3554void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
3497 size_t len); 3555 const u8 *buf, size_t len);
3498
3499/**
3500 * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
3501 * @dev: network device
3502 * @buf: disassociation frame (header + body)
3503 * @len: length of the frame data
3504 *
3505 * This function is called whenever a received Disassociation frame has been
3506 * dropped in station mode because of MFP being used but the Disassociation
3507 * frame was not protected. This function may sleep.
3508 */
3509void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3510 size_t len);
3511 3556
3512/** 3557/**
3513 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 3558 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -4153,6 +4198,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4153 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 4198 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
4154 * 4199 *
4155 * @wdev: the wireless device for which critical protocol is stopped. 4200 * @wdev: the wireless device for which critical protocol is stopped.
4201 * @gfp: allocation flags
4156 * 4202 *
4157 * This function can be called by the driver to indicate it has reverted 4203 * This function can be called by the driver to indicate it has reverted
4158 * operation back to normal. One reason could be that the duration given 4204 * operation back to normal. One reason could be that the duration given
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index a79b6cfb02a8..cf8439ba4d11 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -30,7 +30,7 @@ extern int gnet_stats_copy_basic(struct gnet_dump *d,
30 struct gnet_stats_basic_packed *b); 30 struct gnet_stats_basic_packed *b);
31extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 31extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
32 const struct gnet_stats_basic_packed *b, 32 const struct gnet_stats_basic_packed *b,
33 struct gnet_stats_rate_est *r); 33 struct gnet_stats_rate_est64 *r);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 34extern int gnet_stats_copy_queue(struct gnet_dump *d,
35 struct gnet_stats_queue *q); 35 struct gnet_stats_queue *q);
36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
@@ -38,13 +38,13 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 38extern int gnet_stats_finish_copy(struct gnet_dump *d);
39 39
40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est *rate_est, 41 struct gnet_stats_rate_est64 *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 42 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est *rate_est); 44 struct gnet_stats_rate_est64 *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est64 *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, 48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est *rate_est); 49 const struct gnet_stats_rate_est64 *rate_est);
50#endif 50#endif
diff --git a/include/net/gre.h b/include/net/gre.h
index 9f03a390c826..57e4afdf7879 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -7,6 +7,7 @@
7#define GREPROTO_CISCO 0 7#define GREPROTO_CISCO 0
8#define GREPROTO_PPTP 1 8#define GREPROTO_PPTP 1
9#define GREPROTO_MAX 2 9#define GREPROTO_MAX 2
10#define GRE_IP_PROTO_MAX 2
10 11
11struct gre_protocol { 12struct gre_protocol {
12 int (*handler)(struct sk_buff *skb); 13 int (*handler)(struct sk_buff *skb);
@@ -22,6 +23,36 @@ struct gre_base_hdr {
22int gre_add_protocol(const struct gre_protocol *proto, u8 version); 23int gre_add_protocol(const struct gre_protocol *proto, u8 version);
23int gre_del_protocol(const struct gre_protocol *proto, u8 version); 24int gre_del_protocol(const struct gre_protocol *proto, u8 version);
24 25
26struct gre_cisco_protocol {
27 int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi);
28 int (*err_handler)(struct sk_buff *skb, u32 info,
29 const struct tnl_ptk_info *tpi);
30 u8 priority;
31};
32
33int gre_cisco_register(struct gre_cisco_protocol *proto);
34int gre_cisco_unregister(struct gre_cisco_protocol *proto);
35
36int gre_offload_init(void);
37void gre_offload_exit(void);
38
39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
40 int hdr_len);
41struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum);
42
43static inline int ip_gre_calc_hlen(__be16 o_flags)
44{
45 int addend = 4;
46
47 if (o_flags&TUNNEL_CSUM)
48 addend += 4;
49 if (o_flags&TUNNEL_KEY)
50 addend += 4;
51 if (o_flags&TUNNEL_SEQ)
52 addend += 4;
53 return addend;
54}
55
25static inline __be16 gre_flags_to_tnl_flags(__be16 flags) 56static inline __be16 gre_flags_to_tnl_flags(__be16 flags)
26{ 57{
27 __be16 tflags = 0; 58 __be16 tflags = 0;
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c3999632e616..c6d07cb074bc 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
269#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 269#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04
270#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 270#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08
271#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 271#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10
272#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20
272 273
273#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 274#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03
274#define IEEE80211_RADIOTAP_MCS_BW_20 0 275#define IEEE80211_RADIOTAP_MCS_BW_20 0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
278#define IEEE80211_RADIOTAP_MCS_SGI 0x04 279#define IEEE80211_RADIOTAP_MCS_SGI 0x04
279#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 280#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08
280#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 281#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
282#define IEEE80211_RADIOTAP_MCS_STBC_MASK 0x60
283#define IEEE80211_RADIOTAP_MCS_STBC_1 1
284#define IEEE80211_RADIOTAP_MCS_STBC_2 2
285#define IEEE80211_RADIOTAP_MCS_STBC_3 3
286
287#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT 5
281 288
282/* For IEEE80211_RADIOTAP_AMPDU_STATUS */ 289/* For IEEE80211_RADIOTAP_AMPDU_STATUS */
283#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 290#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 100fb8cec17c..736b5fb95474 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -50,7 +50,7 @@ struct inet6_ifaddr {
50 50
51 int state; 51 int state;
52 52
53 __u8 probes; 53 __u8 dad_probes;
54 __u8 flags; 54 __u8 flags;
55 55
56 __u16 scope; 56 __u16 scope;
@@ -58,7 +58,7 @@ struct inet6_ifaddr {
58 unsigned long cstamp; /* created timestamp */ 58 unsigned long cstamp; /* created timestamp */
59 unsigned long tstamp; /* updated timestamp */ 59 unsigned long tstamp; /* updated timestamp */
60 60
61 struct timer_list timer; 61 struct timer_list dad_timer;
62 62
63 struct inet6_dev *idev; 63 struct inet6_dev *idev;
64 struct rt6_info *rt; 64 struct rt6_info *rt;
@@ -74,6 +74,7 @@ struct inet6_ifaddr {
74 bool tokenized; 74 bool tokenized;
75 75
76 struct rcu_head rcu; 76 struct rcu_head rcu;
77 struct in6_addr peer_addr;
77}; 78};
78 79
79struct ip6_sf_socklist { 80struct ip6_sf_socklist {
@@ -165,6 +166,7 @@ struct inet6_dev {
165 struct net_device *dev; 166 struct net_device *dev;
166 167
167 struct list_head addr_list; 168 struct list_head addr_list;
169 int valid_ll_addr_cnt;
168 170
169 struct ifmcaddr6 *mc_list; 171 struct ifmcaddr6 *mc_list;
170 struct ifmcaddr6 *mc_tomb; 172 struct ifmcaddr6 *mc_tomb;
@@ -172,10 +174,12 @@ struct inet6_dev {
172 unsigned char mc_qrv; 174 unsigned char mc_qrv;
173 unsigned char mc_gq_running; 175 unsigned char mc_gq_running;
174 unsigned char mc_ifc_count; 176 unsigned char mc_ifc_count;
177 unsigned char mc_dad_count;
175 unsigned long mc_v1_seen; 178 unsigned long mc_v1_seen;
176 unsigned long mc_maxdelay; 179 unsigned long mc_maxdelay;
177 struct timer_list mc_gq_timer; /* general query timer */ 180 struct timer_list mc_gq_timer; /* general query timer */
178 struct timer_list mc_ifc_timer; /* interface change timer */ 181 struct timer_list mc_ifc_timer; /* interface change timer */
182 struct timer_list mc_dad_timer; /* dad complete mc timer */
179 183
180 struct ifacaddr6 *ac_list; 184 struct ifacaddr6 *ac_list;
181 rwlock_t lock; 185 rwlock_t lock;
@@ -192,9 +196,12 @@ struct inet6_dev {
192 struct in6_addr token; 196 struct in6_addr token;
193 197
194 struct neigh_parms *nd_parms; 198 struct neigh_parms *nd_parms;
195 struct inet6_dev *next;
196 struct ipv6_devconf cnf; 199 struct ipv6_devconf cnf;
197 struct ipv6_devstat stats; 200 struct ipv6_devstat stats;
201
202 struct timer_list rs_timer;
203 __u8 rs_probes;
204
198 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ 205 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */
199 struct rcu_head rcu; 206 struct rcu_head rcu;
200}; 207};
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index aab73757bc4d..3bd22795c3e2 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -134,12 +134,14 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
134{ 134{
135 switch (skb->protocol) { 135 switch (skb->protocol) {
136 case cpu_to_be16(ETH_P_IP): 136 case cpu_to_be16(ETH_P_IP):
137 if (skb->network_header + sizeof(struct iphdr) <= skb->tail) 137 if (skb_network_header(skb) + sizeof(struct iphdr) <=
138 skb_tail_pointer(skb))
138 return IP_ECN_set_ce(ip_hdr(skb)); 139 return IP_ECN_set_ce(ip_hdr(skb));
139 break; 140 break;
140 141
141 case cpu_to_be16(ETH_P_IPV6): 142 case cpu_to_be16(ETH_P_IPV6):
142 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) 143 if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
144 skb_tail_pointer(skb))
143 return IP6_ECN_set_ce(ipv6_hdr(skb)); 145 return IP6_ECN_set_ce(ipv6_hdr(skb));
144 break; 146 break;
145 } 147 }
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 7235ae73a1e8..b21a7f06d6a4 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -32,7 +32,6 @@
32 * 32 *
33 * @faddr - Saved first hop address 33 * @faddr - Saved first hop address
34 * @nexthop - Saved nexthop address in LSRR and SSRR 34 * @nexthop - Saved nexthop address in LSRR and SSRR
35 * @is_data - Options in __data, rather than skb
36 * @is_strictroute - Strict source route 35 * @is_strictroute - Strict source route
37 * @srr_is_hit - Packet destination addr was our one 36 * @srr_is_hit - Packet destination addr was our one
38 * @is_changed - IP checksum more not valid 37 * @is_changed - IP checksum more not valid
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e49db91593a9..cbf2be37c91a 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -51,11 +51,13 @@ struct rtable;
51 51
52struct fib_nh_exception { 52struct fib_nh_exception {
53 struct fib_nh_exception __rcu *fnhe_next; 53 struct fib_nh_exception __rcu *fnhe_next;
54 int fnhe_genid;
54 __be32 fnhe_daddr; 55 __be32 fnhe_daddr;
55 u32 fnhe_pmtu; 56 u32 fnhe_pmtu;
56 __be32 fnhe_gw; 57 __be32 fnhe_gw;
57 unsigned long fnhe_expires; 58 unsigned long fnhe_expires;
58 struct rtable __rcu *fnhe_rth; 59 struct rtable __rcu *fnhe_rth_input;
60 struct rtable __rcu *fnhe_rth_output;
59 unsigned long fnhe_stamp; 61 unsigned long fnhe_stamp;
60}; 62};
61 63
@@ -289,7 +291,6 @@ static inline int fib_num_tclassid_users(struct net *net)
289extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 291extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
290extern int fib_sync_down_dev(struct net_device *dev, int force); 292extern int fib_sync_down_dev(struct net_device *dev, int force);
291extern int fib_sync_down_addr(struct net *net, __be32 local); 293extern int fib_sync_down_addr(struct net *net, __be32 local);
292extern void fib_update_nh_saddrs(struct net_device *dev);
293extern int fib_sync_up(struct net_device *dev); 294extern int fib_sync_up(struct net_device *dev);
294extern void fib_select_multipath(struct fib_result *res); 295extern void fib_select_multipath(struct fib_result *res);
295 296
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 09b1360e10bf..781b3cf86a2f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -42,6 +42,7 @@ struct ip_tunnel {
42 struct ip_tunnel __rcu *next; 42 struct ip_tunnel __rcu *next;
43 struct hlist_node hash_node; 43 struct hlist_node hash_node;
44 struct net_device *dev; 44 struct net_device *dev;
45 struct net *net; /* netns for packet i/o */
45 46
46 int err_count; /* Number of arrived ICMP errors */ 47 int err_count; /* Number of arrived ICMP errors */
47 unsigned long err_time; /* Time when the last ICMP error 48 unsigned long err_time; /* Time when the last ICMP error
@@ -73,6 +74,7 @@ struct ip_tunnel {
73#define TUNNEL_REC __cpu_to_be16(0x20) 74#define TUNNEL_REC __cpu_to_be16(0x20)
74#define TUNNEL_VERSION __cpu_to_be16(0x40) 75#define TUNNEL_VERSION __cpu_to_be16(0x40)
75#define TUNNEL_NO_KEY __cpu_to_be16(0x80) 76#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
77#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
76 78
77struct tnl_ptk_info { 79struct tnl_ptk_info {
78 __be16 flags; 80 __be16 flags;
@@ -92,6 +94,8 @@ struct ip_tunnel_net {
92 struct net_device *fb_tunnel_dev; 94 struct net_device *fb_tunnel_dev;
93}; 95};
94 96
97#ifdef CONFIG_INET
98
95int ip_tunnel_init(struct net_device *dev); 99int ip_tunnel_init(struct net_device *dev);
96void ip_tunnel_uninit(struct net_device *dev); 100void ip_tunnel_uninit(struct net_device *dev);
97void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 101void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
@@ -101,7 +105,7 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
101void ip_tunnel_delete_net(struct ip_tunnel_net *itn); 105void ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102 106
103void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, 107void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104 const struct iphdr *tnl_params); 108 const struct iphdr *tnl_params, const u8 protocol);
105int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); 109int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); 110int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107 111
@@ -155,23 +159,31 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
155 (skb_shinfo(skb)->gso_segs ?: 1) - 1); 159 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
156} 160}
157 161
158static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) 162int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
159{ 163int iptunnel_xmit(struct net *net, struct rtable *rt,
160 int err; 164 struct sk_buff *skb,
161 int pkt_len = skb->len - skb_transport_offset(skb); 165 __be32 src, __be32 dst, __u8 proto,
162 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); 166 __u8 tos, __u8 ttl, __be16 df);
163 167
164 nf_reset(skb); 168static inline void iptunnel_xmit_stats(int err,
169 struct net_device_stats *err_stats,
170 struct pcpu_tstats __percpu *stats)
171{
172 if (err > 0) {
173 struct pcpu_tstats *tstats = this_cpu_ptr(stats);
165 174
166 err = ip_local_out(skb);
167 if (likely(net_xmit_eval(err) == 0)) {
168 u64_stats_update_begin(&tstats->syncp); 175 u64_stats_update_begin(&tstats->syncp);
169 tstats->tx_bytes += pkt_len; 176 tstats->tx_bytes += err;
170 tstats->tx_packets++; 177 tstats->tx_packets++;
171 u64_stats_update_end(&tstats->syncp); 178 u64_stats_update_end(&tstats->syncp);
179 } else if (err < 0) {
180 err_stats->tx_errors++;
181 err_stats->tx_aborted_errors++;
172 } else { 182 } else {
173 dev->stats.tx_errors++; 183 err_stats->tx_dropped++;
174 dev->stats.tx_aborted_errors++;
175 } 184 }
176} 185}
186
187#endif /* CONFIG_INET */
188
177#endif /* __NET_IP_TUNNELS_H */ 189#endif /* __NET_IP_TUNNELS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4c062ccff9aa..f0d70f066f3d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -197,31 +197,6 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
197 } 197 }
198} 198}
199 199
200/* This function is a faster version of ip_vs_fill_iph_skb().
201 * Where we only populate {s,d}addr (and avoid calling ipv6_find_hdr()).
202 * This is used by the some of the ip_vs_*_schedule() functions.
203 * (Mostly done to avoid ABI breakage of external schedulers)
204 */
205static inline void
206ip_vs_fill_iph_addr_only(int af, const struct sk_buff *skb,
207 struct ip_vs_iphdr *iphdr)
208{
209#ifdef CONFIG_IP_VS_IPV6
210 if (af == AF_INET6) {
211 const struct ipv6hdr *iph =
212 (struct ipv6hdr *)skb_network_header(skb);
213 iphdr->saddr.in6 = iph->saddr;
214 iphdr->daddr.in6 = iph->daddr;
215 } else
216#endif
217 {
218 const struct iphdr *iph =
219 (struct iphdr *)skb_network_header(skb);
220 iphdr->saddr.ip = iph->saddr;
221 iphdr->daddr.ip = iph->daddr;
222 }
223}
224
225static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, 200static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
226 const union nf_inet_addr *src) 201 const union nf_inet_addr *src)
227{ 202{
@@ -405,17 +380,18 @@ enum {
405 */ 380 */
406enum ip_vs_sctp_states { 381enum ip_vs_sctp_states {
407 IP_VS_SCTP_S_NONE, 382 IP_VS_SCTP_S_NONE,
408 IP_VS_SCTP_S_INIT_CLI, 383 IP_VS_SCTP_S_INIT1,
409 IP_VS_SCTP_S_INIT_SER, 384 IP_VS_SCTP_S_INIT,
410 IP_VS_SCTP_S_INIT_ACK_CLI, 385 IP_VS_SCTP_S_COOKIE_SENT,
411 IP_VS_SCTP_S_INIT_ACK_SER, 386 IP_VS_SCTP_S_COOKIE_REPLIED,
412 IP_VS_SCTP_S_ECHO_CLI, 387 IP_VS_SCTP_S_COOKIE_WAIT,
413 IP_VS_SCTP_S_ECHO_SER, 388 IP_VS_SCTP_S_COOKIE,
389 IP_VS_SCTP_S_COOKIE_ECHOED,
414 IP_VS_SCTP_S_ESTABLISHED, 390 IP_VS_SCTP_S_ESTABLISHED,
415 IP_VS_SCTP_S_SHUT_CLI, 391 IP_VS_SCTP_S_SHUTDOWN_SENT,
416 IP_VS_SCTP_S_SHUT_SER, 392 IP_VS_SCTP_S_SHUTDOWN_RECEIVED,
417 IP_VS_SCTP_S_SHUT_ACK_CLI, 393 IP_VS_SCTP_S_SHUTDOWN_ACK_SENT,
418 IP_VS_SCTP_S_SHUT_ACK_SER, 394 IP_VS_SCTP_S_REJECTED,
419 IP_VS_SCTP_S_CLOSED, 395 IP_VS_SCTP_S_CLOSED,
420 IP_VS_SCTP_S_LAST 396 IP_VS_SCTP_S_LAST
421}; 397};
@@ -814,7 +790,8 @@ struct ip_vs_scheduler {
814 790
815 /* selecting a server from the given service */ 791 /* selecting a server from the given service */
816 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, 792 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
817 const struct sk_buff *skb); 793 const struct sk_buff *skb,
794 struct ip_vs_iphdr *iph);
818}; 795};
819 796
820/* The persistence engine object */ 797/* The persistence engine object */
@@ -905,7 +882,7 @@ struct ip_vs_app {
905struct ipvs_master_sync_state { 882struct ipvs_master_sync_state {
906 struct list_head sync_queue; 883 struct list_head sync_queue;
907 struct ip_vs_sync_buff *sync_buff; 884 struct ip_vs_sync_buff *sync_buff;
908 int sync_queue_len; 885 unsigned long sync_queue_len;
909 unsigned int sync_queue_delay; 886 unsigned int sync_queue_delay;
910 struct task_struct *master_thread; 887 struct task_struct *master_thread;
911 struct delayed_work master_wakeup_work; 888 struct delayed_work master_wakeup_work;
@@ -998,10 +975,13 @@ struct netns_ipvs {
998 int sysctl_snat_reroute; 975 int sysctl_snat_reroute;
999 int sysctl_sync_ver; 976 int sysctl_sync_ver;
1000 int sysctl_sync_ports; 977 int sysctl_sync_ports;
1001 int sysctl_sync_qlen_max; 978 int sysctl_sync_persist_mode;
979 unsigned long sysctl_sync_qlen_max;
1002 int sysctl_sync_sock_size; 980 int sysctl_sync_sock_size;
1003 int sysctl_cache_bypass; 981 int sysctl_cache_bypass;
1004 int sysctl_expire_nodest_conn; 982 int sysctl_expire_nodest_conn;
983 int sysctl_sloppy_tcp;
984 int sysctl_sloppy_sctp;
1005 int sysctl_expire_quiescent_template; 985 int sysctl_expire_quiescent_template;
1006 int sysctl_sync_threshold[2]; 986 int sysctl_sync_threshold[2];
1007 unsigned int sysctl_sync_refresh_period; 987 unsigned int sysctl_sync_refresh_period;
@@ -1044,6 +1024,8 @@ struct netns_ipvs {
1044#define DEFAULT_SYNC_THRESHOLD 3 1024#define DEFAULT_SYNC_THRESHOLD 3
1045#define DEFAULT_SYNC_PERIOD 50 1025#define DEFAULT_SYNC_PERIOD 50
1046#define DEFAULT_SYNC_VER 1 1026#define DEFAULT_SYNC_VER 1
1027#define DEFAULT_SLOPPY_TCP 0
1028#define DEFAULT_SLOPPY_SCTP 0
1047#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ) 1029#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ)
1048#define DEFAULT_SYNC_RETRIES 0 1030#define DEFAULT_SYNC_RETRIES 0
1049#define IPVS_SYNC_WAKEUP_RATE 8 1031#define IPVS_SYNC_WAKEUP_RATE 8
@@ -1080,12 +1062,27 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
1080 return ipvs->sysctl_sync_ver; 1062 return ipvs->sysctl_sync_ver;
1081} 1063}
1082 1064
1065static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs)
1066{
1067 return ipvs->sysctl_sloppy_tcp;
1068}
1069
1070static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs)
1071{
1072 return ipvs->sysctl_sloppy_sctp;
1073}
1074
1083static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) 1075static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1084{ 1076{
1085 return ACCESS_ONCE(ipvs->sysctl_sync_ports); 1077 return ACCESS_ONCE(ipvs->sysctl_sync_ports);
1086} 1078}
1087 1079
1088static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs) 1080static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs)
1081{
1082 return ipvs->sysctl_sync_persist_mode;
1083}
1084
1085static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1089{ 1086{
1090 return ipvs->sysctl_sync_qlen_max; 1087 return ipvs->sysctl_sync_qlen_max;
1091} 1088}
@@ -1133,12 +1130,27 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
1133 return DEFAULT_SYNC_VER; 1130 return DEFAULT_SYNC_VER;
1134} 1131}
1135 1132
1133static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs)
1134{
1135 return DEFAULT_SLOPPY_TCP;
1136}
1137
1138static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs)
1139{
1140 return DEFAULT_SLOPPY_SCTP;
1141}
1142
1136static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) 1143static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1137{ 1144{
1138 return 1; 1145 return 1;
1139} 1146}
1140 1147
1141static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs) 1148static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs)
1149{
1150 return 0;
1151}
1152
1153static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1142{ 1154{
1143 return IPVS_SYNC_QLEN_MAX; 1155 return IPVS_SYNC_QLEN_MAX;
1144} 1156}
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 0810aa57c780..5fe564985171 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -260,6 +260,12 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
260 260
261extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 261extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
262 262
263int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
264 struct icmp6hdr *thdr, int len);
265
266struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
267 struct sock *sk, struct flowi6 *fl6);
268
263extern int ip6_ra_control(struct sock *sk, int sel); 269extern int ip6_ra_control(struct sock *sk, int sel);
264 270
265extern int ipv6_parse_hopopts(struct sk_buff *skb); 271extern int ipv6_parse_hopopts(struct sk_buff *skb);
@@ -853,8 +859,8 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
853#endif 859#endif
854 860
855#ifdef CONFIG_SYSCTL 861#ifdef CONFIG_SYSCTL
856extern ctl_table ipv6_route_table_template[]; 862extern struct ctl_table ipv6_route_table_template[];
857extern ctl_table ipv6_icmp_table_template[]; 863extern struct ctl_table ipv6_icmp_table_template[];
858 864
859extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 865extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
860extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 866extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a40d13..5b7a3dadadde 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -217,8 +217,8 @@ struct ieee80211_chanctx_conf {
217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface 217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
218 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) 218 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
219 * changed (currently only in P2P client mode, GO mode will be later) 219 * changed (currently only in P2P client mode, GO mode will be later)
220 * @BSS_CHANGED_DTIM_PERIOD: the DTIM period value was changed (set when 220 * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available:
221 * it becomes valid, managed mode only) 221 * currently dtim_period only is under consideration.
222 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, 222 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
223 * note that this is only called when it changes after the channel 223 * note that this is only called when it changes after the channel
224 * context had been assigned. 224 * context had been assigned.
@@ -244,7 +244,7 @@ enum ieee80211_bss_change {
244 BSS_CHANGED_PS = 1<<17, 244 BSS_CHANGED_PS = 1<<17,
245 BSS_CHANGED_TXPOWER = 1<<18, 245 BSS_CHANGED_TXPOWER = 1<<18,
246 BSS_CHANGED_P2P_PS = 1<<19, 246 BSS_CHANGED_P2P_PS = 1<<19,
247 BSS_CHANGED_DTIM_PERIOD = 1<<20, 247 BSS_CHANGED_BEACON_INFO = 1<<20,
248 BSS_CHANGED_BANDWIDTH = 1<<21, 248 BSS_CHANGED_BANDWIDTH = 1<<21,
249 249
250 /* when adding here, make sure to change ieee80211_reconfig */ 250 /* when adding here, make sure to change ieee80211_reconfig */
@@ -288,7 +288,7 @@ enum ieee80211_rssi_event {
288 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 288 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
289 * @dtim_period: num of beacons before the next DTIM, for beaconing, 289 * @dtim_period: num of beacons before the next DTIM, for beaconing,
290 * valid in station mode only if after the driver was notified 290 * valid in station mode only if after the driver was notified
291 * with the %BSS_CHANGED_DTIM_PERIOD flag, will be non-zero then. 291 * with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
292 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old 292 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
293 * as it may have been received during scanning long ago). If the 293 * as it may have been received during scanning long ago). If the
294 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can 294 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
@@ -305,6 +305,7 @@ enum ieee80211_rssi_event {
305 * @basic_rates: bitmap of basic rates, each bit stands for an 305 * @basic_rates: bitmap of basic rates, each bit stands for an
306 * index into the rate table configured by the driver in 306 * index into the rate table configured by the driver in
307 * the current band. 307 * the current band.
308 * @beacon_rate: associated AP's beacon TX rate
308 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 309 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
309 * @bssid: The BSSID for this BSS 310 * @bssid: The BSSID for this BSS
310 * @enable_beacon: whether beaconing should be enabled or not 311 * @enable_beacon: whether beaconing should be enabled or not
@@ -352,6 +353,7 @@ struct ieee80211_bss_conf {
352 u32 sync_device_ts; 353 u32 sync_device_ts;
353 u8 sync_dtim_count; 354 u8 sync_dtim_count;
354 u32 basic_rates; 355 u32 basic_rates;
356 struct ieee80211_rate *beacon_rate;
355 int mcast_rate[IEEE80211_NUM_BANDS]; 357 int mcast_rate[IEEE80211_NUM_BANDS];
356 u16 ht_operation_mode; 358 u16 ht_operation_mode;
357 s32 cqm_rssi_thold; 359 s32 cqm_rssi_thold;
@@ -460,6 +462,8 @@ struct ieee80211_bss_conf {
460 * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it 462 * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
461 * would be fragmented by size (this is optional, only used for 463 * would be fragmented by size (this is optional, only used for
462 * monitor injection). 464 * monitor injection).
465 * @IEEE80211_TX_CTL_PS_RESPONSE: This frame is a response to a poll
466 * frame (PS-Poll or uAPSD).
463 * 467 *
464 * Note: If you have to add new flags to the enumeration, then don't 468 * Note: If you have to add new flags to the enumeration, then don't
465 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. 469 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
@@ -495,6 +499,7 @@ enum mac80211_tx_control_flags {
495 IEEE80211_TX_STATUS_EOSP = BIT(28), 499 IEEE80211_TX_STATUS_EOSP = BIT(28),
496 IEEE80211_TX_CTL_USE_MINRATE = BIT(29), 500 IEEE80211_TX_CTL_USE_MINRATE = BIT(29),
497 IEEE80211_TX_CTL_DONTFRAG = BIT(30), 501 IEEE80211_TX_CTL_DONTFRAG = BIT(30),
502 IEEE80211_TX_CTL_PS_RESPONSE = BIT(31),
498}; 503};
499 504
500#define IEEE80211_TX_CTL_STBC_SHIFT 23 505#define IEEE80211_TX_CTL_STBC_SHIFT 23
@@ -805,6 +810,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
805 * on this subframe 810 * on this subframe
806 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 811 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
807 * is stored in the @ampdu_delimiter_crc field) 812 * is stored in the @ampdu_delimiter_crc field)
813 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
808 */ 814 */
809enum mac80211_rx_flags { 815enum mac80211_rx_flags {
810 RX_FLAG_MMIC_ERROR = BIT(0), 816 RX_FLAG_MMIC_ERROR = BIT(0),
@@ -832,8 +838,11 @@ enum mac80211_rx_flags {
832 RX_FLAG_80MHZ = BIT(23), 838 RX_FLAG_80MHZ = BIT(23),
833 RX_FLAG_80P80MHZ = BIT(24), 839 RX_FLAG_80P80MHZ = BIT(24),
834 RX_FLAG_160MHZ = BIT(25), 840 RX_FLAG_160MHZ = BIT(25),
841 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
835}; 842};
836 843
844#define RX_FLAG_STBC_SHIFT 26
845
837/** 846/**
838 * struct ieee80211_rx_status - receive status 847 * struct ieee80211_rx_status - receive status
839 * 848 *
@@ -850,6 +859,10 @@ enum mac80211_rx_flags {
850 * @signal: signal strength when receiving this frame, either in dBm, in dB or 859 * @signal: signal strength when receiving this frame, either in dBm, in dB or
851 * unspecified depending on the hardware capabilities flags 860 * unspecified depending on the hardware capabilities flags
852 * @IEEE80211_HW_SIGNAL_* 861 * @IEEE80211_HW_SIGNAL_*
862 * @chains: bitmask of receive chains for which separate signal strength
863 * values were filled.
864 * @chain_signal: per-chain signal strength, in dBm (unlike @signal, doesn't
865 * support dB or unspecified units)
853 * @antenna: antenna used 866 * @antenna: antenna used
854 * @rate_idx: index of data rate into band's supported rates or MCS index if 867 * @rate_idx: index of data rate into band's supported rates or MCS index if
855 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 868 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
@@ -881,6 +894,8 @@ struct ieee80211_rx_status {
881 u8 band; 894 u8 band;
882 u8 antenna; 895 u8 antenna;
883 s8 signal; 896 s8 signal;
897 u8 chains;
898 s8 chain_signal[IEEE80211_MAX_CHAINS];
884 u8 ampdu_delimiter_crc; 899 u8 ampdu_delimiter_crc;
885 u8 vendor_radiotap_align; 900 u8 vendor_radiotap_align;
886 u8 vendor_radiotap_oui[3]; 901 u8 vendor_radiotap_oui[3];
@@ -1235,7 +1250,7 @@ enum ieee80211_sta_rx_bandwidth {
1235 * struct ieee80211_sta_rates - station rate selection table 1250 * struct ieee80211_sta_rates - station rate selection table
1236 * 1251 *
1237 * @rcu_head: RCU head used for freeing the table on update 1252 * @rcu_head: RCU head used for freeing the table on update
1238 * @rates: transmit rates/flags to be used by default. 1253 * @rate: transmit rates/flags to be used by default.
1239 * Overriding entries per-packet is possible by using cb tx control. 1254 * Overriding entries per-packet is possible by using cb tx control.
1240 */ 1255 */
1241struct ieee80211_sta_rates { 1256struct ieee80211_sta_rates {
@@ -1276,7 +1291,7 @@ struct ieee80211_sta_rates {
1276 * notifications and capabilities. The value is only valid after 1291 * notifications and capabilities. The value is only valid after
1277 * the station moves to associated state. 1292 * the station moves to associated state.
1278 * @smps_mode: current SMPS mode (off, static or dynamic) 1293 * @smps_mode: current SMPS mode (off, static or dynamic)
1279 * @tx_rates: rate control selection table 1294 * @rates: rate control selection table
1280 */ 1295 */
1281struct ieee80211_sta { 1296struct ieee80211_sta {
1282 u32 supp_rates[IEEE80211_NUM_BANDS]; 1297 u32 supp_rates[IEEE80211_NUM_BANDS];
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 745bf741e029..949d77528f2f 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -230,7 +230,7 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
230 void __user *buffer, 230 void __user *buffer,
231 size_t *lenp, 231 size_t *lenp,
232 loff_t *ppos); 232 loff_t *ppos);
233int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, 233int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
234 void __user *oldval, size_t __user *oldlenp, 234 void __user *oldval, size_t __user *oldlenp,
235 void __user *newval, size_t newlen); 235 void __user *newval, size_t newlen);
236#endif 236#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index b17697827482..84e37b1ca9e1 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -115,9 +115,12 @@ struct net {
115#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
116 struct netns_xfrm xfrm; 116 struct netns_xfrm xfrm;
117#endif 117#endif
118#if IS_ENABLED(CONFIG_IP_VS)
118 struct netns_ipvs *ipvs; 119 struct netns_ipvs *ipvs;
120#endif
119 struct sock *diag_nlsk; 121 struct sock *diag_nlsk;
120 atomic_t rt_genid; 122 atomic_t rt_genid;
123 atomic_t fnhe_genid;
121}; 124};
122 125
123/* 126/*
@@ -340,4 +343,14 @@ static inline void rt_genid_bump(struct net *net)
340 atomic_inc(&net->rt_genid); 343 atomic_inc(&net->rt_genid);
341} 344}
342 345
346static inline int fnhe_genid(struct net *net)
347{
348 return atomic_read(&net->fnhe_genid);
349}
350
351static inline void fnhe_genid_bump(struct net *net)
352{
353 atomic_inc(&net->fnhe_genid);
354}
355
343#endif /* __NET_NET_NAMESPACE_H */ 356#endif /* __NET_NET_NAMESPACE_H */
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 5a2978d1cb22..495c71f66e7e 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -6,7 +6,7 @@ struct xt_rateest {
6 struct gnet_stats_basic_packed bstats; 6 struct gnet_stats_basic_packed bstats;
7 spinlock_t lock; 7 spinlock_t lock;
8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */ 8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */
9 struct gnet_stats_rate_est rstats; 9 struct gnet_stats_rate_est64 rstats;
10 10
11 /* following fields not accessed in hot path */ 11 /* following fields not accessed in hot path */
12 struct hlist_node list; 12 struct hlist_node list;
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index c24060ee411e..02fe40f8c8fd 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -15,5 +15,11 @@ struct netns_xt {
15 struct ebt_table *frame_filter; 15 struct ebt_table *frame_filter;
16 struct ebt_table *frame_nat; 16 struct ebt_table *frame_nat;
17#endif 17#endif
18#if IS_ENABLED(CONFIG_IP_NF_TARGET_ULOG)
19 bool ulog_warn_deprecated;
20#endif
21#if IS_ENABLED(CONFIG_BRIDGE_EBT_ULOG)
22 bool ebt_ulog_warn_deprecated;
23#endif
18}; 24};
19#endif 25#endif
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b87a1692b086..0af851c3b038 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -59,8 +59,10 @@ struct nfc_hci_ops {
59 struct nfc_target *target); 59 struct nfc_target *target);
60 int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, 60 int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
61 struct sk_buff *skb); 61 struct sk_buff *skb);
62 int (*enable_se)(struct nfc_dev *dev, u32 secure_element); 62 int (*fw_upload)(struct nfc_hci_dev *hdev, const char *firmware_name);
63 int (*disable_se)(struct nfc_dev *dev, u32 secure_element); 63 int (*discover_se)(struct nfc_hci_dev *dev);
64 int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
65 int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
64}; 66};
65 67
66/* Pipes */ 68/* Pipes */
@@ -152,7 +154,6 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
152 struct nfc_hci_init_data *init_data, 154 struct nfc_hci_init_data *init_data,
153 unsigned long quirks, 155 unsigned long quirks,
154 u32 protocols, 156 u32 protocols,
155 u32 supported_se,
156 const char *llc_name, 157 const char *llc_name,
157 int tx_headroom, 158 int tx_headroom,
158 int tx_tailroom, 159 int tx_tailroom,
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 5bc0c460edc0..99fc1f3a392a 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -3,6 +3,7 @@
3 * NFC Controller (NFCC) and a Device Host (DH). 3 * NFC Controller (NFCC) and a Device Host (DH).
4 * 4 *
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011 Texas Instruments, Inc.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 7 *
7 * Written by Ilan Elias <ilane@ti.com> 8 * Written by Ilan Elias <ilane@ti.com>
8 * 9 *
@@ -66,7 +67,7 @@ struct nci_dev;
66struct nci_ops { 67struct nci_ops {
67 int (*open)(struct nci_dev *ndev); 68 int (*open)(struct nci_dev *ndev);
68 int (*close)(struct nci_dev *ndev); 69 int (*close)(struct nci_dev *ndev);
69 int (*send)(struct sk_buff *skb); 70 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
70}; 71};
71 72
72#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 73#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
@@ -147,13 +148,12 @@ struct nci_dev {
147/* ----- NCI Devices ----- */ 148/* ----- NCI Devices ----- */
148struct nci_dev *nci_allocate_device(struct nci_ops *ops, 149struct nci_dev *nci_allocate_device(struct nci_ops *ops,
149 __u32 supported_protocols, 150 __u32 supported_protocols,
150 __u32 supported_se,
151 int tx_headroom, 151 int tx_headroom,
152 int tx_tailroom); 152 int tx_tailroom);
153void nci_free_device(struct nci_dev *ndev); 153void nci_free_device(struct nci_dev *ndev);
154int nci_register_device(struct nci_dev *ndev); 154int nci_register_device(struct nci_dev *ndev);
155void nci_unregister_device(struct nci_dev *ndev); 155void nci_unregister_device(struct nci_dev *ndev);
156int nci_recv_frame(struct sk_buff *skb); 156int nci_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
157 157
158static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, 158static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
159 unsigned int len, 159 unsigned int len,
@@ -202,4 +202,56 @@ void nci_req_complete(struct nci_dev *ndev, int result);
202/* ----- NCI status code ----- */ 202/* ----- NCI status code ----- */
203int nci_to_errno(__u8 code); 203int nci_to_errno(__u8 code);
204 204
205/* ----- NCI over SPI acknowledge modes ----- */
206#define NCI_SPI_CRC_DISABLED 0x00
207#define NCI_SPI_CRC_ENABLED 0x01
208
209/* ----- NCI SPI structures ----- */
210struct nci_spi_dev;
211
212struct nci_spi_ops {
213 int (*open)(struct nci_spi_dev *ndev);
214 int (*close)(struct nci_spi_dev *ndev);
215 void (*assert_int)(struct nci_spi_dev *ndev);
216 void (*deassert_int)(struct nci_spi_dev *ndev);
217};
218
219struct nci_spi_dev {
220 struct nci_dev *nci_dev;
221 struct spi_device *spi;
222 struct nci_spi_ops *ops;
223
224 unsigned int xfer_udelay; /* microseconds delay between
225 transactions */
226 u8 acknowledge_mode;
227
228 struct completion req_completion;
229 u8 req_result;
230
231 void *driver_data;
232};
233
234/* ----- NCI SPI Devices ----- */
235struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi,
236 struct nci_spi_ops *ops,
237 u32 supported_protocols,
238 u32 supported_se,
239 u8 acknowledge_mode,
240 unsigned int delay);
241void nci_spi_free_device(struct nci_spi_dev *ndev);
242int nci_spi_register_device(struct nci_spi_dev *ndev);
243void nci_spi_unregister_device(struct nci_spi_dev *ndev);
244int nci_spi_recv_frame(struct nci_spi_dev *ndev);
245
246static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
247 void *data)
248{
249 ndev->driver_data = data;
250}
251
252static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
253{
254 return ndev->driver_data;
255}
256
205#endif /* __NCI_CORE_H */ 257#endif /* __NCI_CORE_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 5eb80bb3cbb2..0e353f1658bb 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -68,8 +68,12 @@ struct nfc_ops {
68 void *cb_context); 68 void *cb_context);
69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); 69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); 70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
71 int (*enable_se)(struct nfc_dev *dev, u32 secure_element); 71 int (*fw_upload)(struct nfc_dev *dev, const char *firmware_name);
72 int (*disable_se)(struct nfc_dev *dev, u32 secure_element); 72
73 /* Secure Element API */
74 int (*discover_se)(struct nfc_dev *dev);
75 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
76 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
73}; 77};
74 78
75#define NFC_TARGET_IDX_ANY -1 79#define NFC_TARGET_IDX_ANY -1
@@ -83,6 +87,8 @@ struct nfc_target {
83 u8 sel_res; 87 u8 sel_res;
84 u8 nfcid1_len; 88 u8 nfcid1_len;
85 u8 nfcid1[NFC_NFCID1_MAXSIZE]; 89 u8 nfcid1[NFC_NFCID1_MAXSIZE];
90 u8 nfcid2_len;
91 u8 nfcid2[NFC_NFCID2_MAXSIZE];
86 u8 sensb_res_len; 92 u8 sensb_res_len;
87 u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; 93 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
88 u8 sensf_res_len; 94 u8 sensf_res_len;
@@ -91,6 +97,23 @@ struct nfc_target {
91 u8 logical_idx; 97 u8 logical_idx;
92}; 98};
93 99
100/**
101 * nfc_se - A structure for NFC accessible secure elements.
102 *
103 * @idx: The secure element index. User space will enable or
104 * disable a secure element by its index.
105 * @type: The secure element type. It can be SE_UICC or
106 * SE_EMBEDDED.
107 * @state: The secure element state, either enabled or disabled.
108 *
109 */
110struct nfc_se {
111 struct list_head list;
112 u32 idx;
113 u16 type;
114 u16 state;
115};
116
94struct nfc_genl_data { 117struct nfc_genl_data {
95 u32 poll_req_portid; 118 u32 poll_req_portid;
96 struct mutex genl_data_mutex; 119 struct mutex genl_data_mutex;
@@ -104,6 +127,7 @@ struct nfc_dev {
104 int targets_generation; 127 int targets_generation;
105 struct device dev; 128 struct device dev;
106 bool dev_up; 129 bool dev_up;
130 bool fw_upload_in_progress;
107 u8 rf_mode; 131 u8 rf_mode;
108 bool polling; 132 bool polling;
109 struct nfc_target *active_target; 133 struct nfc_target *active_target;
@@ -111,8 +135,7 @@ struct nfc_dev {
111 struct nfc_genl_data genl_data; 135 struct nfc_genl_data genl_data;
112 u32 supported_protocols; 136 u32 supported_protocols;
113 137
114 u32 supported_se; 138 struct list_head secure_elements;
115 u32 active_se;
116 139
117 int tx_headroom; 140 int tx_headroom;
118 int tx_tailroom; 141 int tx_tailroom;
@@ -132,7 +155,6 @@ extern struct class nfc_class;
132 155
133struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 156struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
134 u32 supported_protocols, 157 u32 supported_protocols,
135 u32 supported_se,
136 int tx_headroom, 158 int tx_headroom,
137 int tx_tailroom); 159 int tx_tailroom);
138 160
@@ -216,4 +238,7 @@ int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb);
216 238
217void nfc_driver_failure(struct nfc_dev *dev, int err); 239void nfc_driver_failure(struct nfc_dev *dev, int err);
218 240
241int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
242int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
243
219#endif /* __NET_NFC_H */ 244#endif /* __NET_NFC_H */
diff --git a/include/net/ping.h b/include/net/ping.h
index 682b5ae9af51..5db0224b73ac 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -13,6 +13,7 @@
13#ifndef _PING_H 13#ifndef _PING_H
14#define _PING_H 14#define _PING_H
15 15
16#include <net/icmp.h>
16#include <net/netns/hash.h> 17#include <net/netns/hash.h>
17 18
18/* PING_HTABLE_SIZE must be power of 2 */ 19/* PING_HTABLE_SIZE must be power of 2 */
@@ -28,6 +29,18 @@
28 */ 29 */
29#define GID_T_MAX (((gid_t)~0U) >> 1) 30#define GID_T_MAX (((gid_t)~0U) >> 1)
30 31
32/* Compatibility glue so we can support IPv6 when it's compiled as a module */
33struct pingv6_ops {
34 int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len);
35 int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg,
36 struct sk_buff *skb);
37 int (*icmpv6_err_convert)(u8 type, u8 code, int *err);
38 void (*ipv6_icmp_error)(struct sock *sk, struct sk_buff *skb, int err,
39 __be16 port, u32 info, u8 *payload);
40 int (*ipv6_chk_addr)(struct net *net, const struct in6_addr *addr,
41 const struct net_device *dev, int strict);
42};
43
31struct ping_table { 44struct ping_table {
32 struct hlist_nulls_head hash[PING_HTABLE_SIZE]; 45 struct hlist_nulls_head hash[PING_HTABLE_SIZE];
33 rwlock_t lock; 46 rwlock_t lock;
@@ -36,20 +49,66 @@ struct ping_table {
36struct ping_iter_state { 49struct ping_iter_state {
37 struct seq_net_private p; 50 struct seq_net_private p;
38 int bucket; 51 int bucket;
52 sa_family_t family;
39}; 53};
40 54
41extern struct proto ping_prot; 55extern struct proto ping_prot;
56extern struct ping_table ping_table;
57#if IS_ENABLED(CONFIG_IPV6)
58extern struct pingv6_ops pingv6_ops;
59#endif
60
61struct pingfakehdr {
62 struct icmphdr icmph;
63 struct iovec *iov;
64 sa_family_t family;
65 __wsum wcheck;
66};
67
68int ping_get_port(struct sock *sk, unsigned short ident);
69void ping_hash(struct sock *sk);
70void ping_unhash(struct sock *sk);
42 71
72int ping_init_sock(struct sock *sk);
73void ping_close(struct sock *sk, long timeout);
74int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len);
75void ping_err(struct sk_buff *skb, int offset, u32 info);
76int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd,
77 struct sk_buff *);
43 78
44extern void ping_rcv(struct sk_buff *); 79int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
45extern void ping_err(struct sk_buff *, u32 info); 80 size_t len, int noblock, int flags, int *addr_len);
81int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
82 void *user_icmph, size_t icmph_len);
83int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
84 size_t len);
85int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
86 size_t len);
87int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
88void ping_rcv(struct sk_buff *skb);
46 89
47#ifdef CONFIG_PROC_FS 90#ifdef CONFIG_PROC_FS
91struct ping_seq_afinfo {
92 char *name;
93 sa_family_t family;
94 const struct file_operations *seq_fops;
95 const struct seq_operations seq_ops;
96};
97
98extern const struct file_operations ping_seq_fops;
99
100void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family);
101void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos);
102void ping_seq_stop(struct seq_file *seq, void *v);
103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo);
104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo);
105
48extern int __init ping_proc_init(void); 106extern int __init ping_proc_init(void);
49extern void ping_proc_exit(void); 107extern void ping_proc_exit(void);
50#endif 108#endif
51 109
52void __init ping_init(void); 110void __init ping_init(void);
53 111int __init pingv6_init(void);
112void pingv6_exit(void);
54 113
55#endif /* _PING_H */ 114#endif /* _PING_H */
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e7f4e21cc3e1..6eab63363e59 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -58,14 +58,12 @@ struct Qdisc {
58 * multiqueue device. 58 * multiqueue device.
59 */ 59 */
60#define TCQ_F_WARN_NONWC (1 << 16) 60#define TCQ_F_WARN_NONWC (1 << 16)
61 int padded; 61 u32 limit;
62 const struct Qdisc_ops *ops; 62 const struct Qdisc_ops *ops;
63 struct qdisc_size_table __rcu *stab; 63 struct qdisc_size_table __rcu *stab;
64 struct list_head list; 64 struct list_head list;
65 u32 handle; 65 u32 handle;
66 u32 parent; 66 u32 parent;
67 atomic_t refcnt;
68 struct gnet_stats_rate_est rate_est;
69 int (*reshape_fail)(struct sk_buff *skb, 67 int (*reshape_fail)(struct sk_buff *skb,
70 struct Qdisc *q); 68 struct Qdisc *q);
71 69
@@ -76,8 +74,9 @@ struct Qdisc {
76 */ 74 */
77 struct Qdisc *__parent; 75 struct Qdisc *__parent;
78 struct netdev_queue *dev_queue; 76 struct netdev_queue *dev_queue;
79 struct Qdisc *next_sched;
80 77
78 struct gnet_stats_rate_est64 rate_est;
79 struct Qdisc *next_sched;
81 struct sk_buff *gso_skb; 80 struct sk_buff *gso_skb;
82 /* 81 /*
83 * For performance sake on SMP, we put highly modified fields at the end 82 * For performance sake on SMP, we put highly modified fields at the end
@@ -88,8 +87,10 @@ struct Qdisc {
88 unsigned int __state; 87 unsigned int __state;
89 struct gnet_stats_queue qstats; 88 struct gnet_stats_queue qstats;
90 struct rcu_head rcu_head; 89 struct rcu_head rcu_head;
91 spinlock_t busylock; 90 int padded;
92 u32 limit; 91 atomic_t refcnt;
92
93 spinlock_t busylock ____cacheline_aligned_in_smp;
93}; 94};
94 95
95static inline bool qdisc_is_running(const struct Qdisc *qdisc) 96static inline bool qdisc_is_running(const struct Qdisc *qdisc)
@@ -679,7 +680,7 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
679#endif 680#endif
680 681
681struct psched_ratecfg { 682struct psched_ratecfg {
682 u64 rate_bps; 683 u64 rate_bytes_ps; /* bytes per second */
683 u32 mult; 684 u32 mult;
684 u16 overhead; 685 u16 overhead;
685 u8 shift; 686 u8 shift;
@@ -697,7 +698,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
697 const struct psched_ratecfg *r) 698 const struct psched_ratecfg *r)
698{ 699{
699 memset(res, 0, sizeof(*res)); 700 memset(res, 0, sizeof(*res));
700 res->rate = r->rate_bps >> 3; 701 res->rate = r->rate_bytes_ps;
701 res->overhead = r->overhead; 702 res->overhead = r->overhead;
702} 703}
703 704
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 5a2110d3176d..0cb08e6fb6df 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -42,6 +42,9 @@
42 * be incorporated into the next SCTP release. 42 * be incorporated into the next SCTP release.
43 */ 43 */
44 44
45#ifndef __sctp_checksum_h__
46#define __sctp_checksum_h__
47
45#include <linux/types.h> 48#include <linux/types.h>
46#include <net/sctp/sctp.h> 49#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 50#include <linux/crc32c.h>
@@ -81,3 +84,5 @@ static inline __le32 sctp_end_cksum(__u32 crc32)
81{ 84{
82 return cpu_to_le32(~crc32); 85 return cpu_to_le32(~crc32);
83} 86}
87
88#endif /* __sctp_checksum_h__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index cd89510eab2a..d8e37ecea691 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -83,30 +83,12 @@
83#include <net/sctp/structs.h> 83#include <net/sctp/structs.h>
84#include <net/sctp/constants.h> 84#include <net/sctp/constants.h>
85 85
86
87/* Set SCTP_DEBUG flag via config if not already set. */
88#ifndef SCTP_DEBUG
89#ifdef CONFIG_SCTP_DBG_MSG
90#define SCTP_DEBUG 1
91#else
92#define SCTP_DEBUG 0
93#endif /* CONFIG_SCTP_DBG */
94#endif /* SCTP_DEBUG */
95
96#ifdef CONFIG_IP_SCTP_MODULE 86#ifdef CONFIG_IP_SCTP_MODULE
97#define SCTP_PROTOSW_FLAG 0 87#define SCTP_PROTOSW_FLAG 0
98#else /* static! */ 88#else /* static! */
99#define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT 89#define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT
100#endif 90#endif
101 91
102
103/* Certain internal static functions need to be exported when
104 * compiled into the test frame.
105 */
106#ifndef SCTP_STATIC
107#define SCTP_STATIC static
108#endif
109
110/* 92/*
111 * Function declarations. 93 * Function declarations.
112 */ 94 */
@@ -196,11 +178,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
196 * Section: Macros, externs, and inlines 178 * Section: Macros, externs, and inlines
197 */ 179 */
198 180
199
200#ifdef TEST_FRAME
201#include <test_frame.h>
202#else
203
204/* spin lock wrappers. */ 181/* spin lock wrappers. */
205#define sctp_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags) 182#define sctp_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags)
206#define sctp_spin_unlock_irqrestore(lock, flags) \ 183#define sctp_spin_unlock_irqrestore(lock, flags) \
@@ -226,8 +203,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
226#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field) 203#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
227#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field) 204#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
228 205
229#endif /* !TEST_FRAME */
230
231/* sctp mib definitions */ 206/* sctp mib definitions */
232enum { 207enum {
233 SCTP_MIB_NUM = 0, 208 SCTP_MIB_NUM = 0,
@@ -285,61 +260,6 @@ static inline void sctp_max_rto(struct sctp_association *asoc,
285 } 260 }
286} 261}
287 262
288/* Print debugging messages. */
289#if SCTP_DEBUG
290extern int sctp_debug_flag;
291#define SCTP_DEBUG_PRINTK(fmt, args...) \
292do { \
293 if (sctp_debug_flag) \
294 printk(KERN_DEBUG pr_fmt(fmt), ##args); \
295} while (0)
296#define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \
297do { \
298 if (sctp_debug_flag) \
299 pr_cont(fmt, ##args); \
300} while (0)
301#define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \
302 args_lead, addr, args_trail...) \
303do { \
304 const union sctp_addr *_addr = (addr); \
305 if (sctp_debug_flag) { \
306 if (_addr->sa.sa_family == AF_INET6) { \
307 printk(KERN_DEBUG \
308 pr_fmt(fmt_lead "%pI6" fmt_trail), \
309 args_lead, \
310 &_addr->v6.sin6_addr, \
311 args_trail); \
312 } else { \
313 printk(KERN_DEBUG \
314 pr_fmt(fmt_lead "%pI4" fmt_trail), \
315 args_lead, \
316 &_addr->v4.sin_addr.s_addr, \
317 args_trail); \
318 } \
319 } \
320} while (0)
321#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
322#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
323
324#define SCTP_ASSERT(expr, str, func) \
325 if (!(expr)) { \
326 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \
327 str, (#expr), __FILE__, __func__, __LINE__); \
328 func; \
329 }
330
331#else /* SCTP_DEBUG */
332
333#define SCTP_DEBUG_PRINTK(whatever...)
334#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)
335#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
336#define SCTP_ENABLE_DEBUG
337#define SCTP_DISABLE_DEBUG
338#define SCTP_ASSERT(expr, str, func)
339
340#endif /* SCTP_DEBUG */
341
342
343/* 263/*
344 * Macros for keeping a global reference of object allocations. 264 * Macros for keeping a global reference of object allocations.
345 */ 265 */
@@ -575,27 +495,6 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
575/* Round an int up to the next multiple of 4. */ 495/* Round an int up to the next multiple of 4. */
576#define WORD_ROUND(s) (((s)+3)&~3) 496#define WORD_ROUND(s) (((s)+3)&~3)
577 497
578/* Make a new instance of type. */
579#define t_new(type, flags) kzalloc(sizeof(type), flags)
580
581/* Compare two timevals. */
582#define tv_lt(s, t) \
583 (s.tv_sec < t.tv_sec || (s.tv_sec == t.tv_sec && s.tv_usec < t.tv_usec))
584
585/* Add tv1 to tv2. */
586#define TIMEVAL_ADD(tv1, tv2) \
587({ \
588 suseconds_t usecs = (tv2).tv_usec + (tv1).tv_usec; \
589 time_t secs = (tv2).tv_sec + (tv1).tv_sec; \
590\
591 if (usecs >= 1000000) { \
592 usecs -= 1000000; \
593 secs++; \
594 } \
595 (tv2).tv_sec = secs; \
596 (tv2).tv_usec = usecs; \
597})
598
599/* External references. */ 498/* External references. */
600 499
601extern struct proto sctp_prot; 500extern struct proto sctp_prot;
@@ -633,16 +532,6 @@ static inline int param_type2af(__be16 type)
633 } 532 }
634} 533}
635 534
636/* Perform some sanity checks. */
637static inline int sctp_sanity_check(void)
638{
639 SCTP_ASSERT(sizeof(struct sctp_ulpevent) <=
640 sizeof(((struct sk_buff *)0)->cb),
641 "SCTP: ulpevent does not fit in skb!\n", return 0);
642
643 return 1;
644}
645
646/* Warning: The following hash functions assume a power of two 'size'. */ 535/* Warning: The following hash functions assume a power of two 'size'. */
647/* This is the hash function for the SCTP port hash table. */ 536/* This is the hash function for the SCTP port hash table. */
648static inline int sctp_phashfn(struct net *net, __u16 lport) 537static inline int sctp_phashfn(struct net *net, __u16 lport)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 1bd4c4144fe8..e745c92a1532 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -54,7 +54,7 @@
54#ifndef __sctp_structs_h__ 54#ifndef __sctp_structs_h__
55#define __sctp_structs_h__ 55#define __sctp_structs_h__
56 56
57#include <linux/time.h> /* We get struct timespec. */ 57#include <linux/ktime.h>
58#include <linux/socket.h> /* linux/in.h needs this!! */ 58#include <linux/socket.h> /* linux/in.h needs this!! */
59#include <linux/in.h> /* We get struct sockaddr_in. */ 59#include <linux/in.h> /* We get struct sockaddr_in. */
60#include <linux/in6.h> /* We get struct in6_addr */ 60#include <linux/in6.h> /* We get struct in6_addr */
@@ -284,7 +284,7 @@ struct sctp_cookie {
284 __u32 peer_ttag; 284 __u32 peer_ttag;
285 285
286 /* When does this cookie expire? */ 286 /* When does this cookie expire? */
287 struct timeval expiration; 287 ktime_t expiration;
288 288
289 /* Number of inbound/outbound streams which are set 289 /* Number of inbound/outbound streams which are set
290 * and negotiated during the INIT process. 290 * and negotiated during the INIT process.
@@ -1537,7 +1537,7 @@ struct sctp_association {
1537 sctp_state_t state; 1537 sctp_state_t state;
1538 1538
1539 /* The cookie life I award for any cookie. */ 1539 /* The cookie life I award for any cookie. */
1540 struct timeval cookie_life; 1540 ktime_t cookie_life;
1541 1541
1542 /* Overall : The overall association error count. 1542 /* Overall : The overall association error count.
1543 * Error Count : [Clear this any time I get something.] 1543 * Error Count : [Clear this any time I get something.]
diff --git a/include/net/sock.h b/include/net/sock.h
index 66772cf8c3c5..95a5a2c6925a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -229,6 +229,8 @@ struct cg_proto;
229 * @sk_omem_alloc: "o" is "option" or "other" 229 * @sk_omem_alloc: "o" is "option" or "other"
230 * @sk_wmem_queued: persistent queue size 230 * @sk_wmem_queued: persistent queue size
231 * @sk_forward_alloc: space allocated forward 231 * @sk_forward_alloc: space allocated forward
232 * @sk_napi_id: id of the last napi context to receive data for sk
233 * @sk_ll_usec: usecs to busypoll when there is no data
232 * @sk_allocation: allocation mode 234 * @sk_allocation: allocation mode
233 * @sk_sndbuf: size of send buffer in bytes 235 * @sk_sndbuf: size of send buffer in bytes
234 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 236 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
@@ -325,6 +327,10 @@ struct sock {
325#ifdef CONFIG_RPS 327#ifdef CONFIG_RPS
326 __u32 sk_rxhash; 328 __u32 sk_rxhash;
327#endif 329#endif
330#ifdef CONFIG_NET_LL_RX_POLL
331 unsigned int sk_napi_id;
332 unsigned int sk_ll_usec;
333#endif
328 atomic_t sk_drops; 334 atomic_t sk_drops;
329 int sk_rcvbuf; 335 int sk_rcvbuf;
330 336
@@ -2041,18 +2047,21 @@ static inline void sk_wake_async(struct sock *sk, int how, int band)
2041 sock_wake_async(sk->sk_socket, how, band); 2047 sock_wake_async(sk->sk_socket, how, band);
2042} 2048}
2043 2049
2044#define SOCK_MIN_SNDBUF 2048 2050/* Since sk_{r,w}mem_alloc sums skb->truesize, even a small frame might
2045/* 2051 * need sizeof(sk_buff) + MTU + padding, unless net driver perform copybreak.
2046 * Since sk_rmem_alloc sums skb->truesize, even a small frame might need 2052 * Note: for send buffers, TCP works better if we can build two skbs at
2047 * sizeof(sk_buff) + MTU + padding, unless net driver perform copybreak 2053 * minimum.
2048 */ 2054 */
2049#define SOCK_MIN_RCVBUF (2048 + sizeof(struct sk_buff)) 2055#define TCP_SKB_MIN_TRUESIZE (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff)))
2056
2057#define SOCK_MIN_SNDBUF (TCP_SKB_MIN_TRUESIZE * 2)
2058#define SOCK_MIN_RCVBUF TCP_SKB_MIN_TRUESIZE
2050 2059
2051static inline void sk_stream_moderate_sndbuf(struct sock *sk) 2060static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2052{ 2061{
2053 if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { 2062 if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) {
2054 sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); 2063 sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1);
2055 sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); 2064 sk->sk_sndbuf = max_t(u32, sk->sk_sndbuf, SOCK_MIN_SNDBUF);
2056 } 2065 }
2057} 2066}
2058 2067
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5bba80fbd1d9..d1980054ec75 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -61,9 +61,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
61 */ 61 */
62#define MAX_TCP_WINDOW 32767U 62#define MAX_TCP_WINDOW 32767U
63 63
64/* Offer an initial receive window of 10 mss. */
65#define TCP_DEFAULT_INIT_RCVWND 10
66
67/* Minimal accepted MSS. It is (60+60+8) - (20+20). */ 64/* Minimal accepted MSS. It is (60+60+8) - (20+20). */
68#define TCP_MIN_MSS 88U 65#define TCP_MIN_MSS 88U
69 66
@@ -1047,6 +1044,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1047 rx_opt->num_sacks = 0; 1044 rx_opt->num_sacks = 0;
1048} 1045}
1049 1046
1047extern u32 tcp_default_init_rwnd(u32 mss);
1048
1050/* Determine a window scaling and initial window to offer. */ 1049/* Determine a window scaling and initial window to offer. */
1051extern void tcp_select_initial_window(int __space, __u32 mss, 1050extern void tcp_select_initial_window(int __space, __u32 mss,
1052 __u32 *rcv_wnd, __u32 *window_clamp, 1051 __u32 *rcv_wnd, __u32 *window_clamp,
@@ -1193,7 +1192,6 @@ static inline void tcp_mib_init(struct net *net)
1193static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) 1192static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
1194{ 1193{
1195 tp->lost_skb_hint = NULL; 1194 tp->lost_skb_hint = NULL;
1196 tp->scoreboard_skb_hint = NULL;
1197} 1195}
1198 1196
1199static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) 1197static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
@@ -1284,11 +1282,13 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1284#define tcp_twsk_md5_key(twsk) NULL 1282#define tcp_twsk_md5_key(twsk) NULL
1285#endif 1283#endif
1286 1284
1287extern struct tcp_md5sig_pool __percpu *tcp_alloc_md5sig_pool(struct sock *); 1285extern bool tcp_alloc_md5sig_pool(void);
1288extern void tcp_free_md5sig_pool(void);
1289 1286
1290extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1287extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1291extern void tcp_put_md5sig_pool(void); 1288static inline void tcp_put_md5sig_pool(void)
1289{
1290 local_bh_enable();
1291}
1292 1292
1293extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1293extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1294extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1294extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
@@ -1319,9 +1319,9 @@ void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1319 1319
1320/* Fastopen key context */ 1320/* Fastopen key context */
1321struct tcp_fastopen_context { 1321struct tcp_fastopen_context {
1322 struct crypto_cipher __rcu *tfm; 1322 struct crypto_cipher *tfm;
1323 __u8 key[TCP_FASTOPEN_KEY_LENGTH]; 1323 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1324 struct rcu_head rcu; 1324 struct rcu_head rcu;
1325}; 1325};
1326 1326
1327/* write queue abstraction */ 1327/* write queue abstraction */
@@ -1540,15 +1540,14 @@ extern struct request_sock_ops tcp6_request_sock_ops;
1540 1540
1541extern void tcp_v4_destroy_sock(struct sock *sk); 1541extern void tcp_v4_destroy_sock(struct sock *sk);
1542 1542
1543extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1544extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, 1543extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
1545 netdev_features_t features); 1544 netdev_features_t features);
1546extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1545extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1547 struct sk_buff *skb); 1546 struct sk_buff *skb);
1548extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1549 struct sk_buff *skb);
1550extern int tcp_gro_complete(struct sk_buff *skb); 1547extern int tcp_gro_complete(struct sk_buff *skb);
1551extern int tcp4_gro_complete(struct sk_buff *skb); 1548
1549extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr,
1550 __be32 daddr);
1552 1551
1553#ifdef CONFIG_PROC_FS 1552#ifdef CONFIG_PROC_FS
1554extern int tcp4_proc_init(void); 1553extern int tcp4_proc_init(void);
@@ -1583,6 +1582,8 @@ struct tcp_request_sock_ops {
1583#endif 1582#endif
1584}; 1583};
1585 1584
1585extern int tcpv4_offload_init(void);
1586
1586extern void tcp_v4_init(void); 1587extern void tcp_v4_init(void);
1587extern void tcp_init(void); 1588extern void tcp_init(void);
1588 1589
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 938b7fd11204..48660e50ae90 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -3,56 +3,57 @@
3 3
4#include <net/checksum.h> 4#include <net/checksum.h>
5 5
6/* 6/* IPv6 transport protocols */
7 * IPv6 transport protocols
8 */
9
10extern struct proto rawv6_prot; 7extern struct proto rawv6_prot;
11extern struct proto udpv6_prot; 8extern struct proto udpv6_prot;
12extern struct proto udplitev6_prot; 9extern struct proto udplitev6_prot;
13extern struct proto tcpv6_prot; 10extern struct proto tcpv6_prot;
11extern struct proto pingv6_prot;
14 12
15struct flowi6; 13struct flowi6;
16 14
17/* extension headers */ 15/* extension headers */
18extern int ipv6_exthdrs_init(void); 16int ipv6_exthdrs_init(void);
19extern void ipv6_exthdrs_exit(void); 17void ipv6_exthdrs_exit(void);
20extern int ipv6_frag_init(void); 18int ipv6_frag_init(void);
21extern void ipv6_frag_exit(void); 19void ipv6_frag_exit(void);
22 20
23/* transport protocols */ 21/* transport protocols */
24extern int rawv6_init(void); 22int pingv6_init(void);
25extern void rawv6_exit(void); 23void pingv6_exit(void);
26extern int udpv6_init(void); 24int rawv6_init(void);
27extern void udpv6_exit(void); 25void rawv6_exit(void);
28extern int udplitev6_init(void); 26int udpv6_init(void);
29extern void udplitev6_exit(void); 27void udpv6_exit(void);
30extern int tcpv6_init(void); 28int udplitev6_init(void);
31extern void tcpv6_exit(void); 29void udplitev6_exit(void);
32 30int tcpv6_init(void);
33extern int udpv6_connect(struct sock *sk, 31void tcpv6_exit(void);
34 struct sockaddr *uaddr, 32
35 int addr_len); 33int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
36 34
37extern int ip6_datagram_recv_ctl(struct sock *sk, 35int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg,
38 struct msghdr *msg, 36 struct sk_buff *skb);
39 struct sk_buff *skb); 37
40 38int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
41extern int ip6_datagram_send_ctl(struct net *net, 39 struct flowi6 *fl6, struct ipv6_txoptions *opt,
42 struct sock *sk, 40 int *hlimit, int *tclass, int *dontfrag);
43 struct msghdr *msg, 41
44 struct flowi6 *fl6, 42void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
45 struct ipv6_txoptions *opt, 43 __u16 srcp, __u16 destp, int bucket);
46 int *hlimit, int *tclass, 44
47 int *dontfrag); 45#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
48 46
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 47/* address family specific functions */
50
51/*
52 * address family specific functions
53 */
54extern const struct inet_connection_sock_af_ops ipv4_specific; 48extern const struct inet_connection_sock_af_ops ipv4_specific;
55 49
56extern void inet6_destroy_sock(struct sock *sk); 50void inet6_destroy_sock(struct sock *sk);
51
52#define IPV6_SEQ_DGRAM_HEADER \
53 " sl " \
54 "local_address " \
55 "remote_address " \
56 "st tx_queue rx_queue tr tm->when retrnsmt" \
57 " uid timeout inode ref pointer drops\n"
57 58
58#endif 59#endif
diff --git a/include/net/udp.h b/include/net/udp.h
index 065f379c6503..74c10ec5e74f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -181,12 +181,15 @@ extern int udp_get_port(struct sock *sk, unsigned short snum,
181extern void udp_err(struct sk_buff *, u32); 181extern void udp_err(struct sk_buff *, u32);
182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
183 struct msghdr *msg, size_t len); 183 struct msghdr *msg, size_t len);
184extern int udp_push_pending_frames(struct sock *sk);
184extern void udp_flush_pending_frames(struct sock *sk); 185extern void udp_flush_pending_frames(struct sock *sk);
185extern int udp_rcv(struct sk_buff *skb); 186extern int udp_rcv(struct sk_buff *skb);
186extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 187extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
187extern int udp_disconnect(struct sock *sk, int flags); 188extern int udp_disconnect(struct sock *sk, int flags);
188extern unsigned int udp_poll(struct file *file, struct socket *sock, 189extern unsigned int udp_poll(struct file *file, struct socket *sock,
189 poll_table *wait); 190 poll_table *wait);
191extern struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
192 netdev_features_t features);
190extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 193extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
191 char __user *optval, int __user *optlen); 194 char __user *optval, int __user *optlen);
192extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 195extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
@@ -262,11 +265,10 @@ extern int udp4_proc_init(void);
262extern void udp4_proc_exit(void); 265extern void udp4_proc_exit(void);
263#endif 266#endif
264 267
268extern int udpv4_offload_init(void);
269
265extern void udp_init(void); 270extern void udp_init(void);
266 271
267extern int udp4_ufo_send_check(struct sk_buff *skb);
268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
269 netdev_features_t features);
270extern void udp_encap_enable(void); 272extern void udp_encap_enable(void);
271#if IS_ENABLED(CONFIG_IPV6) 273#if IS_ENABLED(CONFIG_IPV6)
272extern void udpv6_encap_enable(void); 274extern void udpv6_encap_enable(void);
diff --git a/include/rdma/ib.h b/include/rdma/ib.h
new file mode 100644
index 000000000000..cf8f9e700e48
--- /dev/null
+++ b/include/rdma/ib.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright (c) 2010 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#if !defined(_RDMA_IB_H)
34#define _RDMA_IB_H
35
36#include <linux/types.h>
37
38struct ib_addr {
39 union {
40 __u8 uib_addr8[16];
41 __be16 uib_addr16[8];
42 __be32 uib_addr32[4];
43 __be64 uib_addr64[2];
44 } ib_u;
45#define sib_addr8 ib_u.uib_addr8
46#define sib_addr16 ib_u.uib_addr16
47#define sib_addr32 ib_u.uib_addr32
48#define sib_addr64 ib_u.uib_addr64
49#define sib_raw ib_u.uib_addr8
50#define sib_subnet_prefix ib_u.uib_addr64[0]
51#define sib_interface_id ib_u.uib_addr64[1]
52};
53
54static inline int ib_addr_any(const struct ib_addr *a)
55{
56 return ((a->sib_addr64[0] | a->sib_addr64[1]) == 0);
57}
58
59static inline int ib_addr_loopback(const struct ib_addr *a)
60{
61 return ((a->sib_addr32[0] | a->sib_addr32[1] |
62 a->sib_addr32[2] | (a->sib_addr32[3] ^ htonl(1))) == 0);
63}
64
65static inline void ib_addr_set(struct ib_addr *addr,
66 __be32 w1, __be32 w2, __be32 w3, __be32 w4)
67{
68 addr->sib_addr32[0] = w1;
69 addr->sib_addr32[1] = w2;
70 addr->sib_addr32[2] = w3;
71 addr->sib_addr32[3] = w4;
72}
73
74static inline int ib_addr_cmp(const struct ib_addr *a1, const struct ib_addr *a2)
75{
76 return memcmp(a1, a2, sizeof(struct ib_addr));
77}
78
79struct sockaddr_ib {
80 unsigned short int sib_family; /* AF_IB */
81 __be16 sib_pkey;
82 __be32 sib_flowinfo;
83 struct ib_addr sib_addr;
84 __be64 sib_sid;
85 __be64 sib_sid_mask;
86 __u64 sib_scope_id;
87};
88
89#endif /* _RDMA_IB_H */
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 99965395c5f3..f3ac0f2c4c66 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -102,11 +102,7 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr);
102int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, 102int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
103 const unsigned char *dst_dev_addr); 103 const unsigned char *dst_dev_addr);
104 104
105static inline int ip_addr_size(struct sockaddr *addr) 105int rdma_addr_size(struct sockaddr *addr);
106{
107 return addr->sa_family == AF_INET6 ?
108 sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
109}
110 106
111static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr) 107static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
112{ 108{
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 8275e539bace..125f8714301d 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -402,6 +402,12 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
402 struct ib_ah_attr *ah_attr); 402 struct ib_ah_attr *ah_attr);
403 403
404/** 404/**
405 * ib_sa_pack_path - Conert a path record from struct ib_sa_path_rec
406 * to IB MAD wire format.
407 */
408void ib_sa_pack_path(struct ib_sa_path_rec *rec, void *attribute);
409
410/**
405 * ib_sa_unpack_path - Convert a path record from MAD format to struct 411 * ib_sa_unpack_path - Convert a path record from MAD format to struct
406 * ib_sa_path_rec. 412 * ib_sa_path_rec.
407 */ 413 */
@@ -418,4 +424,5 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client,
418 void *context), 424 void *context),
419 void *context, 425 void *context,
420 struct ib_sa_query **sa_query); 426 struct ib_sa_query **sa_query);
427
421#endif /* IB_SA_H */ 428#endif /* IB_SA_H */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 98cc4b29fc5b..645c3cedce9c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -610,7 +610,21 @@ enum ib_qp_type {
610 IB_QPT_RAW_PACKET = 8, 610 IB_QPT_RAW_PACKET = 8,
611 IB_QPT_XRC_INI = 9, 611 IB_QPT_XRC_INI = 9,
612 IB_QPT_XRC_TGT, 612 IB_QPT_XRC_TGT,
613 IB_QPT_MAX 613 IB_QPT_MAX,
614 /* Reserve a range for qp types internal to the low level driver.
615 * These qp types will not be visible at the IB core layer, so the
616 * IB_QPT_MAX usages should not be affected in the core layer
617 */
618 IB_QPT_RESERVED1 = 0x1000,
619 IB_QPT_RESERVED2,
620 IB_QPT_RESERVED3,
621 IB_QPT_RESERVED4,
622 IB_QPT_RESERVED5,
623 IB_QPT_RESERVED6,
624 IB_QPT_RESERVED7,
625 IB_QPT_RESERVED8,
626 IB_QPT_RESERVED9,
627 IB_QPT_RESERVED10,
614}; 628};
615 629
616enum ib_qp_create_flags { 630enum ib_qp_create_flags {
@@ -766,6 +780,19 @@ enum ib_wr_opcode {
766 IB_WR_MASKED_ATOMIC_CMP_AND_SWP, 780 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
767 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, 781 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
768 IB_WR_BIND_MW, 782 IB_WR_BIND_MW,
783 /* reserve values for low level drivers' internal use.
784 * These values will not be used at all in the ib core layer.
785 */
786 IB_WR_RESERVED1 = 0xf0,
787 IB_WR_RESERVED2,
788 IB_WR_RESERVED3,
789 IB_WR_RESERVED4,
790 IB_WR_RESERVED5,
791 IB_WR_RESERVED6,
792 IB_WR_RESERVED7,
793 IB_WR_RESERVED8,
794 IB_WR_RESERVED9,
795 IB_WR_RESERVED10,
769}; 796};
770 797
771enum ib_send_flags { 798enum ib_send_flags {
@@ -773,7 +800,11 @@ enum ib_send_flags {
773 IB_SEND_SIGNALED = (1<<1), 800 IB_SEND_SIGNALED = (1<<1),
774 IB_SEND_SOLICITED = (1<<2), 801 IB_SEND_SOLICITED = (1<<2),
775 IB_SEND_INLINE = (1<<3), 802 IB_SEND_INLINE = (1<<3),
776 IB_SEND_IP_CSUM = (1<<4) 803 IB_SEND_IP_CSUM = (1<<4),
804
805 /* reserve bits 26-31 for low level drivers' internal use */
806 IB_SEND_RESERVED_START = (1 << 26),
807 IB_SEND_RESERVED_END = (1 << 31),
777}; 808};
778 809
779struct ib_sge { 810struct ib_sge {
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index ad3a3142383a..1ed2088dc9f5 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -70,6 +70,11 @@ enum rdma_port_space {
70 RDMA_PS_UDP = 0x0111, 70 RDMA_PS_UDP = 0x0111,
71}; 71};
72 72
73#define RDMA_IB_IP_PS_MASK 0xFFFFFFFFFFFF0000ULL
74#define RDMA_IB_IP_PS_TCP 0x0000000001060000ULL
75#define RDMA_IB_IP_PS_UDP 0x0000000001110000ULL
76#define RDMA_IB_IP_PS_IB 0x00000000013F0000ULL
77
73struct rdma_addr { 78struct rdma_addr {
74 struct sockaddr_storage src_addr; 79 struct sockaddr_storage src_addr;
75 struct sockaddr_storage dst_addr; 80 struct sockaddr_storage dst_addr;
@@ -93,6 +98,7 @@ struct rdma_conn_param {
93 /* Fields below ignored if a QP is created on the rdma_cm_id. */ 98 /* Fields below ignored if a QP is created on the rdma_cm_id. */
94 u8 srq; 99 u8 srq;
95 u32 qp_num; 100 u32 qp_num;
101 u32 qkey;
96}; 102};
97 103
98struct rdma_ud_param { 104struct rdma_ud_param {
@@ -367,4 +373,11 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse);
367 */ 373 */
368int rdma_set_afonly(struct rdma_cm_id *id, int afonly); 374int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
369 375
376 /**
377 * rdma_get_service_id - Return the IB service ID for a specified address.
378 * @id: Communication identifier associated with the address.
379 * @addr: Address for the service ID.
380 */
381__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr);
382
370#endif /* RDMA_CM_H */ 383#endif /* RDMA_CM_H */
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 23a87d0cd72c..e5d09d242ba3 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -34,8 +34,6 @@ extern void iscsit_put_transport(struct iscsit_transport *);
34/* 34/*
35 * From iscsi_target.c 35 * From iscsi_target.c
36 */ 36 */
37extern int iscsit_add_reject_from_cmd(u8, int, int, unsigned char *,
38 struct iscsi_cmd *);
39extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, 37extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
40 unsigned char *); 38 unsigned char *);
41extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); 39extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
@@ -45,18 +43,26 @@ extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
45 struct iscsi_cmd **); 43 struct iscsi_cmd **);
46extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *, 44extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
47 bool); 45 bool);
48extern int iscsit_handle_nop_out(struct iscsi_conn *, struct iscsi_cmd *, 46extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 unsigned char *); 47 struct iscsi_nopout *);
48extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 struct iscsi_nopout *);
50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *, 50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
51 unsigned char *); 51 unsigned char *);
52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *, 52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
53 unsigned char *); 53 unsigned char *);
54extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
55 struct iscsi_text *);
56extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
57 struct iscsi_text *);
54extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *, 58extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
55 bool, struct iscsi_scsi_rsp *); 59 bool, struct iscsi_scsi_rsp *);
56extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *, 60extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
57 struct iscsi_nopin *, bool); 61 struct iscsi_nopin *, bool);
58extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, 62extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
59 struct iscsi_tm_rsp *); 63 struct iscsi_tm_rsp *);
64extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
65 struct iscsi_text_rsp *);
60extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, 66extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
61 struct iscsi_reject *); 67 struct iscsi_reject *);
62extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, 68extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
@@ -67,6 +73,10 @@ extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
67 */ 73 */
68extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *); 74extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
69/* 75/*
76 * From iscsi_target_erl0.c
77 */
78extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
79/*
70 * From iscsi_target_erl1.c 80 * From iscsi_target_erl1.c
71 */ 81 */
72extern void iscsit_stop_dataout_timer(struct iscsi_cmd *); 82extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
@@ -80,4 +90,5 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
80 * From iscsi_target_util.c 90 * From iscsi_target_util.c
81 */ 91 */
82extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); 92extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t);
83extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, __be32); 93extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
94 unsigned char *, __be32);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 4ea4f985f394..e34fc904f2e1 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -218,14 +218,11 @@ enum tcm_tmreq_table {
218 218
219/* fabric independent task management response values */ 219/* fabric independent task management response values */
220enum tcm_tmrsp_table { 220enum tcm_tmrsp_table {
221 TMR_FUNCTION_COMPLETE = 0, 221 TMR_FUNCTION_COMPLETE = 1,
222 TMR_TASK_DOES_NOT_EXIST = 1, 222 TMR_TASK_DOES_NOT_EXIST = 2,
223 TMR_LUN_DOES_NOT_EXIST = 2, 223 TMR_LUN_DOES_NOT_EXIST = 3,
224 TMR_TASK_STILL_ALLEGIANT = 3, 224 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 4,
225 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, 225 TMR_FUNCTION_REJECTED = 5,
226 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
227 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
228 TMR_FUNCTION_REJECTED = 255,
229}; 226};
230 227
231/* 228/*
@@ -339,8 +336,6 @@ struct t10_pr_registration {
339 /* Used during APTPL metadata reading */ 336 /* Used during APTPL metadata reading */
340#define PR_APTPL_MAX_TPORT_LEN 256 337#define PR_APTPL_MAX_TPORT_LEN 256
341 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN]; 338 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN];
342 /* For writing out live meta data */
343 unsigned char *pr_aptpl_buf;
344 u16 pr_aptpl_rpti; 339 u16 pr_aptpl_rpti;
345 u16 pr_reg_tpgt; 340 u16 pr_reg_tpgt;
346 /* Reservation effects all target ports */ 341 /* Reservation effects all target ports */
@@ -374,9 +369,7 @@ struct t10_reservation {
374 /* Activate Persistence across Target Power Loss enabled 369 /* Activate Persistence across Target Power Loss enabled
375 * for SCSI device */ 370 * for SCSI device */
376 int pr_aptpl_active; 371 int pr_aptpl_active;
377 /* Used by struct t10_reservation->pr_aptpl_buf_len */
378#define PR_APTPL_BUF_LEN 8192 372#define PR_APTPL_BUF_LEN 8192
379 u32 pr_aptpl_buf_len;
380 u32 pr_generation; 373 u32 pr_generation;
381 spinlock_t registration_lock; 374 spinlock_t registration_lock;
382 spinlock_t aptpl_reg_lock; 375 spinlock_t aptpl_reg_lock;
@@ -424,8 +417,6 @@ struct se_cmd {
424 int sam_task_attr; 417 int sam_task_attr;
425 /* Transport protocol dependent state, see transport_state_table */ 418 /* Transport protocol dependent state, see transport_state_table */
426 enum transport_state_table t_state; 419 enum transport_state_table t_state;
427 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
428 unsigned check_release:1;
429 unsigned cmd_wait_set:1; 420 unsigned cmd_wait_set:1;
430 unsigned unknown_data_length:1; 421 unsigned unknown_data_length:1;
431 /* See se_cmd_flags_table */ 422 /* See se_cmd_flags_table */
@@ -458,7 +449,6 @@ struct se_cmd {
458 unsigned char *t_task_cdb; 449 unsigned char *t_task_cdb;
459 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 450 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
460 unsigned long long t_task_lba; 451 unsigned long long t_task_lba;
461 atomic_t t_fe_count;
462 unsigned int transport_state; 452 unsigned int transport_state;
463#define CMD_T_ABORTED (1 << 0) 453#define CMD_T_ABORTED (1 << 0)
464#define CMD_T_ACTIVE (1 << 1) 454#define CMD_T_ACTIVE (1 << 1)
@@ -802,11 +792,12 @@ struct se_portal_group {
802 struct target_core_fabric_ops *se_tpg_tfo; 792 struct target_core_fabric_ops *se_tpg_tfo;
803 struct se_wwn *se_tpg_wwn; 793 struct se_wwn *se_tpg_wwn;
804 struct config_group tpg_group; 794 struct config_group tpg_group;
805 struct config_group *tpg_default_groups[6]; 795 struct config_group *tpg_default_groups[7];
806 struct config_group tpg_lun_group; 796 struct config_group tpg_lun_group;
807 struct config_group tpg_np_group; 797 struct config_group tpg_np_group;
808 struct config_group tpg_acl_group; 798 struct config_group tpg_acl_group;
809 struct config_group tpg_attrib_group; 799 struct config_group tpg_attrib_group;
800 struct config_group tpg_auth_group;
810 struct config_group tpg_param_group; 801 struct config_group tpg_param_group;
811}; 802};
812 803
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 612509592ffd..713c5004f4ae 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -23,6 +23,7 @@ struct target_fabric_configfs_template {
23 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
24 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
25 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
26 struct config_item_type tfc_tpg_auth_cit;
26 struct config_item_type tfc_tpg_param_cit; 27 struct config_item_type tfc_tpg_param_cit;
27 struct config_item_type tfc_tpg_nacl_cit; 28 struct config_item_type tfc_tpg_nacl_cit;
28 struct config_item_type tfc_tpg_nacl_base_cit; 29 struct config_item_type tfc_tpg_nacl_base_cit;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 1dcce9cc99b9..7a16178424f9 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -61,7 +61,7 @@ struct target_core_fabric_ops {
61 int (*get_cmd_state)(struct se_cmd *); 61 int (*get_cmd_state)(struct se_cmd *);
62 int (*queue_data_in)(struct se_cmd *); 62 int (*queue_data_in)(struct se_cmd *);
63 int (*queue_status)(struct se_cmd *); 63 int (*queue_status)(struct se_cmd *);
64 int (*queue_tm_rsp)(struct se_cmd *); 64 void (*queue_tm_rsp)(struct se_cmd *);
65 /* 65 /*
66 * fabric module calls for target_core_fabric_configfs.c 66 * fabric module calls for target_core_fabric_configfs.c
67 */ 67 */
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h
index a26fb7586a09..b32a14905cfa 100644
--- a/include/target/target_core_fabric_configfs.h
+++ b/include/target/target_core_fabric_configfs.h
@@ -62,6 +62,17 @@ static struct target_fabric_tpg_attrib_attribute _fabric##_tpg_attrib_##_name =
62 _fabric##_tpg_attrib_show_##_name, \ 62 _fabric##_tpg_attrib_show_##_name, \
63 _fabric##_tpg_attrib_store_##_name); 63 _fabric##_tpg_attrib_store_##_name);
64 64
65CONFIGFS_EATTR_STRUCT(target_fabric_tpg_auth, se_portal_group);
66#define TF_TPG_AUTH_ATTR(_fabric, _name, _mode) \
67static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
68 __CONFIGFS_EATTR(_name, _mode, \
69 _fabric##_tpg_auth_show_##_name, \
70 _fabric##_tpg_auth_store_##_name);
71
72#define TF_TPG_AUTH_ATTR_RO(_fabric, _name) \
73static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
74 __CONFIGFS_EATTR_RO(_name, \
75 _fabric##_tpg_auth_show_##_name);
65 76
66CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group); 77CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group);
67#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \ 78#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index 3cc5a0b278c3..5ebda976ea93 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -9,9 +9,7 @@
9struct search; 9struct search;
10 10
11DECLARE_EVENT_CLASS(bcache_request, 11DECLARE_EVENT_CLASS(bcache_request,
12
13 TP_PROTO(struct search *s, struct bio *bio), 12 TP_PROTO(struct search *s, struct bio *bio),
14
15 TP_ARGS(s, bio), 13 TP_ARGS(s, bio),
16 14
17 TP_STRUCT__entry( 15 TP_STRUCT__entry(
@@ -22,7 +20,6 @@ DECLARE_EVENT_CLASS(bcache_request,
22 __field(dev_t, orig_sector ) 20 __field(dev_t, orig_sector )
23 __field(unsigned int, nr_sector ) 21 __field(unsigned int, nr_sector )
24 __array(char, rwbs, 6 ) 22 __array(char, rwbs, 6 )
25 __array(char, comm, TASK_COMM_LEN )
26 ), 23 ),
27 24
28 TP_fast_assign( 25 TP_fast_assign(
@@ -33,36 +30,66 @@ DECLARE_EVENT_CLASS(bcache_request,
33 __entry->orig_sector = bio->bi_sector - 16; 30 __entry->orig_sector = bio->bi_sector - 16;
34 __entry->nr_sector = bio->bi_size >> 9; 31 __entry->nr_sector = bio->bi_size >> 9;
35 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 32 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
36 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
37 ), 33 ),
38 34
39 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)", 35 TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
40 MAJOR(__entry->dev), MINOR(__entry->dev), 36 MAJOR(__entry->dev), MINOR(__entry->dev),
41 __entry->rwbs, 37 __entry->rwbs, (unsigned long long)__entry->sector,
42 (unsigned long long)__entry->sector, 38 __entry->nr_sector, __entry->orig_major, __entry->orig_minor,
43 __entry->nr_sector, __entry->comm,
44 __entry->orig_major, __entry->orig_minor,
45 (unsigned long long)__entry->orig_sector) 39 (unsigned long long)__entry->orig_sector)
46); 40);
47 41
48DEFINE_EVENT(bcache_request, bcache_request_start, 42DECLARE_EVENT_CLASS(bkey,
43 TP_PROTO(struct bkey *k),
44 TP_ARGS(k),
49 45
50 TP_PROTO(struct search *s, struct bio *bio), 46 TP_STRUCT__entry(
47 __field(u32, size )
48 __field(u32, inode )
49 __field(u64, offset )
50 __field(bool, dirty )
51 ),
51 52
52 TP_ARGS(s, bio) 53 TP_fast_assign(
54 __entry->inode = KEY_INODE(k);
55 __entry->offset = KEY_OFFSET(k);
56 __entry->size = KEY_SIZE(k);
57 __entry->dirty = KEY_DIRTY(k);
58 ),
59
60 TP_printk("%u:%llu len %u dirty %u", __entry->inode,
61 __entry->offset, __entry->size, __entry->dirty)
53); 62);
54 63
55DEFINE_EVENT(bcache_request, bcache_request_end, 64DECLARE_EVENT_CLASS(btree_node,
65 TP_PROTO(struct btree *b),
66 TP_ARGS(b),
67
68 TP_STRUCT__entry(
69 __field(size_t, bucket )
70 ),
56 71
72 TP_fast_assign(
73 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
74 ),
75
76 TP_printk("bucket %zu", __entry->bucket)
77);
78
79/* request.c */
80
81DEFINE_EVENT(bcache_request, bcache_request_start,
57 TP_PROTO(struct search *s, struct bio *bio), 82 TP_PROTO(struct search *s, struct bio *bio),
83 TP_ARGS(s, bio)
84);
58 85
86DEFINE_EVENT(bcache_request, bcache_request_end,
87 TP_PROTO(struct search *s, struct bio *bio),
59 TP_ARGS(s, bio) 88 TP_ARGS(s, bio)
60); 89);
61 90
62DECLARE_EVENT_CLASS(bcache_bio, 91DECLARE_EVENT_CLASS(bcache_bio,
63
64 TP_PROTO(struct bio *bio), 92 TP_PROTO(struct bio *bio),
65
66 TP_ARGS(bio), 93 TP_ARGS(bio),
67 94
68 TP_STRUCT__entry( 95 TP_STRUCT__entry(
@@ -70,7 +97,6 @@ DECLARE_EVENT_CLASS(bcache_bio,
70 __field(sector_t, sector ) 97 __field(sector_t, sector )
71 __field(unsigned int, nr_sector ) 98 __field(unsigned int, nr_sector )
72 __array(char, rwbs, 6 ) 99 __array(char, rwbs, 6 )
73 __array(char, comm, TASK_COMM_LEN )
74 ), 100 ),
75 101
76 TP_fast_assign( 102 TP_fast_assign(
@@ -78,191 +104,328 @@ DECLARE_EVENT_CLASS(bcache_bio,
78 __entry->sector = bio->bi_sector; 104 __entry->sector = bio->bi_sector;
79 __entry->nr_sector = bio->bi_size >> 9; 105 __entry->nr_sector = bio->bi_size >> 9;
80 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 106 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
81 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
82 ), 107 ),
83 108
84 TP_printk("%d,%d %s %llu + %u [%s]", 109 TP_printk("%d,%d %s %llu + %u",
85 MAJOR(__entry->dev), MINOR(__entry->dev), 110 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
86 __entry->rwbs, 111 (unsigned long long)__entry->sector, __entry->nr_sector)
87 (unsigned long long)__entry->sector,
88 __entry->nr_sector, __entry->comm)
89); 112);
90 113
91 114DEFINE_EVENT(bcache_bio, bcache_bypass_sequential,
92DEFINE_EVENT(bcache_bio, bcache_passthrough,
93
94 TP_PROTO(struct bio *bio), 115 TP_PROTO(struct bio *bio),
116 TP_ARGS(bio)
117);
95 118
119DEFINE_EVENT(bcache_bio, bcache_bypass_congested,
120 TP_PROTO(struct bio *bio),
96 TP_ARGS(bio) 121 TP_ARGS(bio)
97); 122);
98 123
99DEFINE_EVENT(bcache_bio, bcache_cache_hit, 124TRACE_EVENT(bcache_read,
125 TP_PROTO(struct bio *bio, bool hit, bool bypass),
126 TP_ARGS(bio, hit, bypass),
100 127
101 TP_PROTO(struct bio *bio), 128 TP_STRUCT__entry(
129 __field(dev_t, dev )
130 __field(sector_t, sector )
131 __field(unsigned int, nr_sector )
132 __array(char, rwbs, 6 )
133 __field(bool, cache_hit )
134 __field(bool, bypass )
135 ),
102 136
103 TP_ARGS(bio) 137 TP_fast_assign(
138 __entry->dev = bio->bi_bdev->bd_dev;
139 __entry->sector = bio->bi_sector;
140 __entry->nr_sector = bio->bi_size >> 9;
141 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
142 __entry->cache_hit = hit;
143 __entry->bypass = bypass;
144 ),
145
146 TP_printk("%d,%d %s %llu + %u hit %u bypass %u",
147 MAJOR(__entry->dev), MINOR(__entry->dev),
148 __entry->rwbs, (unsigned long long)__entry->sector,
149 __entry->nr_sector, __entry->cache_hit, __entry->bypass)
104); 150);
105 151
106DEFINE_EVENT(bcache_bio, bcache_cache_miss, 152TRACE_EVENT(bcache_write,
153 TP_PROTO(struct bio *bio, bool writeback, bool bypass),
154 TP_ARGS(bio, writeback, bypass),
107 155
108 TP_PROTO(struct bio *bio), 156 TP_STRUCT__entry(
157 __field(dev_t, dev )
158 __field(sector_t, sector )
159 __field(unsigned int, nr_sector )
160 __array(char, rwbs, 6 )
161 __field(bool, writeback )
162 __field(bool, bypass )
163 ),
109 164
110 TP_ARGS(bio) 165 TP_fast_assign(
166 __entry->dev = bio->bi_bdev->bd_dev;
167 __entry->sector = bio->bi_sector;
168 __entry->nr_sector = bio->bi_size >> 9;
169 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
170 __entry->writeback = writeback;
171 __entry->bypass = bypass;
172 ),
173
174 TP_printk("%d,%d %s %llu + %u hit %u bypass %u",
175 MAJOR(__entry->dev), MINOR(__entry->dev),
176 __entry->rwbs, (unsigned long long)__entry->sector,
177 __entry->nr_sector, __entry->writeback, __entry->bypass)
111); 178);
112 179
113DEFINE_EVENT(bcache_bio, bcache_read_retry, 180DEFINE_EVENT(bcache_bio, bcache_read_retry,
114
115 TP_PROTO(struct bio *bio), 181 TP_PROTO(struct bio *bio),
116
117 TP_ARGS(bio) 182 TP_ARGS(bio)
118); 183);
119 184
120DEFINE_EVENT(bcache_bio, bcache_writethrough, 185DEFINE_EVENT(bkey, bcache_cache_insert,
186 TP_PROTO(struct bkey *k),
187 TP_ARGS(k)
188);
121 189
122 TP_PROTO(struct bio *bio), 190/* Journal */
123 191
124 TP_ARGS(bio) 192DECLARE_EVENT_CLASS(cache_set,
125); 193 TP_PROTO(struct cache_set *c),
194 TP_ARGS(c),
126 195
127DEFINE_EVENT(bcache_bio, bcache_writeback, 196 TP_STRUCT__entry(
197 __array(char, uuid, 16 )
198 ),
128 199
129 TP_PROTO(struct bio *bio), 200 TP_fast_assign(
201 memcpy(__entry->uuid, c->sb.set_uuid, 16);
202 ),
130 203
131 TP_ARGS(bio) 204 TP_printk("%pU", __entry->uuid)
132); 205);
133 206
134DEFINE_EVENT(bcache_bio, bcache_write_skip, 207DEFINE_EVENT(bkey, bcache_journal_replay_key,
135 208 TP_PROTO(struct bkey *k),
136 TP_PROTO(struct bio *bio), 209 TP_ARGS(k)
210);
137 211
138 TP_ARGS(bio) 212DEFINE_EVENT(cache_set, bcache_journal_full,
213 TP_PROTO(struct cache_set *c),
214 TP_ARGS(c)
139); 215);
140 216
141DEFINE_EVENT(bcache_bio, bcache_btree_read, 217DEFINE_EVENT(cache_set, bcache_journal_entry_full,
218 TP_PROTO(struct cache_set *c),
219 TP_ARGS(c)
220);
142 221
222DEFINE_EVENT(bcache_bio, bcache_journal_write,
143 TP_PROTO(struct bio *bio), 223 TP_PROTO(struct bio *bio),
144
145 TP_ARGS(bio) 224 TP_ARGS(bio)
146); 225);
147 226
148DEFINE_EVENT(bcache_bio, bcache_btree_write, 227/* Btree */
149 228
150 TP_PROTO(struct bio *bio), 229DEFINE_EVENT(cache_set, bcache_btree_cache_cannibalize,
230 TP_PROTO(struct cache_set *c),
231 TP_ARGS(c)
232);
151 233
152 TP_ARGS(bio) 234DEFINE_EVENT(btree_node, bcache_btree_read,
235 TP_PROTO(struct btree *b),
236 TP_ARGS(b)
153); 237);
154 238
155DEFINE_EVENT(bcache_bio, bcache_write_dirty, 239TRACE_EVENT(bcache_btree_write,
240 TP_PROTO(struct btree *b),
241 TP_ARGS(b),
156 242
157 TP_PROTO(struct bio *bio), 243 TP_STRUCT__entry(
244 __field(size_t, bucket )
245 __field(unsigned, block )
246 __field(unsigned, keys )
247 ),
158 248
159 TP_ARGS(bio) 249 TP_fast_assign(
250 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
251 __entry->block = b->written;
252 __entry->keys = b->sets[b->nsets].data->keys;
253 ),
254
255 TP_printk("bucket %zu", __entry->bucket)
160); 256);
161 257
162DEFINE_EVENT(bcache_bio, bcache_read_dirty, 258DEFINE_EVENT(btree_node, bcache_btree_node_alloc,
259 TP_PROTO(struct btree *b),
260 TP_ARGS(b)
261);
163 262
164 TP_PROTO(struct bio *bio), 263DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail,
264 TP_PROTO(struct btree *b),
265 TP_ARGS(b)
266);
165 267
166 TP_ARGS(bio) 268DEFINE_EVENT(btree_node, bcache_btree_node_free,
269 TP_PROTO(struct btree *b),
270 TP_ARGS(b)
167); 271);
168 272
169DEFINE_EVENT(bcache_bio, bcache_write_moving, 273TRACE_EVENT(bcache_btree_gc_coalesce,
274 TP_PROTO(unsigned nodes),
275 TP_ARGS(nodes),
170 276
171 TP_PROTO(struct bio *bio), 277 TP_STRUCT__entry(
278 __field(unsigned, nodes )
279 ),
172 280
173 TP_ARGS(bio) 281 TP_fast_assign(
282 __entry->nodes = nodes;
283 ),
284
285 TP_printk("coalesced %u nodes", __entry->nodes)
174); 286);
175 287
176DEFINE_EVENT(bcache_bio, bcache_read_moving, 288DEFINE_EVENT(cache_set, bcache_gc_start,
289 TP_PROTO(struct cache_set *c),
290 TP_ARGS(c)
291);
177 292
178 TP_PROTO(struct bio *bio), 293DEFINE_EVENT(cache_set, bcache_gc_end,
294 TP_PROTO(struct cache_set *c),
295 TP_ARGS(c)
296);
179 297
180 TP_ARGS(bio) 298DEFINE_EVENT(bkey, bcache_gc_copy,
299 TP_PROTO(struct bkey *k),
300 TP_ARGS(k)
181); 301);
182 302
183DEFINE_EVENT(bcache_bio, bcache_journal_write, 303DEFINE_EVENT(bkey, bcache_gc_copy_collision,
304 TP_PROTO(struct bkey *k),
305 TP_ARGS(k)
306);
184 307
185 TP_PROTO(struct bio *bio), 308TRACE_EVENT(bcache_btree_insert_key,
309 TP_PROTO(struct btree *b, struct bkey *k, unsigned op, unsigned status),
310 TP_ARGS(b, k, op, status),
186 311
187 TP_ARGS(bio) 312 TP_STRUCT__entry(
188); 313 __field(u64, btree_node )
314 __field(u32, btree_level )
315 __field(u32, inode )
316 __field(u64, offset )
317 __field(u32, size )
318 __field(u8, dirty )
319 __field(u8, op )
320 __field(u8, status )
321 ),
189 322
190DECLARE_EVENT_CLASS(bcache_cache_bio, 323 TP_fast_assign(
324 __entry->btree_node = PTR_BUCKET_NR(b->c, &b->key, 0);
325 __entry->btree_level = b->level;
326 __entry->inode = KEY_INODE(k);
327 __entry->offset = KEY_OFFSET(k);
328 __entry->size = KEY_SIZE(k);
329 __entry->dirty = KEY_DIRTY(k);
330 __entry->op = op;
331 __entry->status = status;
332 ),
191 333
192 TP_PROTO(struct bio *bio, 334 TP_printk("%u for %u at %llu(%u): %u:%llu len %u dirty %u",
193 sector_t orig_sector, 335 __entry->status, __entry->op,
194 struct block_device* orig_bdev), 336 __entry->btree_node, __entry->btree_level,
337 __entry->inode, __entry->offset,
338 __entry->size, __entry->dirty)
339);
195 340
196 TP_ARGS(bio, orig_sector, orig_bdev), 341DECLARE_EVENT_CLASS(btree_split,
342 TP_PROTO(struct btree *b, unsigned keys),
343 TP_ARGS(b, keys),
197 344
198 TP_STRUCT__entry( 345 TP_STRUCT__entry(
199 __field(dev_t, dev ) 346 __field(size_t, bucket )
200 __field(dev_t, orig_dev ) 347 __field(unsigned, keys )
201 __field(sector_t, sector )
202 __field(sector_t, orig_sector )
203 __field(unsigned int, nr_sector )
204 __array(char, rwbs, 6 )
205 __array(char, comm, TASK_COMM_LEN )
206 ), 348 ),
207 349
208 TP_fast_assign( 350 TP_fast_assign(
209 __entry->dev = bio->bi_bdev->bd_dev; 351 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
210 __entry->orig_dev = orig_bdev->bd_dev; 352 __entry->keys = keys;
211 __entry->sector = bio->bi_sector;
212 __entry->orig_sector = orig_sector;
213 __entry->nr_sector = bio->bi_size >> 9;
214 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
215 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
216 ), 353 ),
217 354
218 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d %llu)", 355 TP_printk("bucket %zu keys %u", __entry->bucket, __entry->keys)
219 MAJOR(__entry->dev), MINOR(__entry->dev),
220 __entry->rwbs,
221 (unsigned long long)__entry->sector,
222 __entry->nr_sector, __entry->comm,
223 MAJOR(__entry->orig_dev), MINOR(__entry->orig_dev),
224 (unsigned long long)__entry->orig_sector)
225); 356);
226 357
227DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert, 358DEFINE_EVENT(btree_split, bcache_btree_node_split,
228 359 TP_PROTO(struct btree *b, unsigned keys),
229 TP_PROTO(struct bio *bio, 360 TP_ARGS(b, keys)
230 sector_t orig_sector, 361);
231 struct block_device *orig_bdev),
232 362
233 TP_ARGS(bio, orig_sector, orig_bdev) 363DEFINE_EVENT(btree_split, bcache_btree_node_compact,
364 TP_PROTO(struct btree *b, unsigned keys),
365 TP_ARGS(b, keys)
234); 366);
235 367
236DECLARE_EVENT_CLASS(bcache_gc, 368DEFINE_EVENT(btree_node, bcache_btree_set_root,
369 TP_PROTO(struct btree *b),
370 TP_ARGS(b)
371);
237 372
238 TP_PROTO(uint8_t *uuid), 373/* Allocator */
239 374
240 TP_ARGS(uuid), 375TRACE_EVENT(bcache_alloc_invalidate,
376 TP_PROTO(struct cache *ca),
377 TP_ARGS(ca),
241 378
242 TP_STRUCT__entry( 379 TP_STRUCT__entry(
243 __field(uint8_t *, uuid) 380 __field(unsigned, free )
381 __field(unsigned, free_inc )
382 __field(unsigned, free_inc_size )
383 __field(unsigned, unused )
244 ), 384 ),
245 385
246 TP_fast_assign( 386 TP_fast_assign(
247 __entry->uuid = uuid; 387 __entry->free = fifo_used(&ca->free);
388 __entry->free_inc = fifo_used(&ca->free_inc);
389 __entry->free_inc_size = ca->free_inc.size;
390 __entry->unused = fifo_used(&ca->unused);
248 ), 391 ),
249 392
250 TP_printk("%pU", __entry->uuid) 393 TP_printk("free %u free_inc %u/%u unused %u", __entry->free,
394 __entry->free_inc, __entry->free_inc_size, __entry->unused)
251); 395);
252 396
397TRACE_EVENT(bcache_alloc_fail,
398 TP_PROTO(struct cache *ca),
399 TP_ARGS(ca),
253 400
254DEFINE_EVENT(bcache_gc, bcache_gc_start, 401 TP_STRUCT__entry(
402 __field(unsigned, free )
403 __field(unsigned, free_inc )
404 __field(unsigned, unused )
405 __field(unsigned, blocked )
406 ),
255 407
256 TP_PROTO(uint8_t *uuid), 408 TP_fast_assign(
409 __entry->free = fifo_used(&ca->free);
410 __entry->free_inc = fifo_used(&ca->free_inc);
411 __entry->unused = fifo_used(&ca->unused);
412 __entry->blocked = atomic_read(&ca->set->prio_blocked);
413 ),
257 414
258 TP_ARGS(uuid) 415 TP_printk("free %u free_inc %u unused %u blocked %u", __entry->free,
416 __entry->free_inc, __entry->unused, __entry->blocked)
259); 417);
260 418
261DEFINE_EVENT(bcache_gc, bcache_gc_end, 419/* Background writeback */
262 420
263 TP_PROTO(uint8_t *uuid), 421DEFINE_EVENT(bkey, bcache_writeback,
422 TP_PROTO(struct bkey *k),
423 TP_ARGS(k)
424);
264 425
265 TP_ARGS(uuid) 426DEFINE_EVENT(bkey, bcache_writeback_collision,
427 TP_PROTO(struct bkey *k),
428 TP_ARGS(k)
266); 429);
267 430
268#endif /* _TRACE_BCACHE_H */ 431#endif /* _TRACE_BCACHE_H */
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
new file mode 100644
index 000000000000..aef8fc354025
--- /dev/null
+++ b/include/trace/events/target.h
@@ -0,0 +1,214 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM target
3
4#if !defined(_TRACE_TARGET_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TARGET_H
6
7#include <linux/tracepoint.h>
8#include <linux/trace_seq.h>
9#include <scsi/scsi.h>
10#include <scsi/scsi_tcq.h>
11#include <target/target_core_base.h>
12
13/* cribbed verbatim from <trace/event/scsi.h> */
14#define scsi_opcode_name(opcode) { opcode, #opcode }
15#define show_opcode_name(val) \
16 __print_symbolic(val, \
17 scsi_opcode_name(TEST_UNIT_READY), \
18 scsi_opcode_name(REZERO_UNIT), \
19 scsi_opcode_name(REQUEST_SENSE), \
20 scsi_opcode_name(FORMAT_UNIT), \
21 scsi_opcode_name(READ_BLOCK_LIMITS), \
22 scsi_opcode_name(REASSIGN_BLOCKS), \
23 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
24 scsi_opcode_name(READ_6), \
25 scsi_opcode_name(WRITE_6), \
26 scsi_opcode_name(SEEK_6), \
27 scsi_opcode_name(READ_REVERSE), \
28 scsi_opcode_name(WRITE_FILEMARKS), \
29 scsi_opcode_name(SPACE), \
30 scsi_opcode_name(INQUIRY), \
31 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
32 scsi_opcode_name(MODE_SELECT), \
33 scsi_opcode_name(RESERVE), \
34 scsi_opcode_name(RELEASE), \
35 scsi_opcode_name(COPY), \
36 scsi_opcode_name(ERASE), \
37 scsi_opcode_name(MODE_SENSE), \
38 scsi_opcode_name(START_STOP), \
39 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
40 scsi_opcode_name(SEND_DIAGNOSTIC), \
41 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
42 scsi_opcode_name(SET_WINDOW), \
43 scsi_opcode_name(READ_CAPACITY), \
44 scsi_opcode_name(READ_10), \
45 scsi_opcode_name(WRITE_10), \
46 scsi_opcode_name(SEEK_10), \
47 scsi_opcode_name(POSITION_TO_ELEMENT), \
48 scsi_opcode_name(WRITE_VERIFY), \
49 scsi_opcode_name(VERIFY), \
50 scsi_opcode_name(SEARCH_HIGH), \
51 scsi_opcode_name(SEARCH_EQUAL), \
52 scsi_opcode_name(SEARCH_LOW), \
53 scsi_opcode_name(SET_LIMITS), \
54 scsi_opcode_name(PRE_FETCH), \
55 scsi_opcode_name(READ_POSITION), \
56 scsi_opcode_name(SYNCHRONIZE_CACHE), \
57 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
58 scsi_opcode_name(READ_DEFECT_DATA), \
59 scsi_opcode_name(MEDIUM_SCAN), \
60 scsi_opcode_name(COMPARE), \
61 scsi_opcode_name(COPY_VERIFY), \
62 scsi_opcode_name(WRITE_BUFFER), \
63 scsi_opcode_name(READ_BUFFER), \
64 scsi_opcode_name(UPDATE_BLOCK), \
65 scsi_opcode_name(READ_LONG), \
66 scsi_opcode_name(WRITE_LONG), \
67 scsi_opcode_name(CHANGE_DEFINITION), \
68 scsi_opcode_name(WRITE_SAME), \
69 scsi_opcode_name(UNMAP), \
70 scsi_opcode_name(READ_TOC), \
71 scsi_opcode_name(LOG_SELECT), \
72 scsi_opcode_name(LOG_SENSE), \
73 scsi_opcode_name(XDWRITEREAD_10), \
74 scsi_opcode_name(MODE_SELECT_10), \
75 scsi_opcode_name(RESERVE_10), \
76 scsi_opcode_name(RELEASE_10), \
77 scsi_opcode_name(MODE_SENSE_10), \
78 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
79 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
80 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
81 scsi_opcode_name(REPORT_LUNS), \
82 scsi_opcode_name(MAINTENANCE_IN), \
83 scsi_opcode_name(MAINTENANCE_OUT), \
84 scsi_opcode_name(MOVE_MEDIUM), \
85 scsi_opcode_name(EXCHANGE_MEDIUM), \
86 scsi_opcode_name(READ_12), \
87 scsi_opcode_name(WRITE_12), \
88 scsi_opcode_name(WRITE_VERIFY_12), \
89 scsi_opcode_name(SEARCH_HIGH_12), \
90 scsi_opcode_name(SEARCH_EQUAL_12), \
91 scsi_opcode_name(SEARCH_LOW_12), \
92 scsi_opcode_name(READ_ELEMENT_STATUS), \
93 scsi_opcode_name(SEND_VOLUME_TAG), \
94 scsi_opcode_name(WRITE_LONG_2), \
95 scsi_opcode_name(READ_16), \
96 scsi_opcode_name(WRITE_16), \
97 scsi_opcode_name(VERIFY_16), \
98 scsi_opcode_name(WRITE_SAME_16), \
99 scsi_opcode_name(SERVICE_ACTION_IN), \
100 scsi_opcode_name(SAI_READ_CAPACITY_16), \
101 scsi_opcode_name(SAI_GET_LBA_STATUS), \
102 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
103 scsi_opcode_name(MO_SET_TARGET_PGS), \
104 scsi_opcode_name(READ_32), \
105 scsi_opcode_name(WRITE_32), \
106 scsi_opcode_name(WRITE_SAME_32), \
107 scsi_opcode_name(ATA_16), \
108 scsi_opcode_name(ATA_12))
109
110#define show_task_attribute_name(val) \
111 __print_symbolic(val, \
112 { MSG_SIMPLE_TAG, "SIMPLE" }, \
113 { MSG_HEAD_TAG, "HEAD" }, \
114 { MSG_ORDERED_TAG, "ORDERED" }, \
115 { MSG_ACA_TAG, "ACA" } )
116
117#define show_scsi_status_name(val) \
118 __print_symbolic(val, \
119 { SAM_STAT_GOOD, "GOOD" }, \
120 { SAM_STAT_CHECK_CONDITION, "CHECK CONDITION" }, \
121 { SAM_STAT_CONDITION_MET, "CONDITION MET" }, \
122 { SAM_STAT_BUSY, "BUSY" }, \
123 { SAM_STAT_INTERMEDIATE, "INTERMEDIATE" }, \
124 { SAM_STAT_INTERMEDIATE_CONDITION_MET, "INTERMEDIATE CONDITION MET" }, \
125 { SAM_STAT_RESERVATION_CONFLICT, "RESERVATION CONFLICT" }, \
126 { SAM_STAT_COMMAND_TERMINATED, "COMMAND TERMINATED" }, \
127 { SAM_STAT_TASK_SET_FULL, "TASK SET FULL" }, \
128 { SAM_STAT_ACA_ACTIVE, "ACA ACTIVE" }, \
129 { SAM_STAT_TASK_ABORTED, "TASK ABORTED" } )
130
131TRACE_EVENT(target_sequencer_start,
132
133 TP_PROTO(struct se_cmd *cmd),
134
135 TP_ARGS(cmd),
136
137 TP_STRUCT__entry(
138 __field( unsigned int, unpacked_lun )
139 __field( unsigned int, opcode )
140 __field( unsigned int, data_length )
141 __field( unsigned int, task_attribute )
142 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
143 __string( initiator, cmd->se_sess->se_node_acl->initiatorname )
144 ),
145
146 TP_fast_assign(
147 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr;
151 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
152 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
153 ),
154
155 TP_printk("%s -> LUN %03u %s data_length %6u CDB %s (TA:%s C:%02x)",
156 __get_str(initiator), __entry->unpacked_lun,
157 show_opcode_name(__entry->opcode),
158 __entry->data_length, __print_hex(__entry->cdb, 16),
159 show_task_attribute_name(__entry->task_attribute),
160 scsi_command_size(__entry->cdb) <= 16 ?
161 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
162 __entry->cdb[1]
163 )
164);
165
166TRACE_EVENT(target_cmd_complete,
167
168 TP_PROTO(struct se_cmd *cmd),
169
170 TP_ARGS(cmd),
171
172 TP_STRUCT__entry(
173 __field( unsigned int, unpacked_lun )
174 __field( unsigned int, opcode )
175 __field( unsigned int, data_length )
176 __field( unsigned int, task_attribute )
177 __field( unsigned char, scsi_status )
178 __field( unsigned char, sense_length )
179 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
180 __array( unsigned char, sense_data, 18 )
181 __string(initiator, cmd->se_sess->se_node_acl->initiatorname)
182 ),
183
184 TP_fast_assign(
185 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr;
189 __entry->scsi_status = cmd->scsi_status;
190 __entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
191 min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
192 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
193 memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
194 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
195 ),
196
197 TP_printk("%s <- LUN %03u status %s (sense len %d%s%s) %s data_length %6u CDB %s (TA:%s C:%02x)",
198 __get_str(initiator), __entry->unpacked_lun,
199 show_scsi_status_name(__entry->scsi_status),
200 __entry->sense_length, __entry->sense_length ? " / " : "",
201 __print_hex(__entry->sense_data, __entry->sense_length),
202 show_opcode_name(__entry->opcode),
203 __entry->data_length, __print_hex(__entry->cdb, 16),
204 show_task_attribute_name(__entry->task_attribute),
205 scsi_command_size(__entry->cdb) <= 16 ?
206 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
207 __entry->cdb[1]
208 )
209);
210
211#endif /* _TRACE_TARGET_H */
212
213/* This part must be outside protection */
214#include <trace/define_trace.h>
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index d615f78cc6b6..41a6643e2136 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -670,10 +670,6 @@ perf_trace_##call(void *__data, proto) \
670 sizeof(u64)); \ 670 sizeof(u64)); \
671 __entry_size -= sizeof(u32); \ 671 __entry_size -= sizeof(u32); \
672 \ 672 \
673 if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \
674 "profile buffer not large enough")) \
675 return; \
676 \
677 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ 673 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \
678 __entry_size, event_call->event.type, &__regs, &rctx); \ 674 __entry_size, event_call->event.type, &__regs, &rctx); \
679 if (!entry) \ 675 if (!entry) \
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 84bc4197e736..fed853f3d7aa 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -16,6 +16,7 @@
16 * @nb_args: number of parameters it takes 16 * @nb_args: number of parameters it takes
17 * @types: list of types as strings 17 * @types: list of types as strings
18 * @args: list of args as strings (args[i] matches types[i]) 18 * @args: list of args as strings (args[i] matches types[i])
19 * @enter_fields: list of fields for syscall_enter trace event
19 * @enter_event: associated syscall_enter trace event 20 * @enter_event: associated syscall_enter trace event
20 * @exit_event: associated syscall_exit trace event 21 * @exit_event: associated syscall_exit trace event
21 */ 22 */
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index 06632beaa6d5..95e46c8e05f9 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -84,10 +84,14 @@
84#define O_PATH 010000000 84#define O_PATH 010000000
85#endif 85#endif
86 86
87#ifndef O_TMPFILE 87#ifndef __O_TMPFILE
88#define O_TMPFILE 020000000 88#define __O_TMPFILE 020000000
89#endif 89#endif
90 90
91/* a horrid kludge trying to make sure that this will fail on old kernels */
92#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
93#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
94
91#ifndef O_NDELAY 95#ifndef O_NDELAY
92#define O_NDELAY O_NONBLOCK 96#define O_NDELAY O_NONBLOCK
93#endif 97#endif
diff --git a/include/uapi/asm-generic/poll.h b/include/uapi/asm-generic/poll.h
index 9ce7f44aebd2..a9694982689f 100644
--- a/include/uapi/asm-generic/poll.h
+++ b/include/uapi/asm-generic/poll.h
@@ -30,6 +30,8 @@
30 30
31#define POLLFREE 0x4000 /* currently only for epoll */ 31#define POLLFREE 0x4000 /* currently only for epoll */
32 32
33#define POLL_BUSY_LOOP 0x8000
34
33struct pollfd { 35struct pollfd {
34 int fd; 36 int fd;
35 short events; 37 short events;
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index c5d2e3a1cf68..f04b69b6abf2 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -76,4 +76,6 @@
76 76
77#define SO_SELECT_ERR_QUEUE 45 77#define SO_SELECT_ERR_QUEUE 45
78 78
79#define SO_BUSY_POLL 46
80
79#endif /* __ASM_GENERIC_SOCKET_H */ 81#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 5a57be68bab7..238a166b9fe6 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -732,6 +732,7 @@ struct drm_prime_handle {
732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
735#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
735 736
736/** 737/**
737 * Device specific ioctls should only be in their respective headers 738 * Device specific ioctls should only be in their respective headers
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 090e5331ab7e..53db7cea373b 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -388,6 +388,19 @@ struct drm_mode_cursor {
388 __u32 handle; 388 __u32 handle;
389}; 389};
390 390
391struct drm_mode_cursor2 {
392 __u32 flags;
393 __u32 crtc_id;
394 __s32 x;
395 __s32 y;
396 __u32 width;
397 __u32 height;
398 /* driver specific handle */
399 __u32 handle;
400 __s32 hot_x;
401 __s32 hot_y;
402};
403
391struct drm_mode_crtc_lut { 404struct drm_mode_crtc_lut {
392 __u32 crtc_id; 405 __u32 crtc_id;
393 __u32 gamma_size; 406 __u32 gamma_size;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 07d59419fe6b..923ed7fe5775 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -305,7 +305,7 @@ typedef struct drm_i915_irq_wait {
305#define I915_PARAM_HAS_WAIT_TIMEOUT 19 305#define I915_PARAM_HAS_WAIT_TIMEOUT 19
306#define I915_PARAM_HAS_SEMAPHORES 20 306#define I915_PARAM_HAS_SEMAPHORES 20
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22 308#define I915_PARAM_HAS_VEBOX 22
309#define I915_PARAM_HAS_SECURE_BATCHES 23 309#define I915_PARAM_HAS_SECURE_BATCHES 23
310#define I915_PARAM_HAS_PINNED_BATCHES 24 310#define I915_PARAM_HAS_PINNED_BATCHES 24
311#define I915_PARAM_HAS_EXEC_NO_RELOC 25 311#define I915_PARAM_HAS_EXEC_NO_RELOC 25
@@ -660,6 +660,7 @@ struct drm_i915_gem_execbuffer2 {
660#define I915_EXEC_RENDER (1<<0) 660#define I915_EXEC_RENDER (1<<0)
661#define I915_EXEC_BSD (2<<0) 661#define I915_EXEC_BSD (2<<0)
662#define I915_EXEC_BLT (3<<0) 662#define I915_EXEC_BLT (3<<0)
663#define I915_EXEC_VEBOX (4<<0)
663 664
664/* Used for switching the constants addressing mode on gen4+ RENDER ring. 665/* Used for switching the constants addressing mode on gen4+ RENDER ring.
665 * Gen6+ only supports relative addressing to dynamic state (default) and 666 * Gen6+ only supports relative addressing to dynamic state (default) and
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index 6e132a2f7420..73bde4eaf16c 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -17,6 +17,8 @@
17#ifndef _UAPI_TEGRA_DRM_H_ 17#ifndef _UAPI_TEGRA_DRM_H_
18#define _UAPI_TEGRA_DRM_H_ 18#define _UAPI_TEGRA_DRM_H_
19 19
20#include <drm/drm.h>
21
20struct drm_tegra_gem_create { 22struct drm_tegra_gem_create {
21 __u64 size; 23 __u64 size;
22 __u32 flags; 24 __u32 flags;
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index bdc6e87ff3eb..997f9f2f0963 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -62,6 +62,7 @@ header-y += auxvec.h
62header-y += ax25.h 62header-y += ax25.h
63header-y += b1lli.h 63header-y += b1lli.h
64header-y += baycom.h 64header-y += baycom.h
65header-y += bcm933xx_hcs.h
65header-y += bfs_fs.h 66header-y += bfs_fs.h
66header-y += binfmts.h 67header-y += binfmts.h
67header-y += blkpg.h 68header-y += blkpg.h
diff --git a/include/uapi/linux/bcm933xx_hcs.h b/include/uapi/linux/bcm933xx_hcs.h
new file mode 100644
index 000000000000..d22821831549
--- /dev/null
+++ b/include/uapi/linux/bcm933xx_hcs.h
@@ -0,0 +1,24 @@
1/*
2 * Broadcom Cable Modem firmware format
3 */
4
5#ifndef __BCM933XX_HCS_H
6#define __BCM933XX_HCS_H
7
8#include <linux/types.h>
9
10struct bcm_hcs {
11 __u16 magic;
12 __u16 control;
13 __u16 rev_maj;
14 __u16 rev_min;
15 __u32 build_date;
16 __u32 filelen;
17 __u32 ldaddress;
18 char filename[64];
19 __u16 hcs;
20 __u16 her_znaet_chto;
21 __u32 crc;
22};
23
24#endif /* __BCM933XX_HCS */
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 7e75b6fd8d45..afd0cbd52edb 100644
--- a/include/uapi/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 24 270#define DM_VERSION_MINOR 25
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2013-01-15)" 272#define DM_VERSION_EXTRA "-ioctl (2013-06-26)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 0c9b44871df0..38dbafaa5341 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -993,8 +993,8 @@ enum ethtool_sfeatures_retval_bits {
993#define PORT_OTHER 0xff 993#define PORT_OTHER 0xff
994 994
995/* Which transceiver to use. */ 995/* Which transceiver to use. */
996#define XCVR_INTERNAL 0x00 996#define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
997#define XCVR_EXTERNAL 0x01 997#define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
998#define XCVR_DUMMY1 0x02 998#define XCVR_DUMMY1 0x02
999#define XCVR_DUMMY2 0x03 999#define XCVR_DUMMY2 0x03
1000#define XCVR_DUMMY3 0x04 1000#define XCVR_DUMMY3 0x04
diff --git a/include/uapi/linux/gen_stats.h b/include/uapi/linux/gen_stats.h
index 552c8a0a12d1..6487317ea619 100644
--- a/include/uapi/linux/gen_stats.h
+++ b/include/uapi/linux/gen_stats.h
@@ -9,6 +9,7 @@ enum {
9 TCA_STATS_RATE_EST, 9 TCA_STATS_RATE_EST,
10 TCA_STATS_QUEUE, 10 TCA_STATS_QUEUE,
11 TCA_STATS_APP, 11 TCA_STATS_APP,
12 TCA_STATS_RATE_EST64,
12 __TCA_STATS_MAX, 13 __TCA_STATS_MAX,
13}; 14};
14#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) 15#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
@@ -38,6 +39,16 @@ struct gnet_stats_rate_est {
38}; 39};
39 40
40/** 41/**
42 * struct gnet_stats_rate_est64 - rate estimator
43 * @bps: current byte rate
44 * @pps: current packet rate
45 */
46struct gnet_stats_rate_est64 {
47 __u64 bps;
48 __u64 pps;
49};
50
51/**
41 * struct gnet_stats_queue - queuing statistics 52 * struct gnet_stats_queue - queuing statistics
42 * @qlen: queue length 53 * @qlen: queue length
43 * @backlog: backlog size of queue 54 * @backlog: backlog size of queue
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index 82c7d1bdadeb..d7fea3496f32 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -93,6 +93,7 @@
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */ 94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ 95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
96#define ARPHRD_NETLINK 824 /* Netlink header */
96 97
97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 98#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
98#define ARPHRD_NONE 0xFFFE /* zero header length */ 99#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b05823cae784..03f6170ab337 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -221,6 +221,8 @@ enum {
221 IFLA_BRPORT_GUARD, /* bpdu guard */ 221 IFLA_BRPORT_GUARD, /* bpdu guard */
222 IFLA_BRPORT_PROTECT, /* root port protection */ 222 IFLA_BRPORT_PROTECT, /* root port protection */
223 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ 223 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
224 IFLA_BRPORT_LEARNING, /* mac learning */
225 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
224 __IFLA_BRPORT_MAX 226 __IFLA_BRPORT_MAX
225}; 227};
226#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 228#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -336,6 +338,7 @@ enum {
336 IFLA_VF_VLAN, 338 IFLA_VF_VLAN,
337 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 339 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
338 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ 340 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
341 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
339 __IFLA_VF_MAX, 342 __IFLA_VF_MAX,
340}; 343};
341 344
@@ -362,6 +365,18 @@ struct ifla_vf_spoofchk {
362 __u32 setting; 365 __u32 setting;
363}; 366};
364 367
368enum {
369 IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */
370 IFLA_VF_LINK_STATE_ENABLE, /* link always up */
371 IFLA_VF_LINK_STATE_DISABLE, /* link always down */
372 __IFLA_VF_LINK_STATE_MAX,
373};
374
375struct ifla_vf_link_state {
376 __u32 vf;
377 __u32 link_state;
378};
379
365/* VF ports management section 380/* VF ports management section
366 * 381 *
367 * Nested layout of set/get msg is: 382 * Nested layout of set/get msg is:
diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 0b46fd57c8f6..e36a4aecd311 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -135,11 +135,11 @@ struct pppoe_tag {
135 135
136struct pppoe_hdr { 136struct pppoe_hdr {
137#if defined(__LITTLE_ENDIAN_BITFIELD) 137#if defined(__LITTLE_ENDIAN_BITFIELD)
138 __u8 ver : 4;
139 __u8 type : 4; 138 __u8 type : 4;
139 __u8 ver : 4;
140#elif defined(__BIG_ENDIAN_BITFIELD) 140#elif defined(__BIG_ENDIAN_BITFIELD)
141 __u8 type : 4;
142 __u8 ver : 4; 141 __u8 ver : 4;
142 __u8 type : 4;
143#else 143#else
144#error "Please fix <asm/byteorder.h>" 144#error "Please fix <asm/byteorder.h>"
145#endif 145#endif
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 2835b85fd46d..82334f88967e 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -68,6 +68,8 @@
68#define IFF_MULTI_QUEUE 0x0100 68#define IFF_MULTI_QUEUE 0x0100
69#define IFF_ATTACH_QUEUE 0x0200 69#define IFF_ATTACH_QUEUE 0x0200
70#define IFF_DETACH_QUEUE 0x0400 70#define IFF_DETACH_QUEUE 0x0400
71/* read-only flag */
72#define IFF_PERSIST 0x0800
71 73
72/* Features for GSO (TUNSETOFFLOAD). */ 74/* Features for GSO (TUNSETOFFLOAD). */
73#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 75#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index a24537725e80..29458223d044 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -20,6 +20,12 @@
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ 20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ 21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */ 22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */
23#define IP_VS_SVC_F_SCHED1 0x0008 /* scheduler flag 1 */
24#define IP_VS_SVC_F_SCHED2 0x0010 /* scheduler flag 2 */
25#define IP_VS_SVC_F_SCHED3 0x0020 /* scheduler flag 3 */
26
27#define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */
28#define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */
23 29
24/* 30/*
25 * Destination Server Flags 31 * Destination Server Flags
diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h
index a2308ae5a73d..3a9b92147339 100644
--- a/include/uapi/linux/netfilter/nfnetlink_queue.h
+++ b/include/uapi/linux/netfilter/nfnetlink_queue.h
@@ -105,5 +105,7 @@ enum nfqnl_attr_config {
105#define NFQA_SKB_CSUMNOTREADY (1 << 0) 105#define NFQA_SKB_CSUMNOTREADY (1 << 0)
106/* packet is GSO (i.e., exceeds device mtu) */ 106/* packet is GSO (i.e., exceeds device mtu) */
107#define NFQA_SKB_GSO (1 << 1) 107#define NFQA_SKB_GSO (1 << 1)
108/* csum not validated (incoming device doesn't support hw checksum, etc.) */
109#define NFQA_SKB_CSUM_NOTVERIFIED (1 << 2)
108 110
109#endif /* _NFNETLINK_QUEUE_H */ 111#endif /* _NFNETLINK_QUEUE_H */
diff --git a/include/uapi/linux/netfilter/xt_socket.h b/include/uapi/linux/netfilter/xt_socket.h
index 26d7217bd4f1..6315e2ac3474 100644
--- a/include/uapi/linux/netfilter/xt_socket.h
+++ b/include/uapi/linux/netfilter/xt_socket.h
@@ -5,10 +5,17 @@
5 5
6enum { 6enum {
7 XT_SOCKET_TRANSPARENT = 1 << 0, 7 XT_SOCKET_TRANSPARENT = 1 << 0,
8 XT_SOCKET_NOWILDCARD = 1 << 1,
8}; 9};
9 10
10struct xt_socket_mtinfo1 { 11struct xt_socket_mtinfo1 {
11 __u8 flags; 12 __u8 flags;
12}; 13};
14#define XT_SOCKET_FLAGS_V1 XT_SOCKET_TRANSPARENT
15
16struct xt_socket_mtinfo2 {
17 __u8 flags;
18};
19#define XT_SOCKET_FLAGS_V2 (XT_SOCKET_TRANSPARENT | XT_SOCKET_NOWILDCARD)
13 20
14#endif /* _XT_SOCKET_H */ 21#endif /* _XT_SOCKET_H */
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 7c6f627a717d..caed0f324d5f 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -69,6 +69,8 @@
69 * starting a poll from a device which has a secure element enabled means 69 * starting a poll from a device which has a secure element enabled means
70 * we want to do SE based card emulation. 70 * we want to do SE based card emulation.
71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. 71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
72 * @NFC_CMD_FW_UPLOAD: Request to Load/flash firmware, or event to inform that
73 * some firmware was loaded
72 */ 74 */
73enum nfc_commands { 75enum nfc_commands {
74 NFC_CMD_UNSPEC, 76 NFC_CMD_UNSPEC,
@@ -92,6 +94,9 @@ enum nfc_commands {
92 NFC_CMD_DISABLE_SE, 94 NFC_CMD_DISABLE_SE,
93 NFC_CMD_LLC_SDREQ, 95 NFC_CMD_LLC_SDREQ,
94 NFC_EVENT_LLC_SDRES, 96 NFC_EVENT_LLC_SDRES,
97 NFC_CMD_FW_UPLOAD,
98 NFC_EVENT_SE_ADDED,
99 NFC_EVENT_SE_REMOVED,
95/* private: internal use only */ 100/* private: internal use only */
96 __NFC_CMD_AFTER_LAST 101 __NFC_CMD_AFTER_LAST
97}; 102};
@@ -121,6 +126,9 @@ enum nfc_commands {
121 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter 126 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
122 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter 127 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
123 * @NFC_ATTR_SE: Available Secure Elements 128 * @NFC_ATTR_SE: Available Secure Elements
129 * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version
130 * @NFC_ATTR_SE_INDEX: Secure element index
131 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
124 */ 132 */
125enum nfc_attrs { 133enum nfc_attrs {
126 NFC_ATTR_UNSPEC, 134 NFC_ATTR_UNSPEC,
@@ -143,6 +151,9 @@ enum nfc_attrs {
143 NFC_ATTR_LLC_PARAM_MIUX, 151 NFC_ATTR_LLC_PARAM_MIUX,
144 NFC_ATTR_SE, 152 NFC_ATTR_SE,
145 NFC_ATTR_LLC_SDP, 153 NFC_ATTR_LLC_SDP,
154 NFC_ATTR_FIRMWARE_NAME,
155 NFC_ATTR_SE_INDEX,
156 NFC_ATTR_SE_TYPE,
146/* private: internal use only */ 157/* private: internal use only */
147 __NFC_ATTR_AFTER_LAST 158 __NFC_ATTR_AFTER_LAST
148}; 159};
@@ -159,9 +170,12 @@ enum nfc_sdp_attr {
159 170
160#define NFC_DEVICE_NAME_MAXSIZE 8 171#define NFC_DEVICE_NAME_MAXSIZE 8
161#define NFC_NFCID1_MAXSIZE 10 172#define NFC_NFCID1_MAXSIZE 10
173#define NFC_NFCID2_MAXSIZE 8
174#define NFC_NFCID3_MAXSIZE 10
162#define NFC_SENSB_RES_MAXSIZE 12 175#define NFC_SENSB_RES_MAXSIZE 12
163#define NFC_SENSF_RES_MAXSIZE 18 176#define NFC_SENSF_RES_MAXSIZE 18
164#define NFC_GB_MAXSIZE 48 177#define NFC_GB_MAXSIZE 48
178#define NFC_FIRMWARE_NAME_MAXSIZE 32
165 179
166/* NFC protocols */ 180/* NFC protocols */
167#define NFC_PROTO_JEWEL 1 181#define NFC_PROTO_JEWEL 1
@@ -191,10 +205,12 @@ enum nfc_sdp_attr {
191#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) 205#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
192 206
193/* NFC Secure Elements */ 207/* NFC Secure Elements */
194#define NFC_SE_NONE 0x0
195#define NFC_SE_UICC 0x1 208#define NFC_SE_UICC 0x1
196#define NFC_SE_EMBEDDED 0x2 209#define NFC_SE_EMBEDDED 0x2
197 210
211#define NFC_SE_DISABLED 0x0
212#define NFC_SE_ENABLED 0x1
213
198struct sockaddr_nfc { 214struct sockaddr_nfc {
199 sa_family_t sa_family; 215 sa_family_t sa_family;
200 __u32 dev_idx; 216 __u32 dev_idx;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d1e48b5e348f..861e5eba3953 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -27,6 +27,8 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30#define NL80211_GENL_NAME "nl80211"
31
30/** 32/**
31 * DOC: Station handling 33 * DOC: Station handling
32 * 34 *
@@ -1429,6 +1431,11 @@ enum nl80211_commands {
1429 * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which 1431 * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which
1430 * the connection should have increased reliability (u16). 1432 * the connection should have increased reliability (u16).
1431 * 1433 *
1434 * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16).
1435 * This is similar to @NL80211_ATTR_STA_AID but with a difference of being
1436 * allowed to be used with the first @NL80211_CMD_SET_STATION command to
1437 * update a TDLS peer STA entry.
1438 *
1432 * @NL80211_ATTR_MAX: highest attribute number currently defined 1439 * @NL80211_ATTR_MAX: highest attribute number currently defined
1433 * @__NL80211_ATTR_AFTER_LAST: internal use 1440 * @__NL80211_ATTR_AFTER_LAST: internal use
1434 */ 1441 */
@@ -1727,6 +1734,8 @@ enum nl80211_attrs {
1727 NL80211_ATTR_CRIT_PROT_ID, 1734 NL80211_ATTR_CRIT_PROT_ID,
1728 NL80211_ATTR_MAX_CRIT_PROT_DURATION, 1735 NL80211_ATTR_MAX_CRIT_PROT_DURATION,
1729 1736
1737 NL80211_ATTR_PEER_AID,
1738
1730 /* add attributes here, update the policy in nl80211.c */ 1739 /* add attributes here, update the policy in nl80211.c */
1731 1740
1732 __NL80211_ATTR_AFTER_LAST, 1741 __NL80211_ATTR_AFTER_LAST,
@@ -1991,6 +2000,10 @@ enum nl80211_sta_bss_param {
1991 * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode 2000 * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
1992 * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards 2001 * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
1993 * non-peer STA 2002 * non-peer STA
2003 * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU
2004 * Contains a nested array of signal strength attributes (u8, dBm)
2005 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
2006 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
1994 * @__NL80211_STA_INFO_AFTER_LAST: internal 2007 * @__NL80211_STA_INFO_AFTER_LAST: internal
1995 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2008 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1996 */ 2009 */
@@ -2020,6 +2033,8 @@ enum nl80211_sta_info {
2020 NL80211_STA_INFO_NONPEER_PM, 2033 NL80211_STA_INFO_NONPEER_PM,
2021 NL80211_STA_INFO_RX_BYTES64, 2034 NL80211_STA_INFO_RX_BYTES64,
2022 NL80211_STA_INFO_TX_BYTES64, 2035 NL80211_STA_INFO_TX_BYTES64,
2036 NL80211_STA_INFO_CHAIN_SIGNAL,
2037 NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
2023 2038
2024 /* keep last */ 2039 /* keep last */
2025 __NL80211_STA_INFO_AFTER_LAST, 2040 __NL80211_STA_INFO_AFTER_LAST,
@@ -2413,6 +2428,8 @@ enum nl80211_survey_info {
2413 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering 2428 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
2414 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. 2429 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
2415 * overrides all other flags. 2430 * overrides all other flags.
2431 * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address
2432 * and ACK incoming unicast packets.
2416 * 2433 *
2417 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use 2434 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
2418 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag 2435 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
@@ -2424,6 +2441,7 @@ enum nl80211_mntr_flags {
2424 NL80211_MNTR_FLAG_CONTROL, 2441 NL80211_MNTR_FLAG_CONTROL,
2425 NL80211_MNTR_FLAG_OTHER_BSS, 2442 NL80211_MNTR_FLAG_OTHER_BSS,
2426 NL80211_MNTR_FLAG_COOK_FRAMES, 2443 NL80211_MNTR_FLAG_COOK_FRAMES,
2444 NL80211_MNTR_FLAG_ACTIVE,
2427 2445
2428 /* keep last */ 2446 /* keep last */
2429 __NL80211_MNTR_FLAG_AFTER_LAST, 2447 __NL80211_MNTR_FLAG_AFTER_LAST,
@@ -2559,6 +2577,10 @@ enum nl80211_mesh_power_mode {
2559 * 2577 *
2560 * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs) 2578 * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
2561 * 2579 *
2580 * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've
2581 * established peering with for longer than this time (in seconds), then
2582 * remove it from the STA's list of peers. Default is 30 minutes.
2583 *
2562 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2584 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2563 */ 2585 */
2564enum nl80211_meshconf_params { 2586enum nl80211_meshconf_params {
@@ -2590,6 +2612,7 @@ enum nl80211_meshconf_params {
2590 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, 2612 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
2591 NL80211_MESHCONF_POWER_MODE, 2613 NL80211_MESHCONF_POWER_MODE,
2592 NL80211_MESHCONF_AWAKE_WINDOW, 2614 NL80211_MESHCONF_AWAKE_WINDOW,
2615 NL80211_MESHCONF_PLINK_TIMEOUT,
2593 2616
2594 /* keep last */ 2617 /* keep last */
2595 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2618 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2637,6 +2660,10 @@ enum nl80211_meshconf_params {
2637 * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will 2660 * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
2638 * implement an MPM which handles peer allocation and state. 2661 * implement an MPM which handles peer allocation and state.
2639 * 2662 *
2663 * @NL80211_MESH_SETUP_AUTH_PROTOCOL: Inform the kernel of the authentication
2664 * method (u8, as defined in IEEE 8.4.2.100.6, e.g. 0x1 for SAE).
2665 * Default is no authentication method required.
2666 *
2640 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2667 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2641 * 2668 *
2642 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2669 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -2650,6 +2677,7 @@ enum nl80211_mesh_setup_params {
2650 NL80211_MESH_SETUP_USERSPACE_AMPE, 2677 NL80211_MESH_SETUP_USERSPACE_AMPE,
2651 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, 2678 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2652 NL80211_MESH_SETUP_USERSPACE_MPM, 2679 NL80211_MESH_SETUP_USERSPACE_MPM,
2680 NL80211_MESH_SETUP_AUTH_PROTOCOL,
2653 2681
2654 /* keep last */ 2682 /* keep last */
2655 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2683 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2730,6 +2758,8 @@ enum nl80211_channel_type {
2730 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well 2758 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well
2731 * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 2759 * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2732 * attribute must be provided as well 2760 * attribute must be provided as well
2761 * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel
2762 * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel
2733 */ 2763 */
2734enum nl80211_chan_width { 2764enum nl80211_chan_width {
2735 NL80211_CHAN_WIDTH_20_NOHT, 2765 NL80211_CHAN_WIDTH_20_NOHT,
@@ -2738,6 +2768,8 @@ enum nl80211_chan_width {
2738 NL80211_CHAN_WIDTH_80, 2768 NL80211_CHAN_WIDTH_80,
2739 NL80211_CHAN_WIDTH_80P80, 2769 NL80211_CHAN_WIDTH_80P80,
2740 NL80211_CHAN_WIDTH_160, 2770 NL80211_CHAN_WIDTH_160,
2771 NL80211_CHAN_WIDTH_5,
2772 NL80211_CHAN_WIDTH_10,
2741}; 2773};
2742 2774
2743/** 2775/**
@@ -3556,6 +3588,10 @@ enum nl80211_ap_sme_features {
3556 * Peering Management entity which may be implemented by registering for 3588 * Peering Management entity which may be implemented by registering for
3557 * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is 3589 * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is
3558 * still generated by the driver. 3590 * still generated by the driver.
3591 * @NL80211_FEATURE_ACTIVE_MONITOR: This driver supports an active monitor
3592 * interface. An active monitor interface behaves like a normal monitor
3593 * interface, but gets added to the driver. It ensures that incoming
3594 * unicast packets directed at the configured interface address get ACKed.
3559 */ 3595 */
3560enum nl80211_feature_flags { 3596enum nl80211_feature_flags {
3561 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3597 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3575,6 +3611,7 @@ enum nl80211_feature_flags {
3575 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, 3611 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
3576 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, 3612 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3577 NL80211_FEATURE_USERSPACE_MPM = 1 << 16, 3613 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3614 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17,
3578}; 3615};
3579 3616
3580/** 3617/**
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 405918dd7b3f..c55efaaa9bb4 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -164,6 +164,7 @@ enum ovs_vport_type {
164 OVS_VPORT_TYPE_UNSPEC, 164 OVS_VPORT_TYPE_UNSPEC,
165 OVS_VPORT_TYPE_NETDEV, /* network device */ 165 OVS_VPORT_TYPE_NETDEV, /* network device */
166 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 166 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
167 OVS_VPORT_TYPE_GRE, /* GRE tunnel. */
167 __OVS_VPORT_TYPE_MAX 168 __OVS_VPORT_TYPE_MAX
168}; 169};
169 170
@@ -192,7 +193,6 @@ enum ovs_vport_type {
192 * optional; if not specified a free port number is automatically selected. 193 * optional; if not specified a free port number is automatically selected.
193 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 194 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
194 * of vport. 195 * of vport.
195 * and other attributes are ignored.
196 * 196 *
197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
198 * look up the vport to operate on; otherwise dp_idx from the &struct 198 * look up the vport to operate on; otherwise dp_idx from the &struct
@@ -247,11 +247,29 @@ enum ovs_key_attr {
247 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 247 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
248 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 248 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
249 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 249 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
250 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
251
252#ifdef __KERNEL__
253 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */
254#endif
250 __OVS_KEY_ATTR_MAX 255 __OVS_KEY_ATTR_MAX
251}; 256};
252 257
253#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 258#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
254 259
260enum ovs_tunnel_key_attr {
261 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
262 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
263 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
264 OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */
265 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */
266 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */
267 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
268 __OVS_TUNNEL_KEY_ATTR_MAX
269};
270
271#define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1)
272
255/** 273/**
256 * enum ovs_frag_type - IPv4 and IPv6 fragment type 274 * enum ovs_frag_type - IPv4 and IPv6 fragment type
257 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 275 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 7a2144e1afae..eb0f1a554d7b 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -386,6 +386,8 @@ enum {
386#define RTAX_RTO_MIN RTAX_RTO_MIN 386#define RTAX_RTO_MIN RTAX_RTO_MIN
387 RTAX_INITRWND, 387 RTAX_INITRWND,
388#define RTAX_INITRWND RTAX_INITRWND 388#define RTAX_INITRWND RTAX_INITRWND
389 RTAX_QUICKACK,
390#define RTAX_QUICKACK RTAX_QUICKACK
389 __RTAX_MAX 391 __RTAX_MAX
390}; 392};
391 393
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index df2e8b4f9c03..af0a674cc677 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -253,6 +253,7 @@ enum
253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
256 LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */
256 __LINUX_MIB_MAX 257 __LINUX_MIB_MAX
257}; 258};
258 259
@@ -287,6 +288,7 @@ enum
287 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ 288 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
288 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ 289 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/
289 LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */ 290 LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */
291 LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError */
290 __LINUX_MIB_XFRMMAX 292 __LINUX_MIB_XFRMMAX
291}; 293};
292 294
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index f2d90091cc20..852373d27dbb 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface 2 * include/uapi/linux/tipc.h: Header for TIPC socket interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 0b1e3f218a36..6b0bff09b3a7 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 69bd5bb0d5af..e90a88a8708f 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -53,13 +53,13 @@
53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator controls */
57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ 58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ 59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ 60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ 61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* Digital Video controls */ 62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */
63 63
64/* User-class control IDs */ 64/* User-class control IDs */
65 65
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 87ee4f4cff25..916e444e6f74 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -362,10 +362,14 @@ struct vfio_iommu_type1_dma_map {
362#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) 362#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
363 363
364/** 364/**
365 * VFIO_IOMMU_UNMAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_dma_unmap) 365 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
366 * struct vfio_dma_unmap)
366 * 367 *
367 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. 368 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap.
368 * Caller sets argsz. 369 * Caller sets argsz. The actual unmapped size is returned in the size
370 * field. No guarantee is made to the user that arbitrary unmaps of iova
371 * or size different from those used in the original mapping call will
372 * succeed.
369 */ 373 */
370struct vfio_iommu_type1_dma_unmap { 374struct vfio_iommu_type1_dma_unmap {
371 __u32 argsz; 375 __u32 argsz;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index f40b41c7e108..95ef4551edc1 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -395,7 +395,7 @@ struct v4l2_pix_format {
395#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ 395#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
396#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ 396#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
397#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ 397#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
398#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */ 398#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */
399#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ 399#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
400#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ 400#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
401#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ 401#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
@@ -555,7 +555,7 @@ struct v4l2_jpegcompression {
555 __u32 jpeg_markers; /* Which markers should go into the JPEG 555 __u32 jpeg_markers; /* Which markers should go into the JPEG
556 * output. Unless you exactly know what 556 * output. Unless you exactly know what
557 * you do, leave them untouched. 557 * you do, leave them untouched.
558 * Inluding less markers will make the 558 * Including less markers will make the
559 * resulting code smaller, but there will 559 * resulting code smaller, but there will
560 * be fewer applications which can read it. 560 * be fewer applications which can read it.
561 * The presence of the APP and COM marker 561 * The presence of the APP and COM marker
@@ -567,7 +567,7 @@ struct v4l2_jpegcompression {
567#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ 567#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
568#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ 568#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
569#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will 569#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
570 * allways use APP0 */ 570 * always use APP0 */
571}; 571};
572 572
573/* 573/*
@@ -900,7 +900,7 @@ typedef __u64 v4l2_std_id;
900/* 900/*
901 * "Common" PAL - This macro is there to be compatible with the old 901 * "Common" PAL - This macro is there to be compatible with the old
902 * V4L1 concept of "PAL": /BGDKHI. 902 * V4L1 concept of "PAL": /BGDKHI.
903 * Several PAL standards are mising here: /M, /N and /Nc 903 * Several PAL standards are missing here: /M, /N and /Nc
904 */ 904 */
905#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ 905#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
906 V4L2_STD_PAL_DK |\ 906 V4L2_STD_PAL_DK |\
@@ -1787,11 +1787,13 @@ struct v4l2_event_subscription {
1787/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1787/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1788 1788
1789#define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */ 1789#define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */
1790#define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */
1791
1792/* The following four defines are no longer in use */
1790#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE 1793#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE
1791#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ 1794#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
1792#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1795#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1793#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ 1796#define V4L2_CHIP_MATCH_AC97 3 /* Match against ancillary AC97 chip */
1794#define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */
1795 1797
1796struct v4l2_dbg_match { 1798struct v4l2_dbg_match {
1797 __u32 type; /* Match type */ 1799 __u32 type; /* Match type */
@@ -1808,13 +1810,6 @@ struct v4l2_dbg_register {
1808 __u64 val; 1810 __u64 val;
1809} __attribute__ ((packed)); 1811} __attribute__ ((packed));
1810 1812
1811/* VIDIOC_DBG_G_CHIP_IDENT */
1812struct v4l2_dbg_chip_ident {
1813 struct v4l2_dbg_match match;
1814 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1815 __u32 revision; /* chip revision, chip specific */
1816} __attribute__ ((packed));
1817
1818#define V4L2_CHIP_FL_READABLE (1 << 0) 1813#define V4L2_CHIP_FL_READABLE (1 << 0)
1819#define V4L2_CHIP_FL_WRITABLE (1 << 1) 1814#define V4L2_CHIP_FL_WRITABLE (1 << 1)
1820 1815
@@ -1915,12 +1910,6 @@ struct v4l2_create_buffers {
1915#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) 1910#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
1916#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) 1911#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
1917 1912
1918/* Experimental, meant for debugging, testing and internal use.
1919 Never use this ioctl in applications!
1920 Note: this ioctl is deprecated in favor of VIDIOC_DBG_G_CHIP_INFO and
1921 will go away in the future. */
1922#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1923
1924#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1913#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1925 1914
1926#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1915#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index b7cda390fd00..3ce768c6910d 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -51,4 +51,7 @@
51 * suppressed them? */ 51 * suppressed them? */
52#define VIRTIO_F_NOTIFY_ON_EMPTY 24 52#define VIRTIO_F_NOTIFY_ON_EMPTY 24
53 53
54/* Can the device handle any descriptor layout? */
55#define VIRTIO_F_ANY_LAYOUT 27
56
54#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ 57#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index 1ee9239ff8c2..99b80abf360a 100644
--- a/include/uapi/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
@@ -45,8 +45,8 @@
45enum { 45enum {
46 RDMA_USER_CM_CMD_CREATE_ID, 46 RDMA_USER_CM_CMD_CREATE_ID,
47 RDMA_USER_CM_CMD_DESTROY_ID, 47 RDMA_USER_CM_CMD_DESTROY_ID,
48 RDMA_USER_CM_CMD_BIND_ADDR, 48 RDMA_USER_CM_CMD_BIND_IP,
49 RDMA_USER_CM_CMD_RESOLVE_ADDR, 49 RDMA_USER_CM_CMD_RESOLVE_IP,
50 RDMA_USER_CM_CMD_RESOLVE_ROUTE, 50 RDMA_USER_CM_CMD_RESOLVE_ROUTE,
51 RDMA_USER_CM_CMD_QUERY_ROUTE, 51 RDMA_USER_CM_CMD_QUERY_ROUTE,
52 RDMA_USER_CM_CMD_CONNECT, 52 RDMA_USER_CM_CMD_CONNECT,
@@ -59,9 +59,13 @@ enum {
59 RDMA_USER_CM_CMD_GET_OPTION, 59 RDMA_USER_CM_CMD_GET_OPTION,
60 RDMA_USER_CM_CMD_SET_OPTION, 60 RDMA_USER_CM_CMD_SET_OPTION,
61 RDMA_USER_CM_CMD_NOTIFY, 61 RDMA_USER_CM_CMD_NOTIFY,
62 RDMA_USER_CM_CMD_JOIN_MCAST, 62 RDMA_USER_CM_CMD_JOIN_IP_MCAST,
63 RDMA_USER_CM_CMD_LEAVE_MCAST, 63 RDMA_USER_CM_CMD_LEAVE_MCAST,
64 RDMA_USER_CM_CMD_MIGRATE_ID 64 RDMA_USER_CM_CMD_MIGRATE_ID,
65 RDMA_USER_CM_CMD_QUERY,
66 RDMA_USER_CM_CMD_BIND,
67 RDMA_USER_CM_CMD_RESOLVE_ADDR,
68 RDMA_USER_CM_CMD_JOIN_MCAST
65}; 69};
66 70
67/* 71/*
@@ -95,28 +99,51 @@ struct rdma_ucm_destroy_id_resp {
95 __u32 events_reported; 99 __u32 events_reported;
96}; 100};
97 101
98struct rdma_ucm_bind_addr { 102struct rdma_ucm_bind_ip {
99 __u64 response; 103 __u64 response;
100 struct sockaddr_in6 addr; 104 struct sockaddr_in6 addr;
101 __u32 id; 105 __u32 id;
102}; 106};
103 107
104struct rdma_ucm_resolve_addr { 108struct rdma_ucm_bind {
109 __u32 id;
110 __u16 addr_size;
111 __u16 reserved;
112 struct sockaddr_storage addr;
113};
114
115struct rdma_ucm_resolve_ip {
105 struct sockaddr_in6 src_addr; 116 struct sockaddr_in6 src_addr;
106 struct sockaddr_in6 dst_addr; 117 struct sockaddr_in6 dst_addr;
107 __u32 id; 118 __u32 id;
108 __u32 timeout_ms; 119 __u32 timeout_ms;
109}; 120};
110 121
122struct rdma_ucm_resolve_addr {
123 __u32 id;
124 __u32 timeout_ms;
125 __u16 src_size;
126 __u16 dst_size;
127 __u32 reserved;
128 struct sockaddr_storage src_addr;
129 struct sockaddr_storage dst_addr;
130};
131
111struct rdma_ucm_resolve_route { 132struct rdma_ucm_resolve_route {
112 __u32 id; 133 __u32 id;
113 __u32 timeout_ms; 134 __u32 timeout_ms;
114}; 135};
115 136
116struct rdma_ucm_query_route { 137enum {
138 RDMA_USER_CM_QUERY_ADDR,
139 RDMA_USER_CM_QUERY_PATH,
140 RDMA_USER_CM_QUERY_GID
141};
142
143struct rdma_ucm_query {
117 __u64 response; 144 __u64 response;
118 __u32 id; 145 __u32 id;
119 __u32 reserved; 146 __u32 option;
120}; 147};
121 148
122struct rdma_ucm_query_route_resp { 149struct rdma_ucm_query_route_resp {
@@ -129,9 +156,26 @@ struct rdma_ucm_query_route_resp {
129 __u8 reserved[3]; 156 __u8 reserved[3];
130}; 157};
131 158
159struct rdma_ucm_query_addr_resp {
160 __u64 node_guid;
161 __u8 port_num;
162 __u8 reserved;
163 __u16 pkey;
164 __u16 src_size;
165 __u16 dst_size;
166 struct sockaddr_storage src_addr;
167 struct sockaddr_storage dst_addr;
168};
169
170struct rdma_ucm_query_path_resp {
171 __u32 num_paths;
172 __u32 reserved;
173 struct ib_path_rec_data path_data[0];
174};
175
132struct rdma_ucm_conn_param { 176struct rdma_ucm_conn_param {
133 __u32 qp_num; 177 __u32 qp_num;
134 __u32 reserved; 178 __u32 qkey;
135 __u8 private_data[RDMA_MAX_PRIVATE_DATA]; 179 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
136 __u8 private_data_len; 180 __u8 private_data_len;
137 __u8 srq; 181 __u8 srq;
@@ -192,13 +236,22 @@ struct rdma_ucm_notify {
192 __u32 event; 236 __u32 event;
193}; 237};
194 238
195struct rdma_ucm_join_mcast { 239struct rdma_ucm_join_ip_mcast {
196 __u64 response; /* rdma_ucm_create_id_resp */ 240 __u64 response; /* rdma_ucm_create_id_resp */
197 __u64 uid; 241 __u64 uid;
198 struct sockaddr_in6 addr; 242 struct sockaddr_in6 addr;
199 __u32 id; 243 __u32 id;
200}; 244};
201 245
246struct rdma_ucm_join_mcast {
247 __u64 response; /* rdma_ucma_create_id_resp */
248 __u64 uid;
249 __u32 id;
250 __u16 addr_size;
251 __u16 reserved;
252 struct sockaddr_storage addr;
253};
254
202struct rdma_ucm_get_event { 255struct rdma_ucm_get_event {
203 __u64 response; 256 __u64 response;
204}; 257};
diff --git a/include/video/display_timing.h b/include/video/display_timing.h
index 5d0259b08e01..28d9d0d566ca 100644
--- a/include/video/display_timing.h
+++ b/include/video/display_timing.h
@@ -27,6 +27,7 @@ enum display_flags {
27 DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7), 27 DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7),
28 DISPLAY_FLAGS_INTERLACED = BIT(8), 28 DISPLAY_FLAGS_INTERLACED = BIT(8),
29 DISPLAY_FLAGS_DOUBLESCAN = BIT(9), 29 DISPLAY_FLAGS_DOUBLESCAN = BIT(9),
30 DISPLAY_FLAGS_DOUBLECLK = BIT(10),
30}; 31};
31 32
32/* 33/*
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
index 8016eb727cf3..79e6697af6cf 100644
--- a/include/video/of_display_timing.h
+++ b/include/video/of_display_timing.h
@@ -10,10 +10,13 @@
10#define __LINUX_OF_DISPLAY_TIMING_H 10#define __LINUX_OF_DISPLAY_TIMING_H
11 11
12struct device_node; 12struct device_node;
13struct display_timing;
13struct display_timings; 14struct display_timings;
14 15
15#define OF_USE_NATIVE_MODE -1 16#define OF_USE_NATIVE_MODE -1
16 17
18int of_get_display_timing(struct device_node *np, const char *name,
19 struct display_timing *dt);
17struct display_timings *of_get_display_timings(struct device_node *np); 20struct display_timings *of_get_display_timings(struct device_node *np);
18int of_display_timings_exist(struct device_node *np); 21int of_display_timings_exist(struct device_node *np);
19 22
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
index 0c3b46d3daf3..6b2366fb6e53 100644
--- a/include/video/omap-panel-data.h
+++ b/include/video/omap-panel-data.h
@@ -27,6 +27,9 @@
27#ifndef __OMAP_PANEL_DATA_H 27#ifndef __OMAP_PANEL_DATA_H
28#define __OMAP_PANEL_DATA_H 28#define __OMAP_PANEL_DATA_H
29 29
30#include <video/omapdss.h>
31#include <video/display_timing.h>
32
30struct omap_dss_device; 33struct omap_dss_device;
31 34
32/** 35/**
@@ -147,4 +150,210 @@ struct panel_tpo_td043_data {
147 int nreset_gpio; 150 int nreset_gpio;
148}; 151};
149 152
153/**
154 * encoder_tfp410 platform data
155 * @name: name for this display entity
156 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
157 * @data_lines: number of DPI datalines
158 */
159struct encoder_tfp410_platform_data {
160 const char *name;
161 const char *source;
162 int power_down_gpio;
163 int data_lines;
164};
165
166/**
167 * encoder_tpd12s015 platform data
168 * @name: name for this display entity
169 * @ct_cp_hpd_gpio: CT_CP_HPD gpio number
170 * @ls_oe_gpio: LS_OE gpio number
171 * @hpd_gpio: HPD gpio number
172 */
173struct encoder_tpd12s015_platform_data {
174 const char *name;
175 const char *source;
176
177 int ct_cp_hpd_gpio;
178 int ls_oe_gpio;
179 int hpd_gpio;
180};
181
182/**
183 * connector_dvi platform data
184 * @name: name for this display entity
185 * @source: name of the display entity used as a video source
186 * @i2c_bus_num: i2c bus number to be used for reading EDID
187 */
188struct connector_dvi_platform_data {
189 const char *name;
190 const char *source;
191 int i2c_bus_num;
192};
193
194/**
195 * connector_hdmi platform data
196 * @name: name for this display entity
197 * @source: name of the display entity used as a video source
198 */
199struct connector_hdmi_platform_data {
200 const char *name;
201 const char *source;
202};
203
204/**
205 * connector_atv platform data
206 * @name: name for this display entity
207 * @source: name of the display entity used as a video source
208 * @connector_type: composite/svideo
209 * @invert_polarity: invert signal polarity
210 */
211struct connector_atv_platform_data {
212 const char *name;
213 const char *source;
214
215 enum omap_dss_venc_type connector_type;
216 bool invert_polarity;
217};
218
219/**
220 * panel_dpi platform data
221 * @name: name for this display entity
222 * @source: name of the display entity used as a video source
223 * @data_lines: number of DPI datalines
224 * @display_timing: timings for this panel
225 * @backlight_gpio: gpio to enable/disable the backlight (or -1)
226 * @enable_gpio: gpio to enable/disable the panel (or -1)
227 */
228struct panel_dpi_platform_data {
229 const char *name;
230 const char *source;
231
232 int data_lines;
233
234 const struct display_timing *display_timing;
235
236 int backlight_gpio;
237 int enable_gpio;
238};
239
240/**
241 * panel_dsicm platform data
242 * @name: name for this display entity
243 * @source: name of the display entity used as a video source
244 * @reset_gpio: gpio to reset the panel (or -1)
245 * @use_ext_te: use external TE GPIO
246 * @ext_te_gpio: external TE GPIO
247 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
248 * @use_dsi_backlight: true if panel uses DSI command to control backlight
249 * @pin_config: DSI pin configuration
250 */
251struct panel_dsicm_platform_data {
252 const char *name;
253 const char *source;
254
255 int reset_gpio;
256
257 bool use_ext_te;
258 int ext_te_gpio;
259
260 unsigned ulps_timeout;
261
262 bool use_dsi_backlight;
263
264 struct omap_dsi_pin_config pin_config;
265};
266
267/**
268 * panel_acx565akm platform data
269 * @name: name for this display entity
270 * @source: name of the display entity used as a video source
271 * @reset_gpio: gpio to reset the panel (or -1)
272 * @datapairs: number of SDI datapairs
273 */
274struct panel_acx565akm_platform_data {
275 const char *name;
276 const char *source;
277
278 int reset_gpio;
279
280 int datapairs;
281};
282
283/**
284 * panel_lb035q02 platform data
285 * @name: name for this display entity
286 * @source: name of the display entity used as a video source
287 * @data_lines: number of DPI datalines
288 * @backlight_gpio: gpio to enable/disable the backlight (or -1)
289 * @enable_gpio: gpio to enable/disable the panel (or -1)
290 */
291struct panel_lb035q02_platform_data {
292 const char *name;
293 const char *source;
294
295 int data_lines;
296
297 int backlight_gpio;
298 int enable_gpio;
299};
300
301/**
302 * panel_sharp_ls037v7dw01 platform data
303 * @name: name for this display entity
304 * @source: name of the display entity used as a video source
305 * @data_lines: number of DPI datalines
306 * @resb_gpio: reset signal GPIO
307 * @ini_gpio: power on control GPIO
308 * @mo_gpio: selection for resolution(VGA/QVGA) GPIO
309 * @lr_gpio: selection for horizontal scanning direction GPIO
310 * @ud_gpio: selection for vertical scanning direction GPIO
311 */
312struct panel_sharp_ls037v7dw01_platform_data {
313 const char *name;
314 const char *source;
315
316 int data_lines;
317
318 int resb_gpio;
319 int ini_gpio;
320 int mo_gpio;
321 int lr_gpio;
322 int ud_gpio;
323};
324
325/**
326 * panel-tpo-td043mtea1 platform data
327 * @name: name for this display entity
328 * @source: name of the display entity used as a video source
329 * @data_lines: number of DPI datalines
330 * @nreset_gpio: reset signal
331 */
332struct panel_tpo_td043mtea1_platform_data {
333 const char *name;
334 const char *source;
335
336 int data_lines;
337
338 int nreset_gpio;
339};
340
341/**
342 * panel-nec-nl8048hl11 platform data
343 * @name: name for this display entity
344 * @source: name of the display entity used as a video source
345 * @data_lines: number of DPI datalines
346 * @res_gpio: reset signal
347 * @qvga_gpio: selection for resolution(QVGA/WVGA)
348 */
349struct panel_nec_nl8048hl11_platform_data {
350 const char *name;
351 const char *source;
352
353 int data_lines;
354
355 int res_gpio;
356 int qvga_gpio;
357};
358
150#endif /* __OMAP_PANEL_DATA_H */ 359#endif /* __OMAP_PANEL_DATA_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index aeb4e9a0c5d1..b39463553845 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -23,6 +23,8 @@
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25 25
26#include <video/videomode.h>
27
26#define DISPC_IRQ_FRAMEDONE (1 << 0) 28#define DISPC_IRQ_FRAMEDONE (1 << 0)
27#define DISPC_IRQ_VSYNC (1 << 1) 29#define DISPC_IRQ_VSYNC (1 << 1)
28#define DISPC_IRQ_EVSYNC_EVEN (1 << 2) 30#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
@@ -68,6 +70,7 @@ enum omap_display_type {
68 OMAP_DISPLAY_TYPE_DSI = 1 << 3, 70 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
69 OMAP_DISPLAY_TYPE_VENC = 1 << 4, 71 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
70 OMAP_DISPLAY_TYPE_HDMI = 1 << 5, 72 OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
73 OMAP_DISPLAY_TYPE_DVI = 1 << 6,
71}; 74};
72 75
73enum omap_plane { 76enum omap_plane {
@@ -169,6 +172,11 @@ enum omap_dss_audio_state {
169 OMAP_DSS_AUDIO_PLAYING, 172 OMAP_DSS_AUDIO_PLAYING,
170}; 173};
171 174
175struct omap_dss_audio {
176 struct snd_aes_iec958 *iec;
177 struct snd_cea_861_aud_if *cea;
178};
179
172enum omap_dss_rotation_type { 180enum omap_dss_rotation_type {
173 OMAP_DSS_ROT_DMA = 1 << 0, 181 OMAP_DSS_ROT_DMA = 1 << 0,
174 OMAP_DSS_ROT_VRFB = 1 << 1, 182 OMAP_DSS_ROT_VRFB = 1 << 1,
@@ -365,6 +373,7 @@ struct omap_dss_board_info {
365 int num_devices; 373 int num_devices;
366 struct omap_dss_device **devices; 374 struct omap_dss_device **devices;
367 struct omap_dss_device *default_device; 375 struct omap_dss_device *default_device;
376 const char *default_display_name;
368 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); 377 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
369 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); 378 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
370 int (*set_min_bus_tput)(struct device *dev, unsigned long r); 379 int (*set_min_bus_tput)(struct device *dev, unsigned long r);
@@ -512,7 +521,7 @@ struct omap_overlay_manager {
512 enum omap_dss_output_id supported_outputs; 521 enum omap_dss_output_id supported_outputs;
513 522
514 /* dynamic fields */ 523 /* dynamic fields */
515 struct omap_dss_output *output; 524 struct omap_dss_device *output;
516 525
517 /* 526 /*
518 * The following functions do not block: 527 * The following functions do not block:
@@ -526,7 +535,7 @@ struct omap_overlay_manager {
526 */ 535 */
527 536
528 int (*set_output)(struct omap_overlay_manager *mgr, 537 int (*set_output)(struct omap_overlay_manager *mgr,
529 struct omap_dss_output *output); 538 struct omap_dss_device *output);
530 int (*unset_output)(struct omap_overlay_manager *mgr); 539 int (*unset_output)(struct omap_overlay_manager *mgr);
531 540
532 int (*set_manager_info)(struct omap_overlay_manager *mgr, 541 int (*set_manager_info)(struct omap_overlay_manager *mgr,
@@ -569,33 +578,192 @@ struct omap_dss_writeback_info {
569 u8 pre_mult_alpha; 578 u8 pre_mult_alpha;
570}; 579};
571 580
572struct omap_dss_output { 581struct omapdss_dpi_ops {
573 struct list_head list; 582 int (*connect)(struct omap_dss_device *dssdev,
583 struct omap_dss_device *dst);
584 void (*disconnect)(struct omap_dss_device *dssdev,
585 struct omap_dss_device *dst);
574 586
575 const char *name; 587 int (*enable)(struct omap_dss_device *dssdev);
588 void (*disable)(struct omap_dss_device *dssdev);
576 589
577 /* display type supported by the output */ 590 int (*check_timings)(struct omap_dss_device *dssdev,
578 enum omap_display_type type; 591 struct omap_video_timings *timings);
592 void (*set_timings)(struct omap_dss_device *dssdev,
593 struct omap_video_timings *timings);
594 void (*get_timings)(struct omap_dss_device *dssdev,
595 struct omap_video_timings *timings);
579 596
580 /* DISPC channel for this output */ 597 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
581 enum omap_channel dispc_channel; 598};
582 599
583 /* output instance */ 600struct omapdss_sdi_ops {
584 enum omap_dss_output_id id; 601 int (*connect)(struct omap_dss_device *dssdev,
602 struct omap_dss_device *dst);
603 void (*disconnect)(struct omap_dss_device *dssdev,
604 struct omap_dss_device *dst);
585 605
586 /* output's platform device pointer */ 606 int (*enable)(struct omap_dss_device *dssdev);
587 struct platform_device *pdev; 607 void (*disable)(struct omap_dss_device *dssdev);
588 608
589 /* dynamic fields */ 609 int (*check_timings)(struct omap_dss_device *dssdev,
590 struct omap_overlay_manager *manager; 610 struct omap_video_timings *timings);
611 void (*set_timings)(struct omap_dss_device *dssdev,
612 struct omap_video_timings *timings);
613 void (*get_timings)(struct omap_dss_device *dssdev,
614 struct omap_video_timings *timings);
591 615
592 struct omap_dss_device *device; 616 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
617};
618
619struct omapdss_dvi_ops {
620 int (*connect)(struct omap_dss_device *dssdev,
621 struct omap_dss_device *dst);
622 void (*disconnect)(struct omap_dss_device *dssdev,
623 struct omap_dss_device *dst);
624
625 int (*enable)(struct omap_dss_device *dssdev);
626 void (*disable)(struct omap_dss_device *dssdev);
627
628 int (*check_timings)(struct omap_dss_device *dssdev,
629 struct omap_video_timings *timings);
630 void (*set_timings)(struct omap_dss_device *dssdev,
631 struct omap_video_timings *timings);
632 void (*get_timings)(struct omap_dss_device *dssdev,
633 struct omap_video_timings *timings);
634};
635
636struct omapdss_atv_ops {
637 int (*connect)(struct omap_dss_device *dssdev,
638 struct omap_dss_device *dst);
639 void (*disconnect)(struct omap_dss_device *dssdev,
640 struct omap_dss_device *dst);
641
642 int (*enable)(struct omap_dss_device *dssdev);
643 void (*disable)(struct omap_dss_device *dssdev);
644
645 int (*check_timings)(struct omap_dss_device *dssdev,
646 struct omap_video_timings *timings);
647 void (*set_timings)(struct omap_dss_device *dssdev,
648 struct omap_video_timings *timings);
649 void (*get_timings)(struct omap_dss_device *dssdev,
650 struct omap_video_timings *timings);
651
652 void (*set_type)(struct omap_dss_device *dssdev,
653 enum omap_dss_venc_type type);
654 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
655 bool invert_polarity);
656
657 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
658 u32 (*get_wss)(struct omap_dss_device *dssdev);
659};
660
661struct omapdss_hdmi_ops {
662 int (*connect)(struct omap_dss_device *dssdev,
663 struct omap_dss_device *dst);
664 void (*disconnect)(struct omap_dss_device *dssdev,
665 struct omap_dss_device *dst);
666
667 int (*enable)(struct omap_dss_device *dssdev);
668 void (*disable)(struct omap_dss_device *dssdev);
669
670 int (*check_timings)(struct omap_dss_device *dssdev,
671 struct omap_video_timings *timings);
672 void (*set_timings)(struct omap_dss_device *dssdev,
673 struct omap_video_timings *timings);
674 void (*get_timings)(struct omap_dss_device *dssdev,
675 struct omap_video_timings *timings);
676
677 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
678 bool (*detect)(struct omap_dss_device *dssdev);
679
680 /*
681 * Note: These functions might sleep. Do not call while
682 * holding a spinlock/readlock.
683 */
684 int (*audio_enable)(struct omap_dss_device *dssdev);
685 void (*audio_disable)(struct omap_dss_device *dssdev);
686 bool (*audio_supported)(struct omap_dss_device *dssdev);
687 int (*audio_config)(struct omap_dss_device *dssdev,
688 struct omap_dss_audio *audio);
689 /* Note: These functions may not sleep */
690 int (*audio_start)(struct omap_dss_device *dssdev);
691 void (*audio_stop)(struct omap_dss_device *dssdev);
692};
693
694struct omapdss_dsi_ops {
695 int (*connect)(struct omap_dss_device *dssdev,
696 struct omap_dss_device *dst);
697 void (*disconnect)(struct omap_dss_device *dssdev,
698 struct omap_dss_device *dst);
699
700 int (*enable)(struct omap_dss_device *dssdev);
701 void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
702 bool enter_ulps);
703
704 /* bus configuration */
705 int (*set_config)(struct omap_dss_device *dssdev,
706 const struct omap_dss_dsi_config *cfg);
707 int (*configure_pins)(struct omap_dss_device *dssdev,
708 const struct omap_dsi_pin_config *pin_cfg);
709
710 void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
711 bool enable);
712 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
713
714 int (*update)(struct omap_dss_device *dssdev, int channel,
715 void (*callback)(int, void *), void *data);
716
717 void (*bus_lock)(struct omap_dss_device *dssdev);
718 void (*bus_unlock)(struct omap_dss_device *dssdev);
719
720 int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
721 void (*disable_video_output)(struct omap_dss_device *dssdev,
722 int channel);
723
724 int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
725 int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
726 int vc_id);
727 void (*release_vc)(struct omap_dss_device *dssdev, int channel);
728
729 /* data transfer */
730 int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
731 u8 *data, int len);
732 int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
733 u8 *data, int len);
734 int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
735 u8 *data, int len);
736
737 int (*gen_write)(struct omap_dss_device *dssdev, int channel,
738 u8 *data, int len);
739 int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
740 u8 *data, int len);
741 int (*gen_read)(struct omap_dss_device *dssdev, int channel,
742 u8 *reqdata, int reqlen,
743 u8 *data, int len);
744
745 int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
746
747 int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
748 int channel, u16 plen);
593}; 749};
594 750
595struct omap_dss_device { 751struct omap_dss_device {
596 struct device dev; 752 /* old device, to be removed */
753 struct device old_dev;
754
755 /* new device, pointer to panel device */
756 struct device *dev;
757
758 struct module *owner;
759
760 struct list_head panel_list;
761
762 /* alias in the form of "display%d" */
763 char alias[16];
597 764
598 enum omap_display_type type; 765 enum omap_display_type type;
766 enum omap_display_type output_type;
599 767
600 /* obsolete, to be removed */ 768 /* obsolete, to be removed */
601 enum omap_channel channel; 769 enum omap_channel channel;
@@ -616,9 +784,6 @@ struct omap_dss_device {
616 784
617 struct { 785 struct {
618 int module; 786 int module;
619
620 bool ext_te;
621 u8 ext_te_gpio;
622 } dsi; 787 } dsi;
623 788
624 struct { 789 struct {
@@ -639,10 +804,6 @@ struct omap_dss_device {
639 struct rfbi_timings rfbi_timings; 804 struct rfbi_timings rfbi_timings;
640 } ctrl; 805 } ctrl;
641 806
642 int reset_gpio;
643
644 int max_backlight_level;
645
646 const char *name; 807 const char *name;
647 808
648 /* used to match device to driver */ 809 /* used to match device to driver */
@@ -652,22 +813,40 @@ struct omap_dss_device {
652 813
653 struct omap_dss_driver *driver; 814 struct omap_dss_driver *driver;
654 815
816 union {
817 const struct omapdss_dpi_ops *dpi;
818 const struct omapdss_sdi_ops *sdi;
819 const struct omapdss_dvi_ops *dvi;
820 const struct omapdss_hdmi_ops *hdmi;
821 const struct omapdss_atv_ops *atv;
822 const struct omapdss_dsi_ops *dsi;
823 } ops;
824
655 /* helper variable for driver suspend/resume */ 825 /* helper variable for driver suspend/resume */
656 bool activate_after_resume; 826 bool activate_after_resume;
657 827
658 enum omap_display_caps caps; 828 enum omap_display_caps caps;
659 829
660 struct omap_dss_output *output; 830 struct omap_dss_device *output;
661 831
662 enum omap_dss_display_state state; 832 enum omap_dss_display_state state;
663 833
664 enum omap_dss_audio_state audio_state; 834 enum omap_dss_audio_state audio_state;
665 835
666 /* platform specific */ 836 /* OMAP DSS output specific fields */
667 int (*platform_enable)(struct omap_dss_device *dssdev); 837
668 void (*platform_disable)(struct omap_dss_device *dssdev); 838 struct list_head list;
669 int (*set_backlight)(struct omap_dss_device *dssdev, int level); 839
670 int (*get_backlight)(struct omap_dss_device *dssdev); 840 /* DISPC channel for this output */
841 enum omap_channel dispc_channel;
842
843 /* output instance */
844 enum omap_dss_output_id id;
845
846 /* dynamic fields */
847 struct omap_overlay_manager *manager;
848
849 struct omap_dss_device *device;
671}; 850};
672 851
673struct omap_dss_hdmi_data 852struct omap_dss_hdmi_data
@@ -677,17 +856,15 @@ struct omap_dss_hdmi_data
677 int hpd_gpio; 856 int hpd_gpio;
678}; 857};
679 858
680struct omap_dss_audio {
681 struct snd_aes_iec958 *iec;
682 struct snd_cea_861_aud_if *cea;
683};
684
685struct omap_dss_driver { 859struct omap_dss_driver {
686 struct device_driver driver; 860 struct device_driver driver;
687 861
688 int (*probe)(struct omap_dss_device *); 862 int (*probe)(struct omap_dss_device *);
689 void (*remove)(struct omap_dss_device *); 863 void (*remove)(struct omap_dss_device *);
690 864
865 int (*connect)(struct omap_dss_device *dssdev);
866 void (*disconnect)(struct omap_dss_device *dssdev);
867
691 int (*enable)(struct omap_dss_device *display); 868 int (*enable)(struct omap_dss_device *display);
692 void (*disable)(struct omap_dss_device *display); 869 void (*disable)(struct omap_dss_device *display);
693 int (*run_test)(struct omap_dss_device *display, int test); 870 int (*run_test)(struct omap_dss_device *display, int test);
@@ -753,7 +930,10 @@ bool omapdss_is_initialized(void);
753int omap_dss_register_driver(struct omap_dss_driver *); 930int omap_dss_register_driver(struct omap_dss_driver *);
754void omap_dss_unregister_driver(struct omap_dss_driver *); 931void omap_dss_unregister_driver(struct omap_dss_driver *);
755 932
756void omap_dss_get_device(struct omap_dss_device *dssdev); 933int omapdss_register_display(struct omap_dss_device *dssdev);
934void omapdss_unregister_display(struct omap_dss_device *dssdev);
935
936struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
757void omap_dss_put_device(struct omap_dss_device *dssdev); 937void omap_dss_put_device(struct omap_dss_device *dssdev);
758#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL) 938#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
759struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); 939struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
@@ -761,8 +941,10 @@ struct omap_dss_device *omap_dss_find_device(void *data,
761 int (*match)(struct omap_dss_device *dssdev, void *data)); 941 int (*match)(struct omap_dss_device *dssdev, void *data));
762const char *omapdss_get_default_display_name(void); 942const char *omapdss_get_default_display_name(void);
763 943
764int omap_dss_start_device(struct omap_dss_device *dssdev); 944void videomode_to_omap_video_timings(const struct videomode *vm,
765void omap_dss_stop_device(struct omap_dss_device *dssdev); 945 struct omap_video_timings *ovt);
946void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
947 struct videomode *vm);
766 948
767int dss_feat_get_num_mgrs(void); 949int dss_feat_get_num_mgrs(void);
768int dss_feat_get_num_ovls(void); 950int dss_feat_get_num_ovls(void);
@@ -778,10 +960,17 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
778int omap_dss_get_num_overlays(void); 960int omap_dss_get_num_overlays(void);
779struct omap_overlay *omap_dss_get_overlay(int num); 961struct omap_overlay *omap_dss_get_overlay(int num);
780 962
781struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); 963int omapdss_register_output(struct omap_dss_device *output);
782int omapdss_output_set_device(struct omap_dss_output *out, 964void omapdss_unregister_output(struct omap_dss_device *output);
965struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
966struct omap_dss_device *omap_dss_find_output(const char *name);
967struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node);
968int omapdss_output_set_device(struct omap_dss_device *out,
783 struct omap_dss_device *dssdev); 969 struct omap_dss_device *dssdev);
784int omapdss_output_unset_device(struct omap_dss_output *out); 970int omapdss_output_unset_device(struct omap_dss_device *out);
971
972struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
973struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
785 974
786void omapdss_default_get_resolution(struct omap_dss_device *dssdev, 975void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
787 u16 *xres, u16 *yres); 976 u16 *xres, u16 *yres);
@@ -832,7 +1021,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
832 bool mem_to_mem); 1021 bool mem_to_mem);
833 1022
834#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) 1023#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
835#define to_dss_device(x) container_of((x), struct omap_dss_device, dev) 1024#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev)
836 1025
837void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 1026void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
838 bool enable); 1027 bool enable);
@@ -883,6 +1072,11 @@ int omapdss_compat_init(void);
883void omapdss_compat_uninit(void); 1072void omapdss_compat_uninit(void);
884 1073
885struct dss_mgr_ops { 1074struct dss_mgr_ops {
1075 int (*connect)(struct omap_overlay_manager *mgr,
1076 struct omap_dss_device *dst);
1077 void (*disconnect)(struct omap_overlay_manager *mgr,
1078 struct omap_dss_device *dst);
1079
886 void (*start_update)(struct omap_overlay_manager *mgr); 1080 void (*start_update)(struct omap_overlay_manager *mgr);
887 int (*enable)(struct omap_overlay_manager *mgr); 1081 int (*enable)(struct omap_overlay_manager *mgr);
888 void (*disable)(struct omap_overlay_manager *mgr); 1082 void (*disable)(struct omap_overlay_manager *mgr);
@@ -899,6 +1093,10 @@ struct dss_mgr_ops {
899int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); 1093int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
900void dss_uninstall_mgr_ops(void); 1094void dss_uninstall_mgr_ops(void);
901 1095
1096int dss_mgr_connect(struct omap_overlay_manager *mgr,
1097 struct omap_dss_device *dst);
1098void dss_mgr_disconnect(struct omap_overlay_manager *mgr,
1099 struct omap_dss_device *dst);
902void dss_mgr_set_timings(struct omap_overlay_manager *mgr, 1100void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
903 const struct omap_video_timings *timings); 1101 const struct omap_video_timings *timings);
904void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, 1102void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
@@ -910,4 +1108,15 @@ int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr,
910 void (*handler)(void *), void *data); 1108 void (*handler)(void *), void *data);
911void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, 1109void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
912 void (*handler)(void *), void *data); 1110 void (*handler)(void *), void *data);
1111
1112static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
1113{
1114 return dssdev->output;
1115}
1116
1117static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
1118{
1119 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
1120}
1121
913#endif 1122#endif
diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h
index 1a91850cb961..30f53625415c 100644
--- a/include/video/uvesafb.h
+++ b/include/video/uvesafb.h
@@ -134,6 +134,7 @@ struct uvesafb_par {
134 134
135 int mode_idx; 135 int mode_idx;
136 struct vbe_crtc_ib crtc; 136 struct vbe_crtc_ib crtc;
137 int mtrr_handle;
137}; 138};
138 139
139#endif /* _UVESAFB_H */ 140#endif /* _UVESAFB_H */
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index ffd4652de91c..65e12099ef89 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -103,12 +103,46 @@ typedef uint64_t blkif_sector_t;
103#define BLKIF_OP_DISCARD 5 103#define BLKIF_OP_DISCARD 5
104 104
105/* 105/*
106 * Recognized if "feature-max-indirect-segments" in present in the backend
107 * xenbus info. The "feature-max-indirect-segments" node contains the maximum
108 * number of segments allowed by the backend per request. If the node is
109 * present, the frontend might use blkif_request_indirect structs in order to
110 * issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The
111 * maximum number of indirect segments is fixed by the backend, but the
112 * frontend can issue requests with any number of indirect segments as long as
113 * it's less than the number provided by the backend. The indirect_grefs field
114 * in blkif_request_indirect should be filled by the frontend with the
115 * grant references of the pages that are holding the indirect segments.
116 * This pages are filled with an array of blkif_request_segment_aligned
117 * that hold the information about the segments. The number of indirect
118 * pages to use is determined by the maximum number of segments
119 * a indirect request contains. Every indirect page can contain a maximum
120 * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
121 * so to calculate the number of indirect pages to use we have to do
122 * ceil(indirect_segments/512).
123 *
124 * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not*
125 * create the "feature-max-indirect-segments" node!
126 */
127#define BLKIF_OP_INDIRECT 6
128
129/*
106 * Maximum scatter/gather segments per request. 130 * Maximum scatter/gather segments per request.
107 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. 131 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
108 * NB. This could be 12 if the ring indexes weren't stored in the same page. 132 * NB. This could be 12 if the ring indexes weren't stored in the same page.
109 */ 133 */
110#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 134#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
111 135
136#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
137
138struct blkif_request_segment_aligned {
139 grant_ref_t gref; /* reference to I/O buffer frame */
140 /* @first_sect: first sector in frame to transfer (inclusive). */
141 /* @last_sect: last sector in frame to transfer (inclusive). */
142 uint8_t first_sect, last_sect;
143 uint16_t _pad; /* padding to make it 8 bytes, so it's cache-aligned */
144} __attribute__((__packed__));
145
112struct blkif_request_rw { 146struct blkif_request_rw {
113 uint8_t nr_segments; /* number of segments */ 147 uint8_t nr_segments; /* number of segments */
114 blkif_vdev_t handle; /* only for read/write requests */ 148 blkif_vdev_t handle; /* only for read/write requests */
@@ -147,12 +181,31 @@ struct blkif_request_other {
147 uint64_t id; /* private guest value, echoed in resp */ 181 uint64_t id; /* private guest value, echoed in resp */
148} __attribute__((__packed__)); 182} __attribute__((__packed__));
149 183
184struct blkif_request_indirect {
185 uint8_t indirect_op;
186 uint16_t nr_segments;
187#ifdef CONFIG_X86_64
188 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
189#endif
190 uint64_t id;
191 blkif_sector_t sector_number;
192 blkif_vdev_t handle;
193 uint16_t _pad2;
194 grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
195#ifdef CONFIG_X86_64
196 uint32_t _pad3; /* make it 64 byte aligned */
197#else
198 uint64_t _pad3; /* make it 64 byte aligned */
199#endif
200} __attribute__((__packed__));
201
150struct blkif_request { 202struct blkif_request {
151 uint8_t operation; /* BLKIF_OP_??? */ 203 uint8_t operation; /* BLKIF_OP_??? */
152 union { 204 union {
153 struct blkif_request_rw rw; 205 struct blkif_request_rw rw;
154 struct blkif_request_discard discard; 206 struct blkif_request_discard discard;
155 struct blkif_request_other other; 207 struct blkif_request_other other;
208 struct blkif_request_indirect indirect;
156 } u; 209 } u;
157} __attribute__((__packed__)); 210} __attribute__((__packed__));
158 211
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 3ef3fe05ee99..eb262e3324d2 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -38,6 +38,18 @@
38 * that it cannot safely queue packets (as it may not be kicked to send them). 38 * that it cannot safely queue packets (as it may not be kicked to send them).
39 */ 39 */
40 40
41 /*
42 * "feature-split-event-channels" is introduced to separate guest TX
43 * and RX notificaion. Backend either doesn't support this feature or
44 * advertise it via xenstore as 0 (disabled) or 1 (enabled).
45 *
46 * To make use of this feature, frontend should allocate two event
47 * channels for TX and RX, advertise them to backend as
48 * "event-channel-tx" and "event-channel-rx" respectively. If frontend
49 * doesn't want to use this feature, it just writes "event-channel"
50 * node as before.
51 */
52
41/* 53/*
42 * This is the 'wire' format for packets: 54 * This is the 'wire' format for packets:
43 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) 55 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index 75271b9a8f61..7d28aff605c7 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -188,6 +188,11 @@ struct __name##_back_ring { \
188#define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \ 188#define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \
189 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r)) 189 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
190 190
191/* Ill-behaved frontend determination: Can there be this many requests? */
192#define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \
193 (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r))
194
195
191#define RING_PUSH_REQUESTS(_r) do { \ 196#define RING_PUSH_REQUESTS(_r) do { \
192 wmb(); /* back sees requests /before/ updated producer index */ \ 197 wmb(); /* back sees requests /before/ updated producer index */ \
193 (_r)->sring->req_prod = (_r)->req_prod_pvt; \ 198 (_r)->sring->req_prod = (_r)->req_prod_pvt; \