linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jacliburn@bellsouth.net
To: jeff@garzik.org
Cc: csnook@redhat.com, linux-kernel@vger.kernel.org,
	atl1-devel@lists.sourceforge.net,
	Jay Cliburn <jacliburn@bellsouth.net>
Subject: [PATCH 20/26] atl1: update change mtu
Date: Mon, 31 Dec 2007 19:59:58 -0600	[thread overview]
Message-ID: <1199152804-3889-21-git-send-email-jacliburn@bellsouth.net> (raw)
In-Reply-To: <1199152804-3889-1-git-send-email-jacliburn@bellsouth.net>

From: Jay Cliburn <jacliburn@bellsouth.net>

Update atl1_change_mtu() to conform with the current vendor driver version
1.2.40.2.

Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
 drivers/net/atlx/atl1.c |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 972de34..7d84a51 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2438,32 +2438,37 @@ static void atl1_reset_task(struct work_struct *work)
  * atl1_change_mtu - Change the Maximum Transfer Unit
  * @netdev: network interface device structure
  * @new_mtu: new value for maximum frame size
- *
- * Returns 0 on success, negative on failure
  */
 static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	struct atl1_adapter *adapter = netdev_priv(netdev);
-	int old_mtu = netdev->mtu;
-	int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
+	struct atl1_hw *hw = &adapter->hw;
 
-	if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
-	    (max_frame > MAX_JUMBO_FRAME_SIZE)) {
-		dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
+	if ((new_mtu < 40) || (new_mtu > (ETH_DATA_LEN + VLAN_HLEN)))
 		return -EINVAL;
-	}
 
-	adapter->hw.max_frame_size = max_frame;
-	adapter->hw.tx_jumbo_task_th = (max_frame + 7) >> 3;
-	adapter->rx_buffer_len = (max_frame + 7) & ~7;
-	adapter->hw.rx_jumbo_th = adapter->rx_buffer_len / 8;
+	if (hw->max_frame_size != new_mtu) {
+		while (test_and_set_bit(__ATL1_RESETTING, &adapter->flags))
+			msleep(1);
 
-	netdev->mtu = new_mtu;
-	if ((old_mtu != new_mtu) && netif_running(netdev)) {
-		atl1_down(adapter);
-		atl1_up(adapter);
-	}
+		if (netif_running(netdev))
+			atl1_down(adapter);
+
+		netdev->mtu = new_mtu;
+		adapter->hw.max_frame_size = new_mtu;
+		adapter->hw.tx_jumbo_task_th = (new_mtu + ETH_HLEN +
+			ETH_FCS_LEN + VLAN_HLEN + 7) >> 3;
+		adapter->rx_buffer_len = (new_mtu + ETH_HLEN +
+			ETH_FCS_LEN + VLAN_HLEN + 7) & ~7;
+		adapter->hw.rx_jumbo_th = adapter->rx_buffer_len / 8;
 
+		if (netif_running(netdev))
+			atl1_up(adapter);
+		else
+			atl1_reset(adapter);
+
+		clear_bit(__ATL1_RESETTING, &adapter->flags);
+	}
 	return 0;
 }
 
-- 
1.5.3.3


  parent reply	other threads:[~2008-01-01  2:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-01  1:59 [PATCH 00/26] atl1: divide and modernize jacliburn
2008-01-01  1:59 ` [PATCH 01/26] atl1: relocate atl1 driver to /drivers/net/atlx jacliburn
2008-01-01  1:59 ` [PATCH 02/26] atl1: move common functions to atlx files jacliburn
2008-01-01  1:59 ` [PATCH 03/26] atl1: fix broken TSO jacliburn
2008-01-01  1:59 ` [PATCH 04/26] atl1: add ethtool register dump jacliburn
2008-01-22  9:54   ` Jeff Garzik
2008-01-01  1:59 ` [PATCH 05/26] atl1: print debug info if rrd error jacliburn
2008-01-22  9:55   ` Jeff Garzik
2008-01-01  1:59 ` [PATCH 06/26] atl1: update initialization parameters jacliburn
2008-01-22  9:56   ` Jeff Garzik
2008-01-23  2:13     ` Jay Cliburn
2008-01-23  2:19       ` Jeff Garzik
2008-01-23  2:30       ` Chris Snook
2008-01-01  1:59 ` [PATCH 07/26] atl1: clarify max rx frame size jacliburn
2008-01-01  1:59 ` [PATCH 08/26] atl1: additional DMA engine configuration jacliburn
2008-01-01  1:59 ` [PATCH 09/26] atl1: refactor tx processing jacliburn
2008-01-22  9:58   ` Jeff Garzik
2008-01-23  0:31     ` Jay Cliburn
2008-01-25  1:00       ` Jay Cliburn
2008-01-25  1:08         ` Chris Snook
2008-01-25  3:01         ` Jeff Garzik
2008-01-01  1:59 ` [PATCH 10/26] atl1: use csum_start jacliburn
2008-01-01  1:59 ` [PATCH 11/26] atl1: refactor initialization and startup jacliburn
2008-01-01  1:59 ` [PATCH 12/26] atl1: refactor atl1_probe jacliburn
2008-01-01  1:59 ` [PATCH 13/26] atl1: refactor interrupt handling jacliburn
2008-01-22  9:59   ` Jeff Garzik
2008-01-01  1:59 ` [PATCH 14/26] atl1: move stray defines to header file jacliburn
2008-01-01  1:59 ` [PATCH 15/26] atl1: tidy up ring management jacliburn
2008-01-01  1:59 ` [PATCH 16/26] atl1: modernize check link function jacliburn
2008-01-01  1:59 ` [PATCH 17/26] atl1: update phy config function jacliburn
2008-01-01  1:59 ` [PATCH 18/26] atl1: make function static jacliburn
2008-01-01  1:59 ` [PATCH 19/26] atl1: modernize down/up functions jacliburn
2008-01-22 10:01   ` Jeff Garzik
2008-01-01  1:59 ` jacliburn [this message]
2008-01-01  1:59 ` [PATCH 21/26] atl1: update atl1_close jacliburn
2008-01-01  2:00 ` [PATCH 22/26] atl1: update netpoll jacliburn
2008-01-01  2:00 ` [PATCH 23/26] atl1: update shutdown and remove functions jacliburn
2008-01-01  2:00 ` [PATCH 24/26] atl1: update wake-on-lan jacliburn
2008-01-01  2:00 ` [PATCH 25/26] atl1: add NAPI support jacliburn
2008-01-01  6:09   ` Joonwoo Park
2008-01-01 18:15   ` [PATCH 25/26] [REVISED] " Jay Cliburn
2008-01-02  2:56     ` Joonwoo Park
2008-01-02  3:07       ` David Miller
2008-01-01  2:00 ` [PATCH 26/26] atl1: remove experimental tag and clean up comments jacliburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1199152804-3889-21-git-send-email-jacliburn@bellsouth.net \
    --to=jacliburn@bellsouth.net \
    --cc=atl1-devel@lists.sourceforge.net \
    --cc=csnook@redhat.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).