Skip to content

Commit

Permalink
e1000e: e1000e_enable_tx_pkt_filtering() returns wrong value
Browse files Browse the repository at this point in the history
e1000e_enable_tx_pkt_filtering() will return a non-zero value if the
driver fails to enable the manageability interface on the host for
any reason; instead it should retun zero to indicate filtering has been
disabled.  Also provide a single exit point for the function.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bruce Allan authored and David S. Miller committed Jan 8, 2010
1 parent f464ba8 commit ca777f9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/net/e1000e/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2301,20 +2301,22 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
s32 ret_val, hdr_csum, csum;
u8 i, len;

hw->mac.tx_pkt_filtering = true;

/* No manageability, no filtering */
if (!e1000e_check_mng_mode(hw)) {
hw->mac.tx_pkt_filtering = false;
return 0;
goto out;
}

/*
* If we can't read from the host interface for whatever
* reason, disable filtering.
*/
ret_val = e1000_mng_enable_host_if(hw);
if (ret_val != 0) {
if (ret_val) {
hw->mac.tx_pkt_filtering = false;
return ret_val;
goto out;
}

/* Read in the header. Length and offset are in dwords. */
Expand All @@ -2333,17 +2335,17 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
*/
if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) {
hw->mac.tx_pkt_filtering = true;
return 1;
goto out;
}

/* Cookie area is valid, make the final check for filtering. */
if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) {
hw->mac.tx_pkt_filtering = false;
return 0;
goto out;
}

hw->mac.tx_pkt_filtering = true;
return 1;
out:
return hw->mac.tx_pkt_filtering;
}

/**
Expand Down

0 comments on commit ca777f9

Please sign in to comment.