Pull networking fixes from David Miller: 1) Transfer padding was wrong for full-speed USB in ASIX driver, fix from Ingo van Lil. 2) Propagate the negative packet offset fix into the PowerPC BPF JIT. From Jan Seiffert. 3) dl2k driver's private ioctls were letting unprivileged tasks make MII writes and other ugly bits like that. Fix from Jeff Mahoney. 4) Fix TX VLAN and RX packet drops in ucc_geth, from Joakim Tjernlund. 5) OOPS and network namespace fixes in IPVS from Hans Schillstrom and Julian Anastasov. 6) Fix races and sleeping in locked context bugs in drop_monitor, from Neil Horman. 7) Fix link status indication in smsc95xx driver, from Paolo Pisati. 8) Fix bridge netfilter OOPS, from Peter Huang. 9) L2TP sendmsg can return on error conditions with the socket lock held, oops. Fix from Sasha Levin. 10) udp_diag should return meaningful values for socket memory usage, from Shan Wei. 11) Eric Dumazet is so awesome he gets his own section: Socket memory cgroup code (I never should have applied those patches, grumble...) made erroneous changes to sk_sockets_allocated_read_positive(). It was changed to use percpu_counter_sum_positive (which requires BH disabling) instead of percpu_counter_read_positive (which does not). Revert back to avoid crashes and lockdep warnings. Adjust the default tcp_adv_win_scale and tcp_rmem[2] values to fix throughput regressions. This is necessary as a result of our more precise skb->truesize tracking. Fix SKB leak in netem packet scheduler. 12) New device IDs for various bluetooth devices, from Manoj Iyer, AceLan Kao, and Steven Harms. 13) Fix command completion race in ipw2200, from Stanislav Yakovlev. 14) Fix rtlwifi oops on unload, from Larry Finger. 15) Fix hard_mtu when adjusting hard_header_len in smsc95xx driver. From Stephane Fillod. 16) ehea driver registers it's IRQ before all the necessary state is setup, resulting in crashes. Fix from Thadeu Lima de Souza Cascardo. 17) Fix PHY connection failures in davinci_emac driver, from Anatolij Gustschin. 18) Missing break; in switch statement in bluetooth's hci_cmd_complete_evt(). Fix from Szymon Janc. 19) Fix queue programming in iwlwifi, from Johannes Berg. 20) Interrupt throttling defaults not being actually programmed into the hardware, fix from Jeff Kirsher and Ying Cai. 21) TLAN driver SKB encoding in descriptor busted on 64-bit, fix from Benjamin Poirier. 22) Fix blind status block RX producer pointer deref in TG3 driver, from Matt Carlson. 23) Promisc and multicast are busted on ehea, fixes from Thadeu Lima de Souza Cascardo. 24) Fix crashes in 6lowpan, from Alexander Smirnov. 25) tcp_complete_cwr() needs to be careful to not rewind the CWND to ssthresh if ssthresh has the "infinite" value. Fix from Yuchung Cheng. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (81 commits) sungem: Fix WakeOnLan tcp: change tcp_adv_win_scale and tcp_rmem[2] net: l2tp: unlock socket lock before returning from l2tp_ip_sendmsg drop_monitor: prevent init path from scheduling on the wrong cpu usbnet: fix failure handling in usbnet_probe usbnet: fix leak of transfer buffer of dev->interrupt ucc_geth: Add 16 bytes to max TX frame for VLANs net: ucc_geth, increase no. of HW RX descriptors netem: fix possible skb leak sky2: fix receive length error in mixed non-VLAN/VLAN traffic sky2: propogate rx hash when packet is copied net: fix two typos in skbuff.h cxgb3: Don't call cxgb_vlan_mode until q locks are initialized ixgbe: fix calling skb_put on nonlinear skb assertion bug ixgbe: Fix a memory leak in IEEE DCB igbvf: fix the bug when initializing the igbvf smsc75xx: enable mac to detect speed/duplex from phy smsc75xx: declare smsc75xx's MII as GMII capable smsc75xx: fix phy interrupt acknowledge smsc75xx: fix phy init reset loop ...
Unified · Split
| @@ -147,7 +147,7 @@ tcp_adv_win_scale - INTEGER · 146 unmodified lines | ||
| 147 | 147 | (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), |
| 148 | 148 | if it is <= 0. |
| 149 | 149 | Possible values are [-31, 31], inclusive. |
| 150 | − Default: 2 | |
| 150 | + Default: 1 | |
| 151 | 151 | |
| 152 | 152 | tcp_allowed_congestion_control - STRING |
| 153 | 153 | Show/set the congestion control choices available to non-privileged |
| @@ -410,7 +410,7 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max · 256 unmodified lines | ||
| 410 | 410 | net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables |
| 411 | 411 | automatic tuning of that socket's receive buffer size, in which |
| 412 | 412 | case this value is ignored. |
| 413 | − Default: between 87380B and 4MB, depending on RAM size. | |
| 413 | + Default: between 87380B and 6MB, depending on RAM size. | |
| 414 | 414 | |
| 415 | 415 | tcp_sack - BOOLEAN |
| 416 | 416 | Enable select acknowledgments (SACKS). |
| @@ -5892,11 +5892,11 @@ F: Documentation/scsi/st.txt · 5891 unmodified lines | ||
| 5892 | 5892 | F: drivers/scsi/st* |
| 5893 | 5893 | |
| 5894 | 5894 | SCTP PROTOCOL |
| 5895 | −M: Vlad Yasevich <vladislav.yasevich@hp.com> | |
| 5895 | +M: Vlad Yasevich <vyasevich@gmail.com> | |
| 5896 | 5896 | M: Sridhar Samudrala <sri@us.ibm.com> |
| 5897 | 5897 | L: linux-sctp@vger.kernel.org |
| 5898 | 5898 | W: http://lksctp.sourceforge.net |
| 5899 | −S: Supported | |
| 5899 | +S: Maintained | |
| 5900 | 5900 | F: Documentation/networking/sctp.txt |
| 5901 | 5901 | F: include/linux/sctp.h |
| 5902 | 5902 | F: include/net/sctp/ |
| @@ -48,7 +48,13 @@ · 47 unmodified lines | ||
| 48 | 48 | /* |
| 49 | 49 | * Assembly helpers from arch/powerpc/net/bpf_jit.S: |
| 50 | 50 | */ |
| 51 | −extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; | |
| 51 | +#define DECLARE_LOAD_FUNC(func) \ | |
| 52 | + extern u8 func[], func##_negative_offset[], func##_positive_offset[] | |
| 53 | + | |
| 54 | +DECLARE_LOAD_FUNC(sk_load_word); | |
| 55 | +DECLARE_LOAD_FUNC(sk_load_half); | |
| 56 | +DECLARE_LOAD_FUNC(sk_load_byte); | |
| 57 | +DECLARE_LOAD_FUNC(sk_load_byte_msh); | |
| 52 | 58 | |
| 53 | 59 | #define FUNCTION_DESCR_SIZE 24 |
| 54 | 60 | |
| @@ -31,14 +31,13 @@ · 30 unmodified lines | ||
| 31 | 31 | * then branch directly to slow_path_XXX if required. (In fact, could |
| 32 | 32 | * load a spare GPR with the address of slow_path_generic and pass size |
| 33 | 33 | * as an argument, making the call site a mtlr, li and bllr.) |
| 34 | − * | |
| 35 | − * Technically, the "is addr < 0" check is unnecessary & slowing down | |
| 36 | − * the ABS path, as it's statically checked on generation. | |
| 37 | 34 | */ |
| 38 | 35 | .globl sk_load_word |
| 39 | 36 | sk_load_word: |
| 40 | 37 | cmpdi r_addr, 0 |
| 41 | − blt bpf_error | |
| 38 | + blt bpf_slow_path_word_neg | |
| 39 | + .globl sk_load_word_positive_offset | |
| 40 | +sk_load_word_positive_offset: | |
| 42 | 41 | /* Are we accessing past headlen? */ |
| 43 | 42 | subi r_scratch1, r_HL, 4 |
| 44 | 43 | cmpd r_scratch1, r_addr |
| @@ -51,7 +50,9 @@ sk_load_word: · 6 unmodified lines | ||
| 51 | 50 | .globl sk_load_half |
| 52 | 51 | sk_load_half: |
| 53 | 52 | cmpdi r_addr, 0 |
| 54 | − blt bpf_error | |
| 53 | + blt bpf_slow_path_half_neg | |
| 54 | + .globl sk_load_half_positive_offset | |
| 55 | +sk_load_half_positive_offset: | |
| 55 | 56 | subi r_scratch1, r_HL, 2 |
| 56 | 57 | cmpd r_scratch1, r_addr |
| 57 | 58 | blt bpf_slow_path_half |
| @@ -61,7 +62,9 @@ sk_load_half: · 3 unmodified lines | ||
| 61 | 62 | .globl sk_load_byte |
| 62 | 63 | sk_load_byte: |
| 63 | 64 | cmpdi r_addr, 0 |
| 64 | − blt bpf_error | |
| 65 | + blt bpf_slow_path_byte_neg | |
| 66 | + .globl sk_load_byte_positive_offset | |
| 67 | +sk_load_byte_positive_offset: | |
| 65 | 68 | cmpd r_HL, r_addr |
| 66 | 69 | ble bpf_slow_path_byte |
| 67 | 70 | lbzx r_A, r_D, r_addr |
| @@ -69,22 +72,20 @@ sk_load_byte: · 1 unmodified line | ||
| 69 | 72 | |
| 70 | 73 | /* |
| 71 | 74 | * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) |
| 72 | − * r_addr is the offset value, already known positive | |
| 75 | + * r_addr is the offset value | |
| 73 | 76 | */ |
| 74 | 77 | .globl sk_load_byte_msh |
| 75 | 78 | sk_load_byte_msh: |
| 79 | + cmpdi r_addr, 0 | |
| 80 | + blt bpf_slow_path_byte_msh_neg | |
| 81 | + .globl sk_load_byte_msh_positive_offset | |
| 82 | +sk_load_byte_msh_positive_offset: | |
| 76 | 83 | cmpd r_HL, r_addr |
| 77 | 84 | ble bpf_slow_path_byte_msh |
| 78 | 85 | lbzx r_X, r_D, r_addr |
| 79 | 86 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 80 | 87 | blr |
| 81 | 88 | |
| 82 | −bpf_error: | |
| 83 | − /* Entered with cr0 = lt */ | |
| 84 | − li r3, 0 | |
| 85 | − /* Generated code will 'blt epilogue', returning 0. */ | |
| 86 | − blr | |
| 87 | − | |
| 88 | 89 | /* Call out to skb_copy_bits: |
| 89 | 90 | * We'll need to back up our volatile regs first; we have |
| 90 | 91 | * local variable space at r1+(BPF_PPC_STACK_BASIC). |
| @@ -136,3 +137,84 @@ bpf_slow_path_byte_msh: · 45 unmodified lines | ||
| 136 | 137 | lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) |
| 137 | 138 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 138 | 139 | blr |
| 140 | + | |
| 141 | +/* Call out to bpf_internal_load_pointer_neg_helper: | |
| 142 | + * We'll need to back up our volatile regs first; we have | |
| 143 | + * local variable space at r1+(BPF_PPC_STACK_BASIC). | |
| 144 | + * Allocate a new stack frame here to remain ABI-compliant in | |
| 145 | + * stashing LR. | |
| 146 | + */ | |
| 147 | +#define sk_negative_common(SIZE) \ | |
| 148 | + mflr r0; \ | |
| 149 | + std r0, 16(r1); \ | |
| 150 | + /* R3 goes in parameter space of caller's frame */ \ | |
| 151 | + std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | |
| 152 | + std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | |
| 153 | + std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | |
| 154 | + stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \ | |
| 155 | + /* R3 = r_skb, as passed */ \ | |
| 156 | + mr r4, r_addr; \ | |
| 157 | + li r5, SIZE; \ | |
| 158 | + bl bpf_internal_load_pointer_neg_helper; \ | |
| 159 | + /* R3 != 0 on success */ \ | |
| 160 | + addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ | |
| 161 | + ld r0, 16(r1); \ | |
| 162 | + ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | |
| 163 | + ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | |
| 164 | + mtlr r0; \ | |
| 165 | + cmpldi r3, 0; \ | |
| 166 | + beq bpf_error_slow; /* cr0 = EQ */ \ | |
| 167 | + mr r_addr, r3; \ | |
| 168 | + ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | |
| 169 | + /* Great success! */ | |
| 170 | + | |
| 171 | +bpf_slow_path_word_neg: | |
| 172 | + lis r_scratch1,-32 /* SKF_LL_OFF */ | |
| 173 | + cmpd r_addr, r_scratch1 /* addr < SKF_* */ | |
| 174 | + blt bpf_error /* cr0 = LT */ | |
| 175 | + .globl sk_load_word_negative_offset | |
| 176 | +sk_load_word_negative_offset: | |
| 177 | + sk_negative_common(4) | |
| 178 | + lwz r_A, 0(r_addr) | |
| 179 | + blr | |
| 180 | + | |
| 181 | +bpf_slow_path_half_neg: | |
| 182 | + lis r_scratch1,-32 /* SKF_LL_OFF */ | |
| 183 | + cmpd r_addr, r_scratch1 /* addr < SKF_* */ | |
| 184 | + blt bpf_error /* cr0 = LT */ | |
| 185 | + .globl sk_load_half_negative_offset | |
| 186 | +sk_load_half_negative_offset: | |
| 187 | + sk_negative_common(2) | |
| 188 | + lhz r_A, 0(r_addr) | |
| 189 | + blr | |
| 190 | + | |
| 191 | +bpf_slow_path_byte_neg: | |
| 192 | + lis r_scratch1,-32 /* SKF_LL_OFF */ | |
| 193 | + cmpd r_addr, r_scratch1 /* addr < SKF_* */ | |
| 194 | + blt bpf_error /* cr0 = LT */ | |
| 195 | + .globl sk_load_byte_negative_offset | |
| 196 | +sk_load_byte_negative_offset: | |
| 197 | + sk_negative_common(1) | |
| 198 | + lbz r_A, 0(r_addr) | |
| 199 | + blr | |
| 200 | + | |
| 201 | +bpf_slow_path_byte_msh_neg: | |
| 202 | + lis r_scratch1,-32 /* SKF_LL_OFF */ | |
| 203 | + cmpd r_addr, r_scratch1 /* addr < SKF_* */ | |
| 204 | + blt bpf_error /* cr0 = LT */ | |
| 205 | + .globl sk_load_byte_msh_negative_offset | |
| 206 | +sk_load_byte_msh_negative_offset: | |
| 207 | + sk_negative_common(1) | |
| 208 | + lbz r_X, 0(r_addr) | |
| 209 | + rlwinm r_X, r_X, 2, 32-4-2, 31-2 | |
| 210 | + blr | |
| 211 | + | |
| 212 | +bpf_error_slow: | |
| 213 | + /* fabricate a cr0 = lt */ | |
| 214 | + li r_scratch1, -1 | |
| 215 | + cmpdi r_scratch1, 0 | |
| 216 | +bpf_error: | |
| 217 | + /* Entered with cr0 = lt */ | |
| 218 | + li r3, 0 | |
| 219 | + /* Generated code will 'blt epilogue', returning 0. */ | |
| 220 | + blr | |
| @@ -127,6 +127,9 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx) · 126 unmodified lines | ||
| 127 | 127 | PPC_BLR(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | +#define CHOOSE_LOAD_FUNC(K, func) \ | |
| 131 | + ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) | |
| 132 | + | |
| 130 | 133 | /* Assemble the body code between the prologue & epilogue. */ |
| 131 | 134 | static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, |
| 132 | 135 | struct codegen_context *ctx, |
| @@ -391,21 +394,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, · 258 unmodified lines | ||
| 391 | 394 | |
| 392 | 395 | /*** Absolute loads from packet header/data ***/ |
| 393 | 396 | case BPF_S_LD_W_ABS: |
| 394 | − func = sk_load_word; | |
| 397 | + func = CHOOSE_LOAD_FUNC(K, sk_load_word); | |
| 395 | 398 | goto common_load; |
| 396 | 399 | case BPF_S_LD_H_ABS: |
| 397 | − func = sk_load_half; | |
| 400 | + func = CHOOSE_LOAD_FUNC(K, sk_load_half); | |
| 398 | 401 | goto common_load; |
| 399 | 402 | case BPF_S_LD_B_ABS: |
| 400 | − func = sk_load_byte; | |
| 403 | + func = CHOOSE_LOAD_FUNC(K, sk_load_byte); | |
| 401 | 404 | common_load: |
| 402 | − /* | |
| 403 | − * Load from [K]. Reference with the (negative) | |
| 404 | − * SKF_NET_OFF/SKF_LL_OFF offsets is unsupported. | |
| 405 | − */ | |
| 405 | + /* Load from [K]. */ | |
| 406 | 406 | ctx->seen |= SEEN_DATAREF; |
| 407 | − if ((int)K < 0) | |
| 408 | − return -ENOTSUPP; | |
| 409 | 407 | PPC_LI64(r_scratch1, func); |
| 410 | 408 | PPC_MTLR(r_scratch1); |
| 411 | 409 | PPC_LI32(r_addr, K); |
| @@ -429,7 +427,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, · 17 unmodified lines | ||
| 429 | 427 | common_load_ind: |
| 430 | 428 | /* |
| 431 | 429 | * Load from [X + K]. Negative offsets are tested for |
| 432 | − * in the helper functions, and result in a 'ret 0'. | |
| 430 | + * in the helper functions. | |
| 433 | 431 | */ |
| 434 | 432 | ctx->seen |= SEEN_DATAREF | SEEN_XREG; |
| 435 | 433 | PPC_LI64(r_scratch1, func); |
| @@ -443,13 +441,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, · 7 unmodified lines | ||
| 443 | 441 | break; |
| 444 | 442 | |
| 445 | 443 | case BPF_S_LDX_B_MSH: |
| 446 | − /* | |
| 447 | − * x86 version drops packet (RET 0) when K<0, whereas | |
| 448 | − * interpreter does allow K<0 (__load_pointer, special | |
| 449 | − * ancillary data). common_load returns ENOTSUPP if K<0, | |
| 450 | − * so we fall back to interpreter & filter works. | |
| 451 | − */ | |
| 452 | − func = sk_load_byte_msh; | |
| 444 | + func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh); | |
| 453 | 445 | goto common_load; |
| 454 | 446 | break; |
| 455 | 447 | |
| @@ -75,6 +75,8 @@ static struct usb_device_id ath3k_table[] = { · 74 unmodified lines | ||
| 75 | 75 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 76 | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
| 77 | 77 | { USB_DEVICE(0x04CA, 0x3005) }, |
| 78 | + { USB_DEVICE(0x13d3, 0x3362) }, | |
| 79 | + { USB_DEVICE(0x0CF3, 0xE004) }, | |
| 78 | 80 | |
| 79 | 81 | /* Atheros AR5BBU12 with sflash firmware */ |
| 80 | 82 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -94,6 +96,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { · 13 unmodified lines | ||
| 94 | 96 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 95 | 97 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 96 | 98 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 99 | + { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | |
| 100 | + { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | |
| 97 | 101 | |
| 98 | 102 | { } /* Terminating entry */ |
| 99 | 103 | }; |
| @@ -101,12 +101,16 @@ static struct usb_device_id btusb_table[] = { · 100 unmodified lines | ||
| 101 | 101 | { USB_DEVICE(0x0c10, 0x0000) }, |
| 102 | 102 | |
| 103 | 103 | /* Broadcom BCM20702A0 */ |
| 104 | + { USB_DEVICE(0x0489, 0xe042) }, | |
| 104 | 105 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
| 105 | 106 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
| 106 | 107 | { USB_DEVICE(0x0a5c, 0x21e8) }, |
| 107 | 108 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
| 108 | 109 | { USB_DEVICE(0x413c, 0x8197) }, |
| 109 | 110 | |
| 111 | + /* Foxconn - Hon Hai */ | |
| 112 | + { USB_DEVICE(0x0489, 0xe033) }, | |
| 113 | + | |
| 110 | 114 | { } /* Terminating entry */ |
| 111 | 115 | }; |
| 112 | 116 | |
| @@ -133,6 +137,8 @@ static struct usb_device_id blacklist_table[] = { · 20 unmodified lines | ||
| 133 | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 134 | 138 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 135 | 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 140 | + { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | |
| 141 | + { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | |
| 136 | 142 | |
| 137 | 143 | /* Atheros AR5BBU12 with sflash firmware */ |
| 138 | 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
| @@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) · 878 unmodified lines | ||
| 879 | 879 | if (sblk->status & SD_STATUS_LINK_CHG) |
| 880 | 880 | work_exists = 1; |
| 881 | 881 | } |
| 882 | − /* check for RX/TX work to do */ | |
| 883 | − if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | |
| 882 | + | |
| 883 | + /* check for TX work to do */ | |
| 884 | + if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | |
| 885 | + work_exists = 1; | |
| 886 | + | |
| 887 | + /* check for RX work to do */ | |
| 888 | + if (tnapi->rx_rcb_prod_idx && | |
| 884 | 889 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
| 885 | 890 | work_exists = 1; |
| 886 | 891 | |
| @@ -6124,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) · 5237 unmodified lines | ||
| 6124 | 6129 | return work_done; |
| 6125 | 6130 | } |
| 6126 | 6131 | |
| 6132 | + if (!tnapi->rx_rcb_prod_idx) | |
| 6133 | + return work_done; | |
| 6134 | + | |
| 6127 | 6135 | /* run RX thread, within the bounds set by NAPI. |
| 6128 | 6136 | * All RX "locking" is done by ensuring outside |
| 6129 | 6137 | * code synchronizes with tg3->napi.poll() |
| @@ -7567,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) · 1437 unmodified lines | ||
| 7567 | 7575 | */ |
| 7568 | 7576 | switch (i) { |
| 7569 | 7577 | default: |
| 7578 | + if (tg3_flag(tp, ENABLE_RSS)) { | |
| 7579 | + tnapi->rx_rcb_prod_idx = NULL; | |
| 7580 | + break; | |
| 7581 | + } | |
| 7582 | + /* Fall through */ | |
| 7583 | + case 1: | |
| 7570 | 7584 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
| 7571 | 7585 | break; |
| 7572 | 7586 | case 2: |
| @@ -1149,6 +1149,48 @@ release_tpsram: · 1148 unmodified lines | ||
| 1149 | 1149 | return ret; |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | +/** | |
| 1153 | + * t3_synchronize_rx - wait for current Rx processing on a port to complete | |
| 1154 | + * @adap: the adapter | |
| 1155 | + * @p: the port | |
| 1156 | + * | |
| 1157 | + * Ensures that current Rx processing on any of the queues associated with | |
| 1158 | + * the given port completes before returning. We do this by acquiring and | |
| 1159 | + * releasing the locks of the response queues associated with the port. | |
| 1160 | + */ | |
| 1161 | +static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | |
| 1162 | +{ | |
| 1163 | + int i; | |
| 1164 | + | |
| 1165 | + for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | |
| 1166 | + struct sge_rspq *q = &adap->sge.qs[i].rspq; | |
| 1167 | + | |
| 1168 | + spin_lock_irq(&q->lock); | |
| 1169 | + spin_unlock_irq(&q->lock); | |
| 1170 | + } | |
| 1171 | +} | |
| 1172 | + | |
| 1173 | +static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | |
| 1174 | +{ | |
| 1175 | + struct port_info *pi = netdev_priv(dev); | |
| 1176 | + struct adapter *adapter = pi->adapter; | |
| 1177 | + | |
| 1178 | + if (adapter->params.rev > 0) { | |
| 1179 | + t3_set_vlan_accel(adapter, 1 << pi->port_id, | |
| 1180 | + features & NETIF_F_HW_VLAN_RX); | |
| 1181 | + } else { | |
| 1182 | + /* single control for all ports */ | |
| 1183 | + unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | |
| 1184 | + | |
| 1185 | + for_each_port(adapter, i) | |
| 1186 | + have_vlans |= | |
| 1187 | + adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | |
| 1188 | + | |
| 1189 | + t3_set_vlan_accel(adapter, 1, have_vlans); | |
| 1190 | + } | |
| 1191 | + t3_synchronize_rx(adapter, pi); | |
| 1192 | +} | |
| 1193 | + | |
| 1152 | 1194 | /** |
| 1153 | 1195 | * cxgb_up - enable the adapter |
| 1154 | 1196 | * @adapter: adapter being enabled |
| @@ -1161,7 +1203,7 @@ release_tpsram: · 6 unmodified lines | ||
| 1161 | 1203 | */ |
| 1162 | 1204 | static int cxgb_up(struct adapter *adap) |
| 1163 | 1205 | { |
| 1164 | − int err; | |
| 1206 | + int i, err; | |
| 1165 | 1207 | |
| 1166 | 1208 | if (!(adap->flags & FULL_INIT_DONE)) { |
| 1167 | 1209 | err = t3_check_fw_version(adap); |
| @@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap) · 30 unmodified lines | ||
| 1198 | 1240 | if (err) |
| 1199 | 1241 | goto out; |
| 1200 | 1242 | |
| 1243 | + for_each_port(adap, i) | |
| 1244 | + cxgb_vlan_mode(adap->port[i], adap->port[i]->features); | |
| 1245 | + | |
| 1201 | 1246 | setup_rss(adap); |
| 1202 | 1247 | if (!(adap->flags & NAPI_INIT)) |
| 1203 | 1248 | init_napi(adap); |
| @@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) · 1304 unmodified lines | ||
| 2508 | 2553 | return 0; |
| 2509 | 2554 | } |
| 2510 | 2555 | |
| 2511 | −/** | |
| 2512 | − * t3_synchronize_rx - wait for current Rx processing on a port to complete | |
| 2513 | − * @adap: the adapter | |
| 2514 | − * @p: the port | |
| 2515 | − * | |
| 2516 | − * Ensures that current Rx processing on any of the queues associated with | |
| 2517 | − * the given port completes before returning. We do this by acquiring and | |
| 2518 | − * releasing the locks of the response queues associated with the port. | |
| 2519 | − */ | |
| 2520 | −static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | |
| 2521 | −{ | |
| 2522 | − int i; | |
| 2523 | − | |
| 2524 | − for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | |
| 2525 | − struct sge_rspq *q = &adap->sge.qs[i].rspq; | |
| 2526 | − | |
| 2527 | − spin_lock_irq(&q->lock); | |
| 2528 | − spin_unlock_irq(&q->lock); | |
| 2529 | − } | |
| 2530 | −} | |
| 2531 | − | |
| 2532 | −static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | |
| 2533 | −{ | |
| 2534 | − struct port_info *pi = netdev_priv(dev); | |
| 2535 | − struct adapter *adapter = pi->adapter; | |
| 2536 | − | |
| 2537 | − if (adapter->params.rev > 0) { | |
| 2538 | − t3_set_vlan_accel(adapter, 1 << pi->port_id, | |
| 2539 | − features & NETIF_F_HW_VLAN_RX); | |
| 2540 | − } else { | |
| 2541 | − /* single control for all ports */ | |
| 2542 | − unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | |
| 2543 | − | |
| 2544 | − for_each_port(adapter, i) | |
| 2545 | − have_vlans |= | |
| 2546 | − adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | |
| 2547 | − | |
| 2548 | − t3_set_vlan_accel(adapter, 1, have_vlans); | |
| 2549 | − } | |
| 2550 | − t3_synchronize_rx(adapter, pi); | |
| 2551 | −} | |
| 2552 | − | |
| 2553 | 2556 | static netdev_features_t cxgb_fix_features(struct net_device *dev, |
| 2554 | 2557 | netdev_features_t features) |
| 2555 | 2558 | { |
| @@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev, · 797 unmodified lines | ||
| 3353 | 3356 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
| 3354 | 3357 | &cxgb3_attr_group); |
| 3355 | 3358 | |
| 3356 | − for_each_port(adapter, i) | |
| 3357 | − cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features); | |
| 3358 | − | |
| 3359 | 3359 | print_port_info(adapter, ai); |
| 3360 | 3360 | return 0; |
| 3361 | 3361 | |
| @@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) · 1258 unmodified lines | ||
| 1259 | 1259 | { |
| 1260 | 1260 | int phy_addr; |
| 1261 | 1261 | struct netdev_private *np = netdev_priv(dev); |
| 1262 | − struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | |
| 1263 | − | |
| 1264 | − struct netdev_desc *desc; | |
| 1265 | − int i; | |
| 1262 | + struct mii_ioctl_data *miidata = if_mii(rq); | |
| 1266 | 1263 | |
| 1267 | 1264 | phy_addr = np->phy_addr; |
| 1268 | 1265 | switch (cmd) { |
| 1269 | − case SIOCDEVPRIVATE: | |
| 1270 | − break; | |
| 1271 | − | |
| 1272 | − case SIOCDEVPRIVATE + 1: | |
| 1273 | − miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | |
| 1266 | + case SIOCGMIIPHY: | |
| 1267 | + miidata->phy_id = phy_addr; | |
| 1274 | 1268 | break; |
| 1275 | − case SIOCDEVPRIVATE + 2: | |
| 1276 | − mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | |
| 1269 | + case SIOCGMIIREG: | |
| 1270 | + miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); | |
| 1277 | 1271 | break; |
| 1278 | − case SIOCDEVPRIVATE + 3: | |
| 1279 | − break; | |
| 1280 | − case SIOCDEVPRIVATE + 4: | |
| 1281 | − break; | |
| 1282 | − case SIOCDEVPRIVATE + 5: | |
| 1283 | − netif_stop_queue (dev); | |
| 1272 | + case SIOCSMIIREG: | |
| 1273 | + if (!capable(CAP_NET_ADMIN)) | |
| 1274 | + return -EPERM; | |
| 1275 | + mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); | |
| 1284 | 1276 | break; |
| 1285 | − case SIOCDEVPRIVATE + 6: | |
| 1286 | − netif_wake_queue (dev); | |
| 1287 | − break; | |
| 1288 | − case SIOCDEVPRIVATE + 7: | |
| 1289 | − printk | |
| 1290 | − ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | |
| 1291 | − netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | |
| 1292 | − np->old_rx); | |
| 1293 | − break; | |
| 1294 | − case SIOCDEVPRIVATE + 8: | |
| 1295 | − printk("TX ring:\n"); | |
| 1296 | − for (i = 0; i < TX_RING_SIZE; i++) { | |
| 1297 | − desc = &np->tx_ring[i]; | |
| 1298 | − printk | |
| 1299 | − ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | |
| 1300 | − i, | |
| 1301 | − (u32) (np->tx_ring_dma + i * sizeof (*desc)), | |
| 1302 | − (u32)le64_to_cpu(desc->next_desc), | |
| 1303 | − (u32)le64_to_cpu(desc->status), | |
| 1304 | − (u32)(le64_to_cpu(desc->fraginfo) >> 32), | |
| 1305 | − (u32)le64_to_cpu(desc->fraginfo)); | |
| 1306 | − printk ("\n"); | |
| 1307 | − } | |
| 1308 | − printk ("\n"); | |
| 1309 | − break; | |
| 1310 | − | |
| 1311 | 1277 | default: |
| 1312 | 1278 | return -EOPNOTSUPP; |
| 1313 | 1279 | } |
| @@ -365,13 +365,6 @@ struct ioctl_data { · 364 unmodified lines | ||
| 365 | 365 | char *data; |
| 366 | 366 | }; |
| 367 | 367 | |
| 368 | −struct mii_data { | |
| 369 | − __u16 reserved; | |
| 370 | − __u16 reg_num; | |
| 371 | − __u16 in_value; | |
| 372 | − __u16 out_value; | |
| 373 | −}; | |
| 374 | − | |
| 375 | 368 | /* The Rx and Tx buffer descriptors. */ |
| 376 | 369 | struct netdev_desc { |
| 377 | 370 | __le64 next_desc; |
| @@ -116,10 +116,10 @@ static struct ucc_geth_info ugeth_primary_info = { · 115 unmodified lines | ||
| 116 | 116 | .maxGroupAddrInHash = 4, |
| 117 | 117 | .maxIndAddrInHash = 4, |
| 118 | 118 | .prel = 7, |
| 119 | − .maxFrameLength = 1518, | |
| 119 | + .maxFrameLength = 1518+16, /* Add extra bytes for VLANs etc. */ | |
| 120 | 120 | .minFrameLength = 64, |
| 121 | − .maxD1Length = 1520, | |
| 122 | − .maxD2Length = 1520, | |
| 121 | + .maxD1Length = 1520+16, /* Add extra bytes for VLANs etc. */ | |
| 122 | + .maxD2Length = 1520+16, /* Add extra bytes for VLANs etc. */ | |
| 123 | 123 | .vlantype = 0x8100, |
| 124 | 124 | .ecamptr = ((uint32_t) NULL), |
| 125 | 125 | .eventRegMask = UCCE_OTHER, |
| @@ -877,7 +877,7 @@ struct ucc_geth_hardware_statistics { · 876 unmodified lines | ||
| 877 | 877 | |
| 878 | 878 | /* Driver definitions */ |
| 879 | 879 | #define TX_BD_RING_LEN 0x10 |
| 880 | −#define RX_BD_RING_LEN 0x10 | |
| 880 | +#define RX_BD_RING_LEN 0x20 | |
| 881 | 881 | |
| 882 | 882 | #define TX_RING_MOD_MASK(size) (size-1) |
| 883 | 883 | #define RX_RING_MOD_MASK(size) (size-1) |
| @@ -290,16 +290,18 @@ static void ehea_update_bcmc_registrations(void) · 289 unmodified lines | ||
| 290 | 290 | |
| 291 | 291 | arr[i].adh = adapter->handle; |
| 292 | 292 | arr[i].port_id = port->logical_port_id; |
| 293 | − arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | |
| 294 | − EHEA_BCMC_MULTICAST | | |
| 293 | + arr[i].reg_type = EHEA_BCMC_MULTICAST | | |
| 295 | 294 | EHEA_BCMC_UNTAGGED; |
| 295 | + if (mc_entry->macaddr == 0) | |
| 296 | + arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | |
| 296 | 297 | arr[i++].macaddr = mc_entry->macaddr; |
| 297 | 298 | |
| 298 | 299 | arr[i].adh = adapter->handle; |
| 299 | 300 | arr[i].port_id = port->logical_port_id; |
| 300 | − arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | |
| 301 | − EHEA_BCMC_MULTICAST | | |
| 301 | + arr[i].reg_type = EHEA_BCMC_MULTICAST | | |
| 302 | 302 | EHEA_BCMC_VLANID_ALL; |
| 303 | + if (mc_entry->macaddr == 0) | |
| 304 | + arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | |
| 303 | 305 | arr[i++].macaddr = mc_entry->macaddr; |
| 304 | 306 | num_registrations -= 2; |
| 305 | 307 | } |
| @@ -1838,8 +1840,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, · 1532 unmodified lines | ||
| 1838 | 1840 | u64 hret; |
| 1839 | 1841 | u8 reg_type; |
| 1840 | 1842 | |
| 1841 | − reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | |
| 1842 | − | EHEA_BCMC_UNTAGGED; | |
| 1843 | + reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_UNTAGGED; | |
| 1844 | + if (mc_mac_addr == 0) | |
| 1845 | + reg_type |= EHEA_BCMC_SCOPE_ALL; | |
| 1843 | 1846 | |
| 1844 | 1847 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1845 | 1848 | port->logical_port_id, |
| @@ -1847,8 +1850,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, · 1 unmodified line | ||
| 1847 | 1850 | if (hret) |
| 1848 | 1851 | goto out; |
| 1849 | 1852 | |
| 1850 | − reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | |
| 1851 | − | EHEA_BCMC_VLANID_ALL; | |
| 1853 | + reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_VLANID_ALL; | |
| 1854 | + if (mc_mac_addr == 0) | |
| 1855 | + reg_type |= EHEA_BCMC_SCOPE_ALL; | |
| 1852 | 1856 | |
| 1853 | 1857 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1854 | 1858 | port->logical_port_id, |
| @@ -1898,7 +1902,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) · 43 unmodified lines | ||
| 1898 | 1902 | netdev_err(dev, |
| 1899 | 1903 | "failed enabling IFF_ALLMULTI\n"); |
| 1900 | 1904 | } |
| 1901 | − } else | |
| 1905 | + } else { | |
| 1902 | 1906 | if (!enable) { |
| 1903 | 1907 | /* Disable ALLMULTI */ |
| 1904 | 1908 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); |
| @@ -1908,6 +1912,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) · 3 unmodified lines | ||
| 1908 | 1912 | netdev_err(dev, |
| 1909 | 1913 | "failed disabling IFF_ALLMULTI\n"); |
| 1910 | 1914 | } |
| 1915 | + } | |
| 1911 | 1916 | } |
| 1912 | 1917 | |
| 1913 | 1918 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) |
| @@ -1941,11 +1946,7 @@ static void ehea_set_multicast_list(struct net_device *dev) · 27 unmodified lines | ||
| 1941 | 1946 | struct netdev_hw_addr *ha; |
| 1942 | 1947 | int ret; |
| 1943 | 1948 | |
| 1944 | − if (port->promisc) { | |
| 1945 | − ehea_promiscuous(dev, 1); | |
| 1946 | − return; | |
| 1947 | − } | |
| 1948 | − ehea_promiscuous(dev, 0); | |
| 1949 | + ehea_promiscuous(dev, !!(dev->flags & IFF_PROMISC)); | |
| 1949 | 1950 | |
| 1950 | 1951 | if (dev->flags & IFF_ALLMULTI) { |
| 1951 | 1952 | ehea_allmulti(dev, 1); |
| @@ -2463,6 +2464,7 @@ static int ehea_down(struct net_device *dev) · 511 unmodified lines | ||
| 2463 | 2464 | return 0; |
| 2464 | 2465 | |
| 2465 | 2466 | ehea_drop_multicast_list(dev); |
| 2467 | + ehea_allmulti(dev, 0); | |
| 2466 | 2468 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
| 2467 | 2469 | |
| 2468 | 2470 | ehea_free_interrupts(dev); |
| @@ -3261,6 +3263,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, · 792 unmodified lines | ||
| 3261 | 3263 | struct ehea_adapter *adapter; |
| 3262 | 3264 | const u64 *adapter_handle; |
| 3263 | 3265 | int ret; |
| 3266 | + int i; | |
| 3264 | 3267 | |
| 3265 | 3268 | if (!dev || !dev->dev.of_node) { |
| 3266 | 3269 | pr_err("Invalid ibmebus device probed\n"); |
| @@ -3314,17 +3317,9 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, · 47 unmodified lines | ||
| 3314 | 3317 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
| 3315 | 3318 | (unsigned long)adapter); |
| 3316 | 3319 | |
| 3317 | − ret = ibmebus_request_irq(adapter->neq->attr.ist1, | |
| 3318 | − ehea_interrupt_neq, IRQF_DISABLED, | |
| 3319 | − "ehea_neq", adapter); | |
| 3320 | − if (ret) { | |
| 3321 | − dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | |
| 3322 | − goto out_kill_eq; | |
| 3323 | − } | |
| 3324 | − | |
| 3325 | 3320 | ret = ehea_create_device_sysfs(dev); |
| 3326 | 3321 | if (ret) |
| 3327 | − goto out_free_irq; | |
| 3322 | + goto out_kill_eq; | |
| 3328 | 3323 | |
| 3329 | 3324 | ret = ehea_setup_ports(adapter); |
| 3330 | 3325 | if (ret) { |
| @@ -3332,15 +3327,28 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, · 1 unmodified line | ||
| 3332 | 3327 | goto out_rem_dev_sysfs; |
| 3333 | 3328 | } |
| 3334 | 3329 | |
| 3330 | + ret = ibmebus_request_irq(adapter->neq->attr.ist1, | |
| 3331 | + ehea_interrupt_neq, IRQF_DISABLED, | |
| 3332 | + "ehea_neq", adapter); | |
| 3333 | + if (ret) { | |
| 3334 | + dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | |
| 3335 | + goto out_shutdown_ports; | |
| 3336 | + } | |
| 3337 | + | |
| 3338 | + | |
| 3335 | 3339 | ret = 0; |
| 3336 | 3340 | goto out; |
| 3337 | 3341 | |
| 3342 | +out_shutdown_ports: | |
| 3343 | + for (i = 0; i < EHEA_MAX_PORTS; i++) | |
| 3344 | + if (adapter->port[i]) { | |
| 3345 | + ehea_shutdown_single_port(adapter->port[i]); | |
| 3346 | + adapter->port[i] = NULL; | |
| 3347 | + } | |
| 3348 | + | |
| 3338 | 3349 | out_rem_dev_sysfs: |
| 3339 | 3350 | ehea_remove_device_sysfs(dev); |
| 3340 | 3351 | |
| 3341 | −out_free_irq: | |
| 3342 | − ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | |
| 3343 | − | |
| 3344 | 3352 | out_kill_eq: |
| 3345 | 3353 | ehea_destroy_eq(adapter->neq); |
| 3346 | 3354 | |
| @@ -450,7 +450,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num, · 449 unmodified lines | ||
| 450 | 450 | void *cb_addr); |
| 451 | 451 | |
| 452 | 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) |
| 453 | −#define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(61, 63) | |
| 453 | +#define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(60, 63) | |
| 454 | 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) |
| 455 | 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) |
| 456 | 456 | |
| @@ -3799,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) · 3798 unmodified lines | ||
| 3799 | 3799 | /* fire an unusual interrupt on the test handler */ |
| 3800 | 3800 | ew32(ICS, E1000_ICS_RXSEQ); |
| 3801 | 3801 | e1e_flush(); |
| 3802 | − msleep(50); | |
| 3802 | + msleep(100); | |
| 3803 | 3803 | |
| 3804 | 3804 | e1000_irq_disable(adapter); |
| 3805 | 3805 | |
| @@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); · 105 unmodified lines | ||
| 106 | 106 | /* |
| 107 | 107 | * Interrupt Throttle Rate (interrupts/sec) |
| 108 | 108 | * |
| 109 | − * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) | |
| 109 | + * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative | |
| 110 | 110 | */ |
| 111 | 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
| 112 | 112 | #define DEFAULT_ITR 3 |
| @@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) · 231 unmodified lines | ||
| 344 | 344 | |
| 345 | 345 | if (num_InterruptThrottleRate > bd) { |
| 346 | 346 | adapter->itr = InterruptThrottleRate[bd]; |
| 347 | − switch (adapter->itr) { | |
| 348 | − case 0: | |
| 349 | − e_info("%s turned off\n", opt.name); | |
| 350 | − break; | |
| 351 | − case 1: | |
| 352 | − e_info("%s set to dynamic mode\n", opt.name); | |
| 353 | − adapter->itr_setting = adapter->itr; | |
| 354 | − adapter->itr = 20000; | |
| 355 | − break; | |
| 356 | − case 3: | |
| 357 | − e_info("%s set to dynamic conservative mode\n", | |
| 358 | − opt.name); | |
| 359 | − adapter->itr_setting = adapter->itr; | |
| 360 | − adapter->itr = 20000; | |
| 361 | − break; | |
| 362 | − case 4: | |
| 363 | − e_info("%s set to simplified (2000-8000 ints) " | |
| 364 | − "mode\n", opt.name); | |
| 365 | − adapter->itr_setting = 4; | |
| 366 | − break; | |
| 367 | − default: | |
| 368 | − /* | |
| 369 | − * Save the setting, because the dynamic bits | |
| 370 | − * change itr. | |
| 371 | − */ | |
| 372 | − if (e1000_validate_option(&adapter->itr, &opt, | |
| 373 | − adapter) && | |
| 374 | − (adapter->itr == 3)) { | |
| 375 | − /* | |
| 376 | − * In case of invalid user value, | |
| 377 | − * default to conservative mode. | |
| 378 | − */ | |
| 379 | − adapter->itr_setting = adapter->itr; | |
| 380 | − adapter->itr = 20000; | |
| 381 | − } else { | |
| 382 | − /* | |
| 383 | − * Clear the lower two bits because | |
| 384 | − * they are used as control. | |
| 385 | − */ | |
| 386 | − adapter->itr_setting = | |
| 387 | − adapter->itr & ~3; | |
| 388 | − } | |
| 389 | − break; | |
| 390 | − } | |
| 347 | + | |
| 348 | + /* | |
| 349 | + * Make sure a message is printed for non-special | |
| 350 | + * values. And in case of an invalid option, display | |
| 351 | + * warning, use default and got through itr/itr_setting | |
| 352 | + * adjustment logic below | |
| 353 | + */ | |
| 354 | + if ((adapter->itr > 4) && | |
| 355 | + e1000_validate_option(&adapter->itr, &opt, adapter)) | |
| 356 | + adapter->itr = opt.def; | |
| 391 | 357 | } else { |
| 392 | − adapter->itr_setting = opt.def; | |
| 358 | + /* | |
| 359 | + * If no option specified, use default value and go | |
| 360 | + * through the logic below to adjust itr/itr_setting | |
| 361 | + */ | |
| 362 | + adapter->itr = opt.def; | |
| 363 | + | |
| 364 | + /* | |
| 365 | + * Make sure a message is printed for non-special | |
| 366 | + * default values | |
| 367 | + */ | |
| 368 | + if (adapter->itr > 40) | |
| 369 | + e_info("%s set to default %d\n", opt.name, | |
| 370 | + adapter->itr); | |
| 371 | + } | |
| 372 | + | |
| 373 | + adapter->itr_setting = adapter->itr; | |
| 374 | + switch (adapter->itr) { | |
| 375 | + case 0: | |
| 376 | + e_info("%s turned off\n", opt.name); | |
| 377 | + break; | |
| 378 | + case 1: | |
| 379 | + e_info("%s set to dynamic mode\n", opt.name); | |
| 380 | + adapter->itr = 20000; | |
| 381 | + break; | |
| 382 | + case 3: | |
| 383 | + e_info("%s set to dynamic conservative mode\n", | |
| 384 | + opt.name); | |
| 393 | 385 | adapter->itr = 20000; |
| 386 | + break; | |
| 387 | + case 4: | |
| 388 | + e_info("%s set to simplified (2000-8000 ints) mode\n", | |
| 389 | + opt.name); | |
| 390 | + break; | |
| 391 | + default: | |
| 392 | + /* | |
| 393 | + * Save the setting, because the dynamic bits | |
| 394 | + * change itr. | |
| 395 | + * | |
| 396 | + * Clear the lower two bits because | |
| 397 | + * they are used as control. | |
| 398 | + */ | |
| 399 | + adapter->itr_setting &= ~3; | |
| 400 | + break; | |
| 394 | 401 | } |
| 395 | 402 | } |
| 396 | 403 | { /* Interrupt Mode */ |
| @@ -2731,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, · 2730 unmodified lines | ||
| 2731 | 2731 | netdev->addr_len); |
| 2732 | 2732 | } |
| 2733 | 2733 | |
| 2734 | − if (!is_valid_ether_addr(netdev->perm_addr)) { | |
| 2734 | + if (!is_valid_ether_addr(netdev->dev_addr)) { | |
| 2735 | 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
| 2736 | 2736 | netdev->dev_addr); |
| 2737 | 2737 | err = -EIO; |
| 2738 | 2738 | goto err_hw_init; |
| 2739 | 2739 | } |
| 2740 | 2740 | |
| 2741 | − memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | |
| 2741 | + memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | |
| 2742 | 2742 | |
| 2743 | 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
| 2744 | 2744 | (unsigned long) adapter); |
| @@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, · 436 unmodified lines | ||
| 437 | 437 | */ |
| 438 | 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && |
| 439 | 439 | (fctl & FC_FC_END_SEQ)) { |
| 440 | + skb_linearize(skb); | |
| 440 | 441 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); |
| 441 | 442 | crc->fcoe_eof = FC_EOF_T; |
| 442 | 443 | } |
| @@ -4873,10 +4873,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) · 4872 unmodified lines | ||
| 4873 | 4873 | } |
| 4874 | 4874 | |
| 4875 | 4875 | ixgbe_clear_interrupt_scheme(adapter); |
| 4876 | −#ifdef CONFIG_DCB | |
| 4877 | − kfree(adapter->ixgbe_ieee_pfc); | |
| 4878 | − kfree(adapter->ixgbe_ieee_ets); | |
| 4879 | −#endif | |
| 4880 | 4876 | |
| 4881 | 4877 | #ifdef CONFIG_PM |
| 4882 | 4878 | retval = pci_save_state(pdev); |
| @@ -7224,6 +7220,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) · 2341 unmodified lines | ||
| 7224 | 7220 | |
| 7225 | 7221 | ixgbe_release_hw_control(adapter); |
| 7226 | 7222 | |
| 7223 | +#ifdef CONFIG_DCB | |
| 7224 | + kfree(adapter->ixgbe_ieee_pfc); | |
| 7225 | + kfree(adapter->ixgbe_ieee_ets); | |
| 7226 | + | |
| 7227 | +#endif | |
| 7227 | 7228 | iounmap(adapter->hw.hw_addr); |
| 7228 | 7229 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
| 7229 | 7230 | IORESOURCE_MEM)); |
| @@ -2494,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, · 2493 unmodified lines | ||
| 2494 | 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); |
| 2495 | 2495 | skb->ip_summed = re->skb->ip_summed; |
| 2496 | 2496 | skb->csum = re->skb->csum; |
| 2497 | + skb->rxhash = re->skb->rxhash; | |
| 2498 | + skb->vlan_tci = re->skb->vlan_tci; | |
| 2499 | + | |
| 2497 | 2500 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, |
| 2498 | 2501 | length, PCI_DMA_FROMDEVICE); |
| 2502 | + re->skb->vlan_tci = 0; | |
| 2503 | + re->skb->rxhash = 0; | |
| 2499 | 2504 | re->skb->ip_summed = CHECKSUM_NONE; |
| 2500 | 2505 | skb_put(skb, length); |
| 2501 | 2506 | } |
| @@ -2580,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, · 78 unmodified lines | ||
| 2580 | 2585 | struct sk_buff *skb = NULL; |
| 2581 | 2586 | u16 count = (status & GMR_FS_LEN) >> 16; |
| 2582 | 2587 | |
| 2583 | − if (status & GMR_FS_VLAN) | |
| 2584 | − count -= VLAN_HLEN; /* Account for vlan tag */ | |
| 2585 | − | |
| 2586 | 2588 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, |
| 2587 | 2589 | "rx slot %u status 0x%x len %d\n", |
| 2588 | 2590 | sky2->rx_next, status, length); |
| @@ -2590,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev, · 1 unmodified line | ||
| 2590 | 2592 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; |
| 2591 | 2593 | prefetch(sky2->rx_ring + sky2->rx_next); |
| 2592 | 2594 | |
| 2595 | + if (vlan_tx_tag_present(re->skb)) | |
| 2596 | + count -= VLAN_HLEN; /* Account for vlan tag */ | |
| 2597 | + | |
| 2593 | 2598 | /* This chip has hardware problems that generates bogus status. |
| 2594 | 2599 | * So do only marginal checking and expect higher level protocols |
| 2595 | 2600 | * to handle crap frames. |
| @@ -2647,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) · 51 unmodified lines | ||
| 2647 | 2652 | } |
| 2648 | 2653 | |
| 2649 | 2654 | static inline void sky2_skb_rx(const struct sky2_port *sky2, |
| 2650 | − u32 status, struct sk_buff *skb) | |
| 2655 | + struct sk_buff *skb) | |
| 2651 | 2656 | { |
| 2652 | − if (status & GMR_FS_VLAN) | |
| 2653 | − __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); | |
| 2654 | − | |
| 2655 | 2657 | if (skb->ip_summed == CHECKSUM_NONE) |
| 2656 | 2658 | netif_receive_skb(skb); |
| 2657 | 2659 | else |
| @@ -2705,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) · 47 unmodified lines | ||
| 2705 | 2707 | } |
| 2706 | 2708 | } |
| 2707 | 2709 | |
| 2710 | +static void sky2_rx_tag(struct sky2_port *sky2, u16 length) | |
| 2711 | +{ | |
| 2712 | + struct sk_buff *skb; | |
| 2713 | + | |
| 2714 | + skb = sky2->rx_ring[sky2->rx_next].skb; | |
| 2715 | + __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); | |
| 2716 | +} | |
| 2717 | + | |
| 2708 | 2718 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) |
| 2709 | 2719 | { |
| 2710 | 2720 | struct sk_buff *skb; |
| @@ -2763,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) · 52 unmodified lines | ||
| 2763 | 2773 | } |
| 2764 | 2774 | |
| 2765 | 2775 | skb->protocol = eth_type_trans(skb, dev); |
| 2766 | − | |
| 2767 | − sky2_skb_rx(sky2, status, skb); | |
| 2776 | + sky2_skb_rx(sky2, skb); | |
| 2768 | 2777 | |
| 2769 | 2778 | /* Stop after net poll weight */ |
| 2770 | 2779 | if (++work_done >= to_do) |
| @@ -2772,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) · 1 unmodified line | ||
| 2772 | 2781 | break; |
| 2773 | 2782 | |
| 2774 | 2783 | case OP_RXVLAN: |
| 2775 | − sky2->rx_tag = length; | |
| 2784 | + sky2_rx_tag(sky2, length); | |
| 2776 | 2785 | break; |
| 2777 | 2786 | |
| 2778 | 2787 | case OP_RXCHKSVLAN: |
| 2779 | − sky2->rx_tag = length; | |
| 2788 | + sky2_rx_tag(sky2, length); | |
| 2780 | 2789 | /* fall through */ |
| 2781 | 2790 | case OP_RXCHKS: |
| 2782 | 2791 | if (likely(dev->features & NETIF_F_RXCSUM)) |
| @@ -2241,7 +2241,6 @@ struct sky2_port { · 2240 unmodified lines | ||
| 2241 | 2241 | u16 rx_pending; |
| 2242 | 2242 | u16 rx_data_size; |
| 2243 | 2243 | u16 rx_nfrags; |
| 2244 | − u16 rx_tag; | |
| 2245 | 2244 | |
| 2246 | 2245 | struct { |
| 2247 | 2246 | unsigned long last; |
| @@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) · 2338 unmodified lines | ||
| 2339 | 2339 | netif_device_detach(dev); |
| 2340 | 2340 | |
| 2341 | 2341 | /* Switch off chip, remember WOL setting */ |
| 2342 | − gp->asleep_wol = gp->wake_on_lan; | |
| 2342 | + gp->asleep_wol = !!gp->wake_on_lan; | |
| 2343 | 2343 | gem_do_stop(dev, gp->asleep_wol); |
| 2344 | 2344 | |
| 2345 | 2345 | /* Unlock the network stack */ |
| @@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) · 1510 unmodified lines | ||
| 1511 | 1511 | |
| 1512 | 1512 | static int match_first_device(struct device *dev, void *data) |
| 1513 | 1513 | { |
| 1514 | − return 1; | |
| 1514 | + return !strncmp(dev_name(dev), "davinci_mdio", 12); | |
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | /** |
| @@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag) · 227 unmodified lines | ||
| 228 | 228 | unsigned long addr; |
| 229 | 229 | |
| 230 | 230 | addr = tag->buffer[9].address; |
| 231 | − addr |= (tag->buffer[8].address << 16) << 16; | |
| 231 | + addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; | |
| 232 | 232 | return (struct sk_buff *) addr; |
| 233 | 233 | } |
| 234 | 234 | |
| @@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 354 unmodified lines | ||
| 355 | 355 | u32 packet_len; |
| 356 | 356 | u32 padbytes = 0xffff0000; |
| 357 | 357 | |
| 358 | − padlen = ((skb->len + 4) % 512) ? 0 : 4; | |
| 358 | + padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; | |
| 359 | 359 | |
| 360 | 360 | if ((!skb_cloned(skb)) && |
| 361 | 361 | ((headroom + tailroom) >= (4 + padlen))) { |
| @@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 15 unmodified lines | ||
| 377 | 377 | cpu_to_le32s(&packet_len); |
| 378 | 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
| 379 | 379 | |
| 380 | − if ((skb->len % 512) == 0) { | |
| 380 | + if (padlen) { | |
| 381 | 381 | cpu_to_le32s(&padbytes); |
| 382 | 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
| 383 | 383 | skb_put(skb, sizeof(padbytes)); |
| @@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index, · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | if (unlikely(ret < 0)) |
| 100 | 100 | netdev_warn(dev->net, |
| 101 | − "Failed to read register index 0x%08x", index); | |
| 101 | + "Failed to read reg index 0x%08x: %d", index, ret); | |
| 102 | 102 | |
| 103 | 103 | le32_to_cpus(buf); |
| 104 | 104 | *data = *buf; |
| @@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, · 23 unmodified lines | ||
| 128 | 128 | |
| 129 | 129 | if (unlikely(ret < 0)) |
| 130 | 130 | netdev_warn(dev->net, |
| 131 | − "Failed to write register index 0x%08x", index); | |
| 131 | + "Failed to write reg index 0x%08x: %d", index, ret); | |
| 132 | 132 | |
| 133 | 133 | kfree(buf); |
| 134 | 134 | |
| @@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx) · 36 unmodified lines | ||
| 171 | 171 | idx &= dev->mii.reg_num_mask; |
| 172 | 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 173 | 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 174 | − | MII_ACCESS_READ; | |
| 174 | + | MII_ACCESS_READ | MII_ACCESS_BUSY; | |
| 175 | 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 176 | 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 177 | 177 | |
| @@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx, · 32 unmodified lines | ||
| 210 | 210 | idx &= dev->mii.reg_num_mask; |
| 211 | 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 212 | 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 213 | − | MII_ACCESS_WRITE; | |
| 213 | + | MII_ACCESS_WRITE | MII_ACCESS_BUSY; | |
| 214 | 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 215 | 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 216 | 216 | |
| @@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev) · 291 unmodified lines | ||
| 508 | 508 | u16 lcladv, rmtadv; |
| 509 | 509 | int ret; |
| 510 | 510 | |
| 511 | − /* clear interrupt status */ | |
| 511 | + /* read and write to clear phy interrupt status */ | |
| 512 | 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); |
| 513 | 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
| 514 | + smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff); | |
| 514 | 515 | |
| 515 | 516 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); |
| 516 | 517 | check_warn_return(ret, "Error writing INT_STS"); |
| @@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev) · 126 unmodified lines | ||
| 643 | 644 | |
| 644 | 645 | static int smsc75xx_phy_initialize(struct usbnet *dev) |
| 645 | 646 | { |
| 646 | − int bmcr, timeout = 0; | |
| 647 | + int bmcr, ret, timeout = 0; | |
| 647 | 648 | |
| 648 | 649 | /* Initialize MII structure */ |
| 649 | 650 | dev->mii.dev = dev->net; |
| @@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) · 1 unmodified line | ||
| 651 | 652 | dev->mii.mdio_write = smsc75xx_mdio_write; |
| 652 | 653 | dev->mii.phy_id_mask = 0x1f; |
| 653 | 654 | dev->mii.reg_num_mask = 0x1f; |
| 655 | + dev->mii.supports_gmii = 1; | |
| 654 | 656 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; |
| 655 | 657 | |
| 656 | 658 | /* reset phy and wait for reset to complete */ |
| @@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) · 4 unmodified lines | ||
| 661 | 663 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); |
| 662 | 664 | check_warn_return(bmcr, "Error reading MII_BMCR"); |
| 663 | 665 | timeout++; |
| 664 | − } while ((bmcr & MII_BMCR) && (timeout < 100)); | |
| 666 | + } while ((bmcr & BMCR_RESET) && (timeout < 100)); | |
| 665 | 667 | |
| 666 | 668 | if (timeout >= 100) { |
| 667 | 669 | netdev_warn(dev->net, "timeout on PHY Reset"); |
| @@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) · 3 unmodified lines | ||
| 671 | 673 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
| 672 | 674 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
| 673 | 675 | ADVERTISE_PAUSE_ASYM); |
| 676 | + smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000, | |
| 677 | + ADVERTISE_1000FULL); | |
| 674 | 678 | |
| 675 | − /* read to clear */ | |
| 676 | − smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | |
| 677 | − check_warn_return(bmcr, "Error reading PHY_INT_SRC"); | |
| 679 | + /* read and write to clear phy interrupt status */ | |
| 680 | + ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | |
| 681 | + check_warn_return(ret, "Error reading PHY_INT_SRC"); | |
| 682 | + smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff); | |
| 678 | 683 | |
| 679 | 684 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, |
| 680 | 685 | PHY_INT_MASK_DEFAULT); |
| @@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev) · 265 unmodified lines | ||
| 946 | 951 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); |
| 947 | 952 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); |
| 948 | 953 | |
| 954 | + /* allow mac to detect speed and duplex from phy */ | |
| 955 | + ret = smsc75xx_read_reg(dev, MAC_CR, &buf); | |
| 956 | + check_warn_return(ret, "Failed to read MAC_CR: %d", ret); | |
| 957 | + | |
| 958 | + buf |= (MAC_CR_ADD | MAC_CR_ASD); | |
| 959 | + ret = smsc75xx_write_reg(dev, MAC_CR, buf); | |
| 960 | + check_warn_return(ret, "Failed to write MAC_CR: %d", ret); | |
| 961 | + | |
| 949 | 962 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); |
| 950 | 963 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); |
| 951 | 964 | |
| @@ -1212,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { · 260 unmodified lines | ||
| 1212 | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
| 1213 | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
| 1214 | 1227 | .status = smsc75xx_status, |
| 1215 | − .flags = FLAG_ETHER | FLAG_SEND_ZLP, | |
| 1228 | + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, | |
| 1216 | 1229 | }; |
| 1217 | 1230 | |
| 1218 | 1231 | static const struct usb_device_id products[] = { |
| @@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) · 1016 unmodified lines | ||
| 1017 | 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; |
| 1018 | 1018 | dev->net->flags |= IFF_MULTICAST; |
| 1019 | 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; |
| 1020 | + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | |
| 1020 | 1021 | return 0; |
| 1021 | 1022 | } |
| 1022 | 1023 | |
| @@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = { · 168 unmodified lines | ||
| 1191 | 1192 | .rx_fixup = smsc95xx_rx_fixup, |
| 1192 | 1193 | .tx_fixup = smsc95xx_tx_fixup, |
| 1193 | 1194 | .status = smsc95xx_status, |
| 1194 | − .flags = FLAG_ETHER | FLAG_SEND_ZLP, | |
| 1195 | + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, | |
| 1195 | 1196 | }; |
| 1196 | 1197 | |
| 1197 | 1198 | static const struct usb_device_id products[] = { |
| @@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) · 209 unmodified lines | ||
| 210 | 210 | } else { |
| 211 | 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, |
| 212 | 212 | buf, maxp, intr_complete, dev, period); |
| 213 | + dev->interrupt->transfer_flags |= URB_FREE_BUFFER; | |
| 213 | 214 | dev_dbg(&intf->dev, |
| 214 | 215 | "status ep%din, %d bytes period %d\n", |
| 215 | 216 | usb_pipeendpoint(pipe), maxp, period); |
| @@ -1443,7 +1444,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) · 1227 unmodified lines | ||
| 1443 | 1444 | |
| 1444 | 1445 | status = register_netdev (net); |
| 1445 | 1446 | if (status) |
| 1446 | − goto out3; | |
| 1447 | + goto out4; | |
| 1447 | 1448 | netif_info(dev, probe, dev->net, |
| 1448 | 1449 | "register '%s' at usb-%s-%s, %s, %pM\n", |
| 1449 | 1450 | udev->dev.driver->name, |
| @@ -1461,6 +1462,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) · 11 unmodified lines | ||
| 1461 | 1462 | |
| 1462 | 1463 | return 0; |
| 1463 | 1464 | |
| 1465 | +out4: | |
| 1466 | + usb_free_urb(dev->interrupt); | |
| 1464 | 1467 | out3: |
| 1465 | 1468 | if (info->unbind) |
| 1466 | 1469 | info->unbind (dev, udev); |
| @@ -220,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) · 219 unmodified lines | ||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | ath5k_deinit_ah(ah); |
| 223 | + iounmap(ah->iobase); | |
| 223 | 224 | platform_set_drvdata(pdev, NULL); |
| 224 | 225 | ieee80211_free_hw(hw); |
| 225 | 226 | |
| @@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, · 868 unmodified lines | ||
| 869 | 869 | ar5008_hw_set_channel_regs(ah, chan); |
| 870 | 870 | ar5008_hw_init_chain_masks(ah); |
| 871 | 871 | ath9k_olc_init(ah); |
| 872 | − ath9k_hw_apply_txpower(ah, chan); | |
| 872 | + ath9k_hw_apply_txpower(ah, chan, false); | |
| 873 | 873 | |
| 874 | 874 | /* Write analog registers */ |
| 875 | 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
| @@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val) · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | if (val) { |
| 56 | 56 | ah->paprd_table_write_done = true; |
| 57 | − ath9k_hw_apply_txpower(ah, chan); | |
| 57 | + ath9k_hw_apply_txpower(ah, chan, false); | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, |
| @@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, · 693 unmodified lines | ||
| 694 | 694 | ar9003_hw_override_ini(ah); |
| 695 | 695 | ar9003_hw_set_channel_regs(ah, chan); |
| 696 | 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
| 697 | − ath9k_hw_apply_txpower(ah, chan); | |
| 697 | + ath9k_hw_apply_txpower(ah, chan, false); | |
| 698 | 698 | |
| 699 | 699 | if (AR_SREV_9462(ah)) { |
| 700 | 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, |
| @@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, · 823 unmodified lines | ||
| 824 | 824 | regulatory->max_power_level = ratesArray[i]; |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | + ath9k_hw_update_regulatory_maxpower(ah); | |
| 828 | + | |
| 827 | 829 | if (test) |
| 828 | 830 | return; |
| 829 | 831 | |
| @@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, · 1453 unmodified lines | ||
| 1454 | 1454 | return false; |
| 1455 | 1455 | } |
| 1456 | 1456 | ath9k_hw_set_clockrate(ah); |
| 1457 | − ath9k_hw_apply_txpower(ah, chan); | |
| 1457 | + ath9k_hw_apply_txpower(ah, chan, false); | |
| 1458 | 1458 | ath9k_hw_rfbus_done(ah); |
| 1459 | 1459 | |
| 1460 | 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
| @@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) · 1191 unmodified lines | ||
| 2652 | 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); |
| 2653 | 2653 | } |
| 2654 | 2654 | |
| 2655 | −void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |
| 2655 | +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, | |
| 2656 | + bool test) | |
| 2656 | 2657 | { |
| 2657 | 2658 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
| 2658 | 2659 | struct ieee80211_channel *channel; |
| @@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) · 14 unmodified lines | ||
| 2673 | 2674 | |
| 2674 | 2675 | ah->eep_ops->set_txpower(ah, chan, |
| 2675 | 2676 | ath9k_regd_get_ctl(reg, chan), |
| 2676 | − ant_reduction, new_pwr, false); | |
| 2677 | + ant_reduction, new_pwr, test); | |
| 2677 | 2678 | } |
| 2678 | 2679 | |
| 2679 | 2680 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
| @@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) · 6 unmodified lines | ||
| 2686 | 2687 | if (test) |
| 2687 | 2688 | channel->max_power = MAX_RATE_POWER / 2; |
| 2688 | 2689 | |
| 2689 | − ath9k_hw_apply_txpower(ah, chan); | |
| 2690 | + ath9k_hw_apply_txpower(ah, chan, test); | |
| 2690 | 2691 | |
| 2691 | 2692 | if (test) |
| 2692 | 2693 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); |
| @@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); · 984 unmodified lines | ||
| 985 | 985 | /* PHY */ |
| 986 | 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
| 987 | 987 | u32 *coef_mantissa, u32 *coef_exponent); |
| 988 | −void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); | |
| 988 | +void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, | |
| 989 | + bool test); | |
| 989 | 990 | |
| 990 | 991 | /* |
| 991 | 992 | * Code Specific to AR5008, AR9001 or AR9002, |
| @@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw) · 4826 unmodified lines | ||
| 4827 | 4827 | out_mutex_unlock: |
| 4828 | 4828 | mutex_unlock(&wl->mutex); |
| 4829 | 4829 | |
| 4830 | − /* reload configuration */ | |
| 4831 | − b43_op_config(hw, ~0); | |
| 4830 | + /* | |
| 4831 | + * Configuration may have been overwritten during initialization. | |
| 4832 | + * Reload the configuration, but only if initialization was | |
| 4833 | + * successful. Reloading the configuration after a failed init | |
| 4834 | + * may hang the system. | |
| 4835 | + */ | |
| 4836 | + if (!err) | |
| 4837 | + b43_op_config(hw, ~0); | |
| 4832 | 4838 | |
| 4833 | 4839 | return err; |
| 4834 | 4840 | } |
| @@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, · 107 unmodified lines | ||
| 108 | 108 | sdio_release_host(sdfunc); |
| 109 | 109 | } |
| 110 | 110 | } else if (regaddr == SDIO_CCCR_ABORT) { |
| 111 | + sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), | |
| 112 | + GFP_KERNEL); | |
| 113 | + if (!sdfunc) | |
| 114 | + return -ENOMEM; | |
| 115 | + sdfunc->num = 0; | |
| 111 | 116 | sdio_claim_host(sdfunc); |
| 112 | 117 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); |
| 113 | 118 | sdio_release_host(sdfunc); |
| 119 | + kfree(sdfunc); | |
| 114 | 120 | } else if (regaddr < 0xF0) { |
| 115 | 121 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); |
| 116 | 122 | err_ret = -EPERM; |
| @@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, · 369 unmodified lines | ||
| 486 | 492 | kfree(bus_if); |
| 487 | 493 | return -ENOMEM; |
| 488 | 494 | } |
| 489 | − sdiodev->func[0] = func->card->sdio_func[0]; | |
| 495 | + sdiodev->func[0] = func; | |
| 490 | 496 | sdiodev->func[1] = func; |
| 491 | 497 | sdiodev->bus_if = bus_if; |
| 492 | 498 | bus_if->bus_priv.sdio = sdiodev; |
| @@ -574,6 +574,8 @@ struct brcmf_sdio { · 573 unmodified lines | ||
| 574 | 574 | |
| 575 | 575 | struct task_struct *dpc_tsk; |
| 576 | 576 | struct completion dpc_wait; |
| 577 | + struct list_head dpc_tsklst; | |
| 578 | + spinlock_t dpc_tl_lock; | |
| 577 | 579 | |
| 578 | 580 | struct semaphore sdsem; |
| 579 | 581 | |
| @@ -2594,29 +2596,58 @@ clkwait: · 2014 unmodified lines | ||
| 2594 | 2596 | return resched; |
| 2595 | 2597 | } |
| 2596 | 2598 | |
| 2599 | +static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) | |
| 2600 | +{ | |
| 2601 | + struct list_head *new_hd; | |
| 2602 | + unsigned long flags; | |
| 2603 | + | |
| 2604 | + if (in_interrupt()) | |
| 2605 | + new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); | |
| 2606 | + else | |
| 2607 | + new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); | |
| 2608 | + if (new_hd == NULL) | |
| 2609 | + return; | |
| 2610 | + | |
| 2611 | + spin_lock_irqsave(&bus->dpc_tl_lock, flags); | |
| 2612 | + list_add_tail(new_hd, &bus->dpc_tsklst); | |
| 2613 | + spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | |
| 2614 | +} | |
| 2615 | + | |
| 2597 | 2616 | static int brcmf_sdbrcm_dpc_thread(void *data) |
| 2598 | 2617 | { |
| 2599 | 2618 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; |
| 2619 | + struct list_head *cur_hd, *tmp_hd; | |
| 2620 | + unsigned long flags; | |
| 2600 | 2621 | |
| 2601 | 2622 | allow_signal(SIGTERM); |
| 2602 | 2623 | /* Run until signal received */ |
| 2603 | 2624 | while (1) { |
| 2604 | 2625 | if (kthread_should_stop()) |
| 2605 | 2626 | break; |
| 2606 | − if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | |
| 2607 | − /* Call bus dpc unless it indicated down | |
| 2608 | − (then clean stop) */ | |
| 2609 | − if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { | |
| 2610 | − if (brcmf_sdbrcm_dpc(bus)) | |
| 2611 | − complete(&bus->dpc_wait); | |
| 2612 | − } else { | |
| 2627 | + | |
| 2628 | + if (list_empty(&bus->dpc_tsklst)) | |
| 2629 | + if (wait_for_completion_interruptible(&bus->dpc_wait)) | |
| 2630 | + break; | |
| 2631 | + | |
| 2632 | + spin_lock_irqsave(&bus->dpc_tl_lock, flags); | |
| 2633 | + list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { | |
| 2634 | + spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | |
| 2635 | + | |
| 2636 | + if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { | |
| 2613 | 2637 | /* after stopping the bus, exit thread */ |
| 2614 | 2638 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); |
| 2615 | 2639 | bus->dpc_tsk = NULL; |
| 2616 | 2640 | break; |
| 2617 | 2641 | } |
| 2618 | − } else | |
| 2619 | − break; | |
| 2642 | + | |
| 2643 | + if (brcmf_sdbrcm_dpc(bus)) | |
| 2644 | + brcmf_sdbrcm_adddpctsk(bus); | |
| 2645 | + | |
| 2646 | + spin_lock_irqsave(&bus->dpc_tl_lock, flags); | |
| 2647 | + list_del(cur_hd); | |
| 2648 | + kfree(cur_hd); | |
| 2649 | + } | |
| 2650 | + spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | |
| 2620 | 2651 | } |
| 2621 | 2652 | return 0; |
| 2622 | 2653 | } |
| @@ -2669,8 +2700,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) · 46 unmodified lines | ||
| 2669 | 2700 | /* Schedule DPC if needed to send queued packet(s) */ |
| 2670 | 2701 | if (!bus->dpc_sched) { |
| 2671 | 2702 | bus->dpc_sched = true; |
| 2672 | − if (bus->dpc_tsk) | |
| 2703 | + if (bus->dpc_tsk) { | |
| 2704 | + brcmf_sdbrcm_adddpctsk(bus); | |
| 2673 | 2705 | complete(&bus->dpc_wait); |
| 2706 | + } | |
| 2674 | 2707 | } |
| 2675 | 2708 | |
| 2676 | 2709 | return ret; |
| @@ -3514,8 +3547,10 @@ void brcmf_sdbrcm_isr(void *arg) · 837 unmodified lines | ||
| 3514 | 3547 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
| 3515 | 3548 | |
| 3516 | 3549 | bus->dpc_sched = true; |
| 3517 | − if (bus->dpc_tsk) | |
| 3550 | + if (bus->dpc_tsk) { | |
| 3551 | + brcmf_sdbrcm_adddpctsk(bus); | |
| 3518 | 3552 | complete(&bus->dpc_wait); |
| 3553 | + } | |
| 3519 | 3554 | } |
| 3520 | 3555 | |
| 3521 | 3556 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
| @@ -3559,8 +3594,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) · 37 unmodified lines | ||
| 3559 | 3594 | bus->ipend = true; |
| 3560 | 3595 | |
| 3561 | 3596 | bus->dpc_sched = true; |
| 3562 | − if (bus->dpc_tsk) | |
| 3597 | + if (bus->dpc_tsk) { | |
| 3598 | + brcmf_sdbrcm_adddpctsk(bus); | |
| 3563 | 3599 | complete(&bus->dpc_wait); |
| 3600 | + } | |
| 3564 | 3601 | } |
| 3565 | 3602 | } |
| 3566 | 3603 | |
| @@ -3897,6 +3934,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) · 330 unmodified lines | ||
| 3897 | 3934 | } |
| 3898 | 3935 | /* Initialize DPC thread */ |
| 3899 | 3936 | init_completion(&bus->dpc_wait); |
| 3937 | + INIT_LIST_HEAD(&bus->dpc_tsklst); | |
| 3938 | + spin_lock_init(&bus->dpc_tl_lock); | |
| 3900 | 3939 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
| 3901 | 3940 | bus, "brcmf_dpc"); |
| 3902 | 3941 | if (IS_ERR(bus->dpc_tsk)) { |
| @@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) · 846 unmodified lines | ||
| 847 | 847 | */ |
| 848 | 848 | if (!(txs->status & TX_STATUS_AMPDU) |
| 849 | 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
| 850 | − wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", | |
| 851 | − __func__); | |
| 850 | + BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); | |
| 852 | 851 | return false; |
| 853 | 852 | } |
| 854 | 853 | |
| @@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) · 2190 unmodified lines | ||
| 2191 | 2191 | { |
| 2192 | 2192 | int rc = 0; |
| 2193 | 2193 | unsigned long flags; |
| 2194 | + unsigned long now, end; | |
| 2194 | 2195 | |
| 2195 | 2196 | spin_lock_irqsave(&priv->lock, flags); |
| 2196 | 2197 | if (priv->status & STATUS_HCMD_ACTIVE) { |
| @@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) · 35 unmodified lines | ||
| 2232 | 2233 | } |
| 2233 | 2234 | spin_unlock_irqrestore(&priv->lock, flags); |
| 2234 | 2235 | |
| 2236 | + now = jiffies; | |
| 2237 | + end = now + HOST_COMPLETE_TIMEOUT; | |
| 2238 | +again: | |
| 2235 | 2239 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
| 2236 | 2240 | !(priv-> |
| 2237 | 2241 | status & STATUS_HCMD_ACTIVE), |
| 2238 | − HOST_COMPLETE_TIMEOUT); | |
| 2242 | + end - now); | |
| 2243 | + if (rc < 0) { | |
| 2244 | + now = jiffies; | |
| 2245 | + if (time_before(now, end)) | |
| 2246 | + goto again; | |
| 2247 | + rc = 0; | |
| 2248 | + } | |
| 2249 | + | |
| 2239 | 2250 | if (rc == 0) { |
| 2240 | 2251 | spin_lock_irqsave(&priv->lock, flags); |
| 2241 | 2252 | if (priv->status & STATUS_HCMD_ACTIVE) { |
| @@ -46,8 +46,8 @@ · 45 unmodified lines | ||
| 46 | 46 | #include "iwl-prph.h" |
| 47 | 47 | |
| 48 | 48 | /* Highest firmware API version supported */ |
| 49 | −#define IWL1000_UCODE_API_MAX 6 | |
| 50 | −#define IWL100_UCODE_API_MAX 6 | |
| 49 | +#define IWL1000_UCODE_API_MAX 5 | |
| 50 | +#define IWL100_UCODE_API_MAX 5 | |
| 51 | 51 | |
| 52 | 52 | /* Oldest version we won't warn about */ |
| 53 | 53 | #define IWL1000_UCODE_API_OK 5 |
| @@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = { · 172 unmodified lines | ||
| 226 | 226 | IWL_DEVICE_100, |
| 227 | 227 | }; |
| 228 | 228 | |
| 229 | −MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | |
| 230 | −MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | |
| 229 | +MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); | |
| 230 | +MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); | |
| @@ -51,10 +51,10 @@ · 50 unmodified lines | ||
| 51 | 51 | #define IWL135_UCODE_API_MAX 6 |
| 52 | 52 | |
| 53 | 53 | /* Oldest version we won't warn about */ |
| 54 | −#define IWL2030_UCODE_API_OK 5 | |
| 55 | −#define IWL2000_UCODE_API_OK 5 | |
| 56 | −#define IWL105_UCODE_API_OK 5 | |
| 57 | −#define IWL135_UCODE_API_OK 5 | |
| 54 | +#define IWL2030_UCODE_API_OK 6 | |
| 55 | +#define IWL2000_UCODE_API_OK 6 | |
| 56 | +#define IWL105_UCODE_API_OK 6 | |
| 57 | +#define IWL135_UCODE_API_OK 6 | |
| 58 | 58 | |
| 59 | 59 | /* Lowest firmware API version supported */ |
| 60 | 60 | #define IWL2030_UCODE_API_MIN 5 |
| @@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { · 267 unmodified lines | ||
| 328 | 328 | .ht_params = &iwl2000_ht_params, |
| 329 | 329 | }; |
| 330 | 330 | |
| 331 | −MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | |
| 332 | −MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | |
| 333 | −MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | |
| 334 | −MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | |
| 331 | +MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); | |
| 332 | +MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); | |
| 333 | +MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); | |
| 334 | +MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); | |
| @@ -51,6 +51,10 @@ · 50 unmodified lines | ||
| 51 | 51 | #define IWL5000_UCODE_API_MAX 5 |
| 52 | 52 | #define IWL5150_UCODE_API_MAX 2 |
| 53 | 53 | |
| 54 | +/* Oldest version we won't warn about */ | |
| 55 | +#define IWL5000_UCODE_API_OK 5 | |
| 56 | +#define IWL5150_UCODE_API_OK 2 | |
| 57 | + | |
| 54 | 58 | /* Lowest firmware API version supported */ |
| 55 | 59 | #define IWL5000_UCODE_API_MIN 1 |
| 56 | 60 | #define IWL5150_UCODE_API_MIN 1 |
| @@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { · 269 unmodified lines | ||
| 326 | 330 | #define IWL_DEVICE_5000 \ |
| 327 | 331 | .fw_name_pre = IWL5000_FW_PRE, \ |
| 328 | 332 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
| 333 | + .ucode_api_ok = IWL5000_UCODE_API_OK, \ | |
| 329 | 334 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
| 330 | 335 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 331 | 336 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { · 39 unmodified lines | ||
| 371 | 376 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
| 372 | 377 | .fw_name_pre = IWL5000_FW_PRE, |
| 373 | 378 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
| 379 | + .ucode_api_ok = IWL5000_UCODE_API_OK, | |
| 374 | 380 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
| 375 | 381 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
| 376 | 382 | .max_data_size = IWLAGN_RTC_DATA_SIZE, |
| @@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { · 9 unmodified lines | ||
| 386 | 392 | #define IWL_DEVICE_5150 \ |
| 387 | 393 | .fw_name_pre = IWL5150_FW_PRE, \ |
| 388 | 394 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
| 395 | + .ucode_api_ok = IWL5150_UCODE_API_OK, \ | |
| 389 | 396 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
| 390 | 397 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 391 | 398 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { · 17 unmodified lines | ||
| 409 | 416 | IWL_DEVICE_5150, |
| 410 | 417 | }; |
| 411 | 418 | |
| 412 | −MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | |
| 413 | −MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | |
| 419 | +MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); | |
| 420 | +MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); | |
| @@ -53,6 +53,8 @@ · 52 unmodified lines | ||
| 53 | 53 | /* Oldest version we won't warn about */ |
| 54 | 54 | #define IWL6000_UCODE_API_OK 4 |
| 55 | 55 | #define IWL6000G2_UCODE_API_OK 5 |
| 56 | +#define IWL6050_UCODE_API_OK 5 | |
| 57 | +#define IWL6000G2B_UCODE_API_OK 6 | |
| 56 | 58 | |
| 57 | 59 | /* Lowest firmware API version supported */ |
| 58 | 60 | #define IWL6000_UCODE_API_MIN 4 |
| @@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { · 329 unmodified lines | ||
| 388 | 390 | #define IWL_DEVICE_6030 \ |
| 389 | 391 | .fw_name_pre = IWL6030_FW_PRE, \ |
| 390 | 392 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
| 391 | − .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | |
| 393 | + .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ | |
| 392 | 394 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
| 393 | 395 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
| 394 | 396 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
| @@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { · 162 unmodified lines | ||
| 557 | 559 | }; |
| 558 | 560 | |
| 559 | 561 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
| 560 | −MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | |
| 561 | −MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | |
| 562 | −MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | |
| 562 | +MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); | |
| 563 | +MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); | |
| 564 | +MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); | |
| @@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) · 862 unmodified lines | ||
| 863 | 863 | |
| 864 | 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
| 865 | 865 | { |
| 866 | − struct iwl_rxon_context *ctx; | |
| 867 | 866 | bool bt_full_concurrent; |
| 868 | 867 | u8 bt_ci_compliance; |
| 869 | 868 | u8 bt_load; |
| @@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) · 2 unmodified lines | ||
| 872 | 871 | |
| 873 | 872 | lockdep_assert_held(&priv->mutex); |
| 874 | 873 | |
| 875 | − for_each_context(priv, ctx) | |
| 876 | − ctx->vif = NULL; | |
| 877 | 874 | priv->is_open = 0; |
| 878 | 875 | |
| 879 | 876 | /* |
| @@ -104,15 +104,29 @@ · 103 unmodified lines | ||
| 104 | 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 |
| 105 | 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte |
| 106 | 106 | * aligned (address bits 0-7 must be 0). |
| 107 | + * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | |
| 108 | + * for them are in different places. | |
| 107 | 109 | * |
| 108 | 110 | * Bit fields in each pointer register: |
| 109 | 111 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned |
| 110 | 112 | */ |
| 111 | −#define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | |
| 112 | −#define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | |
| 113 | − | |
| 114 | −/* Find TFD CB base pointer for given queue (range 0-15). */ | |
| 115 | −#define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | |
| 113 | +#define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | |
| 114 | +#define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | |
| 115 | +#define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | |
| 116 | +#define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) | |
| 117 | +#define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) | |
| 118 | +#define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | |
| 119 | + | |
| 120 | +/* Find TFD CB base pointer for given queue */ | |
| 121 | +static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | |
| 122 | +{ | |
| 123 | + if (chnl < 16) | |
| 124 | + return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | |
| 125 | + if (chnl < 20) | |
| 126 | + return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | |
| 127 | + WARN_ON_ONCE(chnl >= 32); | |
| 128 | + return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | |
| 129 | +} | |
| 116 | 130 | |
| 117 | 131 | |
| 118 | 132 | /** |
| @@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, · 1243 unmodified lines | ||
| 1244 | 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; |
| 1245 | 1245 | int err; |
| 1246 | 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
| 1247 | + bool reset = false; | |
| 1247 | 1248 | |
| 1248 | 1249 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
| 1249 | 1250 | viftype, vif->addr); |
| @@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, · 15 unmodified lines | ||
| 1265 | 1266 | tmp->interface_modes | tmp->exclusive_interface_modes; |
| 1266 | 1267 | |
| 1267 | 1268 | if (tmp->vif) { |
| 1269 | + /* On reset we need to add the same interface again */ | |
| 1270 | + if (tmp->vif == vif) { | |
| 1271 | + reset = true; | |
| 1272 | + ctx = tmp; | |
| 1273 | + break; | |
| 1274 | + } | |
| 1275 | + | |
| 1268 | 1276 | /* check if this busy context is exclusive */ |
| 1269 | 1277 | if (tmp->exclusive_interface_modes & |
| 1270 | 1278 | BIT(tmp->vif->type)) { |
| @@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, · 20 unmodified lines | ||
| 1291 | 1299 | ctx->vif = vif; |
| 1292 | 1300 | |
| 1293 | 1301 | err = iwl_setup_interface(priv, ctx); |
| 1294 | − if (!err) | |
| 1302 | + if (!err || reset) | |
| 1295 | 1303 | goto out; |
| 1296 | 1304 | |
| 1297 | 1305 | ctx->vif = NULL; |
| @@ -223,12 +223,33 @@ · 222 unmodified lines | ||
| 223 | 223 | #define SCD_AIT (SCD_BASE + 0x0c) |
| 224 | 224 | #define SCD_TXFACT (SCD_BASE + 0x10) |
| 225 | 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) |
| 226 | −#define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | |
| 227 | −#define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | |
| 228 | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
| 229 | 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
| 230 | 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
| 231 | −#define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | |
| 229 | + | |
| 230 | +static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | |
| 231 | +{ | |
| 232 | + if (chnl < 20) | |
| 233 | + return SCD_BASE + 0x18 + chnl * 4; | |
| 234 | + WARN_ON_ONCE(chnl >= 32); | |
| 235 | + return SCD_BASE + 0x284 + (chnl - 20) * 4; | |
| 236 | +} | |
| 237 | + | |
| 238 | +static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | |
| 239 | +{ | |
| 240 | + if (chnl < 20) | |
| 241 | + return SCD_BASE + 0x68 + chnl * 4; | |
| 242 | + WARN_ON_ONCE(chnl >= 32); | |
| 243 | + return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | |
| 244 | +} | |
| 245 | + | |
| 246 | +static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | |
| 247 | +{ | |
| 248 | + if (chnl < 20) | |
| 249 | + return SCD_BASE + 0x10c + chnl * 4; | |
| 250 | + WARN_ON_ONCE(chnl >= 32); | |
| 251 | + return SCD_BASE + 0x384 + (chnl - 20) * 4; | |
| 252 | +} | |
| 232 | 253 | |
| 233 | 254 | /*********************** END TX SCHEDULER *************************************/ |
| 234 | 255 | |
| @@ -1941,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) · 1940 unmodified lines | ||
| 1941 | 1941 | rtl_deinit_deferred_work(hw); |
| 1942 | 1942 | rtlpriv->intf_ops->adapter_stop(hw); |
| 1943 | 1943 | } |
| 1944 | + rtlpriv->cfg->ops->disable_interrupt(hw); | |
| 1944 | 1945 | |
| 1945 | 1946 | /*deinit rfkill */ |
| 1946 | 1947 | rtl_deinit_rfkill(hw); |
| @@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) · 478 unmodified lines | ||
| 479 | 479 | cancel_work_sync(&wl->irq_work); |
| 480 | 480 | cancel_work_sync(&wl->tx_work); |
| 481 | 481 | cancel_work_sync(&wl->filter_work); |
| 482 | + cancel_delayed_work_sync(&wl->elp_work); | |
| 482 | 483 | |
| 483 | 484 | mutex_lock(&wl->mutex); |
| 484 | 485 | |
| @@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) · 314 unmodified lines | ||
| 315 | 315 | |
| 316 | 316 | if (wl->irq) |
| 317 | 317 | free_irq(wl->irq, wl); |
| 318 | − kfree(wl_sdio); | |
| 319 | 318 | wl1251_free_hw(wl); |
| 319 | + kfree(wl_sdio); | |
| 320 | 320 | |
| 321 | 321 | sdio_claim_host(func); |
| 322 | 322 | sdio_release_irq(func); |
| @@ -1672,7 +1672,8 @@ static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd) · 1671 unmodified lines | ||
| 1672 | 1672 | { |
| 1673 | 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); |
| 1674 | 1674 | |
| 1675 | − if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && prcd[76] == 0xF5) { | |
| 1675 | + if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && | |
| 1676 | + (prcd[76] == 0xF5 || prcd[76] == 0xF6)) { | |
| 1676 | 1677 | card->info.blkt.time_total = 250; |
| 1677 | 1678 | card->info.blkt.inter_packet = 5; |
| 1678 | 1679 | card->info.blkt.inter_packet_jumbo = 15; |
| @@ -4540,7 +4541,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) · 2861 unmodified lines | ||
| 4540 | 4541 | goto out_offline; |
| 4541 | 4542 | } |
| 4542 | 4543 | qeth_configure_unitaddr(card, prcd); |
| 4543 | − qeth_configure_blkt_default(card, prcd); | |
| 4544 | + if (ddev_offline) | |
| 4545 | + qeth_configure_blkt_default(card, prcd); | |
| 4544 | 4546 | kfree(prcd); |
| 4545 | 4547 | |
| 4546 | 4548 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); |
| @@ -104,9 +104,18 @@ struct bridge_skb_cb { · 103 unmodified lines | ||
| 104 | 104 | } daddr; |
| 105 | 105 | }; |
| 106 | 106 | |
| 107 | +static inline void br_drop_fake_rtable(struct sk_buff *skb) | |
| 108 | +{ | |
| 109 | + struct dst_entry *dst = skb_dst(skb); | |
| 110 | + | |
| 111 | + if (dst && (dst->flags & DST_FAKE_RTABLE)) | |
| 112 | + skb_dst_drop(skb); | |
| 113 | +} | |
| 114 | + | |
| 107 | 115 | #else |
| 108 | 116 | #define nf_bridge_maybe_copy_header(skb) (0) |
| 109 | 117 | #define nf_bridge_pad(skb) (0) |
| 118 | +#define br_drop_fake_rtable(skb) do { } while (0) | |
| 110 | 119 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
| 111 | 120 | |
| 112 | 121 | #endif /* __KERNEL__ */ |
| @@ -1020,7 +1020,7 @@ static inline void skb_queue_splice(const struct sk_buff_head *list, · 1019 unmodified lines | ||
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | /** |
| 1023 | − * skb_queue_splice - join two skb lists and reinitialise the emptied list | |
| 1023 | + * skb_queue_splice_init - join two skb lists and reinitialise the emptied list | |
| 1024 | 1024 | * @list: the new list to add |
| 1025 | 1025 | * @head: the place to add it in the first list |
| 1026 | 1026 | * |
| @@ -1051,7 +1051,7 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list, · 24 unmodified lines | ||
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
| 1054 | − * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list | |
| 1054 | + * skb_queue_splice_tail_init - join two skb lists and reinitialise the emptied list | |
| 1055 | 1055 | * @list: the new list to add |
| 1056 | 1056 | * @head: the place to add it in the first list |
| 1057 | 1057 | * |
| @@ -314,6 +314,7 @@ struct hci_conn { · 313 unmodified lines | ||
| 314 | 314 | |
| 315 | 315 | __u8 remote_cap; |
| 316 | 316 | __u8 remote_auth; |
| 317 | + bool flush_key; | |
| 317 | 318 | |
| 318 | 319 | unsigned int sent; |
| 319 | 320 | |
| @@ -980,7 +981,7 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); · 660 unmodified lines | ||
| 980 | 981 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
| 981 | 982 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
| 982 | 983 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
| 983 | − u8 persistent); | |
| 984 | + bool persistent); | |
| 984 | 985 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
| 985 | 986 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
| 986 | 987 | u8 *dev_class); |
| @@ -59,6 +59,7 @@ struct dst_entry { · 58 unmodified lines | ||
| 59 | 59 | #define DST_NOCACHE 0x0010 |
| 60 | 60 | #define DST_NOCOUNT 0x0020 |
| 61 | 61 | #define DST_NOPEER 0x0040 |
| 62 | +#define DST_FAKE_RTABLE 0x0080 | |
| 62 | 63 | |
| 63 | 64 | short error; |
| 64 | 65 | short obsolete; |
| @@ -393,7 +393,7 @@ struct ip_vs_protocol { · 392 unmodified lines | ||
| 393 | 393 | |
| 394 | 394 | void (*exit)(struct ip_vs_protocol *pp); |
| 395 | 395 | |
| 396 | − void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); | |
| 396 | + int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); | |
| 397 | 397 | |
| 398 | 398 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); |
| 399 | 399 | |
| @@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, · 803 unmodified lines | ||
| 1203 | 1203 | |
| 1204 | 1204 | extern int ip_vs_use_count_inc(void); |
| 1205 | 1205 | extern void ip_vs_use_count_dec(void); |
| 1206 | +extern int ip_vs_register_nl_ioctl(void); | |
| 1207 | +extern void ip_vs_unregister_nl_ioctl(void); | |
| 1206 | 1208 | extern int ip_vs_control_init(void); |
| 1207 | 1209 | extern void ip_vs_control_cleanup(void); |
| 1208 | 1210 | extern struct ip_vs_dest * |
| @@ -1129,9 +1129,9 @@ sk_sockets_allocated_read_positive(struct sock *sk) · 1128 unmodified lines | ||
| 1129 | 1129 | struct proto *prot = sk->sk_prot; |
| 1130 | 1130 | |
| 1131 | 1131 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) |
| 1132 | − return percpu_counter_sum_positive(sk->sk_cgrp->sockets_allocated); | |
| 1132 | + return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); | |
| 1133 | 1133 | |
| 1134 | − return percpu_counter_sum_positive(prot->sockets_allocated); | |
| 1134 | + return percpu_counter_read_positive(prot->sockets_allocated); | |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | static inline int |
| @@ -1215,40 +1215,40 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) · 1214 unmodified lines | ||
| 1215 | 1215 | return NULL; |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | −static int hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | |
| 1218 | +static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | |
| 1219 | 1219 | u8 key_type, u8 old_key_type) |
| 1220 | 1220 | { |
| 1221 | 1221 | /* Legacy key */ |
| 1222 | 1222 | if (key_type < 0x03) |
| 1223 | − return 1; | |
| 1223 | + return true; | |
| 1224 | 1224 | |
| 1225 | 1225 | /* Debug keys are insecure so don't store them persistently */ |
| 1226 | 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) |
| 1227 | − return 0; | |
| 1227 | + return false; | |
| 1228 | 1228 | |
| 1229 | 1229 | /* Changed combination key and there's no previous one */ |
| 1230 | 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) |
| 1231 | − return 0; | |
| 1231 | + return false; | |
| 1232 | 1232 | |
| 1233 | 1233 | /* Security mode 3 case */ |
| 1234 | 1234 | if (!conn) |
| 1235 | − return 1; | |
| 1235 | + return true; | |
| 1236 | 1236 | |
| 1237 | 1237 | /* Neither local nor remote side had no-bonding as requirement */ |
| 1238 | 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) |
| 1239 | − return 1; | |
| 1239 | + return true; | |
| 1240 | 1240 | |
| 1241 | 1241 | /* Local side had dedicated bonding as requirement */ |
| 1242 | 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) |
| 1243 | − return 1; | |
| 1243 | + return true; | |
| 1244 | 1244 | |
| 1245 | 1245 | /* Remote side had dedicated bonding as requirement */ |
| 1246 | 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) |
| 1247 | − return 1; | |
| 1247 | + return true; | |
| 1248 | 1248 | |
| 1249 | 1249 | /* If none of the above criteria match, then don't store the key |
| 1250 | 1250 | * persistently */ |
| 1251 | − return 0; | |
| 1251 | + return false; | |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) |
| @@ -1285,7 +1285,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, · 30 unmodified lines | ||
| 1285 | 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) |
| 1286 | 1286 | { |
| 1287 | 1287 | struct link_key *key, *old_key; |
| 1288 | − u8 old_key_type, persistent; | |
| 1288 | + u8 old_key_type; | |
| 1289 | + bool persistent; | |
| 1289 | 1290 | |
| 1290 | 1291 | old_key = hci_find_link_key(hdev, bdaddr); |
| 1291 | 1292 | if (old_key) { |
| @@ -1328,10 +1329,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, · 36 unmodified lines | ||
| 1328 | 1329 | |
| 1329 | 1330 | mgmt_new_link_key(hdev, key, persistent); |
| 1330 | 1331 | |
| 1331 | − if (!persistent) { | |
| 1332 | − list_del(&key->list); | |
| 1333 | − kfree(key); | |
| 1334 | − } | |
| 1332 | + if (conn) | |
| 1333 | + conn->flush_key = !persistent; | |
| 1335 | 1334 | |
| 1336 | 1335 | return 0; |
| 1337 | 1336 | } |
| @@ -1901,6 +1901,8 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff · 1900 unmodified lines | ||
| 1901 | 1901 | } |
| 1902 | 1902 | |
| 1903 | 1903 | if (ev->status == 0) { |
| 1904 | + if (conn->type == ACL_LINK && conn->flush_key) | |
| 1905 | + hci_remove_link_key(hdev, &conn->dst); | |
| 1904 | 1906 | hci_proto_disconn_cfm(conn, ev->reason); |
| 1905 | 1907 | hci_conn_del(conn); |
| 1906 | 1908 | } |
| @@ -2311,6 +2313,7 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk · 404 unmodified lines | ||
| 2311 | 2313 | |
| 2312 | 2314 | case HCI_OP_USER_PASSKEY_NEG_REPLY: |
| 2313 | 2315 | hci_cc_user_passkey_neg_reply(hdev, skb); |
| 2316 | + break; | |
| 2314 | 2317 | |
| 2315 | 2318 | case HCI_OP_LE_SET_SCAN_PARAM: |
| 2316 | 2319 | hci_cc_le_set_scan_param(hdev, skb); |
| @@ -2884,7 +2884,7 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status) · 2883 unmodified lines | ||
| 2884 | 2884 | return 0; |
| 2885 | 2885 | } |
| 2886 | 2886 | |
| 2887 | −int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, u8 persistent) | |
| 2887 | +int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, bool persistent) | |
| 2888 | 2888 | { |
| 2889 | 2889 | struct mgmt_ev_new_link_key ev; |
| 2890 | 2890 | |
| @@ -47,6 +47,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb) · 46 unmodified lines | ||
| 47 | 47 | kfree_skb(skb); |
| 48 | 48 | } else { |
| 49 | 49 | skb_push(skb, ETH_HLEN); |
| 50 | + br_drop_fake_rtable(skb); | |
| 50 | 51 | dev_queue_xmit(skb); |
| 51 | 52 | } |
| 52 | 53 | |
| @@ -156,7 +156,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) · 155 unmodified lines | ||
| 156 | 156 | rt->dst.dev = br->dev; |
| 157 | 157 | rt->dst.path = &rt->dst; |
| 158 | 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
| 159 | − rt->dst.flags = DST_NOXFRM | DST_NOPEER; | |
| 159 | + rt->dst.flags = DST_NOXFRM | DST_NOPEER | DST_FAKE_RTABLE; | |
| 160 | 160 | rt->dst.ops = &fake_dst_ops; |
| 161 | 161 | } |
| 162 | 162 | |
| @@ -694,11 +694,7 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, · 531 unmodified lines | ||
| 694 | 694 | const struct net_device *out, |
| 695 | 695 | int (*okfn)(struct sk_buff *)) |
| 696 | 696 | { |
| 697 | − struct rtable *rt = skb_rtable(skb); | |
| 698 | − | |
| 699 | − if (rt && rt == bridge_parent_rtable(in)) | |
| 700 | − skb_dst_drop(skb); | |
| 701 | − | |
| 697 | + br_drop_fake_rtable(skb); | |
| 702 | 698 | return NF_ACCEPT; |
| 703 | 699 | } |
| 704 | 700 | |
| @@ -42,13 +42,14 @@ static void send_dm_alert(struct work_struct *unused); · 41 unmodified lines | ||
| 42 | 42 | * netlink alerts |
| 43 | 43 | */ |
| 44 | 44 | static int trace_state = TRACE_OFF; |
| 45 | −static DEFINE_SPINLOCK(trace_state_lock); | |
| 45 | +static DEFINE_MUTEX(trace_state_mutex); | |
| 46 | 46 | |
| 47 | 47 | struct per_cpu_dm_data { |
| 48 | 48 | struct work_struct dm_alert_work; |
| 49 | − struct sk_buff *skb; | |
| 49 | + struct sk_buff __rcu *skb; | |
| 50 | 50 | atomic_t dm_hit_count; |
| 51 | 51 | struct timer_list send_timer; |
| 52 | + int cpu; | |
| 52 | 53 | }; |
| 53 | 54 | |
| 54 | 55 | struct dm_hw_stat_delta { |
| @@ -79,29 +80,53 @@ static void reset_per_cpu_data(struct per_cpu_dm_data *data) · 24 unmodified lines | ||
| 79 | 80 | size_t al; |
| 80 | 81 | struct net_dm_alert_msg *msg; |
| 81 | 82 | struct nlattr *nla; |
| 83 | + struct sk_buff *skb; | |
| 84 | + struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1); | |
| 82 | 85 | |
| 83 | 86 | al = sizeof(struct net_dm_alert_msg); |
| 84 | 87 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
| 85 | 88 | al += sizeof(struct nlattr); |
| 86 | 89 | |
| 87 | − data->skb = genlmsg_new(al, GFP_KERNEL); | |
| 88 | − genlmsg_put(data->skb, 0, 0, &net_drop_monitor_family, | |
| 89 | − 0, NET_DM_CMD_ALERT); | |
| 90 | − nla = nla_reserve(data->skb, NLA_UNSPEC, sizeof(struct net_dm_alert_msg)); | |
| 91 | − msg = nla_data(nla); | |
| 92 | − memset(msg, 0, al); | |
| 93 | − atomic_set(&data->dm_hit_count, dm_hit_limit); | |
| 90 | + skb = genlmsg_new(al, GFP_KERNEL); | |
| 91 | + | |
| 92 | + if (skb) { | |
| 93 | + genlmsg_put(skb, 0, 0, &net_drop_monitor_family, | |
| 94 | + 0, NET_DM_CMD_ALERT); | |
| 95 | + nla = nla_reserve(skb, NLA_UNSPEC, | |
| 96 | + sizeof(struct net_dm_alert_msg)); | |
| 97 | + msg = nla_data(nla); | |
| 98 | + memset(msg, 0, al); | |
| 99 | + } else | |
| 100 | + schedule_work_on(data->cpu, &data->dm_alert_work); | |
| 101 | + | |
| 102 | + /* | |
| 103 | + * Don't need to lock this, since we are guaranteed to only | |
| 104 | + * run this on a single cpu at a time. | |
| 105 | + * Note also that we only update data->skb if the old and new skb | |
| 106 | + * pointers don't match. This ensures that we don't continually call | |
| 107 | + * synchornize_rcu if we repeatedly fail to alloc a new netlink message. | |
| 108 | + */ | |
| 109 | + if (skb != oskb) { | |
| 110 | + rcu_assign_pointer(data->skb, skb); | |
| 111 | + | |
| 112 | + synchronize_rcu(); | |
| 113 | + | |
| 114 | + atomic_set(&data->dm_hit_count, dm_hit_limit); | |
| 115 | + } | |
| 116 | + | |
| 94 | 117 | } |
| 95 | 118 | |
| 96 | 119 | static void send_dm_alert(struct work_struct *unused) |
| 97 | 120 | { |
| 98 | 121 | struct sk_buff *skb; |
| 99 | − struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | |
| 122 | + struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | |
| 123 | + | |
| 124 | + WARN_ON_ONCE(data->cpu != smp_processor_id()); | |
| 100 | 125 | |
| 101 | 126 | /* |
| 102 | 127 | * Grab the skb we're about to send |
| 103 | 128 | */ |
| 104 | − skb = data->skb; | |
| 129 | + skb = rcu_dereference_protected(data->skb, 1); | |
| 105 | 130 | |
| 106 | 131 | /* |
| 107 | 132 | * Replace it with a new one |
| @@ -111,8 +136,10 @@ static void send_dm_alert(struct work_struct *unused) · 3 unmodified lines | ||
| 111 | 136 | /* |
| 112 | 137 | * Ship it! |
| 113 | 138 | */ |
| 114 | − genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | |
| 139 | + if (skb) | |
| 140 | + genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | |
| 115 | 141 | |
| 142 | + put_cpu_var(dm_cpu_data); | |
| 116 | 143 | } |
| 117 | 144 | |
| 118 | 145 | /* |
| @@ -123,9 +150,11 @@ static void send_dm_alert(struct work_struct *unused) · 4 unmodified lines | ||
| 123 | 150 | */ |
| 124 | 151 | static void sched_send_work(unsigned long unused) |
| 125 | 152 | { |
| 126 | − struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | |
| 153 | + struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | |
| 154 | + | |
| 155 | + schedule_work_on(smp_processor_id(), &data->dm_alert_work); | |
| 127 | 156 | |
| 128 | − schedule_work(&data->dm_alert_work); | |
| 157 | + put_cpu_var(dm_cpu_data); | |
| 129 | 158 | } |
| 130 | 159 | |
| 131 | 160 | static void trace_drop_common(struct sk_buff *skb, void *location) |
| @@ -134,8 +163,15 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 2 unmodified lines | ||
| 134 | 163 | struct nlmsghdr *nlh; |
| 135 | 164 | struct nlattr *nla; |
| 136 | 165 | int i; |
| 137 | − struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | |
| 166 | + struct sk_buff *dskb; | |
| 167 | + struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | |
| 168 | + | |
| 169 | + | |
| 170 | + rcu_read_lock(); | |
| 171 | + dskb = rcu_dereference(data->skb); | |
| 138 | 172 | |
| 173 | + if (!dskb) | |
| 174 | + goto out; | |
| 139 | 175 | |
| 140 | 176 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { |
| 141 | 177 | /* |
| @@ -144,7 +180,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 2 unmodified lines | ||
| 144 | 180 | goto out; |
| 145 | 181 | } |
| 146 | 182 | |
| 147 | − nlh = (struct nlmsghdr *)data->skb->data; | |
| 183 | + nlh = (struct nlmsghdr *)dskb->data; | |
| 148 | 184 | nla = genlmsg_data(nlmsg_data(nlh)); |
| 149 | 185 | msg = nla_data(nla); |
| 150 | 186 | for (i = 0; i < msg->entries; i++) { |
| @@ -158,7 +194,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 7 unmodified lines | ||
| 158 | 194 | /* |
| 159 | 195 | * We need to create a new entry |
| 160 | 196 | */ |
| 161 | − __nla_reserve_nohdr(data->skb, sizeof(struct net_dm_drop_point)); | |
| 197 | + __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); | |
| 162 | 198 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); |
| 163 | 199 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); |
| 164 | 200 | msg->points[msg->entries].count = 1; |
| @@ -170,6 +206,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) · 5 unmodified lines | ||
| 170 | 206 | } |
| 171 | 207 | |
| 172 | 208 | out: |
| 209 | + rcu_read_unlock(); | |
| 210 | + put_cpu_var(dm_cpu_data); | |
| 173 | 211 | return; |
| 174 | 212 | } |
| 175 | 213 | |
| @@ -214,7 +252,7 @@ static int set_all_monitor_traces(int state) · 38 unmodified lines | ||
| 214 | 252 | struct dm_hw_stat_delta *new_stat = NULL; |
| 215 | 253 | struct dm_hw_stat_delta *temp; |
| 216 | 254 | |
| 217 | − spin_lock(&trace_state_lock); | |
| 255 | + mutex_lock(&trace_state_mutex); | |
| 218 | 256 | |
| 219 | 257 | if (state == trace_state) { |
| 220 | 258 | rc = -EAGAIN; |
| @@ -253,7 +291,7 @@ static int set_all_monitor_traces(int state) · 32 unmodified lines | ||
| 253 | 291 | rc = -EINPROGRESS; |
| 254 | 292 | |
| 255 | 293 | out_unlock: |
| 256 | − spin_unlock(&trace_state_lock); | |
| 294 | + mutex_unlock(&trace_state_mutex); | |
| 257 | 295 | |
| 258 | 296 | return rc; |
| 259 | 297 | } |
| @@ -296,12 +334,12 @@ static int dropmon_net_event(struct notifier_block *ev_block, · 36 unmodified lines | ||
| 296 | 334 | |
| 297 | 335 | new_stat->dev = dev; |
| 298 | 336 | new_stat->last_rx = jiffies; |
| 299 | − spin_lock(&trace_state_lock); | |
| 337 | + mutex_lock(&trace_state_mutex); | |
| 300 | 338 | list_add_rcu(&new_stat->list, &hw_stats_list); |
| 301 | − spin_unlock(&trace_state_lock); | |
| 339 | + mutex_unlock(&trace_state_mutex); | |
| 302 | 340 | break; |
| 303 | 341 | case NETDEV_UNREGISTER: |
| 304 | − spin_lock(&trace_state_lock); | |
| 342 | + mutex_lock(&trace_state_mutex); | |
| 305 | 343 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
| 306 | 344 | if (new_stat->dev == dev) { |
| 307 | 345 | new_stat->dev = NULL; |
| @@ -312,7 +350,7 @@ static int dropmon_net_event(struct notifier_block *ev_block, · 4 unmodified lines | ||
| 312 | 350 | } |
| 313 | 351 | } |
| 314 | 352 | } |
| 315 | − spin_unlock(&trace_state_lock); | |
| 353 | + mutex_unlock(&trace_state_mutex); | |
| 316 | 354 | break; |
| 317 | 355 | } |
| 318 | 356 | out: |
| @@ -368,13 +406,15 @@ static int __init init_net_drop_monitor(void) · 49 unmodified lines | ||
| 368 | 406 | |
| 369 | 407 | for_each_present_cpu(cpu) { |
| 370 | 408 | data = &per_cpu(dm_cpu_data, cpu); |
| 371 | − reset_per_cpu_data(data); | |
| 409 | + data->cpu = cpu; | |
| 372 | 410 | INIT_WORK(&data->dm_alert_work, send_dm_alert); |
| 373 | 411 | init_timer(&data->send_timer); |
| 374 | 412 | data->send_timer.data = cpu; |
| 375 | 413 | data->send_timer.function = sched_send_work; |
| 414 | + reset_per_cpu_data(data); | |
| 376 | 415 | } |
| 377 | 416 | |
| 417 | + | |
| 378 | 418 | goto out; |
| 379 | 419 | |
| 380 | 420 | out_unreg: |
| @@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) · 1043 unmodified lines | ||
| 1044 | 1044 | free_netdev(dev); |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | +static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | |
| 1048 | +{ | |
| 1049 | + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | |
| 1050 | + return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | |
| 1051 | +} | |
| 1052 | + | |
| 1053 | +static u16 lowpan_get_pan_id(const struct net_device *dev) | |
| 1054 | +{ | |
| 1055 | + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | |
| 1056 | + return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | |
| 1057 | +} | |
| 1058 | + | |
| 1059 | +static u16 lowpan_get_short_addr(const struct net_device *dev) | |
| 1060 | +{ | |
| 1061 | + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | |
| 1062 | + return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | |
| 1063 | +} | |
| 1064 | + | |
| 1047 | 1065 | static struct header_ops lowpan_header_ops = { |
| 1048 | 1066 | .create = lowpan_header_create, |
| 1049 | 1067 | }; |
| @@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { · 3 unmodified lines | ||
| 1053 | 1071 | .ndo_set_mac_address = eth_mac_addr, |
| 1054 | 1072 | }; |
| 1055 | 1073 | |
| 1074 | +static struct ieee802154_mlme_ops lowpan_mlme = { | |
| 1075 | + .get_pan_id = lowpan_get_pan_id, | |
| 1076 | + .get_phy = lowpan_get_phy, | |
| 1077 | + .get_short_addr = lowpan_get_short_addr, | |
| 1078 | +}; | |
| 1079 | + | |
| 1056 | 1080 | static void lowpan_setup(struct net_device *dev) |
| 1057 | 1081 | { |
| 1058 | 1082 | pr_debug("(%s)\n", __func__); |
| @@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) · 11 unmodified lines | ||
| 1070 | 1094 | |
| 1071 | 1095 | dev->netdev_ops = &lowpan_netdev_ops; |
| 1072 | 1096 | dev->header_ops = &lowpan_header_ops; |
| 1097 | + dev->ml_priv = &lowpan_mlme; | |
| 1073 | 1098 | dev->destructor = lowpan_dev_free; |
| 1074 | 1099 | } |
| 1075 | 1100 | |
| @@ -1143,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, · 67 unmodified lines | ||
| 1143 | 1168 | list_add_tail(&entry->list, &lowpan_devices); |
| 1144 | 1169 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1145 | 1170 | |
| 1171 | + spin_lock_init(&flist_lock); | |
| 1172 | + | |
| 1146 | 1173 | register_netdevice(dev); |
| 1147 | 1174 | |
| 1148 | 1175 | return 0; |
| @@ -1152,11 +1179,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head) · 3 unmodified lines | ||
| 1152 | 1179 | { |
| 1153 | 1180 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); |
| 1154 | 1181 | struct net_device *real_dev = lowpan_dev->real_dev; |
| 1155 | − struct lowpan_dev_record *entry; | |
| 1156 | − struct lowpan_dev_record *tmp; | |
| 1182 | + struct lowpan_dev_record *entry, *tmp; | |
| 1183 | + struct lowpan_fragment *frame, *tframe; | |
| 1157 | 1184 | |
| 1158 | 1185 | ASSERT_RTNL(); |
| 1159 | 1186 | |
| 1187 | + spin_lock(&flist_lock); | |
| 1188 | + list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) { | |
| 1189 | + del_timer(&frame->timer); | |
| 1190 | + list_del(&frame->list); | |
| 1191 | + dev_kfree_skb(frame->skb); | |
| 1192 | + kfree(frame); | |
| 1193 | + } | |
| 1194 | + spin_unlock(&flist_lock); | |
| 1195 | + | |
| 1160 | 1196 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1161 | 1197 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { |
| 1162 | 1198 | if (entry->ldev == dev) { |
| @@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 140 unmodified lines | ||
| 141 | 141 | goto rtattr_failure; |
| 142 | 142 | |
| 143 | 143 | if (icsk == NULL) { |
| 144 | − r->idiag_rqueue = r->idiag_wqueue = 0; | |
| 144 | + handler->idiag_get_info(sk, r, NULL); | |
| 145 | 145 | goto out; |
| 146 | 146 | } |
| 147 | 147 | |
| @@ -3243,7 +3243,7 @@ void __init tcp_init(void) · 3242 unmodified lines | ||
| 3243 | 3243 | { |
| 3244 | 3244 | struct sk_buff *skb = NULL; |
| 3245 | 3245 | unsigned long limit; |
| 3246 | − int max_share, cnt; | |
| 3246 | + int max_rshare, max_wshare, cnt; | |
| 3247 | 3247 | unsigned int i; |
| 3248 | 3248 | unsigned long jiffy = jiffies; |
| 3249 | 3249 | |
| @@ -3303,15 +3303,16 @@ void __init tcp_init(void) · 53 unmodified lines | ||
| 3303 | 3303 | tcp_init_mem(&init_net); |
| 3304 | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
| 3305 | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
| 3306 | − max_share = min(4UL*1024*1024, limit); | |
| 3306 | + max_wshare = min(4UL*1024*1024, limit); | |
| 3307 | + max_rshare = min(6UL*1024*1024, limit); | |
| 3307 | 3308 | |
| 3308 | 3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
| 3309 | 3310 | sysctl_tcp_wmem[1] = 16*1024; |
| 3310 | − sysctl_tcp_wmem[2] = max(64*1024, max_share); | |
| 3311 | + sysctl_tcp_wmem[2] = max(64*1024, max_wshare); | |
| 3311 | 3312 | |
| 3312 | 3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; |
| 3313 | 3314 | sysctl_tcp_rmem[1] = 87380; |
| 3314 | − sysctl_tcp_rmem[2] = max(87380, max_share); | |
| 3315 | + sysctl_tcp_rmem[2] = max(87380, max_rshare); | |
| 3315 | 3316 | |
| 3316 | 3317 | pr_info("Hash tables configured (established %u bind %u)\n", |
| 3317 | 3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
| @@ -85,7 +85,7 @@ int sysctl_tcp_ecn __read_mostly = 2; · 84 unmodified lines | ||
| 85 | 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); |
| 86 | 86 | int sysctl_tcp_dsack __read_mostly = 1; |
| 87 | 87 | int sysctl_tcp_app_win __read_mostly = 31; |
| 88 | −int sysctl_tcp_adv_win_scale __read_mostly = 2; | |
| 88 | +int sysctl_tcp_adv_win_scale __read_mostly = 1; | |
| 89 | 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); |
| 90 | 90 | |
| 91 | 91 | int sysctl_tcp_stdurg __read_mostly; |
| @@ -495,7 +495,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) · 403 unmodified lines | ||
| 495 | 495 | goto new_measure; |
| 496 | 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
| 497 | 497 | return; |
| 498 | − tcp_rcv_rtt_update(tp, jiffies - tp->rcv_rtt_est.time, 1); | |
| 498 | + tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_rtt_est.time, 1); | |
| 499 | 499 | |
| 500 | 500 | new_measure: |
| 501 | 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; |
| @@ -2868,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk) · 2366 unmodified lines | ||
| 2868 | 2868 | |
| 2869 | 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ |
| 2870 | 2870 | if (tp->undo_marker) { |
| 2871 | − if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) | |
| 2871 | + if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { | |
| 2872 | 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); |
| 2873 | − else /* PRR */ | |
| 2873 | + tp->snd_cwnd_stamp = tcp_time_stamp; | |
| 2874 | + } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) { | |
| 2875 | + /* PRR algorithm. */ | |
| 2874 | 2876 | tp->snd_cwnd = tp->snd_ssthresh; |
| 2875 | − tp->snd_cwnd_stamp = tcp_time_stamp; | |
| 2877 | + tp->snd_cwnd_stamp = tcp_time_stamp; | |
| 2878 | + } | |
| 2876 | 2879 | } |
| 2877 | 2880 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); |
| 2878 | 2881 | } |
| @@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, · 145 unmodified lines | ||
| 146 | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | +static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | |
| 150 | + void *info) | |
| 151 | +{ | |
| 152 | + r->idiag_rqueue = sk_rmem_alloc_get(sk); | |
| 153 | + r->idiag_wqueue = sk_wmem_alloc_get(sk); | |
| 154 | +} | |
| 155 | + | |
| 149 | 156 | static const struct inet_diag_handler udp_diag_handler = { |
| 150 | 157 | .dump = udp_diag_dump, |
| 151 | 158 | .dump_one = udp_diag_dump_one, |
| 159 | + .idiag_get_info = udp_diag_get_info, | |
| 152 | 160 | .idiag_type = IPPROTO_UDP, |
| 153 | 161 | }; |
| 154 | 162 | |
| @@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr * · 12 unmodified lines | ||
| 167 | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
| 168 | 176 | .dump = udplite_diag_dump, |
| 169 | 177 | .dump_one = udplite_diag_dump_one, |
| 178 | + .idiag_get_info = udp_diag_get_info, | |
| 170 | 179 | .idiag_type = IPPROTO_UDPLITE, |
| 171 | 180 | }; |
| 172 | 181 | |
| @@ -442,8 +442,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m · 441 unmodified lines | ||
| 442 | 442 | |
| 443 | 443 | daddr = lip->l2tp_addr.s_addr; |
| 444 | 444 | } else { |
| 445 | + rc = -EDESTADDRREQ; | |
| 445 | 446 | if (sk->sk_state != TCP_ESTABLISHED) |
| 446 | − return -EDESTADDRREQ; | |
| 447 | + goto out; | |
| 447 | 448 | |
| 448 | 449 | daddr = inet->inet_daddr; |
| 449 | 450 | connected = 1; |
| @@ -1210,7 +1210,7 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, · 1209 unmodified lines | ||
| 1210 | 1210 | struct sk_buff *skb); |
| 1211 | 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); |
| 1212 | 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); |
| 1213 | −void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata); | |
| 1213 | +void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); | |
| 1214 | 1214 | |
| 1215 | 1215 | /* IBSS code */ |
| 1216 | 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
| @@ -486,6 +486,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, · 485 unmodified lines | ||
| 486 | 486 | /* free all potentially still buffered bcast frames */ |
| 487 | 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); |
| 488 | 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); |
| 489 | + } else if (sdata->vif.type == NL80211_IFTYPE_STATION) { | |
| 490 | + ieee80211_mgd_stop(sdata); | |
| 489 | 491 | } |
| 490 | 492 | |
| 491 | 493 | if (going_down) |
| @@ -644,8 +646,6 @@ static void ieee80211_teardown_sdata(struct net_device *dev) · 152 unmodified lines | ||
| 644 | 646 | |
| 645 | 647 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
| 646 | 648 | mesh_rmc_free(sdata); |
| 647 | − else if (sdata->vif.type == NL80211_IFTYPE_STATION) | |
| 648 | − ieee80211_mgd_teardown(sdata); | |
| 649 | 649 | |
| 650 | 650 | flushed = sta_info_flush(local, sdata); |
| 651 | 651 | WARN_ON(flushed); |
| @@ -3497,7 +3497,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, · 3496 unmodified lines | ||
| 3497 | 3497 | return 0; |
| 3498 | 3498 | } |
| 3499 | 3499 | |
| 3500 | −void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata) | |
| 3500 | +void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) | |
| 3501 | 3501 | { |
| 3502 | 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| 3503 | 3503 | |
| @@ -1158,7 +1158,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, · 1157 unmodified lines | ||
| 1158 | 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
| 1159 | 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) |
| 1160 | 1160 | return TX_DROP; |
| 1161 | − } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | |
| 1161 | + } else if (info->flags & IEEE80211_TX_CTL_INJECTED || | |
| 1162 | + tx->sdata->control_port_protocol == tx->skb->protocol) { | |
| 1162 | 1163 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); |
| 1163 | 1164 | } |
| 1164 | 1165 | if (!tx->sta) |
| @@ -1924,6 +1924,7 @@ protocol_fail: · 1923 unmodified lines | ||
| 1924 | 1924 | control_fail: |
| 1925 | 1925 | ip_vs_estimator_net_cleanup(net); |
| 1926 | 1926 | estimator_fail: |
| 1927 | + net->ipvs = NULL; | |
| 1927 | 1928 | return -ENOMEM; |
| 1928 | 1929 | } |
| 1929 | 1930 | |
| @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) · 6 unmodified lines | ||
| 1936 | 1937 | ip_vs_control_net_cleanup(net); |
| 1937 | 1938 | ip_vs_estimator_net_cleanup(net); |
| 1938 | 1939 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); |
| 1940 | + net->ipvs = NULL; | |
| 1939 | 1941 | } |
| 1940 | 1942 | |
| 1941 | 1943 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) |
| @@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) · 51 unmodified lines | ||
| 1993 | 1995 | goto cleanup_dev; |
| 1994 | 1996 | } |
| 1995 | 1997 | |
| 1998 | + ret = ip_vs_register_nl_ioctl(); | |
| 1999 | + if (ret < 0) { | |
| 2000 | + pr_err("can't register netlink/ioctl.\n"); | |
| 2001 | + goto cleanup_hooks; | |
| 2002 | + } | |
| 2003 | + | |
| 1996 | 2004 | pr_info("ipvs loaded.\n"); |
| 1997 | 2005 | |
| 1998 | 2006 | return ret; |
| 1999 | 2007 | |
| 2008 | +cleanup_hooks: | |
| 2009 | + nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | |
| 2000 | 2010 | cleanup_dev: |
| 2001 | 2011 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2002 | 2012 | cleanup_sub: |
| @@ -2012,6 +2022,7 @@ exit: · 9 unmodified lines | ||
| 2012 | 2022 | |
| 2013 | 2023 | static void __exit ip_vs_cleanup(void) |
| 2014 | 2024 | { |
| 2025 | + ip_vs_unregister_nl_ioctl(); | |
| 2015 | 2026 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); |
| 2016 | 2027 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2017 | 2028 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ |
| @@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) · 3679 unmodified lines | ||
| 3680 | 3680 | return 0; |
| 3681 | 3681 | } |
| 3682 | 3682 | |
| 3683 | −void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | |
| 3683 | +void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) | |
| 3684 | 3684 | { |
| 3685 | 3685 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 3686 | 3686 | |
| @@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) · 5 unmodified lines | ||
| 3692 | 3692 | #else |
| 3693 | 3693 | |
| 3694 | 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } |
| 3695 | −void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } | |
| 3695 | +void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } | |
| 3696 | 3696 | |
| 3697 | 3697 | #endif |
| 3698 | 3698 | |
| @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) · 51 unmodified lines | ||
| 3750 | 3750 | free_percpu(ipvs->tot_stats.cpustats); |
| 3751 | 3751 | } |
| 3752 | 3752 | |
| 3753 | −int __init ip_vs_control_init(void) | |
| 3753 | +int __init ip_vs_register_nl_ioctl(void) | |
| 3754 | 3754 | { |
| 3755 | − int idx; | |
| 3756 | 3755 | int ret; |
| 3757 | 3756 | |
| 3758 | − EnterFunction(2); | |
| 3759 | − | |
| 3760 | − /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | |
| 3761 | − for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | |
| 3762 | − INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | |
| 3763 | − INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | |
| 3764 | − } | |
| 3765 | − | |
| 3766 | − smp_wmb(); /* Do we really need it now ? */ | |
| 3767 | − | |
| 3768 | 3757 | ret = nf_register_sockopt(&ip_vs_sockopts); |
| 3769 | 3758 | if (ret) { |
| 3770 | 3759 | pr_err("cannot register sockopt.\n"); |
| @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) · 5 unmodified lines | ||
| 3776 | 3765 | pr_err("cannot register Generic Netlink interface.\n"); |
| 3777 | 3766 | goto err_genl; |
| 3778 | 3767 | } |
| 3779 | − | |
| 3780 | − ret = register_netdevice_notifier(&ip_vs_dst_notifier); | |
| 3781 | − if (ret < 0) | |
| 3782 | − goto err_notf; | |
| 3783 | − | |
| 3784 | − LeaveFunction(2); | |
| 3785 | 3768 | return 0; |
| 3786 | 3769 | |
| 3787 | −err_notf: | |
| 3788 | − ip_vs_genl_unregister(); | |
| 3789 | 3770 | err_genl: |
| 3790 | 3771 | nf_unregister_sockopt(&ip_vs_sockopts); |
| 3791 | 3772 | err_sock: |
| 3792 | 3773 | return ret; |
| 3793 | 3774 | } |
| 3794 | 3775 | |
| 3776 | +void ip_vs_unregister_nl_ioctl(void) | |
| 3777 | +{ | |
| 3778 | + ip_vs_genl_unregister(); | |
| 3779 | + nf_unregister_sockopt(&ip_vs_sockopts); | |
| 3780 | +} | |
| 3781 | + | |
| 3782 | +int __init ip_vs_control_init(void) | |
| 3783 | +{ | |
| 3784 | + int idx; | |
| 3785 | + int ret; | |
| 3786 | + | |
| 3787 | + EnterFunction(2); | |
| 3788 | + | |
| 3789 | + /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | |
| 3790 | + for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | |
| 3791 | + INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | |
| 3792 | + INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | |
| 3793 | + } | |
| 3794 | + | |
| 3795 | + smp_wmb(); /* Do we really need it now ? */ | |
| 3796 | + | |
| 3797 | + ret = register_netdevice_notifier(&ip_vs_dst_notifier); | |
| 3798 | + if (ret < 0) | |
| 3799 | + return ret; | |
| 3800 | + | |
| 3801 | + LeaveFunction(2); | |
| 3802 | + return 0; | |
| 3803 | +} | |
| 3804 | + | |
| 3795 | 3805 | |
| 3796 | 3806 | void ip_vs_control_cleanup(void) |
| 3797 | 3807 | { |
| 3798 | 3808 | EnterFunction(2); |
| 3799 | 3809 | unregister_netdevice_notifier(&ip_vs_dst_notifier); |
| 3800 | − ip_vs_genl_unregister(); | |
| 3801 | − nf_unregister_sockopt(&ip_vs_sockopts); | |
| 3802 | 3810 | LeaveFunction(2); |
| 3803 | 3811 | } |
| @@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) · 438 unmodified lines | ||
| 439 | 439 | struct ip_vs_app *app; |
| 440 | 440 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 441 | 441 | |
| 442 | + if (!ipvs) | |
| 443 | + return -ENOENT; | |
| 442 | 444 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); |
| 443 | 445 | if (!app) |
| 444 | 446 | return -ENOMEM; |
| @@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) · 550 unmodified lines | ||
| 551 | 551 | { |
| 552 | 552 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 553 | 553 | |
| 554 | + if (!ipvs) | |
| 555 | + return -ENOENT; | |
| 556 | + | |
| 554 | 557 | if (!net_eq(net, &init_net)) { |
| 555 | 558 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, |
| 556 | 559 | sizeof(vs_vars_table), |
| @@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) · 744 unmodified lines | ||
| 745 | 745 | { |
| 746 | 746 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 747 | 747 | |
| 748 | + if (!ipvs) | |
| 749 | + return -ENOENT; | |
| 750 | + | |
| 748 | 751 | if (!net_eq(net, &init_net)) { |
| 749 | 752 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, |
| 750 | 753 | sizeof(vs_vars_table), |
| @@ -59,9 +59,6 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp) · 58 unmodified lines | ||
| 59 | 59 | return 0; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | −#if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \ | |
| 63 | − defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \ | |
| 64 | − defined(CONFIG_IP_VS_PROTO_ESP) | |
| 65 | 62 | /* |
| 66 | 63 | * register an ipvs protocols netns related data |
| 67 | 64 | */ |
| @@ -81,12 +78,18 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp) · 13 unmodified lines | ||
| 81 | 78 | ipvs->proto_data_table[hash] = pd; |
| 82 | 79 | atomic_set(&pd->appcnt, 0); /* Init app counter */ |
| 83 | 80 | |
| 84 | − if (pp->init_netns != NULL) | |
| 85 | − pp->init_netns(net, pd); | |
| 81 | + if (pp->init_netns != NULL) { | |
| 82 | + int ret = pp->init_netns(net, pd); | |
| 83 | + if (ret) { | |
| 84 | + /* unlink an free proto data */ | |
| 85 | + ipvs->proto_data_table[hash] = pd->next; | |
| 86 | + kfree(pd); | |
| 87 | + return ret; | |
| 88 | + } | |
| 89 | + } | |
| 86 | 90 | |
| 87 | 91 | return 0; |
| 88 | 92 | } |
| 89 | −#endif | |
| 90 | 93 | |
| 91 | 94 | /* |
| 92 | 95 | * unregister an ipvs protocol |
| @@ -316,22 +319,35 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, · 223 unmodified lines | ||
| 316 | 319 | */ |
| 317 | 320 | int __net_init ip_vs_protocol_net_init(struct net *net) |
| 318 | 321 | { |
| 322 | + int i, ret; | |
| 323 | + static struct ip_vs_protocol *protos[] = { | |
| 319 | 324 | #ifdef CONFIG_IP_VS_PROTO_TCP |
| 320 | − register_ip_vs_proto_netns(net, &ip_vs_protocol_tcp); | |
| 325 | + &ip_vs_protocol_tcp, | |
| 321 | 326 | #endif |
| 322 | 327 | #ifdef CONFIG_IP_VS_PROTO_UDP |
| 323 | − register_ip_vs_proto_netns(net, &ip_vs_protocol_udp); | |
| 328 | + &ip_vs_protocol_udp, | |
| 324 | 329 | #endif |
| 325 | 330 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
| 326 | − register_ip_vs_proto_netns(net, &ip_vs_protocol_sctp); | |
| 331 | + &ip_vs_protocol_sctp, | |
| 327 | 332 | #endif |
| 328 | 333 | #ifdef CONFIG_IP_VS_PROTO_AH |
| 329 | − register_ip_vs_proto_netns(net, &ip_vs_protocol_ah); | |
| 334 | + &ip_vs_protocol_ah, | |
| 330 | 335 | #endif |
| 331 | 336 | #ifdef CONFIG_IP_VS_PROTO_ESP |
| 332 | − register_ip_vs_proto_netns(net, &ip_vs_protocol_esp); | |
| 337 | + &ip_vs_protocol_esp, | |
| 333 | 338 | #endif |
| 339 | + }; | |
| 340 | + | |
| 341 | + for (i = 0; i < ARRAY_SIZE(protos); i++) { | |
| 342 | + ret = register_ip_vs_proto_netns(net, protos[i]); | |
| 343 | + if (ret < 0) | |
| 344 | + goto cleanup; | |
| 345 | + } | |
| 334 | 346 | return 0; |
| 347 | + | |
| 348 | +cleanup: | |
| 349 | + ip_vs_protocol_net_cleanup(net); | |
| 350 | + return ret; | |
| 335 | 351 | } |
| 336 | 352 | |
| 337 | 353 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) |
| @@ -1090,7 +1090,7 @@ out: · 1089 unmodified lines | ||
| 1090 | 1090 | * timeouts is netns related now. |
| 1091 | 1091 | * --------------------------------------------- |
| 1092 | 1092 | */ |
| 1093 | −static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 1093 | +static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 1094 | 1094 | { |
| 1095 | 1095 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 1096 | 1096 | |
| @@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) · 1 unmodified line | ||
| 1098 | 1098 | spin_lock_init(&ipvs->sctp_app_lock); |
| 1099 | 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, |
| 1100 | 1100 | sizeof(sctp_timeouts)); |
| 1101 | + if (!pd->timeout_table) | |
| 1102 | + return -ENOMEM; | |
| 1103 | + return 0; | |
| 1101 | 1104 | } |
| 1102 | 1105 | |
| 1103 | 1106 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) |
| @@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp) · 676 unmodified lines | ||
| 677 | 677 | * timeouts is netns related now. |
| 678 | 678 | * --------------------------------------------- |
| 679 | 679 | */ |
| 680 | −static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 680 | +static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 681 | 681 | { |
| 682 | 682 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 683 | 683 | |
| @@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) · 1 unmodified line | ||
| 685 | 685 | spin_lock_init(&ipvs->tcp_app_lock); |
| 686 | 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, |
| 687 | 687 | sizeof(tcp_timeouts)); |
| 688 | + if (!pd->timeout_table) | |
| 689 | + return -ENOMEM; | |
| 688 | 690 | pd->tcp_state_table = tcp_states; |
| 691 | + return 0; | |
| 689 | 692 | } |
| 690 | 693 | |
| 691 | 694 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) |
| @@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction, · 466 unmodified lines | ||
| 467 | 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | −static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 470 | +static int __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |
| 471 | 471 | { |
| 472 | 472 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 473 | 473 | |
| @@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) · 1 unmodified line | ||
| 475 | 475 | spin_lock_init(&ipvs->udp_app_lock); |
| 476 | 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, |
| 477 | 477 | sizeof(udp_timeouts)); |
| 478 | + if (!pd->timeout_table) | |
| 479 | + return -ENOMEM; | |
| 480 | + return 0; | |
| 478 | 481 | } |
| 479 | 482 | |
| 480 | 483 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) |
| @@ -227,7 +227,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) · 226 unmodified lines | ||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
| 230 | − if (info->timeout) { | |
| 230 | + if (info->timeout[0]) { | |
| 231 | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
| 232 | 232 | struct nf_conn_timeout *timeout_ext; |
| 233 | 233 | |
| @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 407 unmodified lines | ||
| 408 | 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
| 409 | 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
| 410 | 410 | (skb->ip_summed == CHECKSUM_PARTIAL && |
| 411 | − skb_checksum_help(skb))) { | |
| 412 | − sch->qstats.drops++; | |
| 413 | − return NET_XMIT_DROP; | |
| 414 | − } | |
| 411 | + skb_checksum_help(skb))) | |
| 412 | + return qdisc_drop(skb, sch); | |
| 415 | 413 | |
| 416 | 414 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
| 417 | 415 | } |