Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org
Cc: John Ronciak <john.ronciak@intel.com>,
	Bruce Allan <bruce.w.allan@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [patch] e1000: Tidy up logic in e1000_enable_tx_pkt_filtering()
Date: Fri, 11 Sep 2009 12:17:44 +1000	[thread overview]
Message-ID: <20090911021744.GB3221@verge.net.au> (raw)

This is purely cosmetic, but to my mind it makes the code a lot easier
to follow.

Signed-off-by: Simon Horman <horms@verge.net.au>

--- 

Lightly tested.

Index: net-next-2.6/drivers/net/e1000/e1000_hw.c
===================================================================
--- net-next-2.6.orig/drivers/net/e1000/e1000_hw.c	2009-08-31 17:44:07.000000000 +1000
+++ net-next-2.6/drivers/net/e1000/e1000_hw.c	2009-09-09 11:40:14.000000000 +1000
@@ -7604,31 +7604,33 @@ bool e1000_enable_tx_pkt_filtering(struc
 {
     /* called in init as well as watchdog timer functions */
 
-    s32 ret_val, checksum;
-    bool tx_filter = false;
+    s32 checksum;
+    bool tx_filter = true;
     struct e1000_host_mng_dhcp_cookie *hdr = &(hw->mng_cookie);
     u8 *buffer = (u8 *) &(hw->mng_cookie);
 
-    if (e1000_check_mng_mode(hw)) {
-        ret_val = e1000_mng_enable_host_if(hw);
-        if (ret_val == E1000_SUCCESS) {
-            ret_val = e1000_host_if_read_cookie(hw, buffer);
-            if (ret_val == E1000_SUCCESS) {
-                checksum = hdr->checksum;
-                hdr->checksum = 0;
-                if ((hdr->signature == E1000_IAMT_SIGNATURE) &&
-                    checksum == e1000_calculate_mng_checksum((char *)buffer,
-                                               E1000_MNG_DHCP_COOKIE_LENGTH)) {
-                    if (hdr->status &
-                        E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT)
-                        tx_filter = true;
-                } else
-                    tx_filter = true;
-            } else
-                tx_filter = true;
-        }
-    }
+    if (!e1000_check_mng_mode(hw))
+        goto out_false;
+
+    if (e1000_mng_enable_host_if(hw) != E1000_SUCCESS)
+        goto out_false;
+
+    if (e1000_host_if_read_cookie(hw, buffer) != E1000_SUCCESS)
+	goto out_true;
 
+    checksum = hdr->checksum;
+    hdr->checksum = 0;
+    if ((hdr->signature != E1000_IAMT_SIGNATURE) ||
+        checksum != e1000_calculate_mng_checksum((char *)buffer,
+                                   E1000_MNG_DHCP_COOKIE_LENGTH))
+	goto out_true;
+
+    if (hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT)
+	goto out_true;
+
+out_false:
+    tx_filter = false;
+out_true:
     hw->tx_pkt_filtering = tx_filter;
     return tx_filter;
 }

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

                 reply	other threads:[~2009-09-11  2:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090911021744.GB3221@verge.net.au \
    --to=horms@verge.net.au \
    --cc=bruce.w.allan@intel.com \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=netdev@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