Lines Matching +full:compute +full:- +full:cb

1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2024-2025 Intel Corporation
9 #include "iwl-drv.h"
10 #include "iwl-utils.h"
18 struct ieee80211_hdr *hdr = (void *)skb->data; in iwl_tx_tso_segment()
19 char cb[sizeof(skb->cb)]; in iwl_tx_tso_segment() local
22 unsigned int mss = skb_shinfo(skb)->gso_size; in iwl_tx_tso_segment()
23 bool ipv4 = (skb->protocol == htons(ETH_P_IP)); in iwl_tx_tso_segment()
24 bool qos = ieee80211_is_data_qos(hdr->frame_control); in iwl_tx_tso_segment()
25 u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0; in iwl_tx_tso_segment()
27 skb_shinfo(skb)->gso_size = num_subframes * mss; in iwl_tx_tso_segment()
28 memcpy(cb, skb->cb, sizeof(cb)); in iwl_tx_tso_segment()
31 skb_shinfo(skb)->gso_size = mss; in iwl_tx_tso_segment()
32 skb_shinfo(skb)->gso_type = ipv4 ? SKB_GSO_TCPV4 : SKB_GSO_TCPV6; in iwl_tx_tso_segment()
34 if (IS_ERR(next) && PTR_ERR(next) == -ENOMEM) in iwl_tx_tso_segment()
35 return -ENOMEM; in iwl_tx_tso_segment()
45 memcpy(tmp->cb, cb, sizeof(tmp->cb)); in iwl_tx_tso_segment()
47 * Compute the length of all the data added for the A-MSDU. in iwl_tx_tso_segment()
48 * This will be used to compute the length to write in the TX in iwl_tx_tso_segment()
49 * command. We have: SNAP + IP + TCP for n -1 subframes and in iwl_tx_tso_segment()
52 tcp_payload_len = skb_tail_pointer(tmp) - in iwl_tx_tso_segment()
53 skb_transport_header(tmp) - in iwl_tx_tso_segment()
54 tcp_hdrlen(tmp) + tmp->data_len; in iwl_tx_tso_segment()
57 ip_hdr(tmp)->id = htons(ip_base_id + i * num_subframes); in iwl_tx_tso_segment()
60 skb_shinfo(tmp)->gso_size = mss; in iwl_tx_tso_segment()
61 skb_shinfo(tmp)->gso_type = ipv4 ? SKB_GSO_TCPV4 : in iwl_tx_tso_segment()
70 qc = ieee80211_get_qos_ctl((void *)tmp->data); in iwl_tx_tso_segment()
73 skb_shinfo(tmp)->gso_size = 0; in iwl_tx_tso_segment()
103 value = (((u64)value) * db_to_val[change - 1]) >> 32; in iwl_div_by_db()
105 db -= change; in iwl_div_by_db()
115 int sum_magnitude = -128; in iwl_average_neg_dbm()
123 * at least -10 to -110 dBm that will not fit into a 32 bit integer. in iwl_average_neg_dbm()
131 * gives us plenty of head-room for adding up a few values and even in iwl_average_neg_dbm()
133 * (1/2^16 is somewhere around -48 dB, so effectively zero). in iwl_average_neg_dbm()
154 val_magnitude = -neg_dbm_values[i]; in iwl_average_neg_dbm()
157 u8 div_db = sum_magnitude - val_magnitude; in iwl_average_neg_dbm()
162 u8 div_db = val_magnitude - sum_magnitude; in iwl_average_neg_dbm()
182 * average_factor is between -0.5 dB and 0.5 dB. in iwl_average_neg_dbm()
184 * Just do -1 dB steps and find the point where in iwl_average_neg_dbm()
185 * -0.5 dB * -i dB = 0x10000 * 10^(-0.5/10) / i dB in iwl_average_neg_dbm()
193 return clamp(average_magnitude - i, -128, 0); in iwl_average_neg_dbm()