Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (34 commits)
net/fsl_pq_mdio: add module license GPL
can: fix WARN_ON dump in net/core/rtnetlink.c:rtmsg_ifinfo()
can: should not use __dev_get_by_index() without locks
hisax: remove bad udelay call to fix build error on ARM
ipip: Fix handling of DF packets when pmtudisc is OFF
qlge: Set PCIe reset type for EEH to fundamental.
qlge: Fix early exit from mbox cmd complete wait.
ixgbe: fix traffic hangs on Tx with ioatdma loaded
ixgbe: Fix checking TFCS register for TXOFF status when DCB is enabled
ixgbe: Fix gso_max_size for 82599 when DCB is enabled
macsonic: fix crash on PowerBook 520
NET: cassini, fix lock imbalance
ems_usb: Fix byte order issues on big endian machines
be2net: Bug fix to send config commands to hardware after netdev_register
be2net: fix to set proper flow control on resume
netfilter: xt_connlimit: fix regression caused by zero family value
rt2x00: Don't queue ieee80211 work after USB removal
Revert "ipw2200: fix oops on missing firmware"
decnet: netdevice refcount leak
netfilter: nf_nat: fix NAT issue in 2.6.30.4+
...

+407 -237
+1
MAINTAINERS
··· 3665 3665 W: http://www.linuxfoundation.org/en/Net 3666 3666 W: http://patchwork.ozlabs.org/project/netdev/list/ 3667 3667 T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git 3668 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git 3668 3669 S: Maintained 3669 3670 F: net/ 3670 3671 F: include/net/
+3 -2
drivers/isdn/hardware/eicon/maintidi.c
··· 959 959 } 960 960 if (!strncmp("State\\Layer2 No1", path, pVar->path_length)) { 961 961 char* tmp = &pLib->lines[0].pInterface->Layer2[0]; 962 - dword l2_state; 963 - diva_strace_read_uint (pVar, &l2_state); 962 + dword l2_state; 963 + if (diva_strace_read_uint(pVar, &l2_state)) 964 + return -1; 964 965 965 966 switch (l2_state) { 966 967 case 0:
+9 -9
drivers/isdn/hardware/eicon/message.c
··· 2692 2692 if (!(fax_control_bits & T30_CONTROL_BIT_MORE_DOCUMENTS) 2693 2693 || (fax_feature_bits & T30_FEATURE_BIT_MORE_DOCUMENTS)) 2694 2694 { 2695 - len = (byte)(&(((T30_INFO *) 0)->universal_6)); 2695 + len = offsetof(T30_INFO, universal_6); 2696 2696 fax_info_change = false; 2697 2697 if (ncpi->length >= 4) 2698 2698 { ··· 2754 2754 for (i = 0; i < w; i++) 2755 2755 ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id[i] = fax_parms[4].info[1+i]; 2756 2756 ((T30_INFO *)(plci->fax_connect_info_buffer))->head_line_len = 0; 2757 - len = (byte)(((T30_INFO *) 0)->station_id + 20); 2757 + len = offsetof(T30_INFO, station_id) + 20; 2758 2758 w = fax_parms[5].length; 2759 2759 if (w > 20) 2760 2760 w = 20; ··· 2788 2788 } 2789 2789 else 2790 2790 { 2791 - len = (byte)(&(((T30_INFO *) 0)->universal_6)); 2791 + len = offsetof(T30_INFO, universal_6); 2792 2792 } 2793 2793 fax_info_change = true; 2794 2794 ··· 2892 2892 && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_ENABLE_NSF) 2893 2893 && (plci->nsf_control_bits & T30_NSF_CONTROL_BIT_NEGOTIATE_RESP)) 2894 2894 { 2895 - len = ((byte)(((T30_INFO *) 0)->station_id + 20)); 2895 + len = offsetof(T30_INFO, station_id) + 20; 2896 2896 if (plci->fax_connect_info_length < len) 2897 2897 { 2898 2898 ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; ··· 3802 3802 break; 3803 3803 } 3804 3804 ncpi = &m_parms[1]; 3805 - len = ((byte)(((T30_INFO *) 0)->station_id + 20)); 3805 + len = offsetof(T30_INFO, station_id) + 20; 3806 3806 if (plci->fax_connect_info_length < len) 3807 3807 { 3808 3808 ((T30_INFO *)(plci->fax_connect_info_buffer))->station_id_len = 0; ··· 6844 6844 if ((plci->requested_options_conn | plci->requested_options | a->requested_options_table[plci->appl->Id-1]) 6845 6845 & ((1L << PRIVATE_FAX_SUB_SEP_PWD) | (1L << PRIVATE_FAX_NONSTANDARD))) 6846 6846 { 6847 - i = ((word)(((T30_INFO *) 0)->station_id + 20)) + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; 6847 + i = offsetof(T30_INFO, station_id) + 20 + ((T30_INFO *)plci->NL.RBuffer->P)->head_line_len; 6848 6848 while (i < plci->NL.RBuffer->length) 6849 6849 plci->ncpi_buffer[++len] = plci->NL.RBuffer->P[i++]; 6850 6850 } ··· 7236 7236 { 7237 7237 plci->RData[1].P = plci->RData[0].P; 7238 7238 plci->RData[1].PLength = plci->RData[0].PLength; 7239 - plci->RData[0].P = v120_header_buffer + (-((int) v120_header_buffer) & 3); 7239 + plci->RData[0].P = v120_header_buffer + (-((unsigned long)v120_header_buffer) & 3); 7240 7240 if ((plci->NL.RBuffer->P[0] & V120_HEADER_EXTEND_BIT) || (plci->NL.RLength == 1)) 7241 7241 plci->RData[0].PLength = 1; 7242 7242 else ··· 8473 8473 fax_control_bits |= T30_CONTROL_BIT_ACCEPT_SEL_POLLING; 8474 8474 } 8475 8475 len = nlc[0]; 8476 - pos = ((byte)(((T30_INFO *) 0)->station_id + 20)); 8476 + pos = offsetof(T30_INFO, station_id) + 20; 8477 8477 if (pos < plci->fax_connect_info_length) 8478 8478 { 8479 8479 for (i = 1 + plci->fax_connect_info_buffer[pos]; i != 0; i--) ··· 8525 8525 } 8526 8526 8527 8527 PUT_WORD(&(((T30_INFO *)&nlc[1])->control_bits_low), fax_control_bits); 8528 - len = ((byte)(((T30_INFO *) 0)->station_id + 20)); 8528 + len = offsetof(T30_INFO, station_id) + 20; 8529 8529 for (i = 0; i < len; i++) 8530 8530 plci->fax_connect_info_buffer[i] = nlc[1+i]; 8531 8531 ((T30_INFO *) plci->fax_connect_info_buffer)->head_line_len = 0;
+1
drivers/isdn/hisax/amd7930_fn.c
··· 594 594 if (cs->debug & L1_DEB_WARN) 595 595 debugl1(cs, "Amd7930: l1hw: l2l1 tx_skb exist this shouldn't happen"); 596 596 skb_queue_tail(&cs->sq, skb); 597 + spin_unlock_irqrestore(&cs->lock, flags); 597 598 break; 598 599 } 599 600 if (cs->debug & DEB_DLOG_HEX)
+1 -1
drivers/isdn/hisax/diva.c
··· 382 382 { 383 383 int to = 50; 384 384 385 - while ((!(MemReadHSCX(cs, hscx, HSCX_STAR) & 0x44) == 0x40) && to) { 385 + while (((MemReadHSCX(cs, hscx, HSCX_STAR) & 0x44) != 0x40) && to) { 386 386 udelay(1); 387 387 to--; 388 388 }
+11 -11
drivers/isdn/hisax/elsa_ser.c
··· 477 477 modem_set_init(struct IsdnCardState *cs) { 478 478 int timeout; 479 479 480 - #define RCV_DELAY 20000 480 + #define RCV_DELAY 20 481 481 modem_write_cmd(cs, MInit_1, strlen(MInit_1)); 482 482 timeout = 1000; 483 483 while(timeout-- && cs->hw.elsa.transcnt) 484 484 udelay(1000); 485 485 debugl1(cs, "msi tout=%d", timeout); 486 - udelay(RCV_DELAY); 486 + mdelay(RCV_DELAY); 487 487 modem_write_cmd(cs, MInit_2, strlen(MInit_2)); 488 488 timeout = 1000; 489 489 while(timeout-- && cs->hw.elsa.transcnt) 490 490 udelay(1000); 491 491 debugl1(cs, "msi tout=%d", timeout); 492 - udelay(RCV_DELAY); 492 + mdelay(RCV_DELAY); 493 493 modem_write_cmd(cs, MInit_3, strlen(MInit_3)); 494 494 timeout = 1000; 495 495 while(timeout-- && cs->hw.elsa.transcnt) 496 496 udelay(1000); 497 497 debugl1(cs, "msi tout=%d", timeout); 498 - udelay(RCV_DELAY); 498 + mdelay(RCV_DELAY); 499 499 modem_write_cmd(cs, MInit_4, strlen(MInit_4)); 500 500 timeout = 1000; 501 501 while(timeout-- && cs->hw.elsa.transcnt) 502 502 udelay(1000); 503 503 debugl1(cs, "msi tout=%d", timeout); 504 - udelay(RCV_DELAY ); 504 + mdelay(RCV_DELAY); 505 505 modem_write_cmd(cs, MInit_5, strlen(MInit_5)); 506 506 timeout = 1000; 507 507 while(timeout-- && cs->hw.elsa.transcnt) 508 508 udelay(1000); 509 509 debugl1(cs, "msi tout=%d", timeout); 510 - udelay(RCV_DELAY); 510 + mdelay(RCV_DELAY); 511 511 modem_write_cmd(cs, MInit_6, strlen(MInit_6)); 512 512 timeout = 1000; 513 513 while(timeout-- && cs->hw.elsa.transcnt) 514 514 udelay(1000); 515 515 debugl1(cs, "msi tout=%d", timeout); 516 - udelay(RCV_DELAY); 516 + mdelay(RCV_DELAY); 517 517 modem_write_cmd(cs, MInit_7, strlen(MInit_7)); 518 518 timeout = 1000; 519 519 while(timeout-- && cs->hw.elsa.transcnt) 520 520 udelay(1000); 521 521 debugl1(cs, "msi tout=%d", timeout); 522 - udelay(RCV_DELAY); 522 + mdelay(RCV_DELAY); 523 523 } 524 524 525 525 static void 526 526 modem_set_dial(struct IsdnCardState *cs, int outgoing) { 527 527 int timeout; 528 - #define RCV_DELAY 20000 528 + #define RCV_DELAY 20 529 529 530 530 modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800)); 531 531 timeout = 1000; 532 532 while(timeout-- && cs->hw.elsa.transcnt) 533 533 udelay(1000); 534 534 debugl1(cs, "msi tout=%d", timeout); 535 - udelay(RCV_DELAY); 535 + mdelay(RCV_DELAY); 536 536 if (outgoing) 537 537 modem_write_cmd(cs, MInit_dialout, strlen(MInit_dialout)); 538 538 else ··· 541 541 while(timeout-- && cs->hw.elsa.transcnt) 542 542 udelay(1000); 543 543 debugl1(cs, "msi tout=%d", timeout); 544 - udelay(RCV_DELAY); 544 + mdelay(RCV_DELAY); 545 545 } 546 546 547 547 static void
+2 -2
drivers/isdn/hisax/hfc_usb.c
··· 817 817 } 818 818 /* we have a complete hdlc packet */ 819 819 if (finish) { 820 - if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) 821 - && (fifo->skbuff->len > 3)) { 820 + if (fifo->skbuff->len > 3 && 821 + !fifo->skbuff->data[fifo->skbuff->len - 1]) { 822 822 823 823 if (fifon == HFCUSB_D_RX) { 824 824 DBG(HFCUSB_DBG_DCHANNEL,
+1 -1
drivers/isdn/hisax/hscx_irq.c
··· 32 32 { 33 33 int to = 50; 34 34 35 - while ((!(READHSCX(cs, hscx, HSCX_STAR) & 0x44) == 0x40) && to) { 35 + while (((READHSCX(cs, hscx, HSCX_STAR) & 0x44) != 0x40) && to) { 36 36 udelay(1); 37 37 to--; 38 38 }
+1
drivers/isdn/hisax/icc.c
··· 468 468 if (cs->debug & L1_DEB_WARN) 469 469 debugl1(cs, " l2l1 tx_skb exist this shouldn't happen"); 470 470 skb_queue_tail(&cs->sq, skb); 471 + spin_unlock_irqrestore(&cs->lock, flags); 471 472 break; 472 473 } 473 474 if (cs->debug & DEB_DLOG_HEX)
+1 -1
drivers/isdn/mISDN/stack.c
··· 364 364 static int 365 365 st_own_ctrl(struct mISDNchannel *ch, u_int cmd, void *arg) 366 366 { 367 - if (!ch->st || ch->st->layer1) 367 + if (!ch->st || !ch->st->layer1) 368 368 return -EINVAL; 369 369 return ch->st->layer1->ctrl(ch->st->layer1, cmd, arg); 370 370 }
+2
drivers/net/benet/be.h
··· 259 259 u32 port_num; 260 260 bool promiscuous; 261 261 u32 cap; 262 + u32 rx_fc; /* Rx flow control */ 263 + u32 tx_fc; /* Tx flow control */ 262 264 }; 263 265 264 266 extern const struct ethtool_ops be_ethtool_ops;
+1 -1
drivers/net/benet/be_cmds.h
··· 68 68 #define CQE_STATUS_COMPL_MASK 0xFFFF 69 69 #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ 70 70 #define CQE_STATUS_EXTD_MASK 0xFFFF 71 - #define CQE_STATUS_EXTD_SHIFT 0 /* bits 0 - 15 */ 71 + #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */ 72 72 73 73 struct be_mcc_compl { 74 74 u32 status; /* dword 0 */
+5 -3
drivers/net/benet/be_ethtool.c
··· 323 323 324 324 if (ecmd->autoneg != 0) 325 325 return -EINVAL; 326 + adapter->tx_fc = ecmd->tx_pause; 327 + adapter->rx_fc = ecmd->rx_pause; 326 328 327 - status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, 328 - ecmd->rx_pause); 329 - if (!status) 329 + status = be_cmd_set_flow_control(adapter, 330 + adapter->tx_fc, adapter->rx_fc); 331 + if (status) 330 332 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); 331 333 332 334 return status;
+17 -11
drivers/net/benet/be_main.c
··· 1610 1610 1611 1611 status = be_cmd_link_status_query(adapter, &link_up); 1612 1612 if (status) 1613 - return status; 1613 + goto ret_sts; 1614 1614 be_link_status_update(adapter, link_up); 1615 1615 1616 + status = be_vid_config(adapter); 1617 + if (status) 1618 + goto ret_sts; 1619 + 1620 + status = be_cmd_set_flow_control(adapter, 1621 + adapter->tx_fc, adapter->rx_fc); 1622 + if (status) 1623 + goto ret_sts; 1624 + 1616 1625 schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); 1617 - return 0; 1626 + ret_sts: 1627 + return status; 1618 1628 } 1619 1629 1620 1630 static int be_setup(struct be_adapter *adapter) ··· 1658 1648 if (status != 0) 1659 1649 goto rx_qs_destroy; 1660 1650 1661 - status = be_vid_config(adapter); 1662 - if (status != 0) 1663 - goto mccqs_destroy; 1664 - 1665 - status = be_cmd_set_flow_control(adapter, true, true); 1666 - if (status != 0) 1667 - goto mccqs_destroy; 1668 1651 return 0; 1669 1652 1670 - mccqs_destroy: 1671 - be_mcc_queues_destroy(adapter); 1672 1653 rx_qs_destroy: 1673 1654 be_rx_queues_destroy(adapter); 1674 1655 tx_qs_destroy: ··· 1909 1908 netdev->flags |= IFF_MULTICAST; 1910 1909 1911 1910 adapter->rx_csum = true; 1911 + 1912 + /* Default settings for Rx and Tx flow control */ 1913 + adapter->rx_fc = true; 1914 + adapter->tx_fc = true; 1912 1915 1913 1916 netif_set_gso_max_size(netdev, 65535); 1914 1917 ··· 2176 2171 be_close(netdev); 2177 2172 rtnl_unlock(); 2178 2173 } 2174 + be_cmd_get_flow_control(adapter, &adapter->tx_fc, &adapter->rx_fc); 2179 2175 be_clear(adapter); 2180 2176 2181 2177 pci_save_state(pdev);
+17
drivers/net/can/dev.c
··· 589 589 return 0; 590 590 } 591 591 592 + static size_t can_get_size(const struct net_device *dev) 593 + { 594 + struct can_priv *priv = netdev_priv(dev); 595 + size_t size; 596 + 597 + size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */ 598 + size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */ 599 + size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ 600 + size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */ 601 + size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */ 602 + if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ 603 + size += sizeof(struct can_bittiming_const); 604 + 605 + return size; 606 + } 607 + 592 608 static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) 593 609 { 594 610 struct can_priv *priv = netdev_priv(dev); ··· 655 639 .setup = can_setup, 656 640 .newlink = can_newlink, 657 641 .changelink = can_changelink, 642 + .get_size = can_get_size, 658 643 .fill_info = can_fill_info, 659 644 .fill_xstats = can_fill_xstats, 660 645 };
+4 -1
drivers/net/can/usb/ems_usb.c
··· 319 319 320 320 cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); 321 321 322 - cf->can_id = msg->msg.can_msg.id; 322 + cf->can_id = le32_to_cpu(msg->msg.can_msg.id); 323 323 cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8); 324 324 325 325 if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME ··· 812 812 813 813 msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; 814 814 } 815 + 816 + /* Respect byte order */ 817 + msg->msg.can_msg.id = cpu_to_le32(msg->msg.can_msg.id); 815 818 816 819 for (i = 0; i < MAX_TX_URBS; i++) { 817 820 if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) {
+3 -2
drivers/net/cassini.c
··· 4342 4342 cas_unlock_all_restore(cp, flags); 4343 4343 } 4344 4344 4345 + err = -ENOMEM; 4345 4346 if (cas_tx_tiny_alloc(cp) < 0) 4346 - return -ENOMEM; 4347 + goto err_unlock; 4347 4348 4348 4349 /* alloc rx descriptors */ 4349 - err = -ENOMEM; 4350 4350 if (cas_alloc_rxds(cp) < 0) 4351 4351 goto err_tx_tiny; 4352 4352 ··· 4386 4386 cas_free_rxds(cp); 4387 4387 err_tx_tiny: 4388 4388 cas_tx_tiny_free(cp); 4389 + err_unlock: 4389 4390 mutex_unlock(&cp->pm_mutex); 4390 4391 return err; 4391 4392 }
+1 -1
drivers/net/davinci_emac.c
··· 2221 2221 struct emac_priv *priv = netdev_priv(ndev); 2222 2222 2223 2223 emac_int_disable(priv); 2224 - emac_irq(ndev->irq, priv); 2224 + emac_irq(ndev->irq, ndev); 2225 2225 emac_int_enable(priv); 2226 2226 } 2227 2227 #endif
+1
drivers/net/fsl_pq_mdio.c
··· 427 427 of_unregister_platform_driver(&fsl_pq_mdio_driver); 428 428 } 429 429 module_exit(fsl_pq_mdio_exit); 430 + MODULE_LICENSE("GPL");
+78 -6
drivers/net/ixgbe/ixgbe_main.c
··· 44 44 45 45 #include "ixgbe.h" 46 46 #include "ixgbe_common.h" 47 + #include "ixgbe_dcb_82599.h" 47 48 48 49 char ixgbe_driver_name[] = "ixgbe"; 49 50 static const char ixgbe_driver_string[] = ··· 227 226 /* tx_buffer_info must be completely set up in the transmit path */ 228 227 } 229 228 229 + /** 230 + * ixgbe_tx_is_paused - check if the tx ring is paused 231 + * @adapter: the ixgbe adapter 232 + * @tx_ring: the corresponding tx_ring 233 + * 234 + * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the 235 + * corresponding TC of this tx_ring when checking TFCS. 236 + * 237 + * Returns : true if paused 238 + */ 239 + static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, 240 + struct ixgbe_ring *tx_ring) 241 + { 242 + int tc; 243 + u32 txoff = IXGBE_TFCS_TXOFF; 244 + 245 + #ifdef CONFIG_IXGBE_DCB 246 + if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 247 + int reg_idx = tx_ring->reg_idx; 248 + int dcb_i = adapter->ring_feature[RING_F_DCB].indices; 249 + 250 + if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 251 + tc = reg_idx >> 2; 252 + txoff = IXGBE_TFCS_TXOFF0; 253 + } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 254 + tc = 0; 255 + txoff = IXGBE_TFCS_TXOFF; 256 + if (dcb_i == 8) { 257 + /* TC0, TC1 */ 258 + tc = reg_idx >> 5; 259 + if (tc == 2) /* TC2, TC3 */ 260 + tc += (reg_idx - 64) >> 4; 261 + else if (tc == 3) /* TC4, TC5, TC6, TC7 */ 262 + tc += 1 + ((reg_idx - 96) >> 3); 263 + } else if (dcb_i == 4) { 264 + /* TC0, TC1 */ 265 + tc = reg_idx >> 6; 266 + if (tc == 1) { 267 + tc += (reg_idx - 64) >> 5; 268 + if (tc == 2) /* TC2, TC3 */ 269 + tc += (reg_idx - 96) >> 4; 270 + } 271 + } 272 + } 273 + txoff <<= tc; 274 + } 275 + #endif 276 + return IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & txoff; 277 + } 278 + 230 279 static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, 231 280 struct ixgbe_ring *tx_ring, 232 281 unsigned int eop) ··· 288 237 adapter->detect_tx_hung = false; 289 238 if (tx_ring->tx_buffer_info[eop].time_stamp && 290 239 time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && 291 - !(IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)) { 240 + !ixgbe_tx_is_paused(adapter, tx_ring)) { 292 241 /* detected Tx unit hang */ 293 242 union ixgbe_adv_tx_desc *tx_desc; 294 243 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); ··· 463 412 u32 txctrl; 464 413 int cpu = get_cpu(); 465 414 int q = tx_ring - adapter->tx_ring; 415 + struct ixgbe_hw *hw = &adapter->hw; 466 416 467 417 if (tx_ring->cpu != cpu) { 468 - txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q)); 469 418 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 419 + txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(q)); 470 420 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; 471 421 txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); 422 + txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; 423 + IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(q), txctrl); 472 424 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 425 + txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(q)); 473 426 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; 474 427 txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << 475 - IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); 428 + IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); 429 + txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; 430 + IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(q), txctrl); 476 431 } 477 - txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; 478 - IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl); 479 432 tx_ring->cpu = cpu; 480 433 } 481 434 put_cpu(); ··· 1968 1913 break; 1969 1914 } 1970 1915 } 1916 + 1971 1917 if (hw->mac.type == ixgbe_mac_82599EB) { 1918 + u32 rttdcs; 1919 + 1920 + /* disable the arbiter while setting MTQC */ 1921 + rttdcs = IXGBE_READ_REG(hw, IXGBE_RTTDCS); 1922 + rttdcs |= IXGBE_RTTDCS_ARBDIS; 1923 + IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); 1924 + 1972 1925 /* We enable 8 traffic classes, DCB only */ 1973 1926 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) 1974 1927 IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | 1975 1928 IXGBE_MTQC_8TC_8TQ)); 1929 + else 1930 + IXGBE_WRITE_REG(hw, IXGBE_MTQC, IXGBE_MTQC_64Q_1PB); 1931 + 1932 + /* re-eable the arbiter */ 1933 + rttdcs &= ~IXGBE_RTTDCS_ARBDIS; 1934 + IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs); 1976 1935 } 1977 1936 } 1978 1937 ··· 2540 2471 ixgbe_restore_vlan(adapter); 2541 2472 #ifdef CONFIG_IXGBE_DCB 2542 2473 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 2543 - netif_set_gso_max_size(netdev, 32768); 2474 + if (hw->mac.type == ixgbe_mac_82598EB) 2475 + netif_set_gso_max_size(netdev, 32768); 2476 + else 2477 + netif_set_gso_max_size(netdev, 65536); 2544 2478 ixgbe_configure_dcb(adapter); 2545 2479 } else { 2546 2480 netif_set_gso_max_size(netdev, 65536);
+60 -57
drivers/net/macsonic.c
··· 223 223 return 0; 224 224 } 225 225 226 - static int __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) 226 + #define INVALID_MAC(mac) (memcmp(mac, "\x08\x00\x07", 3) && \ 227 + memcmp(mac, "\x00\xA0\x40", 3) && \ 228 + memcmp(mac, "\x00\x80\x19", 3) && \ 229 + memcmp(mac, "\x00\x05\x02", 3)) 230 + 231 + static void __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) 227 232 { 228 233 struct sonic_local *lp = netdev_priv(dev); 229 234 const int prom_addr = ONBOARD_SONIC_PROM_BASE; 230 - int i; 235 + unsigned short val; 231 236 232 - /* On NuBus boards we can sometimes look in the ROM resources. 233 - No such luck for comm-slot/onboard. */ 234 - for(i = 0; i < 6; i++) 235 - dev->dev_addr[i] = SONIC_READ_PROM(i); 237 + /* 238 + * On NuBus boards we can sometimes look in the ROM resources. 239 + * No such luck for comm-slot/onboard. 240 + * On the PowerBook 520, the PROM base address is a mystery. 241 + */ 242 + if (hwreg_present((void *)prom_addr)) { 243 + int i; 236 244 237 - /* Most of the time, the address is bit-reversed. The NetBSD 238 - source has a rather long and detailed historical account of 239 - why this is so. */ 240 - if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && 241 - memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && 242 - memcmp(dev->dev_addr, "\x00\x80\x19", 3) && 243 - memcmp(dev->dev_addr, "\x00\x05\x02", 3)) 244 - bit_reverse_addr(dev->dev_addr); 245 - else 246 - return 0; 245 + for (i = 0; i < 6; i++) 246 + dev->dev_addr[i] = SONIC_READ_PROM(i); 247 + if (!INVALID_MAC(dev->dev_addr)) 248 + return; 247 249 248 - /* If we still have what seems to be a bogus address, we'll 249 - look in the CAM. The top entry should be ours. */ 250 - /* Danger! This only works if MacOS has already initialized 251 - the card... */ 252 - if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && 253 - memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && 254 - memcmp(dev->dev_addr, "\x00\x80\x19", 3) && 255 - memcmp(dev->dev_addr, "\x00\x05\x02", 3)) 256 - { 257 - unsigned short val; 258 - 259 - printk(KERN_INFO "macsonic: PROM seems to be wrong, trying CAM entry 15\n"); 260 - 261 - SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); 262 - SONIC_WRITE(SONIC_CEP, 15); 263 - 264 - val = SONIC_READ(SONIC_CAP2); 265 - dev->dev_addr[5] = val >> 8; 266 - dev->dev_addr[4] = val & 0xff; 267 - val = SONIC_READ(SONIC_CAP1); 268 - dev->dev_addr[3] = val >> 8; 269 - dev->dev_addr[2] = val & 0xff; 270 - val = SONIC_READ(SONIC_CAP0); 271 - dev->dev_addr[1] = val >> 8; 272 - dev->dev_addr[0] = val & 0xff; 273 - 274 - printk(KERN_INFO "HW Address from CAM 15: %pM\n", 275 - dev->dev_addr); 276 - } else return 0; 277 - 278 - if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && 279 - memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && 280 - memcmp(dev->dev_addr, "\x00\x80\x19", 3) && 281 - memcmp(dev->dev_addr, "\x00\x05\x02", 3)) 282 - { 283 250 /* 284 - * Still nonsense ... messed up someplace! 251 + * Most of the time, the address is bit-reversed. The NetBSD 252 + * source has a rather long and detailed historical account of 253 + * why this is so. 285 254 */ 286 - printk(KERN_ERR "macsonic: ERROR (INVALID MAC)\n"); 287 - return -EIO; 288 - } else return 0; 255 + bit_reverse_addr(dev->dev_addr); 256 + if (!INVALID_MAC(dev->dev_addr)) 257 + return; 258 + 259 + /* 260 + * If we still have what seems to be a bogus address, we'll 261 + * look in the CAM. The top entry should be ours. 262 + */ 263 + printk(KERN_WARNING "macsonic: MAC address in PROM seems " 264 + "to be invalid, trying CAM\n"); 265 + } else { 266 + printk(KERN_WARNING "macsonic: cannot read MAC address from " 267 + "PROM, trying CAM\n"); 268 + } 269 + 270 + /* This only works if MacOS has already initialized the card. */ 271 + 272 + SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); 273 + SONIC_WRITE(SONIC_CEP, 15); 274 + 275 + val = SONIC_READ(SONIC_CAP2); 276 + dev->dev_addr[5] = val >> 8; 277 + dev->dev_addr[4] = val & 0xff; 278 + val = SONIC_READ(SONIC_CAP1); 279 + dev->dev_addr[3] = val >> 8; 280 + dev->dev_addr[2] = val & 0xff; 281 + val = SONIC_READ(SONIC_CAP0); 282 + dev->dev_addr[1] = val >> 8; 283 + dev->dev_addr[0] = val & 0xff; 284 + 285 + if (!INVALID_MAC(dev->dev_addr)) 286 + return; 287 + 288 + /* Still nonsense ... messed up someplace! */ 289 + 290 + printk(KERN_WARNING "macsonic: MAC address in CAM entry 15 " 291 + "seems invalid, will use a random MAC\n"); 292 + random_ether_addr(dev->dev_addr); 289 293 } 290 294 291 295 static int __devinit mac_onboard_sonic_probe(struct net_device *dev) ··· 406 402 SONIC_WRITE(SONIC_ISR, 0x7fff); 407 403 408 404 /* Now look for the MAC address. */ 409 - if (mac_onboard_sonic_ethernet_addr(dev) != 0) 410 - return -ENODEV; 405 + mac_onboard_sonic_ethernet_addr(dev); 411 406 412 407 /* Shared init code */ 413 408 return macsonic_init(dev);
+2
drivers/net/qlge/qlge_main.c
··· 3916 3916 goto err_out; 3917 3917 } 3918 3918 3919 + /* Set PCIe reset type for EEH to fundamental. */ 3920 + pdev->needs_freset = 1; 3919 3921 pci_save_state(pdev); 3920 3922 qdev->reg_base = 3921 3923 ioremap_nocache(pci_resource_start(pdev, 1),
+1 -1
drivers/net/qlge/qlge_mpi.c
··· 499 499 /* Wait for the interrupt to come in. */ 500 500 status = ql_wait_mbx_cmd_cmplt(qdev); 501 501 if (status) 502 - goto end; 502 + continue; 503 503 504 504 /* Process the event. If it's an AEN, it 505 505 * will be handled in-line or a worker
+1 -1
drivers/net/usb/Kconfig
··· 174 174 * Ericsson Mobile Broadband Module (all variants) 175 175 * Motorola (DM100 and SB4100) 176 176 * Broadcom Cable Modem (reference design) 177 - * Toshiba (PCX1100U and F3507g) 177 + * Toshiba (PCX1100U and F3507g/F3607gw) 178 178 * ... 179 179 180 180 This driver creates an interface named "ethX", where X depends on
+41 -1
drivers/net/usb/cdc_ether.c
··· 544 544 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 545 545 .driver_info = (unsigned long) &cdc_info, 546 546 }, { 547 - /* Ericsson F3307 */ 547 + /* Ericsson F3607gw ver 2 */ 548 + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1905, USB_CLASS_COMM, 549 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 550 + .driver_info = (unsigned long) &cdc_info, 551 + }, { 552 + /* Ericsson F3607gw ver 3 */ 548 553 USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1906, USB_CLASS_COMM, 554 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 555 + .driver_info = (unsigned long) &cdc_info, 556 + }, { 557 + /* Ericsson F3307 */ 558 + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x190a, USB_CLASS_COMM, 559 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 560 + .driver_info = (unsigned long) &cdc_info, 561 + }, { 562 + /* Ericsson F3307 ver 2 */ 563 + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1909, USB_CLASS_COMM, 564 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 565 + .driver_info = (unsigned long) &cdc_info, 566 + }, { 567 + /* Ericsson C3607w */ 568 + USB_DEVICE_AND_INTERFACE_INFO(0x0bdb, 0x1049, USB_CLASS_COMM, 549 569 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 550 570 .driver_info = (unsigned long) &cdc_info, 551 571 }, { ··· 574 554 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 575 555 .driver_info = (unsigned long) &cdc_info, 576 556 }, { 557 + /* Toshiba F3607gw */ 558 + USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x130c, USB_CLASS_COMM, 559 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 560 + .driver_info = (unsigned long) &cdc_info, 561 + }, { 562 + /* Toshiba F3607gw ver 2 */ 563 + USB_DEVICE_AND_INTERFACE_INFO(0x0930, 0x1311, USB_CLASS_COMM, 564 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 565 + .driver_info = (unsigned long) &cdc_info, 566 + }, { 577 567 /* Dell F3507g */ 578 568 USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8147, USB_CLASS_COMM, 569 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 570 + .driver_info = (unsigned long) &cdc_info, 571 + }, { 572 + /* Dell F3607gw */ 573 + USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8183, USB_CLASS_COMM, 574 + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 575 + .driver_info = (unsigned long) &cdc_info, 576 + }, { 577 + /* Dell F3607gw ver 2 */ 578 + USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x8184, USB_CLASS_COMM, 579 579 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 580 580 .driver_info = (unsigned long) &cdc_info, 581 581 },
+3 -3
drivers/net/virtio_net.c
··· 998 998 VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, 999 999 }; 1000 1000 1001 - static struct virtio_driver virtio_net = { 1001 + static struct virtio_driver virtio_net_driver = { 1002 1002 .feature_table = features, 1003 1003 .feature_table_size = ARRAY_SIZE(features), 1004 1004 .driver.name = KBUILD_MODNAME, ··· 1011 1011 1012 1012 static int __init init(void) 1013 1013 { 1014 - return register_virtio_driver(&virtio_net); 1014 + return register_virtio_driver(&virtio_net_driver); 1015 1015 } 1016 1016 1017 1017 static void __exit fini(void) 1018 1018 { 1019 - unregister_virtio_driver(&virtio_net); 1019 + unregister_virtio_driver(&virtio_net_driver); 1020 1020 } 1021 1021 module_init(init); 1022 1022 module_exit(fini);
+1 -4
drivers/net/wireless/ipw2x00/ipw2100.c
··· 6325 6325 6326 6326 fail: 6327 6327 if (dev) { 6328 - if (registered) { 6329 - unregister_ieee80211(priv->ieee); 6328 + if (registered) 6330 6329 unregister_netdev(dev); 6331 - } 6332 6330 6333 6331 ipw2100_hw_stop_adapter(priv); 6334 6332 ··· 6383 6385 /* Unregister the device first - this results in close() 6384 6386 * being called if the device is open. If we free storage 6385 6387 * first, then close() will crash. */ 6386 - unregister_ieee80211(priv->ieee); 6387 6388 unregister_netdev(dev); 6388 6389 6389 6390 /* ipw2100_down will ensure that there is no more pending work
-2
drivers/net/wireless/ipw2x00/ipw2200.c
··· 11822 11822 if (err) { 11823 11823 IPW_ERROR("Failed to register promiscuous network " 11824 11824 "device (error %d).\n", err); 11825 - unregister_ieee80211(priv->ieee); 11826 11825 unregister_netdev(priv->net_dev); 11827 11826 goto out_remove_sysfs; 11828 11827 } ··· 11872 11873 11873 11874 mutex_unlock(&priv->mutex); 11874 11875 11875 - unregister_ieee80211(priv->ieee); 11876 11876 unregister_netdev(priv->net_dev); 11877 11877 11878 11878 if (priv->rxq) {
-1
drivers/net/wireless/ipw2x00/libipw.h
··· 1020 1020 /* ieee80211.c */ 1021 1021 extern void free_ieee80211(struct net_device *dev, int monitor); 1022 1022 extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); 1023 - extern void unregister_ieee80211(struct libipw_device *ieee); 1024 1023 extern int libipw_change_mtu(struct net_device *dev, int new_mtu); 1025 1024 1026 1025 extern void libipw_networks_age(struct libipw_device *ieee,
+5 -9
drivers/net/wireless/ipw2x00/libipw_module.c
··· 235 235 libipw_networks_free(ieee); 236 236 237 237 /* free cfg80211 resources */ 238 - if (!monitor) 238 + if (!monitor) { 239 + wiphy_unregister(ieee->wdev.wiphy); 240 + kfree(ieee->a_band.channels); 241 + kfree(ieee->bg_band.channels); 239 242 wiphy_free(ieee->wdev.wiphy); 243 + } 240 244 241 245 free_netdev(dev); 242 - } 243 - 244 - void unregister_ieee80211(struct libipw_device *ieee) 245 - { 246 - wiphy_unregister(ieee->wdev.wiphy); 247 - kfree(ieee->a_band.channels); 248 - kfree(ieee->bg_band.channels); 249 246 } 250 247 251 248 #ifdef CONFIG_LIBIPW_DEBUG ··· 330 333 331 334 EXPORT_SYMBOL(alloc_ieee80211); 332 335 EXPORT_SYMBOL(free_ieee80211); 333 - EXPORT_SYMBOL(unregister_ieee80211);
+2 -2
drivers/net/wireless/rt2x00/rt2x00dev.c
··· 815 815 816 816 mutex_init(&rt2x00dev->csr_mutex); 817 817 818 + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 819 + 818 820 /* 819 821 * Make room for rt2x00_intf inside the per-interface 820 822 * structure ieee80211_vif. ··· 872 870 rt2x00link_register(rt2x00dev); 873 871 rt2x00leds_register(rt2x00dev); 874 872 rt2x00debug_register(rt2x00dev); 875 - 876 - set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 877 873 878 874 return 0; 879 875
+7 -4
drivers/net/wireless/rt2x00/rt2x00link.c
··· 362 362 363 363 rt2x00link_reset_tuner(rt2x00dev, false); 364 364 365 - ieee80211_queue_delayed_work(rt2x00dev->hw, 366 - &link->work, LINK_TUNE_INTERVAL); 365 + if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 366 + ieee80211_queue_delayed_work(rt2x00dev->hw, 367 + &link->work, LINK_TUNE_INTERVAL); 367 368 } 368 369 369 370 void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) ··· 470 469 * Increase tuner counter, and reschedule the next link tuner run. 471 470 */ 472 471 link->count++; 473 - ieee80211_queue_delayed_work(rt2x00dev->hw, 474 - &link->work, LINK_TUNE_INTERVAL); 472 + 473 + if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 474 + ieee80211_queue_delayed_work(rt2x00dev->hw, 475 + &link->work, LINK_TUNE_INTERVAL); 475 476 } 476 477 477 478 void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
+8 -1
drivers/net/wireless/rt2x00/rt2x00usb.c
··· 47 47 (requesttype == USB_VENDOR_REQUEST_IN) ? 48 48 usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); 49 49 50 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 51 + return -ENODEV; 50 52 51 53 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 52 54 status = usb_control_msg(usb_dev, pipe, request, requesttype, ··· 62 60 * -ENODEV: Device has disappeared, no point continuing. 63 61 * All other errors: Try again. 64 62 */ 65 - else if (status == -ENODEV) 63 + else if (status == -ENODEV) { 64 + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 66 65 break; 66 + } 67 67 } 68 68 69 69 ERROR(rt2x00dev, ··· 164 160 u32 *reg) 165 161 { 166 162 unsigned int i; 163 + 164 + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 165 + return -ENODEV; 167 166 168 167 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 169 168 rt2x00usb_register_read_lock(rt2x00dev, offset, reg);
+2 -2
drivers/net/wireless/rtl818x/rtl8187_leds.c
··· 210 210 211 211 /* turn the LED off before exiting */ 212 212 ieee80211_queue_delayed_work(dev, &priv->led_off, 0); 213 - cancel_delayed_work_sync(&priv->led_off); 214 - cancel_delayed_work_sync(&priv->led_on); 215 213 rtl8187_unregister_led(&priv->led_rx); 216 214 rtl8187_unregister_led(&priv->led_tx); 215 + cancel_delayed_work_sync(&priv->led_off); 216 + cancel_delayed_work_sync(&priv->led_on); 217 217 } 218 218 #endif /* def CONFIG_RTL8187_LED */ 219 219
+3 -5
include/net/netfilter/nf_conntrack.h
··· 255 255 } 256 256 257 257 /* These are for NAT. Icky. */ 258 - /* Update TCP window tracking data when NAT mangles the packet */ 259 - extern void nf_conntrack_tcp_update(const struct sk_buff *skb, 260 - unsigned int dataoff, 261 - struct nf_conn *ct, int dir, 262 - s16 offset); 258 + extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct, 259 + enum ip_conntrack_dir dir, 260 + u32 seq); 263 261 264 262 /* Fake conntrack entry for untracked connections */ 265 263 extern struct nf_conn nf_conntrack_untracked;
+4
include/net/netfilter/nf_nat_helper.h
··· 32 32 * to port ct->master->saved_proto. */ 33 33 extern void nf_nat_follow_master(struct nf_conn *ct, 34 34 struct nf_conntrack_expect *this); 35 + 36 + extern s16 nf_nat_get_offset(const struct nf_conn *ct, 37 + enum ip_conntrack_dir dir, 38 + u32 seq); 35 39 #endif
+5 -1
net/bridge/br_if.c
··· 377 377 struct net_bridge_port *p; 378 378 int err = 0; 379 379 380 - if (dev->flags & IFF_LOOPBACK || dev->type != ARPHRD_ETHER) 380 + /* Don't allow bridging non-ethernet like devices */ 381 + if ((dev->flags & IFF_LOOPBACK) || 382 + dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN) 381 383 return -EINVAL; 382 384 385 + /* No bridging of bridges */ 383 386 if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit) 384 387 return -ELOOP; 385 388 389 + /* Device is already being bridged */ 386 390 if (dev->br_port != NULL) 387 391 return -EBUSY; 388 392
+12 -7
net/can/bcm.c
··· 132 132 /* 133 133 * procfs functions 134 134 */ 135 - static char *bcm_proc_getifname(int ifindex) 135 + static char *bcm_proc_getifname(char *result, int ifindex) 136 136 { 137 137 struct net_device *dev; 138 138 139 139 if (!ifindex) 140 140 return "any"; 141 141 142 - /* no usage counting */ 142 + read_lock(&dev_base_lock); 143 143 dev = __dev_get_by_index(&init_net, ifindex); 144 144 if (dev) 145 - return dev->name; 145 + strcpy(result, dev->name); 146 + else 147 + strcpy(result, "???"); 148 + read_unlock(&dev_base_lock); 146 149 147 - return "???"; 150 + return result; 148 151 } 149 152 150 153 static int bcm_proc_show(struct seq_file *m, void *v) 151 154 { 155 + char ifname[IFNAMSIZ]; 152 156 struct sock *sk = (struct sock *)m->private; 153 157 struct bcm_sock *bo = bcm_sk(sk); 154 158 struct bcm_op *op; ··· 161 157 seq_printf(m, " / sk %p", sk); 162 158 seq_printf(m, " / bo %p", bo); 163 159 seq_printf(m, " / dropped %lu", bo->dropped_usr_msgs); 164 - seq_printf(m, " / bound %s", bcm_proc_getifname(bo->ifindex)); 160 + seq_printf(m, " / bound %s", bcm_proc_getifname(ifname, bo->ifindex)); 165 161 seq_printf(m, " <<<\n"); 166 162 167 163 list_for_each_entry(op, &bo->rx_ops, list) { ··· 173 169 continue; 174 170 175 171 seq_printf(m, "rx_op: %03X %-5s ", 176 - op->can_id, bcm_proc_getifname(op->ifindex)); 172 + op->can_id, bcm_proc_getifname(ifname, op->ifindex)); 177 173 seq_printf(m, "[%d]%c ", op->nframes, 178 174 (op->flags & RX_CHECK_DLC)?'d':' '); 179 175 if (op->kt_ival1.tv64) ··· 198 194 list_for_each_entry(op, &bo->tx_ops, list) { 199 195 200 196 seq_printf(m, "tx_op: %03X %s [%d] ", 201 - op->can_id, bcm_proc_getifname(op->ifindex), 197 + op->can_id, 198 + bcm_proc_getifname(ifname, op->ifindex), 202 199 op->nframes); 203 200 204 201 if (op->kt_ival1.tv64)
+3 -4
net/decnet/sysctl_net_decnet.c
··· 263 263 return -ENODEV; 264 264 265 265 rv = -ENODEV; 266 - if (dev->dn_ptr != NULL) { 266 + if (dev->dn_ptr != NULL) 267 267 rv = dn_dev_set_default(dev, 1); 268 - if (rv) 269 - dev_put(dev); 270 - } 268 + if (rv) 269 + dev_put(dev); 271 270 } 272 271 273 272 return rv;
+17 -15
net/ipv4/ipip.c
··· 438 438 goto tx_error; 439 439 } 440 440 441 - if (tiph->frag_off) 441 + df |= old_iph->frag_off & htons(IP_DF); 442 + 443 + if (df) { 442 444 mtu = dst_mtu(&rt->u.dst) - sizeof(struct iphdr); 443 - else 444 - mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 445 445 446 - if (mtu < 68) { 447 - stats->collisions++; 448 - ip_rt_put(rt); 449 - goto tx_error; 450 - } 451 - if (skb_dst(skb)) 452 - skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); 446 + if (mtu < 68) { 447 + stats->collisions++; 448 + ip_rt_put(rt); 449 + goto tx_error; 450 + } 453 451 454 - df |= (old_iph->frag_off&htons(IP_DF)); 452 + if (skb_dst(skb)) 453 + skb_dst(skb)->ops->update_pmtu(skb_dst(skb), mtu); 455 454 456 - if ((old_iph->frag_off&htons(IP_DF)) && mtu < ntohs(old_iph->tot_len)) { 457 - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); 458 - ip_rt_put(rt); 459 - goto tx_error; 455 + if ((old_iph->frag_off & htons(IP_DF)) && 456 + mtu < ntohs(old_iph->tot_len)) { 457 + icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 458 + htonl(mtu)); 459 + ip_rt_put(rt); 460 + goto tx_error; 461 + } 460 462 } 461 463 462 464 if (tunnel->err_count > 0) {
+3
net/ipv4/netfilter/nf_nat_core.c
··· 750 750 BUG_ON(nfnetlink_parse_nat_setup_hook != NULL); 751 751 rcu_assign_pointer(nfnetlink_parse_nat_setup_hook, 752 752 nfnetlink_parse_nat_setup); 753 + BUG_ON(nf_ct_nat_offset != NULL); 754 + rcu_assign_pointer(nf_ct_nat_offset, nf_nat_get_offset); 753 755 return 0; 754 756 755 757 cleanup_extend: ··· 766 764 nf_ct_extend_unregister(&nat_extend); 767 765 rcu_assign_pointer(nf_nat_seq_adjust_hook, NULL); 768 766 rcu_assign_pointer(nfnetlink_parse_nat_setup_hook, NULL); 767 + rcu_assign_pointer(nf_ct_nat_offset, NULL); 769 768 synchronize_net(); 770 769 } 771 770
+23 -11
net/ipv4/netfilter/nf_nat_helper.c
··· 73 73 DUMP_OFFSET(this_way); 74 74 } 75 75 76 + /* Get the offset value, for conntrack */ 77 + s16 nf_nat_get_offset(const struct nf_conn *ct, 78 + enum ip_conntrack_dir dir, 79 + u32 seq) 80 + { 81 + struct nf_conn_nat *nat = nfct_nat(ct); 82 + struct nf_nat_seq *this_way; 83 + s16 offset; 84 + 85 + if (!nat) 86 + return 0; 87 + 88 + this_way = &nat->seq[dir]; 89 + spin_lock_bh(&nf_nat_seqofs_lock); 90 + offset = after(seq, this_way->correction_pos) 91 + ? this_way->offset_after : this_way->offset_before; 92 + spin_unlock_bh(&nf_nat_seqofs_lock); 93 + 94 + return offset; 95 + } 96 + EXPORT_SYMBOL_GPL(nf_nat_get_offset); 97 + 76 98 /* Frobs data inside this packet, which is linear. */ 77 99 static void mangle_contents(struct sk_buff *skb, 78 100 unsigned int dataoff, ··· 211 189 adjust_tcp_sequence(ntohl(tcph->seq), 212 190 (int)rep_len - (int)match_len, 213 191 ct, ctinfo); 214 - /* Tell TCP window tracking about seq change */ 215 - nf_conntrack_tcp_update(skb, ip_hdrlen(skb), 216 - ct, CTINFO2DIR(ctinfo), 217 - (int)rep_len - (int)match_len); 218 - 219 192 nf_conntrack_event_cache(IPCT_NATSEQADJ, ct); 220 193 } 221 194 return 1; ··· 432 415 tcph->seq = newseq; 433 416 tcph->ack_seq = newack; 434 417 435 - if (!nf_nat_sack_adjust(skb, tcph, ct, ctinfo)) 436 - return 0; 437 - 438 - nf_conntrack_tcp_update(skb, ip_hdrlen(skb), ct, dir, seqoff); 439 - 440 - return 1; 418 + return nf_nat_sack_adjust(skb, tcph, ct, ctinfo); 441 419 } 442 420 443 421 /* Setup NAT on this expected conntrack so it follows master. */
+8
net/netfilter/nf_conntrack_core.c
··· 1351 1351 return ret; 1352 1352 } 1353 1353 1354 + s16 (*nf_ct_nat_offset)(const struct nf_conn *ct, 1355 + enum ip_conntrack_dir dir, 1356 + u32 seq); 1357 + EXPORT_SYMBOL_GPL(nf_ct_nat_offset); 1358 + 1354 1359 int nf_conntrack_init(struct net *net) 1355 1360 { 1356 1361 int ret; ··· 1373 1368 /* For use by REJECT target */ 1374 1369 rcu_assign_pointer(ip_ct_attach, nf_conntrack_attach); 1375 1370 rcu_assign_pointer(nf_ct_destroy, destroy_conntrack); 1371 + 1372 + /* Howto get NAT offsets */ 1373 + rcu_assign_pointer(nf_ct_nat_offset, NULL); 1376 1374 } 1377 1375 return 0; 1378 1376
+26 -38
net/netfilter/nf_conntrack_proto_tcp.c
··· 492 492 } 493 493 } 494 494 495 + #ifdef CONFIG_NF_NAT_NEEDED 496 + static inline s16 nat_offset(const struct nf_conn *ct, 497 + enum ip_conntrack_dir dir, 498 + u32 seq) 499 + { 500 + typeof(nf_ct_nat_offset) get_offset = rcu_dereference(nf_ct_nat_offset); 501 + 502 + return get_offset != NULL ? get_offset(ct, dir, seq) : 0; 503 + } 504 + #define NAT_OFFSET(pf, ct, dir, seq) \ 505 + (pf == NFPROTO_IPV4 ? nat_offset(ct, dir, seq) : 0) 506 + #else 507 + #define NAT_OFFSET(pf, ct, dir, seq) 0 508 + #endif 509 + 495 510 static bool tcp_in_window(const struct nf_conn *ct, 496 511 struct ip_ct_tcp *state, 497 512 enum ip_conntrack_dir dir, ··· 521 506 struct ip_ct_tcp_state *receiver = &state->seen[!dir]; 522 507 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; 523 508 __u32 seq, ack, sack, end, win, swin; 509 + s16 receiver_offset; 524 510 bool res; 525 511 526 512 /* ··· 535 519 if (receiver->flags & IP_CT_TCP_FLAG_SACK_PERM) 536 520 tcp_sack(skb, dataoff, tcph, &sack); 537 521 522 + /* Take into account NAT sequence number mangling */ 523 + receiver_offset = NAT_OFFSET(pf, ct, !dir, ack - 1); 524 + ack -= receiver_offset; 525 + sack -= receiver_offset; 526 + 538 527 pr_debug("tcp_in_window: START\n"); 539 528 pr_debug("tcp_in_window: "); 540 529 nf_ct_dump_tuple(tuple); 541 - pr_debug("seq=%u ack=%u sack=%u win=%u end=%u\n", 542 - seq, ack, sack, win, end); 530 + pr_debug("seq=%u ack=%u+(%d) sack=%u+(%d) win=%u end=%u\n", 531 + seq, ack, receiver_offset, sack, receiver_offset, win, end); 543 532 pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " 544 533 "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 545 534 sender->td_end, sender->td_maxend, sender->td_maxwin, ··· 634 613 635 614 pr_debug("tcp_in_window: "); 636 615 nf_ct_dump_tuple(tuple); 637 - pr_debug("seq=%u ack=%u sack =%u win=%u end=%u\n", 638 - seq, ack, sack, win, end); 616 + pr_debug("seq=%u ack=%u+(%d) sack=%u+(%d) win=%u end=%u\n", 617 + seq, ack, receiver_offset, sack, receiver_offset, win, end); 639 618 pr_debug("tcp_in_window: sender end=%u maxend=%u maxwin=%u scale=%i " 640 619 "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 641 620 sender->td_end, sender->td_maxend, sender->td_maxwin, ··· 721 700 before(seq, sender->td_maxend + 1) ? 722 701 after(end, sender->td_end - receiver->td_maxwin - 1) ? 723 702 before(sack, receiver->td_end + 1) ? 724 - after(ack, receiver->td_end - MAXACKWINDOW(sender)) ? "BUG" 703 + after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG" 725 704 : "ACK is under the lower bound (possible overly delayed ACK)" 726 705 : "ACK is over the upper bound (ACKed data not seen yet)" 727 706 : "SEQ is under the lower bound (already ACKed data retransmitted)" ··· 735 714 736 715 return res; 737 716 } 738 - 739 - #ifdef CONFIG_NF_NAT_NEEDED 740 - /* Update sender->td_end after NAT successfully mangled the packet */ 741 - /* Caller must linearize skb at tcp header. */ 742 - void nf_conntrack_tcp_update(const struct sk_buff *skb, 743 - unsigned int dataoff, 744 - struct nf_conn *ct, int dir, 745 - s16 offset) 746 - { 747 - const struct tcphdr *tcph = (const void *)skb->data + dataoff; 748 - const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[dir]; 749 - const struct ip_ct_tcp_state *receiver = &ct->proto.tcp.seen[!dir]; 750 - __u32 end; 751 - 752 - end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph); 753 - 754 - spin_lock_bh(&ct->lock); 755 - /* 756 - * We have to worry for the ack in the reply packet only... 757 - */ 758 - if (ct->proto.tcp.seen[dir].td_end + offset == end) 759 - ct->proto.tcp.seen[dir].td_end = end; 760 - ct->proto.tcp.last_end = end; 761 - spin_unlock_bh(&ct->lock); 762 - pr_debug("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " 763 - "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 764 - sender->td_end, sender->td_maxend, sender->td_maxwin, 765 - sender->td_scale, 766 - receiver->td_end, receiver->td_maxend, receiver->td_maxwin, 767 - receiver->td_scale); 768 - } 769 - EXPORT_SYMBOL_GPL(nf_conntrack_tcp_update); 770 - #endif 771 717 772 718 #define TH_FIN 0x01 773 719 #define TH_SYN 0x02
+4 -6
net/netfilter/xt_connlimit.c
··· 103 103 const struct nf_conntrack_tuple *tuple, 104 104 const union nf_inet_addr *addr, 105 105 const union nf_inet_addr *mask, 106 - const struct xt_match *match) 106 + u_int8_t family) 107 107 { 108 108 const struct nf_conntrack_tuple_hash *found; 109 109 struct xt_connlimit_conn *conn; ··· 113 113 bool addit = true; 114 114 int matches = 0; 115 115 116 - 117 - if (match->family == NFPROTO_IPV6) 116 + if (family == NFPROTO_IPV6) 118 117 hash = &data->iphash[connlimit_iphash6(addr, mask)]; 119 118 else 120 119 hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)]; ··· 156 157 continue; 157 158 } 158 159 159 - if (same_source_net(addr, mask, &conn->tuple.src.u3, 160 - match->family)) 160 + if (same_source_net(addr, mask, &conn->tuple.src.u3, family)) 161 161 /* same source network -> be counted! */ 162 162 ++matches; 163 163 nf_ct_put(found_ct); ··· 205 207 206 208 spin_lock_bh(&info->data->lock); 207 209 connections = count_them(info->data, tuple_ptr, &addr, 208 - &info->mask, par->match); 210 + &info->mask, par->family); 209 211 spin_unlock_bh(&info->data->lock); 210 212 211 213 if (connections < 0) {
+6 -10
net/rose/rose_route.c
··· 578 578 579 579 /* 580 580 * Check that the device given is a valid AX.25 interface that is "up". 581 + * called whith RTNL 581 582 */ 582 - static struct net_device *rose_ax25_dev_get(char *devname) 583 + static struct net_device *rose_ax25_dev_find(char *devname) 583 584 { 584 585 struct net_device *dev; 585 586 586 - if ((dev = dev_get_by_name(&init_net, devname)) == NULL) 587 + if ((dev = __dev_get_by_name(&init_net, devname)) == NULL) 587 588 return NULL; 588 589 589 590 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25) 590 591 return dev; 591 592 592 - dev_put(dev); 593 593 return NULL; 594 594 } 595 595 ··· 720 720 case SIOCADDRT: 721 721 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) 722 722 return -EFAULT; 723 - if ((dev = rose_ax25_dev_get(rose_route.device)) == NULL) 723 + if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) 724 724 return -EINVAL; 725 - if (rose_dev_exists(&rose_route.address)) { /* Can't add routes to ourself */ 726 - dev_put(dev); 725 + if (rose_dev_exists(&rose_route.address)) /* Can't add routes to ourself */ 727 726 return -EINVAL; 728 - } 729 727 if (rose_route.mask > 10) /* Mask can't be more than 10 digits */ 730 728 return -EINVAL; 731 729 if (rose_route.ndigis > AX25_MAX_DIGIS) 732 730 return -EINVAL; 733 731 err = rose_add_node(&rose_route, dev); 734 - dev_put(dev); 735 732 return err; 736 733 737 734 case SIOCDELRT: 738 735 if (copy_from_user(&rose_route, arg, sizeof(struct rose_route_struct))) 739 736 return -EFAULT; 740 - if ((dev = rose_ax25_dev_get(rose_route.device)) == NULL) 737 + if ((dev = rose_ax25_dev_find(rose_route.device)) == NULL) 741 738 return -EINVAL; 742 739 err = rose_del_node(&rose_route, dev); 743 - dev_put(dev); 744 740 return err; 745 741 746 742 case SIOCRSCLRRT: