Lines Matching +full:no +full:- +full:hw +full:- +full:checksum

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
7 * e1000_calculate_checksum - Calculate checksum for buffer
9 * @length: size of EEPROM to calculate a checksum for
11 * Calculates the checksum for some buffer on a specified length. The
12 * checksum calculated is returned.
25 return (u8)(0 - sum); in e1000_calculate_checksum()
29 * e1000_mng_enable_host_if - Checks host interface is enabled
30 * @hw: pointer to the HW structure
32 * Returns 0 upon success, else -E1000_ERR_HOST_INTERFACE_COMMAND
38 static s32 e1000_mng_enable_host_if(struct e1000_hw *hw) in e1000_mng_enable_host_if() argument
43 if (!hw->mac.arc_subsystem_valid) { in e1000_mng_enable_host_if()
45 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if()
52 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if()
64 return -E1000_ERR_HOST_INTERFACE_COMMAND; in e1000_mng_enable_host_if()
71 * e1000e_check_mng_mode_generic - Generic check management mode
72 * @hw: pointer to the HW structure
77 bool e1000e_check_mng_mode_generic(struct e1000_hw *hw) in e1000e_check_mng_mode_generic() argument
86 * e1000e_enable_tx_pkt_filtering - Enable packet filtering on Tx
87 * @hw: pointer to the HW structure
92 bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw) in e1000e_enable_tx_pkt_filtering() argument
94 struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie; in e1000e_enable_tx_pkt_filtering()
95 u32 *buffer = (u32 *)&hw->mng_cookie; in e1000e_enable_tx_pkt_filtering()
100 hw->mac.tx_pkt_filtering = true; in e1000e_enable_tx_pkt_filtering()
102 /* No manageability, no filtering */ in e1000e_enable_tx_pkt_filtering()
103 if (!hw->mac.ops.check_mng_mode(hw)) { in e1000e_enable_tx_pkt_filtering()
104 hw->mac.tx_pkt_filtering = false; in e1000e_enable_tx_pkt_filtering()
105 return hw->mac.tx_pkt_filtering; in e1000e_enable_tx_pkt_filtering()
111 ret_val = e1000_mng_enable_host_if(hw); in e1000e_enable_tx_pkt_filtering()
113 hw->mac.tx_pkt_filtering = false; in e1000e_enable_tx_pkt_filtering()
114 return hw->mac.tx_pkt_filtering; in e1000e_enable_tx_pkt_filtering()
121 *(buffer + i) = E1000_READ_REG_ARRAY(hw, E1000_HOST_IF, in e1000e_enable_tx_pkt_filtering()
123 hdr_csum = hdr->checksum; in e1000e_enable_tx_pkt_filtering()
124 hdr->checksum = 0; in e1000e_enable_tx_pkt_filtering()
131 if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { in e1000e_enable_tx_pkt_filtering()
132 hw->mac.tx_pkt_filtering = true; in e1000e_enable_tx_pkt_filtering()
133 return hw->mac.tx_pkt_filtering; in e1000e_enable_tx_pkt_filtering()
137 if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) in e1000e_enable_tx_pkt_filtering()
138 hw->mac.tx_pkt_filtering = false; in e1000e_enable_tx_pkt_filtering()
140 return hw->mac.tx_pkt_filtering; in e1000e_enable_tx_pkt_filtering()
144 * e1000_mng_write_cmd_header - Writes manageability command header
145 * @hw: pointer to the HW structure
148 * Writes the command header after does the checksum calculation.
150 static s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, in e1000_mng_write_cmd_header() argument
155 /* Write the whole command header structure with new checksum. */ in e1000_mng_write_cmd_header()
157 hdr->checksum = e1000_calculate_checksum((u8 *)hdr, length); in e1000_mng_write_cmd_header()
162 E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, i, *((u32 *)hdr + i)); in e1000_mng_write_cmd_header()
170 * e1000_mng_host_if_write - Write to the manageability host interface
171 * @hw: pointer to the HW structure
175 * @sum: sum of the data (not checksum)
181 static s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, in e1000_mng_host_if_write() argument
189 /* sum = only sum of the data and it is not checksum */ in e1000_mng_host_if_write()
192 return -E1000_ERR_PARAM; in e1000_mng_host_if_write()
199 data = E1000_READ_REG_ARRAY(hw, E1000_HOST_IF, offset); in e1000_mng_host_if_write()
204 E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset, data); in e1000_mng_host_if_write()
205 length -= j - prev_bytes; in e1000_mng_host_if_write()
210 length -= remaining; in e1000_mng_host_if_write()
224 E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset + i, data); in e1000_mng_host_if_write()
235 E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset + i, data); in e1000_mng_host_if_write()
242 * e1000e_mng_write_dhcp_info - Writes DHCP info to host interface
243 * @hw: pointer to the HW structure
249 s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length) in e1000e_mng_write_dhcp_info() argument
259 hdr.checksum = 0; in e1000e_mng_write_dhcp_info()
262 ret_val = e1000_mng_enable_host_if(hw); in e1000e_mng_write_dhcp_info()
267 ret_val = e1000_mng_host_if_write(hw, buffer, length, in e1000e_mng_write_dhcp_info()
268 sizeof(hdr), &(hdr.checksum)); in e1000e_mng_write_dhcp_info()
273 ret_val = e1000_mng_write_cmd_header(hw, &hdr); in e1000e_mng_write_dhcp_info()
285 * e1000e_enable_mng_pass_thru - Check if management passthrough is needed
286 * @hw: pointer to the HW structure
291 bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw) in e1000e_enable_mng_pass_thru() argument
301 if (hw->mac.has_fwsm) { in e1000e_enable_mng_pass_thru()
309 } else if ((hw->mac.type == e1000_82574) || in e1000e_enable_mng_pass_thru()
310 (hw->mac.type == e1000_82583)) { in e1000e_enable_mng_pass_thru()
315 ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); in e1000e_enable_mng_pass_thru()