From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/net/ethernet/sfc/ef10.c:2224 efx_ef10_tx_tso_desc() warn: assigning (-208) to unsigned variable 'ip_tot_len'
Date: Sat, 26 Jun 2021 03:15:55 +0800 [thread overview]
Message-ID: <202106260344.QNKawkZ1-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8245 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Edward Cree <ecree@solarflare.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 44db63d1ad8d71c6932cbe007eb41f31c434d140
commit: 0ce8df6614568cfb390756cac35ac690105181f5 sfc: implement encapsulated TSO on EF10
date: 10 months ago
:::::: branch date: 23 hours ago
:::::: commit date: 10 months ago
config: i386-randconfig-m031-20210625 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/net/ethernet/sfc/ef10.c:2224 efx_ef10_tx_tso_desc() warn: assigning (-208) to unsigned variable 'ip_tot_len'
vim +/ip_tot_len +2224 drivers/net/ethernet/sfc/ef10.c
8127d661e77f5e Ben Hutchings 2013-08-29 2175
e9117e5099ea29 Bert Kenward 2016-11-17 2176 /* Add Firmware-Assisted TSO v2 option descriptors to a queue.
e9117e5099ea29 Bert Kenward 2016-11-17 2177 */
1679c72cf48552 Edward Cree 2020-09-11 2178 int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
e9117e5099ea29 Bert Kenward 2016-11-17 2179 bool *data_mapped)
e9117e5099ea29 Bert Kenward 2016-11-17 2180 {
e9117e5099ea29 Bert Kenward 2016-11-17 2181 struct efx_tx_buffer *buffer;
0ce8df6614568c Edward Cree 2020-09-11 2182 u16 inner_ipv4_id = 0;
0ce8df6614568c Edward Cree 2020-09-11 2183 u16 outer_ipv4_id = 0;
e9117e5099ea29 Bert Kenward 2016-11-17 2184 struct tcphdr *tcp;
e9117e5099ea29 Bert Kenward 2016-11-17 2185 struct iphdr *ip;
0ce8df6614568c Edward Cree 2020-09-11 2186 u16 ip_tot_len;
e9117e5099ea29 Bert Kenward 2016-11-17 2187 u32 seqnum;
e9117e5099ea29 Bert Kenward 2016-11-17 2188 u32 mss;
e9117e5099ea29 Bert Kenward 2016-11-17 2189
e01b16a7e217a2 Edward Cree 2016-12-02 2190 EFX_WARN_ON_ONCE_PARANOID(tx_queue->tso_version != 2);
e9117e5099ea29 Bert Kenward 2016-11-17 2191
e9117e5099ea29 Bert Kenward 2016-11-17 2192 mss = skb_shinfo(skb)->gso_size;
e9117e5099ea29 Bert Kenward 2016-11-17 2193
e9117e5099ea29 Bert Kenward 2016-11-17 2194 if (unlikely(mss < 4)) {
e9117e5099ea29 Bert Kenward 2016-11-17 2195 WARN_ONCE(1, "MSS of %u is too small for TSO v2\n", mss);
e9117e5099ea29 Bert Kenward 2016-11-17 2196 return -EINVAL;
e9117e5099ea29 Bert Kenward 2016-11-17 2197 }
e9117e5099ea29 Bert Kenward 2016-11-17 2198
0ce8df6614568c Edward Cree 2020-09-11 2199 if (skb->encapsulation) {
0ce8df6614568c Edward Cree 2020-09-11 2200 if (!tx_queue->tso_encap)
0ce8df6614568c Edward Cree 2020-09-11 2201 return -EINVAL;
e9117e5099ea29 Bert Kenward 2016-11-17 2202 ip = ip_hdr(skb);
0ce8df6614568c Edward Cree 2020-09-11 2203 if (ip->version == 4)
0ce8df6614568c Edward Cree 2020-09-11 2204 outer_ipv4_id = ntohs(ip->id);
0ce8df6614568c Edward Cree 2020-09-11 2205
0ce8df6614568c Edward Cree 2020-09-11 2206 ip = inner_ip_hdr(skb);
0ce8df6614568c Edward Cree 2020-09-11 2207 tcp = inner_tcp_hdr(skb);
0ce8df6614568c Edward Cree 2020-09-11 2208 } else {
0ce8df6614568c Edward Cree 2020-09-11 2209 ip = ip_hdr(skb);
0ce8df6614568c Edward Cree 2020-09-11 2210 tcp = tcp_hdr(skb);
0ce8df6614568c Edward Cree 2020-09-11 2211 }
0ce8df6614568c Edward Cree 2020-09-11 2212
0ce8df6614568c Edward Cree 2020-09-11 2213 /* 8000-series EF10 hardware requires that IP Total Length be
0ce8df6614568c Edward Cree 2020-09-11 2214 * greater than or equal to the value it will have in each segment
0ce8df6614568c Edward Cree 2020-09-11 2215 * (which is at most mss + 208 + TCP header length), but also less
0ce8df6614568c Edward Cree 2020-09-11 2216 * than (0x10000 - inner_network_header). Otherwise the TCP
0ce8df6614568c Edward Cree 2020-09-11 2217 * checksum calculation will be broken for encapsulated packets.
0ce8df6614568c Edward Cree 2020-09-11 2218 * We fill in ip->tot_len with 0xff30, which should satisfy the
0ce8df6614568c Edward Cree 2020-09-11 2219 * first requirement unless the MSS is ridiculously large (which
0ce8df6614568c Edward Cree 2020-09-11 2220 * should be impossible as the driver max MTU is 9216); it is
0ce8df6614568c Edward Cree 2020-09-11 2221 * guaranteed to satisfy the second as we only attempt TSO if
0ce8df6614568c Edward Cree 2020-09-11 2222 * inner_network_header <= 208.
0ce8df6614568c Edward Cree 2020-09-11 2223 */
0ce8df6614568c Edward Cree 2020-09-11 @2224 ip_tot_len = -EFX_TSO2_MAX_HDRLEN;
0ce8df6614568c Edward Cree 2020-09-11 2225 EFX_WARN_ON_ONCE_PARANOID(mss + EFX_TSO2_MAX_HDRLEN +
0ce8df6614568c Edward Cree 2020-09-11 2226 (tcp->doff << 2u) > ip_tot_len);
0ce8df6614568c Edward Cree 2020-09-11 2227
e9117e5099ea29 Bert Kenward 2016-11-17 2228 if (ip->version == 4) {
0ce8df6614568c Edward Cree 2020-09-11 2229 ip->tot_len = htons(ip_tot_len);
e9117e5099ea29 Bert Kenward 2016-11-17 2230 ip->check = 0;
0ce8df6614568c Edward Cree 2020-09-11 2231 inner_ipv4_id = ntohs(ip->id);
e9117e5099ea29 Bert Kenward 2016-11-17 2232 } else {
0ce8df6614568c Edward Cree 2020-09-11 2233 ((struct ipv6hdr *)ip)->payload_len = htons(ip_tot_len);
e9117e5099ea29 Bert Kenward 2016-11-17 2234 }
e9117e5099ea29 Bert Kenward 2016-11-17 2235
e9117e5099ea29 Bert Kenward 2016-11-17 2236 seqnum = ntohl(tcp->seq);
e9117e5099ea29 Bert Kenward 2016-11-17 2237
e9117e5099ea29 Bert Kenward 2016-11-17 2238 buffer = efx_tx_queue_get_insert_buffer(tx_queue);
e9117e5099ea29 Bert Kenward 2016-11-17 2239
e9117e5099ea29 Bert Kenward 2016-11-17 2240 buffer->flags = EFX_TX_BUF_OPTION;
e9117e5099ea29 Bert Kenward 2016-11-17 2241 buffer->len = 0;
e9117e5099ea29 Bert Kenward 2016-11-17 2242 buffer->unmap_len = 0;
e9117e5099ea29 Bert Kenward 2016-11-17 2243 EFX_POPULATE_QWORD_5(buffer->option,
e9117e5099ea29 Bert Kenward 2016-11-17 2244 ESF_DZ_TX_DESC_IS_OPT, 1,
e9117e5099ea29 Bert Kenward 2016-11-17 2245 ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_TSO,
e9117e5099ea29 Bert Kenward 2016-11-17 2246 ESF_DZ_TX_TSO_OPTION_TYPE,
e9117e5099ea29 Bert Kenward 2016-11-17 2247 ESE_DZ_TX_TSO_OPTION_DESC_FATSO2A,
0ce8df6614568c Edward Cree 2020-09-11 2248 ESF_DZ_TX_TSO_IP_ID, inner_ipv4_id,
e9117e5099ea29 Bert Kenward 2016-11-17 2249 ESF_DZ_TX_TSO_TCP_SEQNO, seqnum
e9117e5099ea29 Bert Kenward 2016-11-17 2250 );
e9117e5099ea29 Bert Kenward 2016-11-17 2251 ++tx_queue->insert_count;
e9117e5099ea29 Bert Kenward 2016-11-17 2252
e9117e5099ea29 Bert Kenward 2016-11-17 2253 buffer = efx_tx_queue_get_insert_buffer(tx_queue);
e9117e5099ea29 Bert Kenward 2016-11-17 2254
e9117e5099ea29 Bert Kenward 2016-11-17 2255 buffer->flags = EFX_TX_BUF_OPTION;
e9117e5099ea29 Bert Kenward 2016-11-17 2256 buffer->len = 0;
e9117e5099ea29 Bert Kenward 2016-11-17 2257 buffer->unmap_len = 0;
0ce8df6614568c Edward Cree 2020-09-11 2258 EFX_POPULATE_QWORD_5(buffer->option,
e9117e5099ea29 Bert Kenward 2016-11-17 2259 ESF_DZ_TX_DESC_IS_OPT, 1,
e9117e5099ea29 Bert Kenward 2016-11-17 2260 ESF_DZ_TX_OPTION_TYPE, ESE_DZ_TX_OPTION_DESC_TSO,
e9117e5099ea29 Bert Kenward 2016-11-17 2261 ESF_DZ_TX_TSO_OPTION_TYPE,
e9117e5099ea29 Bert Kenward 2016-11-17 2262 ESE_DZ_TX_TSO_OPTION_DESC_FATSO2B,
0ce8df6614568c Edward Cree 2020-09-11 2263 ESF_DZ_TX_TSO_OUTER_IPID, outer_ipv4_id,
e9117e5099ea29 Bert Kenward 2016-11-17 2264 ESF_DZ_TX_TSO_TCP_MSS, mss
e9117e5099ea29 Bert Kenward 2016-11-17 2265 );
e9117e5099ea29 Bert Kenward 2016-11-17 2266 ++tx_queue->insert_count;
e9117e5099ea29 Bert Kenward 2016-11-17 2267
e9117e5099ea29 Bert Kenward 2016-11-17 2268 return 0;
e9117e5099ea29 Bert Kenward 2016-11-17 2269 }
e9117e5099ea29 Bert Kenward 2016-11-17 2270
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36098 bytes --]
reply other threads:[~2021-06-25 19:15 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=202106260344.QNKawkZ1-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.