Netdev List
 help / color / mirror / Atom feed
* [PATCH] SCTP: Free the per-net sysctl table on net exit. v2
From: Eric W. Biederman @ 2013-01-28  3:25 UTC (permalink / raw)
  To: David Miller; +Cc: vyasevich, netdev, linux-sctp, mmokrejs
In-Reply-To: <87libe3w69.fsf@xmission.com>

From: Vlad Yasevich <vyasevich@gmail.com>
Date: Thu, 24 Jan 2013 11:02:47 -0500

Per-net sysctl table needs to be explicitly freed at
net exit.  Otherwise we see the following with kmemleak:

unreferenced object 0xffff880402d08000 (size 2048):
  comm "chrome_sandbox", pid 18437, jiffies 4310887172 (age 9097.630s)
  hex dump (first 32 bytes):
    b2 68 89 81 ff ff ff ff 20 04 04 f8 01 88 ff ff  .h...... .......
    04 00 00 00 a4 01 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff815b4aad>] kmemleak_alloc+0x21/0x3e
    [<ffffffff81110352>] slab_post_alloc_hook+0x28/0x2a
    [<ffffffff81113fad>] __kmalloc_track_caller+0xf1/0x104
    [<ffffffff810f10c2>] kmemdup+0x1b/0x30
    [<ffffffff81571e9f>] sctp_sysctl_net_register+0x1f/0x72
    [<ffffffff8155d305>] sctp_net_init+0x100/0x39f
    [<ffffffff814ad53c>] ops_init+0xc6/0xf5
    [<ffffffff814ad5b7>] setup_net+0x4c/0xd0
    [<ffffffff814ada5e>] copy_net_ns+0x6d/0xd6
    [<ffffffff810938b1>] create_new_namespaces+0xd7/0x147
    [<ffffffff810939f4>] copy_namespaces+0x63/0x99
    [<ffffffff81076733>] copy_process+0xa65/0x1233
    [<ffffffff81077030>] do_fork+0x10b/0x271
    [<ffffffff8100a0e9>] sys_clone+0x23/0x25
    [<ffffffff815dda73>] stub_clone+0x13/0x20
    [<ffffffffffffffff>] 0xffffffffffffffff

I fixed the spelling of sysctl_header so the code actually
compiles. -- EWB.

Reported-by: Martin Mokrejs <mmokrejs@fold.natur.cuni.cz>
Signed-off-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

The typo is fixed in the patch this time in addition to my test
tree.

 net/sctp/sysctl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 043889a..bf3c6e8 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -366,7 +366,11 @@ int sctp_sysctl_net_register(struct net *net)
 
 void sctp_sysctl_net_unregister(struct net *net)
 {
+	struct ctl_table *table;
+
+	table = net->sctp.sysctl_header->ctl_table_arg;
 	unregister_net_sysctl_table(net->sctp.sysctl_header);
+	kfree(table);
 }
 
 static struct ctl_table_header * sctp_sysctl_header;
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH net-next] ethoc: Cleanup driver format
From: Barry Grussling @ 2013-01-28  4:44 UTC (permalink / raw)
  To: netdev; +Cc: Barry Grussling

From: Barry Grussling <barry@grussling.com>

Cleanup the format of ethoc.c to meet network driver style as
per checkpatch.pl.

Signed-off-by: Barry Grussling <barry@grussling.com>
---
 drivers/net/ethernet/ethoc.c |   34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 8db1c06..8504d2c 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -206,7 +206,7 @@ struct ethoc {
 	unsigned int num_rx;
 	unsigned int cur_rx;
 
-	void** vma;
+	void **vma;
 
 	struct net_device *netdev;
 	struct napi_struct napi;
@@ -292,7 +292,7 @@ static int ethoc_init_ring(struct ethoc *dev, unsigned long mem_start)
 {
 	struct ethoc_bd bd;
 	int i;
-	void* vma;
+	void *vma;
 
 	dev->cur_tx = 0;
 	dev->dty_tx = 0;
@@ -447,8 +447,8 @@ static int ethoc_rx(struct net_device *dev, int limit)
 				netif_receive_skb(skb);
 			} else {
 				if (net_ratelimit())
-					dev_warn(&dev->dev, "low on memory - "
-							"packet dropped\n");
+					dev_warn(&dev->dev,
+					    "low on memory - packet dropped\n");
 
 				dev->stats.rx_dropped++;
 				break;
@@ -555,9 +555,8 @@ static irqreturn_t ethoc_interrupt(int irq, void *dev_id)
 	pending = ethoc_read(priv, INT_SOURCE);
 	pending &= mask;
 
-	if (unlikely(pending == 0)) {
+	if (unlikely(pending == 0))
 		return IRQ_NONE;
-	}
 
 	ethoc_ack_irq(priv, pending);
 
@@ -620,7 +619,7 @@ static int ethoc_mdio_read(struct mii_bus *bus, int phy, int reg)
 	ethoc_write(priv, MIIADDRESS, MIIADDRESS_ADDR(phy, reg));
 	ethoc_write(priv, MIICOMMAND, MIICOMMAND_READ);
 
-	for (i=0; i < 5; i++) {
+	for (i = 0; i < 5; i++) {
 		u32 status = ethoc_read(priv, MIISTATUS);
 		if (!(status & MIISTATUS_BUSY)) {
 			u32 data = ethoc_read(priv, MIIRX_DATA);
@@ -628,7 +627,7 @@ static int ethoc_mdio_read(struct mii_bus *bus, int phy, int reg)
 			ethoc_write(priv, MIICOMMAND, 0);
 			return data;
 		}
-		usleep_range(100,200);
+		usleep_range(100, 200);
 	}
 
 	return -EBUSY;
@@ -643,14 +642,14 @@ static int ethoc_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
 	ethoc_write(priv, MIITX_DATA, val);
 	ethoc_write(priv, MIICOMMAND, MIICOMMAND_WRITE);
 
-	for (i=0; i < 5; i++) {
+	for (i = 0; i < 5; i++) {
 		u32 stat = ethoc_read(priv, MIISTATUS);
 		if (!(stat & MIISTATUS_BUSY)) {
 			/* reset MII command register */
 			ethoc_write(priv, MIICOMMAND, 0);
 			return 0;
 		}
-		usleep_range(100,200);
+		usleep_range(100, 200);
 	}
 
 	return -EBUSY;
@@ -671,11 +670,10 @@ static int ethoc_mdio_probe(struct net_device *dev)
 	struct phy_device *phy;
 	int err;
 
-	if (priv->phy_id != -1) {
+	if (priv->phy_id != -1)
 		phy = priv->mdio->phy_map[priv->phy_id];
-	} else {
+	else
 		phy = phy_find_first(priv->mdio);
-	}
 
 	if (!phy) {
 		dev_err(&dev->dev, "no PHY found\n");
@@ -1022,7 +1020,7 @@ static int ethoc_probe(struct platform_device *pdev)
 	dev_dbg(&pdev->dev, "ethoc: num_tx: %d num_rx: %d\n",
 		priv->num_tx, priv->num_rx);
 
-	priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void*), GFP_KERNEL);
+	priv->vma = devm_kzalloc(&pdev->dev, num_bd*sizeof(void *), GFP_KERNEL);
 	if (!priv->vma) {
 		ret = -ENOMEM;
 		goto error;
@@ -1038,7 +1036,7 @@ static int ethoc_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 		{
-		const uint8_t* mac;
+		const uint8_t *mac;
 
 		mac = of_get_property(pdev->dev.of_node,
 				      "local-mac-address",
@@ -1050,12 +1048,14 @@ static int ethoc_probe(struct platform_device *pdev)
 	}
 
 	/* Check that the given MAC address is valid. If it isn't, read the
-	 * current MAC from the controller. */
+	 * current MAC from the controller.
+	 */
 	if (!is_valid_ether_addr(netdev->dev_addr))
 		ethoc_get_mac_address(netdev, netdev->dev_addr);
 
 	/* Check the MAC again for validity, if it still isn't choose and
-	 * program a random one. */
+	 * program a random one.
+	 */
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
 		eth_random_addr(netdev->dev_addr);
 		random_mac = true;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH] [PATCH] tcp: Increment of LINUX_MIB_LISTENOVERFLOWS in tcp_v4_conn_request() (updated)
From: Vijay Subramanian @ 2013-01-28  5:02 UTC (permalink / raw)
  To: Nivedita Singhvi; +Cc: netdev, David Miller, Nivedita Singhvi
In-Reply-To: <CAGK4HS9_xZSWVHBQX3DwvR7swnGqqccdD8mvL-i20a2dnOvK1A@mail.gmail.com>

On 27 January 2013 18:01, Vijay Subramanian <subramanian.vijay@gmail.com> wrote:
> On 27 January 2013 17:45, Nivedita Singhvi <niveditasinghvi@gmail.com> wrote:
>> From: Nivedita Singhvi <niv@us.ibm.com>
>>
>> We drop a connection request if the accept backlog is full and there are
>> sufficient packets in the syn queue to warrant starting drops. Increment the
>> appropriate counter so this isn't silent, for accurate stats and help in
>> debugging.
>>
>> Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
>

The patch is ok but I think we missed something. Please consider the
following in
tcp_v4_syn_recv_sock()

exit_overflow:
        NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
exit_nonewsk:
        dst_release(dst);
exit:
        NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
        return NULL;
put_and_exit:
        inet_csk_prepare_forced_close(newsk);
        tcp_done(newsk);
        goto exit;


When ListenOverflows is incremented, so is ListenDrops. This is
because overflows is one of  several reasons why a SYN can be dropped
by a socket in LISTEN state. When we increment ListenOverflows, we
should also increment ListenDrops.

So we also need
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);

Would you mind updating this?  (If you want me to do it as I acked the
patch, let me know.)

Thanks,
Vijay

^ permalink raw reply

* Re: [PATCH] SCTP: Free the per-net sysctl table on net exit. v2
From: David Miller @ 2013-01-28  5:11 UTC (permalink / raw)
  To: ebiederm; +Cc: vyasevich, netdev, linux-sctp, mmokrejs
In-Reply-To: <87obgayoo8.fsf_-_@xmission.com>

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Sun, 27 Jan 2013 19:25:11 -0800

> The typo is fixed in the patch this time in addition to my test
> tree.

Applied, thanks for fixing this up Eric.

^ permalink raw reply

* Re: [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16
From: David Miller @ 2013-01-28  5:16 UTC (permalink / raw)
  To: amirv; +Cc: netdev, ogerlitz
In-Reply-To: <1359028459-30961-1-git-send-email-amirv@mellanox.com>

From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 24 Jan 2013 13:54:13 +0200

> These are all small bug fixes to the Mellanox mlx4 driver, patches done against
> net-next commit d59577b "sk-filter: Add ability to lock a socket filter program"

All applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH] dm9601: support dm9620 variant
From: David Miller @ 2013-01-28  5:18 UTC (permalink / raw)
  To: jacmet; +Cc: netdev, slawek
In-Reply-To: <1359326062-5042-1-git-send-email-jacmet@sunsite.dk>

From: Peter Korsgaard <jacmet@sunsite.dk>
Date: Sun, 27 Jan 2013 23:34:22 +0100

> dm9620 is a newer variant of dm9601 with more features (usb 2.0, checksum
> offload, ..), but it can also be put in a dm9601 compatible mode, allowing
> us to reuse the existing driver.
> 
> This does mean that the extended features like checksum offload cannot be
> used, but that's hardly critical on a 100mbps interface.
> 
> Thanks to Sławek Wernikowski <slawek@wernikowski.net> for providing me
> with a dm9620 based device to test.
> 
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>

Applied, thanks Peter.

^ permalink raw reply

* Re: Doubts about listen backlog and tcp_max_syn_backlog
From: Vijay Subramanian @ 2013-01-28  5:21 UTC (permalink / raw)
  To: Nivedita Singhvi
  Cc: Leandro Lucarella, Rick Jones, Eric Dumazet, netdev, linux-kernel
In-Reply-To: <5105E6F2.2010805@gmail.com>

> +    { "ListenDrops", N_("%u SYNs to LISTEN sockets dropped"), opt_number },
>
> (see the file debian/patches/CVS-20081003-statistics.c_sync.patch
>  in the net-tools src)
>
> i.e., the netstat pkg is printing the value of the TCPEXT MIB counter
> that's counting TCPExtListenDrops.
>
> Theoretically, that number should be the same as that printed by nstat,
> as they are getting it from the same kernel stats counter. I have not
> looked at nstat code (I actually almost always dump the counters from
> /proc/net/{netstat + snmp} via a simple prettyprint script (will send
> you that offline).
>

nstat pretty much does what you describe which is to parse the
/proc/net files(s) and
print the contents. This is one advantage of nstat over netstat. When
you add a new MIB, you
do not need to update nstat.

> If the nstat and netstat counters don't match, something is fishy.
> That nstat output is broken.
>

^ permalink raw reply

* Re: pull-request: can-next 2013-01-26
From: David Miller @ 2013-01-28  5:24 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can
In-Reply-To: <5103FFA3.5020507@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Sat, 26 Jan 2013 17:09:07 +0100

> this is a pull-request for net-next/master. There is are 9 patches by 
> Fabio Baltieri and Kurt Van Dijck which add LED infrastructure and
> support for CAN devices. Bernd Krumboeck adds a driver for the USB CAN
> adapter from 8 devices. Oliver Hartkopp improves the CAN gateway
> functionality. There are 4 patches by me, which clean up the CAN's
> Kconfig.

Pulled, although:

1) You need to create an accessor helper for that can_skb_priv
   thing, every access to it is that horrible cast expression.

2) There is no reason to accomodate out of tree stuff, and for that
   reason I see no reason why you should need that headroom size
   check at all.

   Either the driver uses alloc_can_skb() or it does it's own SKB
   allocation and in-tree you've fixed that.

   You're just asking for trouble by trying to accomodate out of
   tree guys anyways, why if they create a headroom that happens
   to be the size of can_skb_priv.  See what a joke that test is?
   It's not really protecting fully against anything.

Thanks.

^ permalink raw reply

* Re: [PATCH net-next] net: fix possible wrong checksum generation
From: David Miller @ 2013-01-28  5:28 UTC (permalink / raw)
  To: eric.dumazet; +Cc: pshelar, netdev, jesse
In-Reply-To: <1359182077.5222.132.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 25 Jan 2013 22:34:37 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Pravin Shelar mentioned that GSO could potentially generate
> wrong TX checksum if skb has fragments that are overwritten
> by the user between the checksum computation and transmit.
> 
> He suggested to linearize skbs but this extra copy can be
> avoided for normal tcp skbs cooked by tcp_sendmsg().
> 
> This patch introduces a new SKB_GSO_SHARED_FRAG flag, set
> in skb_shinfo(skb)->gso_type if at least one frag can be
> modified by the user.
> 
> Typical sources of such possible overwrites are {vm}splice(),
> sendfile(), and macvtap/tun/virtio_net drivers.
> 
> Tested:
 ...
> Performance of the SENDFILE is impacted by the extra allocation and
> copy, and because we use order-0 pages, while the TCP_STREAM uses
> bigger pages.
> 
> Reported-by: Pravin Shelar <pshelar@nicira.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply

* Re: pull-request: can-next 2013-01-26
From: Oliver Hartkopp @ 2013-01-28  5:58 UTC (permalink / raw)
  To: David Miller; +Cc: mkl, netdev, linux-can
In-Reply-To: <20130128.002455.638752456075920210.davem@davemloft.net>

On 28.01.2013 06:24, David Miller wrote:

> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Date: Sat, 26 Jan 2013 17:09:07 +0100
> 
>> this is a pull-request for net-next/master. There is are 9 patches by 
>> Fabio Baltieri and Kurt Van Dijck which add LED infrastructure and
>> support for CAN devices. Bernd Krumboeck adds a driver for the USB CAN
>> adapter from 8 devices. Oliver Hartkopp improves the CAN gateway
>> functionality. There are 4 patches by me, which clean up the CAN's
>> Kconfig.
> 
> Pulled, although:
> 
> 1) You need to create an accessor helper for that can_skb_priv
>    thing, every access to it is that horrible cast expression.


Ok, will do.

> 
> 2) There is no reason to accomodate out of tree stuff, and for that
>    reason I see no reason why you should need that headroom size
>    check at all.
> 
>    Either the driver uses alloc_can_skb() or it does it's own SKB
>    allocation and in-tree you've fixed that.
> 
>    You're just asking for trouble by trying to accomodate out of
>    tree guys anyways, why if they create a headroom that happens
>    to be the size of can_skb_priv.  See what a joke that test is?
>    It's not really protecting fully against anything.


I see.

I'll remove the check and try to inform the few out of tree guys that i'm
aware of.

Thanks,
Oliver

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2013-01-28  6:03 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


Much more accumulated than I would have liked due to an
unexpected bout with a nasty flu.

1) AH and ESP input don't set ECN field correctly because the transport
   head of the SKB isn't set correctly, fix from Li RongQing.

2) If netfilter conntrack zones are disabled, we can return an uninitialized
   variable instead of the proper error code.  Fix from Borislav Petkov.

3) Fix double SKB free in ath9k driver beacon handling, from Felix Feitkau.

4) Remove bogus assumption about netns cleanup ordering in nf_conntrack,
   from Pablo Neira Ayuso.

5) Remove a bogus BUG_ON in the new TCP fastopen code, from Eric
   Dumazet.  It uses spin_is_locked() in it's test and is therefore
   unsuitable for UP.

6) Fix SELINUX labelling regressions added by the tuntap multiqueue
   changes, from Paul Moore.

7) Fix CRC errors with jumbo frame receive in tg3 driver, from Nithin
   Nayak Sujir.

8) CXGB4 driver sets interrupt coalescing parameters only on first
   queue, rather than all of them.  Fix from Thadeu Lima de Souza
   Cascardo.

9) Fix regression in the dispatch of read/write registers in dm9601
   driver, from Tushar Behera.

10) ipv6_append_data miscalculates header length, from Romain KUNTZ.

11) Fix PMTU handling regressions on ipv4 routes, from Steffen
    Klassert, Timo Teräs, and Julian Anastasov.

12) In 3c574_cs driver, add necessary parenthesis to "x << y & z"
    expression.  From Nickolai Zeldovich.

13) macvlan_get_size() causes underallocation netlink message space,
    fix from Eric Dumazet.

14) Avoid division by zero in xfrm_replay_advance_bmp(), from Nickolai
    Zeldovich.  Amusingly the zero check was already there, we were
    just performing it after the modulus :-)

15) Some more splice bug fixes from Eric Dumazet, which fix things mostly
    eminating from how we now more aggressively use high-order pages in
    SKBs.

16) Fix size calculation bug when freeing hash tables in the IPSEC xfrm
    code, from Michal Kubecek.

17) Fix PMTU event propagation into socket cached routes, from Steffen
    Klassert.

18) Fix off by one in TX buffer release in netxen driver, from Eric
    Dumazet.

19) Fix rediculous memory allocation requirements introduced by the
    tuntap multiqueue changes, from Jason Wang.

20) Remove bogus AMD platform workaround in r8169 driver that causes major
    problems in normal operation, from Timo Teräs.

21) virtio-net set affinity and select queue don't handle discontiguous
    cpu numbers properly, fix from Wanlong Gao.

22) Fix a route refcounting issue in loopback driver, from Eric Dumazet.
    There's a similar fix coming that we might add to the macvlan driver
    as well.

23) Fix SKB leaks in batman-adv's distributed arp table code, from
    Matthias Schiffer.

24) r8169 driver gives descriptor ownership back the hardware before we're
    done reading the VLAN tag out of it, fix from Francois Romieu.

25) Checksums not calculated properly in GRE tunnel driver fix from
    Pravin B Shelar.

26) Fix SCTP memory leak on namespace exit.

Please pull, thanks a lot!

The following changes since commit 3152ba0f86428cebe8a9f8462d5be0a9aefa6289:

  Merge tag 'dt-fixes-for-3.8' of git://sources.calxeda.com/kernel/linux (2013-01-14 13:19:08 -0800)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master

for you to fetch changes up to 6642f91c92da07369cf1e582503ea3ccb4a7f1a9:

  dm9601: support dm9620 variant (2013-01-28 00:18:04 -0500)

----------------------------------------------------------------
AceLan Kao (3):
      Bluetooth: Add support for IMC Networks [13d3:3393]
      Bluetooth: Add support for Foxconn / Hon Hai [0489:e04e]
      Bluetooth: Add support for Foxconn / Hon Hai [0489:e056]

Amitkumar Karwar (2):
      mwifiex: update config_bands during infra association
      mwifiex: correct config_bands handling for ibss network

Anderson Lizardo (1):
      Bluetooth: Fix incorrect strncpy() in hidp_setup_hid()

Avinash Patil (1):
      mwifiex: fix typo in PCIe adapter NULL check

Bjørn Mork (7):
      net: qmi_wwan: add TP-LINK HSUPA Modem MA180
      net: qmi_wwan: add ONDA MT8205 4G LTE
      net: cdc_ncm: workaround for missing CDC Union
      net: cdc_mbim: send ZLP after max sized NTBs
      net: cdc_ncm: fix error path for single interface probing
      net: cdc_mbim: send ZLP only for the specific buggy device
      net: cdc_ncm: use IAD provided by the USB core

Bob Copeland (2):
      mac80211: set NEED_TXPROCESSING for PERR frames
      mac80211: add encrypt headroom to PERR frames

Dan Carpenter (1):
      ip6mr: limit IPv6 MRT_TABLE identifiers

Daniel Schaal (1):
      Bluetooth: Add support for GC-WB300D PCIe [04ca:3006] to ath3k.

Daniel Wagner (1):
      net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly

David S. Miller (6):
      Merge branch 'master' of git://1984.lsi.us.es/nf
      Merge branch 'wireless'
      Merge branch 'usb_cdc_fixes'
      Merge branch 'master' of git://git.kernel.org/.../klassert/ipsec
      Merge branch 'for-davem' of git://git.kernel.org/.../linville/wireless
      Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge

Emmanuel Grumbach (1):
      iwlwifi: audit single frames from AGG queue in RS

Eric Dumazet (7):
      tcp: fix a panic on UP machines in reqsk_fastopen_remove
      macvlan: fix macvlan_get_size()
      tcp: fix incorrect LOCKDROPPEDICMPS counter
      net: splice: avoid high order page splitting
      net: splice: fix __splice_segment()
      netxen: fix off by one bug in netxen_release_tx_buffer()
      net: loopback: fix a dst refcounting issue

Felix Fietkau (11):
      ath9k: do not link receive buffers during flush
      ath9k: fix double-free bug on beacon generate failure
      ath9k: remove the WARN_ON that triggers if generating a beacon fails
      ath9k: add a better fix for the rx tasklet vs rx flush race
      ath9k: fix rx flush handling
      ath9k: remove sc->rx.rxbuflock to fix a deadlock
      ath9k: disable the tasklet before taking the PCU lock
      mac80211: fix monitor mode injection
      ath9k_hw: fix calibration issues on chainmask that don't include chain 0
      ath9k_hw: fix chain swap setting when setting rx chainmask to 5
      ath9k: allow setting arbitrary antenna masks on AR9003+

Giuseppe CAVALLARO (1):
      net: phy: icplus: fix broken INTR pin settings

Gustavo Padovan (1):
      Bluetooth: Check if the hci connection exists in SCO shutdown

Jacob Keller (2):
      ixgbe: only compile ixgbe_debugfs.o when enabled
      ixgbe: Fix overwriting of rx_mtrl in ixgbe_ptp_hwtstamp_ioctl

Jaganath Kanakkassery (1):
      Bluetooth: Fix authentication if acl data comes before remote feature evt

Jan Engelhardt (1):
      netfilter: x_tables: print correct hook names for ARP

Jason Wang (2):
      tuntap: reduce memory using of queues
      tuntap: limit the number of flow caches

Jianjun Kong (1):
      net/hyperv: fix wrong length of mac address

Johannes Berg (1):
      mac80211: fix FT roaming

John W. Linville (4):
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
      Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
      Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem

Larry Finger (1):
      rtlwifi: Fix build warning introduced by commit a290593

Li RongQing (2):
      ah4/esp4: set transport header correctly for IPsec tunnel mode.
      ah6/esp6: set transport header correctly for IPsec tunnel mode.

Matthias Schiffer (3):
      batman-adv: fix skb leak in batadv_dat_snoop_incoming_arp_reply()
      batman-adv: check for more types of invalid IP addresses in DAT
      batman-adv: filter ARP packets with invalid MAC addresses in DAT

Michal Kubecek (1):
      xfrm: fix freed block size calculation in xfrm_policy_fini()

Neil Horman (1):
      sctp: refactor sctp_outq_teardown to insure proper re-initalization

Nickolai Zeldovich (2):
      3c574_cs: fix operator precedence between << and &
      net/xfrm/xfrm_replay: avoid division by zero

Nithin Nayak Sujir (2):
      tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode
      tg3: Fix crc errors on jumbo frame receive

Olivier Sobrie (3):
      can: c_can: fix invalid error codes
      can: ti_hecc: fix invalid error codes
      can: pch_can: fix invalid error codes

Or Gerlitz (1):
      net/mlx4_core: Set number of msix vectors under SRIOV mode to firmware defaults

Pablo Neira Ayuso (2):
      netfilter: xt_CT: fix unset return value if conntrack zone are disabled
      netfilter: nf_conntrack: fix BUG_ON while removing nf_conntrack with netns

Paul Moore (2):
      selinux: add the "attach_queue" permission to the "tun_socket" class
      tun: fix LSM/SELinux labeling of tun/tap devices

Peter Korsgaard (1):
      dm9601: support dm9620 variant

Piotr Haber (1):
      brcmsmac: increase timer reference count for new timers only

Pravin B Shelar (1):
      IP_GRE: Fix kernel panic in IP_GRE with GRE csum.

Rob Herring (1):
      net: calxedaxgmac: throw away overrun frames

Romain KUNTZ (1):
      ipv6: fix header length calculation in ip6_append_data()

Sergio Cambra (1):
      Bluetooth device 04ca:3008 should use ath3k

Stanislaw Gruszka (2):
      mac80211: synchronize scan off/on-channel and PS states
      iwlegacy: fix IBSS cleanup

Stef van Os (1):
      phy/marvell: remove fiber/copper autoselect on 88e1111

Steffen Klassert (7):
      ipv4: Remove output route check in ipv4_mtu
      ipv4: Don't update the pmtu on mtu locked routes
      ipv6: Add an error handler for icmp6
      xfrm4: Invalidate all ipv4 routes on IPsec pmtu events
      ipv4: Invalidate the socket cached route on pmtu events if possible
      ipv4: Add a socket release callback for datagram sockets
      ipv4: Fix route refcount on pmtu discovery

Stephen Hemminger (1):
      MAINTAINERS: Stephen Hemminger email change

Stuart Menefy (1):
      net: phy: icplus: Use the RGMII interface mode to configure clock delays

Sujith Manoharan (1):
      ath9k_htc: Fix memory leak

Szymon Janc (1):
      Bluetooth: Fix sending HCI commands after reset

Thadeu Lima de Souza Cascardo (1):
      cxgb4: set coalesce parameters on all queues

Tilman Schmidt (1):
      isdn/gigaset: fix zero size border case in debug dump

Timo Teräs (1):
      r8169: remove the obsolete and incorrect AMD workaround

Tushar Behera (1):
      usbnet: dm9601: Fix incorrect command

Vlad Yasevich (1):
      SCTP: Free the per-net sysctl table on net exit. v2

Wanlong Gao (3):
      virtio-net: fix the set affinity bug when CPU IDs are not consecutive
      virtio-net: split out clean affinity function
      virtio-net: reset virtqueue affinity when doing cpu hotplug

Wei Shuai (2):
      usbnet: add new flag FLAG_NOARP for usb net devices
      cdc_ncm: add support FLAG_NOARP for Infineon modem platform

Xufeng Zhang (1):
      sctp: set association state to established in dupcook_a handler

Yan Burman (1):
      net/mlx4_en: Fix bridged vSwitch configuration for non SRIOV mode

françois romieu (1):
      r8169: fix vlan tag read ordering.

 MAINTAINERS                                           |   6 +--
 drivers/bluetooth/ath3k.c                             |  10 +++++
 drivers/bluetooth/btusb.c                             |   5 +++
 drivers/isdn/gigaset/capi.c                           |   2 +
 drivers/net/can/c_can/c_can.c                         |   4 +-
 drivers/net/can/pch_can.c                             |   2 +-
 drivers/net/can/ti_hecc.c                             |   4 +-
 drivers/net/ethernet/3com/3c574_cs.c                  |   2 +-
 drivers/net/ethernet/broadcom/tg3.c                   |  62 ++++++++++++++++++-----------
 drivers/net/ethernet/calxeda/xgmac.c                  |   4 ++
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c       |  17 ++++++--
 drivers/net/ethernet/intel/ixgbe/Makefile             |   3 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c      |   5 ---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c          |   4 +-
 drivers/net/ethernet/mellanox/mlx4/en_tx.c            |  13 ++++--
 drivers/net/ethernet/mellanox/mlx4/main.c             |  11 +-----
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c  |   2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c  |   2 +
 drivers/net/ethernet/realtek/r8169.c                  |  21 +++-------
 drivers/net/hyperv/hyperv_net.h                       |   2 +-
 drivers/net/hyperv/netvsc_drv.c                       |   2 +-
 drivers/net/loopback.c                                |   5 +++
 drivers/net/macvlan.c                                 |   5 ++-
 drivers/net/phy/icplus.c                              |  29 +++++++++-----
 drivers/net/phy/marvell.c                             |   9 -----
 drivers/net/tun.c                                     |  45 +++++++++++++++------
 drivers/net/usb/cdc_mbim.c                            |  19 +++++++++
 drivers/net/usb/cdc_ncm.c                             |  31 ++++++++++++++-
 drivers/net/usb/dm9601.c                              |  52 ++++++++++++++++--------
 drivers/net/usb/qmi_wwan.c                            |   2 +
 drivers/net/usb/usbnet.c                              |   4 ++
 drivers/net/virtio_net.c                              | 118 +++++++++++++++++++++++++++++++++++++++++++++----------
 drivers/net/wireless/ath/ath9k/ar9003_calib.c         |   2 +
 drivers/net/wireless/ath/ath9k/ar9003_phy.c           |  27 ++++---------
 drivers/net/wireless/ath/ath9k/ath9k.h                |   3 --
 drivers/net/wireless/ath/ath9k/beacon.c               |   2 +-
 drivers/net/wireless/ath/ath9k/debug.c                |   1 -
 drivers/net/wireless/ath/ath9k/debug.h                |   2 -
 drivers/net/wireless/ath/ath9k/htc_hst.c              |   2 +
 drivers/net/wireless/ath/ath9k/hw.h                   |   1 +
 drivers/net/wireless/ath/ath9k/main.c                 |  22 +++++------
 drivers/net/wireless/ath/ath9k/recv.c                 |  54 +++++++------------------
 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c |   7 ++--
 drivers/net/wireless/iwlegacy/common.c                |  35 +++++++----------
 drivers/net/wireless/iwlwifi/dvm/tx.c                 |   2 +
 drivers/net/wireless/mwifiex/cfg80211.c               |  17 +-------
 drivers/net/wireless/mwifiex/pcie.c                   |   2 +-
 drivers/net/wireless/mwifiex/sta_ioctl.c              |  14 +++++++
 drivers/net/wireless/rtlwifi/Kconfig                  |   4 +-
 include/linux/security.h                              |  59 ++++++++++++++++++++++------
 include/linux/usb/usbnet.h                            |   1 +
 include/net/ip.h                                      |   2 +
 include/net/netfilter/nf_conntrack_core.h             |   2 +
 net/batman-adv/distributed-arp-table.c                |  19 ++++++++-
 net/bluetooth/hci_core.c                              |   8 ----
 net/bluetooth/hci_event.c                             |   2 +-
 net/bluetooth/hidp/core.c                             |   2 +-
 net/bluetooth/l2cap_core.c                            |  11 ++++++
 net/bluetooth/sco.c                                   |   2 +-
 net/core/request_sock.c                               |   2 -
 net/core/scm.c                                        |   5 ++-
 net/core/skbuff.c                                     |  44 ++++++---------------
 net/ipv4/ah4.c                                        |  18 +++++++--
 net/ipv4/datagram.c                                   |  25 ++++++++++++
 net/ipv4/esp4.c                                       |  12 ++++--
 net/ipv4/ip_gre.c                                     |   6 ++-
 net/ipv4/ipcomp.c                                     |   7 +++-
 net/ipv4/ping.c                                       |   1 +
 net/ipv4/raw.c                                        |   1 +
 net/ipv4/route.c                                      |  54 ++++++++++++++++++++++++-
 net/ipv4/tcp_ipv4.c                                   |   9 ++---
 net/ipv4/udp.c                                        |   1 +
 net/ipv6/ah6.c                                        |  11 +++++-
 net/ipv6/esp6.c                                       |   5 ++-
 net/ipv6/icmp.c                                       |  12 ++++++
 net/ipv6/ip6_output.c                                 |   4 +-
 net/ipv6/ip6mr.c                                      |   3 ++
 net/mac80211/cfg.c                                    |  12 +++++-
 net/mac80211/ieee80211_i.h                            |   6 +--
 net/mac80211/mesh_hwmp.c                              |   5 ++-
 net/mac80211/offchannel.c                             |  19 ++++-----
 net/mac80211/scan.c                                   |  15 +++----
 net/mac80211/tx.c                                     |   9 +++--
 net/netfilter/nf_conntrack_core.c                     |   9 +++--
 net/netfilter/nf_conntrack_standalone.c               |   1 +
 net/netfilter/x_tables.c                              |  28 +++++++++----
 net/netfilter/xt_CT.c                                 |   4 +-
 net/sctp/outqueue.c                                   |  12 ++++--
 net/sctp/sm_statefuns.c                               |   4 +-
 net/sctp/sysctl.c                                     |   4 ++
 net/xfrm/xfrm_policy.c                                |   2 +-
 net/xfrm/xfrm_replay.c                                |   4 +-
 security/capability.c                                 |  24 +++++++++--
 security/security.c                                   |  28 ++++++++++---
 security/selinux/hooks.c                              |  50 +++++++++++++++++------
 security/selinux/include/classmap.h                   |   2 +-
 security/selinux/include/objsec.h                     |   4 ++
 97 files changed, 851 insertions(+), 418 deletions(-)

^ permalink raw reply

* [Patch net-next] pktgen: support net namespace
From: Cong Wang @ 2013-01-28  6:32 UTC (permalink / raw)
  To: netdev; +Cc: Eric W. Biederman, David S. Miller, Cong Wang

From: Cong Wang <amwang@redhat.com>

This patch add net namespace to pktgen, so that
we can use pktgen in different namespaces.

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
 net/core/pktgen.c |  132 +++++++++++++++++++++++++++++++++++------------------
 1 files changed, 87 insertions(+), 45 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b29dacf..b6be493 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -164,6 +164,7 @@
 #ifdef CONFIG_XFRM
 #include <net/xfrm.h>
 #endif
+#include <net/netns/generic.h>
 #include <asm/byteorder.h>
 #include <linux/rcupdate.h>
 #include <linux/bitops.h>
@@ -212,7 +213,6 @@
 #define PKTGEN_MAGIC 0xbe9be955
 #define PG_PROC_DIR "pktgen"
 #define PGCTRL	    "pgctrl"
-static struct proc_dir_entry *pg_proc_dir;
 
 #define MAX_CFLOWS  65536
 
@@ -414,6 +414,15 @@ struct pktgen_thread {
 
 	wait_queue_head_t queue;
 	struct completion start_done;
+	struct pktgen_net *net;
+};
+
+static int pg_net_id __read_mostly;
+
+struct pktgen_net {
+	struct net		*net;
+	struct net_device	*dev;
+	struct proc_dir_entry	*proc_dir;
 };
 
 #define REMOVE 1
@@ -1886,15 +1895,16 @@ static void pktgen_change_name(struct net_device *dev)
 
 	list_for_each_entry(t, &pktgen_threads, th_list) {
 		struct pktgen_dev *pkt_dev;
+		struct pktgen_net *pn = t->net;
 
 		list_for_each_entry(pkt_dev, &t->if_list, list) {
 			if (pkt_dev->odev != dev)
 				continue;
 
-			remove_proc_entry(pkt_dev->entry->name, pg_proc_dir);
+			remove_proc_entry(pkt_dev->entry->name, pn->proc_dir);
 
 			pkt_dev->entry = proc_create_data(dev->name, 0600,
-							  pg_proc_dir,
+							  pn->proc_dir,
 							  &pktgen_if_fops,
 							  pkt_dev);
 			if (!pkt_dev->entry)
@@ -1909,8 +1919,9 @@ static int pktgen_device_event(struct notifier_block *unused,
 			       unsigned long event, void *ptr)
 {
 	struct net_device *dev = ptr;
+	struct pktgen_net *pn = net_generic(dev_net(dev), pg_net_id);
 
-	if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
+	if (pn->dev != dev || pktgen_exiting)
 		return NOTIFY_DONE;
 
 	/* It is OK that we do not hold the group lock right now,
@@ -1930,7 +1941,8 @@ static int pktgen_device_event(struct notifier_block *unused,
 	return NOTIFY_DONE;
 }
 
-static struct net_device *pktgen_dev_get_by_name(struct pktgen_dev *pkt_dev,
+static struct net_device *pktgen_dev_get_by_name(const struct pktgen_net *pn,
+						 struct pktgen_dev *pkt_dev,
 						 const char *ifname)
 {
 	char b[IFNAMSIZ+5];
@@ -1944,13 +1956,14 @@ static struct net_device *pktgen_dev_get_by_name(struct pktgen_dev *pkt_dev,
 	}
 	b[i] = 0;
 
-	return dev_get_by_name(&init_net, b);
+	return dev_get_by_name(pn->net, b);
 }
 
 
 /* Associate pktgen_dev with a device. */
 
-static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
+static int pktgen_setup_dev(const struct pktgen_net *pn,
+			    struct pktgen_dev *pkt_dev, const char *ifname)
 {
 	struct net_device *odev;
 	int err;
@@ -1961,7 +1974,7 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
 		pkt_dev->odev = NULL;
 	}
 
-	odev = pktgen_dev_get_by_name(pkt_dev, ifname);
+	odev = pktgen_dev_get_by_name(pn, pkt_dev, ifname);
 	if (!odev) {
 		pr_err("no such netdevice: \"%s\"\n", ifname);
 		return -ENODEV;
@@ -2203,9 +2216,10 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
 static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
 {
 	struct xfrm_state *x = pkt_dev->flows[flow].x;
+	struct pktgen_net *pn = net_generic(dev_net(pkt_dev->odev), pg_net_id);
 	if (!x) {
 		/*slow path: we dont already have xfrm_state*/
-		x = xfrm_stateonly_find(&init_net, DUMMY_MARK,
+		x = xfrm_stateonly_find(pn->net, DUMMY_MARK,
 					(xfrm_address_t *)&pkt_dev->cur_daddr,
 					(xfrm_address_t *)&pkt_dev->cur_saddr,
 					AF_INET,
@@ -3154,9 +3168,7 @@ static void pktgen_rem_all_ifs(struct pktgen_thread *t)
 static void pktgen_rem_thread(struct pktgen_thread *t)
 {
 	/* Remove from the thread list */
-
-	remove_proc_entry(t->tsk->comm, pg_proc_dir);
-
+	remove_proc_entry(t->tsk->comm, t->net->proc_dir);
 }
 
 static void pktgen_resched(struct pktgen_dev *pkt_dev)
@@ -3459,13 +3471,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
 	pkt_dev->svlan_id = 0xffff;
 	pkt_dev->node = -1;
 
-	err = pktgen_setup_dev(pkt_dev, ifname);
+	err = pktgen_setup_dev(t->net, pkt_dev, ifname);
 	if (err)
 		goto out1;
 	if (pkt_dev->odev->priv_flags & IFF_TX_SKB_SHARING)
 		pkt_dev->clone_skb = pg_clone_skb_d;
 
-	pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir,
+	t->net->dev = pkt_dev->odev;
+	pkt_dev->entry = proc_create_data(ifname, 0600, t->net->proc_dir,
 					  &pktgen_if_fops, pkt_dev);
 	if (!pkt_dev->entry) {
 		pr_err("cannot create %s/%s procfs entry\n",
@@ -3490,7 +3503,7 @@ out1:
 	return err;
 }
 
-static int __init pktgen_create_thread(int cpu)
+static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
 {
 	struct pktgen_thread *t;
 	struct proc_dir_entry *pe;
@@ -3524,7 +3537,7 @@ static int __init pktgen_create_thread(int cpu)
 	kthread_bind(p, cpu);
 	t->tsk = p;
 
-	pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir,
+	pe = proc_create_data(t->tsk->comm, 0600, pn->proc_dir,
 			      &pktgen_thread_fops, t);
 	if (!pe) {
 		pr_err("cannot create %s/%s procfs entry\n",
@@ -3535,6 +3548,7 @@ static int __init pktgen_create_thread(int cpu)
 		return -EINVAL;
 	}
 
+	t->net = pn;
 	wake_up_process(p);
 	wait_for_completion(&t->start_done);
 
@@ -3560,6 +3574,7 @@ static void _rem_dev_from_if_list(struct pktgen_thread *t,
 static int pktgen_remove_device(struct pktgen_thread *t,
 				struct pktgen_dev *pkt_dev)
 {
+	struct pktgen_net *pn = t->net;
 
 	pr_debug("remove_device pkt_dev=%p\n", pkt_dev);
 
@@ -3580,7 +3595,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
 	_rem_dev_from_if_list(t, pkt_dev);
 
 	if (pkt_dev->entry)
-		remove_proc_entry(pkt_dev->entry->name, pg_proc_dir);
+		remove_proc_entry(pkt_dev->entry->name, pn->proc_dir);
 
 #ifdef CONFIG_XFRM
 	free_SAs(pkt_dev);
@@ -3592,49 +3607,78 @@ static int pktgen_remove_device(struct pktgen_thread *t,
 	return 0;
 }
 
-static int __init pg_init(void)
+static int __net_init pg_net_init(struct net *net)
 {
-	int cpu;
-	struct proc_dir_entry *pe;
-	int ret = 0;
-
-	pr_info("%s", version);
+	struct pktgen_net *pn = net_generic(net, pg_net_id);
+	int cpu, ret = 0;
 
-	pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
-	if (!pg_proc_dir)
-		return -ENODEV;
+	pn->net = net;
+	if (!pn->proc_dir) {
+		struct proc_dir_entry *pe;
+		pn->proc_dir = proc_mkdir(PG_PROC_DIR, pn->net->proc_net);
+		if (!pn->proc_dir) {
+			pr_warn("cannot create /proc/net/%s\n", PG_PROC_DIR);
+			return -ENODEV;
+		}
+		pe = proc_create(PGCTRL, 0600, pn->proc_dir, &pktgen_fops);
+		if (pe == NULL) {
+			pr_err("cannot create %s procfs entry\n", PGCTRL);
+			ret = -EINVAL;
+			goto remove;
+		}
 
-	pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
-	if (pe == NULL) {
-		pr_err("ERROR: cannot create %s procfs entry\n", PGCTRL);
-		ret = -EINVAL;
-		goto remove_dir;
 	}
 
-	register_netdevice_notifier(&pktgen_notifier_block);
-
 	for_each_online_cpu(cpu) {
 		int err;
 
-		err = pktgen_create_thread(cpu);
+		err = pktgen_create_thread(cpu, pn);
 		if (err)
-			pr_warning("WARNING: Cannot create thread for cpu %d (%d)\n",
+			pr_warn("Cannot create thread for cpu %d (%d)\n",
 				   cpu, err);
 	}
 
 	if (list_empty(&pktgen_threads)) {
-		pr_err("ERROR: Initialization failed for all threads\n");
+		pr_err("Initialization failed for all threads\n");
 		ret = -ENODEV;
-		goto unregister;
+		goto remove_entry;
 	}
 
 	return 0;
 
- unregister:
-	unregister_netdevice_notifier(&pktgen_notifier_block);
-	remove_proc_entry(PGCTRL, pg_proc_dir);
- remove_dir:
-	proc_net_remove(&init_net, PG_PROC_DIR);
+remove_entry:
+	remove_proc_entry(PGCTRL, pn->proc_dir);
+remove:
+	proc_net_remove(pn->net, PG_PROC_DIR);
+	return ret;
+}
+
+static void __net_exit pg_net_exit(struct net *net)
+{
+	struct pktgen_net *pn = net_generic(net, pg_net_id);
+	remove_proc_entry(PGCTRL, pn->proc_dir);
+	proc_net_remove(pn->net, PG_PROC_DIR);
+}
+
+static struct pernet_operations pg_net_ops = {
+	.init = pg_net_init,
+	.exit = pg_net_exit,
+	.id   = &pg_net_id,
+	.size = sizeof(struct pktgen_net),
+};
+
+static int __init pg_init(void)
+{
+	int ret = 0;
+
+	pr_info("%s", version);
+	ret = register_pernet_subsys(&pg_net_ops);
+	if (ret)
+		return ret;
+	ret = register_netdevice_notifier(&pktgen_notifier_block);
+	if (ret)
+		unregister_pernet_subsys(&pg_net_ops);
+
 	return ret;
 }
 
@@ -3661,9 +3705,7 @@ static void __exit pg_cleanup(void)
 	/* Un-register us from receiving netdevice events */
 	unregister_netdevice_notifier(&pktgen_notifier_block);
 
-	/* Clean up proc file system */
-	remove_proc_entry(PGCTRL, pg_proc_dir);
-	proc_net_remove(&init_net, PG_PROC_DIR);
+	unregister_pernet_subsys(&pg_net_ops);
 }
 
 module_init(pg_init);

^ permalink raw reply related

* Re: [Patch net-next] pktgen: support net namespace
From: Eric W. Biederman @ 2013-01-28  6:52 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, David S. Miller
In-Reply-To: <1359354775-28344-1-git-send-email-amwang@redhat.com>

Cong Wang <amwang@redhat.com> writes:

> From: Cong Wang <amwang@redhat.com>
>
> This patch add net namespace to pktgen, so that
> we can use pktgen in different namespaces.

Skimming through this looks like a reasonable patch.

I am not a fan of the number of threads, but that has nothing to do with
correctness, and would certainly require a large change in logic to keep
the number of threads down, which might not be a good idea.


One small nit below.

Eric


> @@ -3592,49 +3607,78 @@ static int pktgen_remove_device(struct pktgen_thread *t,
>  	return 0;
>  }
>  
> -static int __init pg_init(void)
> +static int __net_init pg_net_init(struct net *net)
>  {
> -	int cpu;
> -	struct proc_dir_entry *pe;
> -	int ret = 0;
> -
> -	pr_info("%s", version);
> +	struct pktgen_net *pn = net_generic(net, pg_net_id);
> +	int cpu, ret = 0;
>  
> -	pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
> -	if (!pg_proc_dir)
> -		return -ENODEV;
> +	pn->net = net;
> +	if (!pn->proc_dir) {
        ^^^^^^^^^^^^^^^^^^^^

This test is pointless.  pn->proc_dir is allocated with kzalloc so it
will be initially NULL and pg_net_init will be called exactly once
per network namespace so pn->proc_dir will always be NULL here. 

> +		struct proc_dir_entry *pe;
> +		pn->proc_dir = proc_mkdir(PG_PROC_DIR, pn->net->proc_net);
> +		if (!pn->proc_dir) {
> +			pr_warn("cannot create /proc/net/%s\n", PG_PROC_DIR);
> +			return -ENODEV;
> +		}
> +		pe = proc_create(PGCTRL, 0600, pn->proc_dir, &pktgen_fops);
> +		if (pe == NULL) {
> +			pr_err("cannot create %s procfs entry\n", PGCTRL);
> +			ret = -EINVAL;
> +			goto remove;
> +		}
>  
> -	pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
> -	if (pe == NULL) {
> -		pr_err("ERROR: cannot create %s procfs entry\n", PGCTRL);
> -		ret = -EINVAL;
> -		goto remove_dir;
>  	}
>  
> -	register_netdevice_notifier(&pktgen_notifier_block);
> -
>  	for_each_online_cpu(cpu) {
>  		int err;
>  
> -		err = pktgen_create_thread(cpu);
> +		err = pktgen_create_thread(cpu, pn);
>  		if (err)
> -			pr_warning("WARNING: Cannot create thread for cpu %d (%d)\n",
> +			pr_warn("Cannot create thread for cpu %d (%d)\n",
>  				   cpu, err);
>  	}
>  
>  	if (list_empty(&pktgen_threads)) {
> -		pr_err("ERROR: Initialization failed for all threads\n");
> +		pr_err("Initialization failed for all threads\n");
>  		ret = -ENODEV;
> -		goto unregister;
> +		goto remove_entry;
>  	}
>  
>  	return 0;
>  
> - unregister:
> -	unregister_netdevice_notifier(&pktgen_notifier_block);
> -	remove_proc_entry(PGCTRL, pg_proc_dir);
> - remove_dir:
> -	proc_net_remove(&init_net, PG_PROC_DIR);
> +remove_entry:
> +	remove_proc_entry(PGCTRL, pn->proc_dir);
> +remove:
> +	proc_net_remove(pn->net, PG_PROC_DIR);
> +	return ret;
> +}

^ permalink raw reply

* [Patch net] pktgen: correctly handle failures when adding a device
From: Cong Wang @ 2013-01-28  7:14 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Cong Wang

From: Cong Wang <amwang@redhat.com>

The return value of pktgen_add_device() is not checked, so
even if we fail to add some device, for example, non-exist one,
we still see "OK:...". This patch fixes it.

After this patch, I got:

	# echo "add_device non-exist" > /proc/net/pktgen/kpktgend_0
	-bash: echo: write error: No such device
	# cat /proc/net/pktgen/kpktgend_0
	Running: 
	Stopped: 
	Result: ERROR: can not add device non-exist
	# echo "add_device eth0" > /proc/net/pktgen/kpktgend_0
	# cat /proc/net/pktgen/kpktgend_0
	Running: 
	Stopped: eth0 
	Result: OK: add_device=eth0

(Candidate for -stable)

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>

---
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b29dacf..e6e1cbe 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1781,10 +1781,13 @@ static ssize_t pktgen_thread_write(struct file *file,
 			return -EFAULT;
 		i += len;
 		mutex_lock(&pktgen_thread_lock);
-		pktgen_add_device(t, f);
+		ret = pktgen_add_device(t, f);
 		mutex_unlock(&pktgen_thread_lock);
-		ret = count;
-		sprintf(pg_result, "OK: add_device=%s", f);
+		if (!ret) {
+			ret = count;
+			sprintf(pg_result, "OK: add_device=%s", f);
+		} else
+			sprintf(pg_result, "ERROR: can not add device %s", f);
 		goto out;
 	}
 

^ permalink raw reply related

* Re: [Patch net-next] pktgen: support net namespace
From: Cong Wang @ 2013-01-28  7:36 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: netdev, David S. Miller
In-Reply-To: <87d2wpyf27.fsf@xmission.com>

On Sun, 2013-01-27 at 22:52 -0800, Eric W. Biederman wrote:
> Cong Wang <amwang@redhat.com> writes:
> 
> > From: Cong Wang <amwang@redhat.com>
> >
> > This patch add net namespace to pktgen, so that
> > we can use pktgen in different namespaces.
> 
> Skimming through this looks like a reasonable patch.
> 
> I am not a fan of the number of threads, but that has nothing to do with
> correctness, and would certainly require a large change in logic to keep
> the number of threads down, which might not be a good idea.

Yeah, I noticed we would have nr_ns*nr_cpu threads after this patch,
unfortunately this is not easy to solve due to the interface of pktgen
by design.

> 
> 
> One small nit below.
...
> >  
> > -	pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
> > -	if (!pg_proc_dir)
> > -		return -ENODEV;
> > +	pn->net = net;
> > +	if (!pn->proc_dir) {
>         ^^^^^^^^^^^^^^^^^^^^
> 
> This test is pointless.  pn->proc_dir is allocated with kzalloc so it
> will be initially NULL and pg_net_init will be called exactly once
> per network namespace so pn->proc_dir will always be NULL here. 
> 

Alright... will remove it.

Thanks!

^ permalink raw reply

* Re: [PATCH] soreuseport: fix use of uid in tb->fastuid
From: Steffen Klassert @ 2013-01-28  7:47 UTC (permalink / raw)
  To: Tom Herbert; +Cc: netdev, davem, eric.dumazet
In-Reply-To: <alpine.DEB.2.00.1301260944370.27231@pokey.mtv.corp.google.com>

On Sat, Jan 26, 2013 at 09:50:54AM -0800, Tom Herbert wrote:
> Fix a reported compilation error where ia variable of type kuid_t
> was being set to zero.
> 

Thanks for fixing this.
Unfortunately I get another compilation error now:

net/ipv6/inet6_connection_sock.c: In function ‘inet6_csk_bind_conflict’:
net/ipv6/inet6_connection_sock.c:37:12: error: incompatible types when initializing type ‘int’ using type ‘kuid_t’
net/ipv6/inet6_connection_sock.c:54:30: error: incompatible type for argument 1 of ‘uid_eq’
include/linux/uidgid.h:70:20: note: expected ‘kuid_t’ but argument is of type ‘int’
make[3]: *** [net/ipv6/inet6_connection_sock.o] Error 1

I wondered why noone else is seeing this, so I did some analysis.
I'm getting this because of the UIDGID_STRICT_TYPE_CHECKS config option.
This is selected by USER_NS which in turn depends on UIDGID_CONVERTED.
Most people can't enable USER_NS because they compile something like
nfs or anything else that is not 'UIDGID_CONVERTED'.

^ permalink raw reply

* Re: [PATCH] SCTP: Free the per-net sysctl table on net exit. v2
From: Martin Mokrejs @ 2013-01-28  8:33 UTC (permalink / raw)
  To: David Miller; +Cc: ebiederm, vyasevich, netdev, linux-sctp
In-Reply-To: <20130128.001125.1697434398997976656.davem@davemloft.net>

David Miller wrote:
> From: ebiederm@xmission.com (Eric W. Biederman)
> Date: Sun, 27 Jan 2013 19:25:11 -0800
> 
>> The typo is fixed in the patch this time in addition to my test
>> tree.
> 
> Applied, thanks for fixing this up Eric.

I did check now how come that I patched my 3.7.4 on Jan 24. Looks like
-head or -next has different namings. For me, the original patch applied
fine. So far I haven't hit the memleak although it happened only once to me
before the patch. But probably I can confirm say Tested-by:.

#
-rw-r--r-- 1 root root  8435 Jan 24 17:12 /usr/src/linux-3.7.4/net/sctp/sysctl.c
-rw-rw-r-- 1 root root  8347 Jan 21 20:45 /usr/src/linux-3.7.4/net/sctp/sysctl.c.orig
# ls -la /usr/src/linux-3.7.4/net/sctp/sysctl.o
-rw-r--r-- 1 root root 246144 Jan 21 22:37 /usr/src/linux-3.7.4/net/sctp/sysctl.o
# ls -la /usr/src/linux-3.7.4/arch/x86/boot/bzImage 
-rw-r--r-- 1 root root 3794592 Jan 21 22:45 /usr/src/linux-3.7.4/arch/x86/boot/bzImage
#

If 3.7 and earlier need the old patch (like I currently think) please make them aware
of that.
Martin

^ permalink raw reply

* [net-next 00/14][pull request] Intel Wired LAN Driver Updates
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann

This series contains updates to e1000e, ixgbevf, igb and igbvf.
Majority of the patches are code cleanups of e1000e where code
is removed (Yeah!).  The other two e1000e patches are fixes.  The
first is to fix the maximum frame size for 82579 devices.  The second
fix is to resolve an issue with devices other than 82579 that suffer
from dropped transactions on platforms with deep C-states when
jumbo frames are enabled.

The ixgbevf patch is to ensure that the driver fetches the correct,
refreshed value for link status and speed when the values have changed.

The igb and igbvf patches are a solution to an issue Stefan Assmann
reported, where when the PF is up and igbvf is loaded, the MAC address
is not generated using eth_hw_addr_random().

The following are changes since commit a1b1add07fa794974573d93483d68e373edfe7bd:
  gro: Fix kcalloc argument order
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master

Bruce Allan (11):
  e1000e: cleanup: remove e1000_set_d0_lplu_state()
  e1000e: cleanup: remove e1000_force_speed_duplex()
  e1000e: cleanup: rename e1000_get_cfg_done()
  e1000e: cleanup: remove e1000_get_phy_cfg_done()
  e1000e: cleanup: remove e1000_get_cable_length()
  e1000e: cleanup: remove e1000e_commit_phy()
  e1000e: correct maximum frame size on 82579
  e1000e: adjust PM QoS request
  e1000e: cleanup: remove unused #define
  e1000e: cleanup hw.h
  e1000e: cleanup: remove comments which are no longer applicable

Greg Rose (1):
  ixgbevf: Make sure link status and speed are fetched

Mitch A Williams (2):
  igb: Don't give VFs random MAC addresses
  igbvf: be sane about random MAC addresses

 drivers/net/ethernet/intel/e1000e/80003es2lan.c |   2 +-
 drivers/net/ethernet/intel/e1000e/82571.c       |   4 +-
 drivers/net/ethernet/intel/e1000e/defines.h     |   9 +-
 drivers/net/ethernet/intel/e1000e/e1000.h       |  12 +--
 drivers/net/ethernet/intel/e1000e/ethtool.c     |   5 +-
 drivers/net/ethernet/intel/e1000e/hw.h          |  25 +++---
 drivers/net/ethernet/intel/e1000e/ich8lan.c     |   4 +-
 drivers/net/ethernet/intel/e1000e/netdev.c      |  32 +++----
 drivers/net/ethernet/intel/e1000e/phy.c         | 114 +++++-------------------
 drivers/net/ethernet/intel/igb/igb_main.c       |   6 +-
 drivers/net/ethernet/intel/igbvf/netdev.c       |  24 +++--
 drivers/net/ethernet/intel/ixgbevf/ethtool.c    |   1 +
 12 files changed, 76 insertions(+), 162 deletions(-)

-- 
1.7.11.7

^ permalink raw reply

* [net-next 01/14] e1000e: cleanup: remove e1000_set_d0_lplu_state()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Replace the function e1000_set_d0_lplu_state() with the contents of it
coded in place of the single call to the function.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/phy.c | 33 ++++++---------------------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 44fb432..73d7813 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -30,7 +30,6 @@
 
 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
 static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw);
-static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
 					  u16 *data, bool read, bool page_set);
@@ -894,10 +893,12 @@ s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw)
 	msleep(100);
 
 	/* disable lplu d0 during driver init */
-	ret_val = e1000_set_d0_lplu_state(hw, false);
-	if (ret_val) {
-		e_dbg("Error Disabling LPLU D0\n");
-		return ret_val;
+	if (hw->phy.ops.set_d0_lplu_state) {
+		ret_val = hw->phy.ops.set_d0_lplu_state(hw, false);
+		if (ret_val) {
+			e_dbg("Error Disabling LPLU D0\n");
+			return ret_val;
+		}
 	}
 	/* Configure mdi-mdix settings */
 	ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CTRL, &data);
@@ -2820,28 +2821,6 @@ s32 e1000e_commit_phy(struct e1000_hw *hw)
 }
 
 /**
- *  e1000_set_d0_lplu_state - Sets low power link up state for D0
- *  @hw: pointer to the HW structure
- *  @active: boolean used to enable/disable lplu
- *
- *  Success returns 0, Failure returns 1
- *
- *  The low power link up (lplu) state is set to the power management level D0
- *  and SmartSpeed is disabled when active is true, else clear lplu for D0
- *  and enable Smartspeed.  LPLU and Smartspeed are mutually exclusive.  LPLU
- *  is used during Dx states where the power conservation is most important.
- *  During driver activity, SmartSpeed should be enabled so performance is
- *  maintained.  This is a function pointer entry point called by drivers.
- **/
-static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
-{
-	if (hw->phy.ops.set_d0_lplu_state)
-		return hw->phy.ops.set_d0_lplu_state(hw, active);
-
-	return 0;
-}
-
-/**
  *  __e1000_read_phy_reg_hv -  Read HV PHY register
  *  @hw: pointer to the HW structure
  *  @offset: register offset to be read
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 02/14] e1000e: cleanup: remove e1000_force_speed_duplex()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Remove the function e1000_force_speed_duplex() and replace the single call
to it with the same function pointer that it would call.  The function
pointer is always set so there is no risk of a NULL pointer dereference.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/phy.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 73d7813..81fba6c 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -29,7 +29,6 @@
 #include "e1000.h"
 
 static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
-static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw);
 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
 					  u16 *data, bool read, bool page_set);
@@ -1196,7 +1195,7 @@ s32 e1000e_setup_copper_link(struct e1000_hw *hw)
 		 * depending on user settings.
 		 */
 		e_dbg("Forcing Speed and Duplex\n");
-		ret_val = e1000_phy_force_speed_duplex(hw);
+		ret_val = hw->phy.ops.force_speed_duplex(hw);
 		if (ret_val) {
 			e_dbg("Error Forcing Speed and Duplex\n");
 			return ret_val;
@@ -2284,21 +2283,6 @@ static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw)
 }
 
 /**
- *  e1000_phy_force_speed_duplex - Generic force PHY speed/duplex
- *  @hw: pointer to the HW structure
- *
- *  When the silicon family has not implemented a forced speed/duplex
- *  function for the PHY, simply return 0.
- **/
-static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
-{
-	if (hw->phy.ops.force_speed_duplex)
-		return hw->phy.ops.force_speed_duplex(hw);
-
-	return 0;
-}
-
-/**
  *  e1000e_get_phy_type_from_id - Get PHY type from id
  *  @phy_id: phy_id read from the phy
  *
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 03/14] e1000e: cleanup: rename e1000_get_cfg_done()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

In keeping with the e1000e driver function naming convention, the subject
function is renamed to indicate it is generic, i.e. it is applicable to
more than just a single MAC family (e.g. 80003es2lan, 82571, ich8lan).

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/82571.c   | 4 ++--
 drivers/net/ethernet/intel/e1000e/e1000.h   | 2 +-
 drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 +-
 drivers/net/ethernet/intel/e1000e/phy.c     | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index 0f55d79..076938c 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -1940,7 +1940,7 @@ static const struct e1000_phy_operations e82_phy_ops_m88 = {
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit			= e1000e_phy_sw_reset,
 	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
-	.get_cfg_done		= e1000e_get_cfg_done,
+	.get_cfg_done		= e1000e_get_cfg_done_generic,
 	.get_cable_length	= e1000e_get_cable_length_m88,
 	.get_info		= e1000e_get_phy_info_m88,
 	.read_reg		= e1000e_read_phy_reg_m88,
@@ -1958,7 +1958,7 @@ static const struct e1000_phy_operations e82_phy_ops_bm = {
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit			= e1000e_phy_sw_reset,
 	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
-	.get_cfg_done		= e1000e_get_cfg_done,
+	.get_cfg_done		= e1000e_get_cfg_done_generic,
 	.get_cable_length	= e1000e_get_cable_length_m88,
 	.get_info		= e1000e_get_phy_info_m88,
 	.read_reg		= e1000e_read_phy_reg_bm2,
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index e6b9483..115656e 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -654,7 +654,7 @@ extern s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset,
                                            u16 data);
 extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
 extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
-extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
+extern s32 e1000e_get_cfg_done_generic(struct e1000_hw *hw);
 extern s32 e1000e_get_cable_length_m88(struct e1000_hw *hw);
 extern s32 e1000e_get_phy_info_m88(struct e1000_hw *hw);
 extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 87676b6..edd5996 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -4378,7 +4378,7 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw)
 	u32 bank = 0;
 	u32 status;
 
-	e1000e_get_cfg_done(hw);
+	e1000e_get_cfg_done_generic(hw);
 
 	/* Wait for indication from h/w that it has completed basic config */
 	if (hw->mac.type >= e1000_ich10lan) {
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 81fba6c..37a85d4 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -2169,13 +2169,13 @@ s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw)
 }
 
 /**
- *  e1000e_get_cfg_done - Generic configuration done
+ *  e1000e_get_cfg_done_generic - Generic configuration done
  *  @hw: pointer to the HW structure
  *
  *  Generic function to wait 10 milli-seconds for configuration to complete
  *  and return success.
  **/
-s32 e1000e_get_cfg_done(struct e1000_hw *hw)
+s32 e1000e_get_cfg_done_generic(struct e1000_hw *hw)
 {
 	mdelay(10);
 
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 04/14] e1000e: cleanup: remove e1000_get_phy_cfg_done()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Remove the function e1000_get_phy_cfg_done() and replace the single call
to it with the same function pointer that it would call.  The function
pointer is always set so there is no risk of a NULL pointer dereference.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/phy.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 37a85d4..3cf627b 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -28,7 +28,6 @@
 
 #include "e1000.h"
 
-static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw);
 static s32 e1000_wait_autoneg(struct e1000_hw *hw);
 static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
 					  u16 *data, bool read, bool page_set);
@@ -2165,7 +2164,7 @@ s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw)
 
 	phy->ops.release(hw);
 
-	return e1000_get_phy_cfg_done(hw);
+	return phy->ops.get_cfg_done(hw);
 }
 
 /**
@@ -2265,23 +2264,6 @@ s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw)
 	return 0;
 }
 
-/* Internal function pointers */
-
-/**
- *  e1000_get_phy_cfg_done - Generic PHY configuration done
- *  @hw: pointer to the HW structure
- *
- *  Return success if silicon family did not implement a family specific
- *  get_cfg_done function.
- **/
-static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw)
-{
-	if (hw->phy.ops.get_cfg_done)
-		return hw->phy.ops.get_cfg_done(hw);
-
-	return 0;
-}
-
 /**
  *  e1000e_get_phy_type_from_id - Get PHY type from id
  *  @phy_id: phy_id read from the phy
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 05/14] e1000e: cleanup: remove e1000_get_cable_length()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Remove the function e1000_get_cable_length() and replace the two calls
to it with the same function pointer that it would call.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/e1000.h | 5 -----
 drivers/net/ethernet/intel/e1000e/phy.c   | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 115656e..896eacc 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -737,11 +737,6 @@ static inline s32 e1e_wphy_locked(struct e1000_hw *hw, u32 offset, u16 data)
 	return hw->phy.ops.write_reg_locked(hw, offset, data);
 }
 
-static inline s32 e1000_get_cable_length(struct e1000_hw *hw)
-{
-	return hw->phy.ops.get_cable_length(hw);
-}
-
 extern s32 e1000e_acquire_nvm(struct e1000_hw *hw);
 extern s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
 extern s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw);
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 3cf627b..c4bfbd6 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -1960,7 +1960,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
 	phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX);
 
 	if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
-		ret_val = e1000_get_cable_length(hw);
+		ret_val = hw->phy.ops.get_cable_length(hw);
 		if (ret_val)
 			return ret_val;
 
@@ -2024,7 +2024,7 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
 
 	if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
 	    IGP01E1000_PSSR_SPEED_1000MBPS) {
-		ret_val = e1000_get_cable_length(hw);
+		ret_val = phy->ops.get_cable_length(hw);
 		if (ret_val)
 			return ret_val;
 
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 06/14] e1000e: cleanup: remove e1000e_commit_phy()
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

Remove the function e1000e_commit_phy() and replace the few calls to it
with the same function pointer that it would call.  The function pointer is
almost always set for the devices that access these code paths so there is
no risk of a NULL pointer dereference; for the few instances where the
function pointer might not be set (i.e. can be called for the few devices
which do not have this function pointer set), check for a valid function
pointer.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/80003es2lan.c |  2 +-
 drivers/net/ethernet/intel/e1000e/e1000.h       |  2 --
 drivers/net/ethernet/intel/e1000e/ethtool.c     |  5 ++--
 drivers/net/ethernet/intel/e1000e/phy.c         | 35 +++++++++----------------
 4 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index ae96fac..3f27546 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1010,7 +1010,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
 		return ret_val;
 
 	/* SW Reset the PHY so all changes take effect */
-	ret_val = e1000e_commit_phy(hw);
+	ret_val = hw->phy.ops.commit(hw);
 	if (ret_val) {
 		e_dbg("Error Resetting the PHY\n");
 		return ret_val;
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
index 896eacc..4ffb62b 100644
--- a/drivers/net/ethernet/intel/e1000e/e1000.h
+++ b/drivers/net/ethernet/intel/e1000e/e1000.h
@@ -579,8 +579,6 @@ extern const struct e1000_info e1000_es2_info;
 extern s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
 					 u32 pba_num_size);
 
-extern s32  e1000e_commit_phy(struct e1000_hw *hw);
-
 extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
 
 extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index 6ab949d..58df18c 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -1321,7 +1321,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
 		phy_reg |= 0x006;
 		e1e_wphy(hw, PHY_REG(2, 21), phy_reg);
 		/* Assert SW reset for above settings to take effect */
-		e1000e_commit_phy(hw);
+		hw->phy.ops.commit(hw);
 		mdelay(1);
 		/* Force Full Duplex */
 		e1e_rphy(hw, PHY_REG(769, 16), &phy_reg);
@@ -1542,7 +1542,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
 		if (phy_reg & MII_CR_LOOPBACK) {
 			phy_reg &= ~MII_CR_LOOPBACK;
 			e1e_wphy(hw, PHY_CONTROL, phy_reg);
-			e1000e_commit_phy(hw);
+			if (hw->phy.ops.commit)
+				hw->phy.ops.commit(hw);
 		}
 		break;
 	}
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index c4bfbd6..cddfc6b 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -788,7 +788,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
 			if (ret_val)
 				return ret_val;
 			/* Commit the changes. */
-			ret_val = e1000e_commit_phy(hw);
+			ret_val = phy->ops.commit(hw);
 			if (ret_val) {
 				e_dbg("Error committing the PHY changes\n");
 				return ret_val;
@@ -844,10 +844,12 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
 	}
 
 	/* Commit the changes. */
-	ret_val = e1000e_commit_phy(hw);
-	if (ret_val) {
-		e_dbg("Error committing the PHY changes\n");
-		return ret_val;
+	if (phy->ops.commit) {
+		ret_val = phy->ops.commit(hw);
+		if (ret_val) {
+			e_dbg("Error committing the PHY changes\n");
+			return ret_val;
+		}
 	}
 
 	if (phy->type == e1000_phy_82578) {
@@ -1324,9 +1326,11 @@ s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw)
 		return ret_val;
 
 	/* Reset the phy to commit changes. */
-	ret_val = e1000e_commit_phy(hw);
-	if (ret_val)
-		return ret_val;
+	if (hw->phy.ops.commit) {
+		ret_val = hw->phy.ops.commit(hw);
+		if (ret_val)
+			return ret_val;
+	}
 
 	if (phy->autoneg_wait_to_complete) {
 		e_dbg("Waiting for forced speed/duplex link on M88 phy.\n");
@@ -2772,21 +2776,6 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw)
 }
 
 /**
- *  e1000e_commit_phy - Soft PHY reset
- *  @hw: pointer to the HW structure
- *
- *  Performs a soft PHY reset on those that apply. This is a function pointer
- *  entry point called by drivers.
- **/
-s32 e1000e_commit_phy(struct e1000_hw *hw)
-{
-	if (hw->phy.ops.commit)
-		return hw->phy.ops.commit(hw);
-
-	return 0;
-}
-
-/**
  *  __e1000_read_phy_reg_hv -  Read HV PHY register
  *  @hw: pointer to the HW structure
  *  @offset: register offset to be read
-- 
1.7.11.7

^ permalink raw reply related

* [net-next 07/14] e1000e: correct maximum frame size on 82579
From: Jeff Kirsher @ 2013-01-28  9:04 UTC (permalink / raw)
  To: davem; +Cc: Bruce Allan, netdev, gospo, sassmann, Jeff Kirsher
In-Reply-To: <1359363869-32391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Bruce Allan <bruce.w.allan@intel.com>

The largest jumbo frame supported by the 82579 hardware is 9018.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index edd5996..58547b8 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -4620,7 +4620,7 @@ const struct e1000_info e1000_pch2_info = {
 	.flags2			= FLAG2_HAS_PHY_STATS
 				  | FLAG2_HAS_EEE,
 	.pba			= 26,
-	.max_hw_frame_size	= DEFAULT_JUMBO,
+	.max_hw_frame_size	= 9018,
 	.get_variants		= e1000_get_variants_ich8lan,
 	.mac_ops		= &ich8_mac_ops,
 	.phy_ops		= &ich8_phy_ops,
-- 
1.7.11.7

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox