/* * include/video/gbe.h -- SGI GBE (Graphics Back End) * * Copyright (C) 1999 Silicon Graphics, Inc. (Jeffrey Newquist) * * This file is subject to the terms and conditions of the GNU General Public * License version 2 as published by the Free Software Foundation. */ #ifndef __GBE_H__ #define __GBE_H__ struct sgi_gbe { volatile uint32_t ctrlstat; /* general control */ volatile uint32_t dotclock; /* dot clock PLL control */ volatile uint32_t i2c; /* crt I2C control */ volatile uint32_t sysclk; /* system clock PLL control */ volatile uint32_t i2cfp; /* flat panel I2C control */ volatile uint32_t id; /* device id/chip revision */ volatile uint32_t config; /* power on configuration [1] */ volatile uint32_t bist; /* internal bist status [1] */ uint32_t _pad0[0x010000/4 - 8]; volatile uint32_t vt_xy; /* current dot coords */ volatile uint32_t vt_xymax; /* maximum dot coords */ volatile uint32_t vt_vsync; /* vsync on/off */ volatile uint32_t vt_hsync; /* hsync on/off */ volatile uint32_t vt_vblank; /* vblank on/off */ volatile uint32_t vt_hblank; /* hblank on/off */ volatile uint32_t vt_flags; /* polarity of vt signals */ volatile uint32_t vt_f2rf_lock; /* f2rf & framelck y coord */ volatile uint32_t vt_intr01; /* intr 0,1 y coords */ volatile uint32_t vt_intr23; /* intr 2,3 y coords */ volatile uint32_t fp_hdrv; /* flat panel hdrv on/off */ volatile uint32_t fp_vdrv; /* flat panel vdrv on/off */ volatile uint32_t fp_de; /* flat panel de on/off */ volatile uint32_t vt_hpixen; /* intrnl horiz pixel on/off */ volatile uint32_t vt_vpixen; /* intrnl vert pixel on/off */ volatile uint32_t vt_hcmap; /* cmap write (horiz) */ volatile uint32_t vt_vcmap; /* cmap write (vert) */ volatile uint32_t did_start_xy; /* eol/f did/xy reset val */ volatile uint32_t crs_start_xy; /* eol/f crs/xy reset val */ volatile uint32_t vc_start_xy; /* eol/f vc/xy reset val */ uint32_t _pad1[0xffb0/4]; volatile uint32_t ovr_width_tile;/*overlay plane ctrl 0 */ volatile uint32_t ovr_inhwctrl; /* overlay plane ctrl 1 */ volatile uint32_t ovr_control; /* overlay plane ctrl 1 */ uint32_t _pad2[0xfff4/4]; volatile uint32_t frm_size_tile;/* normal plane ctrl 0 */ volatile uint32_t frm_size_pixel;/*normal plane ctrl 1 */ volatile uint32_t frm_inhwctrl; /* normal plane ctrl 2 */ volatile uint32_t frm_control; /* normal plane ctrl 3 */ uint32_t _pad3[0xfff0/4]; volatile uint32_t did_inhwctrl; /* DID control */ volatile uint32_t did_control; /* DID shadow */ uint32_t _pad4[0x7ff8/4]; volatile uint32_t mode_regs[32];/* WID table */ uint32_t _pad5[0x7f80/4]; volatile uint32_t cmap[6144]; /* color map */ uint32_t _pad6[0x2000/4]; volatile uint32_t cm_fifo; /* color map fifo status */ uint32_t _pad7[0x7ffc/4]; volatile uint32_t gmap[256]; /* gamma map */ uint32_t _pad8[0x7c00/4]; volatile uint32_t gmap10[1024]; /* gamma map */ uint32_t _pad9[0x7000/4]; volatile uint32_t crs_pos; /* cusror control 0 */ volatile uint32_t crs_ctl; /* cusror control 1 */ volatile uint32_t crs_cmap[3]; /* crs cmap */ uint32_t _pad10[0x7fec/4]; volatile uint32_t crs_glyph[64];/* crs glyph */ uint32_t _pad11[0x7f00/4]; volatile uint32_t vc_0; /* video capture crtl 0 */ volatile uint32_t vc_1; /* video capture crtl 1 */ volatile uint32_t vc_2; /* video capture crtl 2 */ volatile uint32_t vc_3; /* video capture crtl 3 */ volatile uint32_t vc_4; /* video capture crtl 4 */ volatile uint32_t vc_5; /* video capture crtl 5 */ volatile uint32_t vc_6; /* video capture crtl 6 */ volatile uint32_t vc_7; /* video capture crtl 7 */ volatile uint32_t vc_8; /* video capture crtl 8 */ }; #define MASK(msb, lsb) \ ( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) ) #define GET(v, msb, lsb) \ ( ((u32)(v) & MASK(msb,lsb)) >> (lsb) ) #define SET(v, f, msb, lsb) \ ( (v) = ((v)&~MASK(msb,lsb)) | (( (u32)(f)<<(lsb) ) & MASK(msb,lsb)) ) #define GET_GBE_FIELD(reg, field, v) \ GET((v), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB) #define SET_GBE_FIELD(reg, field, v, f) \ SET((v), (f), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB) /* * Bit mask information */ #define GBE_CTRLSTAT_CHIPID_MSB 3 #define GBE_CTRLSTAT_CHIPID_LSB 0 #define GBE_CTRLSTAT_SENSE_N_MSB 4 #define GBE_CTRLSTAT_SENSE_N_LSB 4 #define GBE_CTRLSTAT_PCLKSEL_MSB 29 #define GBE_CTRLSTAT_PCLKSEL_LSB 28 #define GBE_DOTCLK_M_MSB 7 #define GBE_DOTCLK_M_LSB 0 #define GBE_DOTCLK_N_MSB 13 #define GBE_DOTCLK_N_LSB 8 #define GBE_DOTCLK_P_MSB 15 #define GBE_DOTCLK_P_LSB 14 #define GBE_DOTCLK_RUN_MSB 20 #define GBE_DOTCLK_RUN_LSB 20 #define GBE_VT_XY_Y_MSB 23 #define GBE_VT_XY_Y_LSB 12 #define GBE_VT_XY_X_MSB 11 #define GBE_VT_XY_X_LSB 0 #define GBE_VT_XY_FREEZE_MSB 31 #define GBE_VT_XY_FREEZE_LSB 31 #define GBE_FP_VDRV_ON_MSB 23 #define GBE_FP_VDRV_ON_LSB 12 #define GBE_FP_VDRV_OFF_MSB 11 #define GBE_FP_VDRV_OFF_LSB 0 #define GBE_FP_HDRV_ON_MSB 23 #define GBE_FP_HDRV_ON_LSB 12 #define GBE_FP_HDRV_OFF_MSB 11 #define GBE_FP_HDRV_OFF_LSB 0 #define GBE_FP_DE_ON_MSB 23 #define GBE_FP_DE_ON_LSB 12 #define GBE_FP_DE_OFF_MSB 11 #define GBE_FP_DE_OFF_LSB 0 #define GBE_VT_VSYNC_VSYNC_ON_MSB 23 #define GBE_VT_VSYNC_VSYNC_ON_LSB 12 #define GBE_VT_VSYNC_VSYNC_OFF_MSB 11 #define GBE_VT_VSYNC_VSYNC_OFF_LSB 0 #define GBE_VT_HSYNC_HSYNC_ON_MSB 23 #define GBE_VT_HSYNC_HSYNC_ON_LSB 12 #define GBE_VT_HSYNC_HSYNC_OFF_MSB 11 #define GBE_VT_HSYNC_HSYNC_OFF_LSB 0 #define GBE_VT_VBLANK_VBLANK_ON_MSB 23 #define GBE_VT_VBLANK_VBLANK_ON_LSB 12 #define GBE_VT_VBLANK_VBLANK_OFF_MSB 11 #define GBE_VT_VBLANK_VBLANK_OFF_LSB 0 #define GBE_VT_HBLANK_HBLANK_ON_MSB 23 #define GBE_VT_HBLANK_HBLANK_ON_LSB 12 #define GBE_VT_HBLANK_HBLANK_OFF_MSB 11 #define GBE_VT_HBLANK_HBLANK_OFF_LSB 0 #define GBE_VT_FLAGS_F2RF_HIGH_MSB 6 #define GBE_VT_FLAGS_F2RF_HIGH_LSB 6 #define GBE_VT_FLAGS_SYNC_LOW_MSB 5 #define GBE_VT_FLAGS_SYNC_LOW_LSB 5 #define GBE_VT_FLAGS_SYNC_HIGH_MSB 4 #define GBE_VT_FLAGS_SYNC_HIGH_LSB 4 #define GBE_VT_FLAGS_HDRV_LOW_MSB 3 #define GBE_VT_FLAGS_HDRV_LOW_LSB 3 #define GBE_VT_FLAGS_HDRV_INVERT_MSB 2 #define GBE_VT_FLAGS_HDRV_INVERT_LSB 2 #define GBE_VT_FLAGS_VDRV_LOW_MSB 1 #define GBE_VT_FLAGS_VDRV_LOW_LSB 1 #define GBE_VT_FLAGS_VDRV_INVERT_MSB 0 #define GBE_VT_FLAGS_VDRV_INVERT_LSB 0 #define GBE_VT_VCMAP_VCMAP_ON_MSB 23 #define GBE_VT_VCMAP_VCMAP_ON_LSB 12 #define GBE_VT_VCMAP_VCMAP_OFF_MSB 11 #define GBE_VT_VCMAP_VCMAP_OFF_LSB 0 #define GBE_VT_HCMAP_HCMAP_ON_MSB 23 #define GBE_VT_HCMAP_HCMAP_ON_LSB 12 #define GBE_VT_HCMAP_HCMAP_OFF_MSB 11 #define GBE_VT_HCMAP_HCMAP_OFF_LSB 0 #define GBE_VT_XYMAX_MAXX_MSB 11 #define GBE_VT_XYMAX_MAXX_LSB 0 #define GBE_VT_XYMAX_MAXY_MSB 23 #define GBE_VT_XYMAX_MAXY_LSB 12 #define GBE_VT_HPIXEN_HPIXEN_ON_MSB 23 #define GBE_VT_HPIXEN_HPIXEN_ON_LSB 12 #define GBE_VT_HPIXEN_HPIXEN_OFF_MSB 11 #define GBE_VT_HPIXEN_HPIXEN_OFF_LSB 0 #define GBE_VT_VPIXEN_VPIXEN_ON_MSB 23 #define GBE_VT_VPIXEN_VPIXEN_ON_LSB 12 #define GBE_VT_VPIXEN_VPIXEN_OFF_MSB 11 #define GBE_VT_VPIXEN_VPIXEN_OFF_LSB 0 #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_MSB 0 #define GBE_OVR_CONTROL_OVR_DMA_ENABLE_LSB 0 #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_MSB 0 #define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_LSB 0 #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_MSB 13 #define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_LSB 13 #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_MSB 0 #define GBE_FRM_CONTROL_FRM_DMA_ENABLE_LSB 0 #define GBE_FRM_CONTROL_FRM_TILE_PTR_MSB 31 #define GBE_FRM_CONTROL_FRM_TILE_PTR_LSB 9 #define GBE_FRM_CONTROL_FRM_LINEAR_MSB 1 #define GBE_FRM_CONTROL_FRM_LINEAR_LSB 1 #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_MSB 0 #define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_LSB 0 #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_MSB 12 #define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_LSB 5 #define GBE_FRM_SIZE_TILE_FRM_RHS_MSB 4 #define GBE_FRM_SIZE_TILE_FRM_RHS_LSB 0 #define GBE_FRM_SIZE_TILE_FRM_DEPTH_MSB 14 #define GBE_FRM_SIZE_TILE_FRM_DEPTH_LSB 13 #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_MSB 15 #define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_LSB 15 #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_MSB 31 #define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_LSB 16 #define GBE_DID_CONTROL_DID_DMA_ENABLE_MSB 0 #define GBE_DID_CONTROL_DID_DMA_ENABLE_LSB 0 #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_MSB 0 #define GBE_DID_INHWCTRL_DID_DMA_ENABLE_LSB 0 #define GBE_DID_START_XY_DID_STARTY_MSB 23 #define GBE_DID_START_XY_DID_STARTY_LSB 12 #define GBE_DID_START_XY_DID_STARTX_MSB 11 #define GBE_DID_START_XY_DID_STARTX_LSB 0 #define GBE_CRS_START_XY_CRS_STARTY_MSB 23 #define GBE_CRS_START_XY_CRS_STARTY_LSB 12 #define GBE_CRS_START_XY_CRS_STARTX_MSB 11 #define GBE_CRS_START_XY_CRS_STARTX_LSB 0 #define GBE_WID_AUX_MSB 12 #define GBE_WID_AUX_LSB 11 #define GBE_WID_GAMMA_MSB 10 #define GBE_WID_GAMMA_LSB 10 #define GBE_WID_CM_MSB 9 #define GBE_WID_CM_LSB 5 #define GBE_WID_TYP_MSB 4 #define GBE_WID_TYP_LSB 2 #define GBE_WID_BUF_MSB 1 #define GBE_WID_BUF_LSB 0 #define GBE_VC_START_XY_VC_STARTY_MSB 23 #define GBE_VC_START_XY_VC_STARTY_LSB 12 #define GBE_VC_START_XY_VC_STARTX_MSB 11 #define GBE_VC_START_XY_VC_STARTX_LSB 0 /* Constants */ #define GBE_FRM_DEPTH_8 0 #define GBE_FRM_DEPTH_16 1 #define GBE_FRM_DEPTH_32 2 #define GBE_CMODE_I8 0 #define GBE_CMODE_I12 1 #define GBE_CMODE_RG3B2 2 #define GBE_CMODE_RGB4 3 #define GBE_CMODE_ARGB5 4 #define GBE_CMODE_RGB8 5 #define GBE_CMODE_RGBA5 6 #define GBE_CMODE_RGB10 7 #define GBE_BMODE_BOTH 3 #define GBE_CRS_MAGIC 54 #define GBE_PIXEN_MAGIC_ON 19 #define GBE_PIXEN_MAGIC_OFF 2 #define GBE_TLB_SIZE 128 /* [1] - only GBE revision 2 and later */ /* * Video Timing Data Structure */ struct gbe_timing_info { int flags; short width; /* Monitor resolution */ short height; int fields_sec; /* fields/sec (Hz -3 dec. places */ int cfreq; /* pixel clock frequency (MHz -3 dec. places) */ short htotal; /* Horizontal total pixels */ short hblank_start; /* Horizontal blank start */ short hblank_end; /* Horizontal blank end */ short hsync_start; /* Horizontal sync start */ short hsync_end; /* Horizontal sync end */ short vtotal; /* Vertical total lines */ short vblank_start; /* Vertical blank start */ short vblank_end; /* Vertical blank end */ short vsync_start; /* Vertical sync start */ short vsync_end; /* Vertical sync end */ short pll_m; /* PLL M parameter */ short pll_n; /* PLL P parameter */ short pll_p; /* PLL N parameter */ }; /* Defines for gbe_vof_info_t flags */ #define GBE_VOF_UNKNOWNMON 1 #define GBE_VOF_STEREO 2 #define GBE_VOF_DO_GENSYNC 4 /* enable incoming sync */ #define GBE_VOF_SYNC_ON_GREEN 8 /* sync on green */ #define GBE_VOF_FLATPANEL 0x1000 /* FLATPANEL Timing */ #define GBE_VOF_MAGICKEY 0x2000 /* Backdoor key */ #endif /* ! __GBE_H__ */ ns'>-0/+165 This module is responsible for the ife encapsulation protocol encode/decode logics. That module can: - ife_encode: encode skb and reserve space for the ife meta header - ife_decode: decode skb and extract the meta header size - ife_tlv_meta_encode - encodes one tlv entry into the reserved ife header space. - ife_tlv_meta_decode - decodes one tlv entry from the packet - ife_tlv_meta_next - advance to the next tlv Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03net/sched: act_ife: Unexport ife_tlv_meta_encodeYotam Gigi1-2/+2 As the function ife_tlv_meta_encode is not used by any other module, unexport it and make it static for the act_ife module. Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Roman Mashak <mrv@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-03tcp: add tcp_mss_clamp() helperEric Dumazet4-23/+8 Small cleanup factorizing code doing the TCP_MAXSEG clamping. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: add LINUX_MIB_PFMEMALLOCDROP counterEric Dumazet2-2/+4 Debugging issues caused by pfmemalloc is often tedious. Add a new SNMP counter to more easily diagnose these problems. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Josef Bacik <jbacik@fb.com> Acked-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: ipv4: remove fib_lookup.h from devinet.c include listDavid Ahern1-2/+0 nothing in devinet.c relies on fib_lookup.h; remove it from the includes Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02net: remove useless pfmemalloc settingEric Dumazet1-1/+0 When __alloc_skb() allocates an skb from fast clone cache, setting pfmemalloc on the clone is not needed. Clone will be properly initialized later at skb_clone() time, including pfmemalloc field, as it is included in the headers_start/headers_end section which is fully copied. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02unix: add ioctl to open a unix socket file with O_PATHAndrey Vagin1-0/+41 This ioctl opens a file to which a socket is bound and returns a file descriptor. The caller has to have CAP_NET_ADMIN in the socket network namespace. Currently it is impossible to get a path and a mount point for a socket file. socket_diag reports address, device ID and inode number for unix sockets. An address can contain a relative path or a file may be moved somewhere. And these properties say nothing about a mount namespace and a mount point of a socket file. With the introduced ioctl, we can get a path by reading /proc/self/fd/X and get mnt_id from /proc/self/fdinfo/X. In CRIU we are going to use this ioctl to dump and restore unix socket. Here is an example how it can be used: $ strace -e socket,bind,ioctl ./test /tmp/test_sock socket(AF_UNIX, SOCK_STREAM, 0) = 3 bind(3, {sa_family=AF_UNIX, sun_path="test_sock"}, 11) = 0 ioctl(3, SIOCUNIXFILE, 0) = 4 ^Z $ ss -a | grep test_sock u_str LISTEN 0 1 test_sock 17798 * 0 $ ls -l /proc/760/fd/{3,4} lrwx------ 1 root root 64 Feb 1 09:41 3 -> 'socket:[17798]' l--------- 1 root root 64 Feb 1 09:41 4 -> /tmp/test_sock $ cat /proc/760/fdinfo/4 pos: 0 flags: 012000000 mnt_id: 40 $ cat /proc/self/mountinfo | grep "^40\s" 40 19 0:37 / /tmp rw shared:23 - tmpfs tmpfs rw Signed-off-by: Andrei Vagin <avagin@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller12-104/+93 All merge conflicts were simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds10-103/+86 Pull networking fixes from David Miller: 1) Fix handling of interrupt status in stmmac driver. Just because we have masked the event from generating interrupts, doesn't mean the bit won't still be set in the interrupt status register. From Alexey Brodkin. 2) Fix DMA API debugging splats in gianfar driver, from Arseny Solokha. 3) Fix off-by-one error in __ip6_append_data(), from Vlad Yasevich. 4) cls_flow does not match on icmpv6 codes properly, from Simon Horman. 5) Initial MAC address can be set incorrectly in some scenerios, from Ivan Vecera. 6) Packet header pointer arithmetic fix in ip6_tnl_parse_tlv_end_lim(), from Dan Carpenter. 7) Fix divide by zero in __tcp_select_window(), from Eric Dumazet. 8) Fix crash in iwlwifi when unregistering thermal zone, from Jens Axboe. 9) Check for DMA mapping errors in starfire driver, from Alexey Khoroshilov. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (31 commits) tcp: fix 0 divide in __tcp_select_window() ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() net: fix ndo_features_check/ndo_fix_features comment ordering net/sched: matchall: Fix configuration race be2net: fix initial MAC setting ipv6: fix flow labels when the traffic class is non-0 net: thunderx: avoid dereferencing xcv when NULL net/sched: cls_flower: Correct matching on ICMPv6 code ipv6: Paritially checksum full MTU frames net/mlx4_core: Avoid command timeouts during VF driver device shutdown gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page net: ethtool: add support for 2500BaseT and 5000BaseT link modes can: bcm: fix hrtimer/tasklet termination in bcm op removal net: adaptec: starfire: add checks for dma mapping errors net: phy: micrel: KSZ8795 do not set SUPPORTED_[Asym_]Pause can: Fix kernel panic at security_sock_rcv_skb net: macb: Fix 64 bit addressing support for GEM stmmac: Discard masked flags in interrupt status register net/mlx5e: Check ets capability before ets query FW command net/mlx5e: Fix update of hash function/key via ethtool ... 2017-02-01net/sched: act_psample: Remove unnecessary ASSERT_RTNLYotam Gigi1-1/+0 The ASSERT_RTNL is not necessary in the init function, as it does not touch any rtnl protected structures, as opposed to the mirred action which does have to hold a net device. Reported-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net/sched: act_sample: Fix error path in initYotam Gigi1-1/+4 Fix error path of in sample init, by releasing the tc hash in case of failure in psample_group creation. Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action") Reported-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01tcp: fix 0 divide in __tcp_select_window()Eric Dumazet1-2/+4 syszkaller fuzzer was able to trigger a divide by zero, when TCP window scaling is not enabled. SO_RCVBUF can be used not only to increase sk_rcvbuf, also to decrease it below current receive buffers utilization. If mss is negative or 0, just return a zero TCP window. Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()Dan Carpenter1-1/+1 Casting is a high precedence operation but "off" and "i" are in terms of bytes so we need to have some parenthesis here. Fixes: fbfa743a9d2a ("ipv6: fix ip6_tnl_parse_tlv_enc_lim()") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net: ipv6: add NLM_F_APPEND in notifications when applicableDavid Ahern1-0/+3 IPv6 does not set the NLM_F_APPEND flag in notifications to signal that a NEWROUTE is an append versus a new route or a replaced one. Add the flag if the request has it. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net: reduce skb_warn_bad_offload() noiseEric Dumazet1-3/+9 Dmitry reported warnings occurring in __skb_gso_segment() [1] All SKB_GSO_DODGY producers can allow user space to feed packets that trigger the current check. We could prevent them from doing so, rejecting packets, but this might add regressions to existing programs. It turns out our SKB_GSO_DODGY handlers properly set up checksum information that is needed anyway when packets needs to be segmented. By checking again skb_needs_check() after skb_mac_gso_segment(), we should remove these pesky warnings, at a very minor cost. With help from Willem de Bruijn [1] WARNING: CPU: 1 PID: 6768 at net/core/dev.c:2439 skb_warn_bad_offload+0x2af/0x390 net/core/dev.c:2434 lo: caps=(0x000000a2803b7c69, 0x0000000000000000) len=138 data_len=0 gso_size=15883 gso_type=4 ip_summed=0 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 6768 Comm: syz-executor1 Not tainted 4.9.0 #5 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801c063ecd8 ffffffff82346bdf ffffffff00000001 1ffff100380c7d2e ffffed00380c7d26 0000000041b58ab3 ffffffff84b37e38 ffffffff823468f1 ffffffff84820740 ffffffff84f289c0 dffffc0000000000 ffff8801c063ee20 Call Trace: [<ffffffff82346bdf>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff82346bdf>] dump_stack+0x2ee/0x3ef lib/dump_stack.c:51 [<ffffffff81827e34>] panic+0x1fb/0x412 kernel/panic.c:179 [<ffffffff8141f704>] __warn+0x1c4/0x1e0 kernel/panic.c:542 [<ffffffff8141f7e5>] warn_slowpath_fmt+0xc5/0x100 kernel/panic.c:565 [<ffffffff8356cbaf>] skb_warn_bad_offload+0x2af/0x390 net/core/dev.c:2434 [<ffffffff83585cd2>] __skb_gso_segment+0x482/0x780 net/core/dev.c:2706 [<ffffffff83586f19>] skb_gso_segment include/linux/netdevice.h:3985 [inline] [<ffffffff83586f19>] validate_xmit_skb+0x5c9/0xc20 net/core/dev.c:2969 [<ffffffff835892bb>] __dev_queue_xmit+0xe6b/0x1e70 net/core/dev.c:3383 [<ffffffff8358a2d7>] dev_queue_xmit+0x17/0x20 net/core/dev.c:3424 [<ffffffff83ad161d>] packet_snd net/packet/af_packet.c:2930 [inline] [<ffffffff83ad161d>] packet_sendmsg+0x32ed/0x4d30 net/packet/af_packet.c:2955 [<ffffffff834f0aaa>] sock_sendmsg_nosec net/socket.c:621 [inline] [<ffffffff834f0aaa>] sock_sendmsg+0xca/0x110 net/socket.c:631 [<ffffffff834f329a>] ___sys_sendmsg+0x8fa/0x9f0 net/socket.c:1954 [<ffffffff834f5e58>] __sys_sendmsg+0x138/0x300 net/socket.c:1988 [<ffffffff834f604d>] SYSC_sendmsg net/socket.c:1999 [inline] [<ffffffff834f604d>] SyS_sendmsg+0x2d/0x50 net/socket.c:1995 [<ffffffff84371941>] entry_SYSCALL_64_fastpath+0x1f/0xc2 Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01net/sched: matchall: Fix configuration raceYotam Gigi1-82/+45 In the current version, the matchall internal state is split into two structs: cls_matchall_head and cls_matchall_filter. This makes little sense, as matchall instance supports only one filter, and there is no situation where one exists and the other does not. In addition, that led to some races when filter was deleted while packet was processed. Unify that two structs into one, thus simplifying the process of matchall creation and deletion. As a result, the new, delete and get callbacks have a dummy implementation where all the work is done in destroy and change callbacks, as was done in cls_cgroup. Fixes: bf3994d2ed31 ("net/sched: introduce Match-all classifier") Reported-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-01rtnetlink: Handle IFLA_MASTER parameter when processing rtnl_newlinkTheuns Verwoerd1-1/+6 Allow a master interface to be specified as one of the parameters when creating a new interface via rtnl_newlink. Previously this would require invoking interface creation, waiting for it to complete, and then separately binding that new interface to a master. In particular, this is used when creating a macvlan child interface for VRRP in a VRF configuration, allowing the interface creator to specify directly what master interface should be inherited by the child, without having to deal with asynchronous complications and potential race conditions. Signed-off-by: Theuns Verwoerd <theuns.verwoerd@alliedtelesis.co.nz> Acked-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>