Commit f2b3b6a2 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-thunderbolt-fix-for-sparse-warnings-and-typos'

Mika Westerberg says:

====================
net: thunderbolt: Fix for sparse warnings and typos

This series tries to fix the rest of the sparse warnings generated
against the driver. While there fix the two typos in comments as well.

The previous version of the series can be found here:
  https://lore.kernel.org/netdev/20230404053636.51597-1-mika.westerberg@linux.intel.com/
====================

Link: https://lore.kernel.org/r/20230411091049.12998-1-mika.westerberg@linux.intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 37f9b2a6 9c60f2a4
...@@ -148,7 +148,7 @@ struct tbnet_ring { ...@@ -148,7 +148,7 @@ struct tbnet_ring {
/** /**
* struct tbnet - ThunderboltIP network driver private data * struct tbnet - ThunderboltIP network driver private data
* @svc: XDomain service the driver is bound to * @svc: XDomain service the driver is bound to
* @xd: XDomain the service blongs to * @xd: XDomain the service belongs to
* @handler: ThunderboltIP configuration protocol handler * @handler: ThunderboltIP configuration protocol handler
* @dev: Networking device * @dev: Networking device
* @napi: NAPI structure for Rx polling * @napi: NAPI structure for Rx polling
...@@ -764,7 +764,7 @@ static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, ...@@ -764,7 +764,7 @@ static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf,
*/ */
if (net->skb && net->rx_hdr.frame_count) { if (net->skb && net->rx_hdr.frame_count) {
/* Check the frame count fits the count field */ /* Check the frame count fits the count field */
if (frame_count != net->rx_hdr.frame_count) { if (frame_count != le32_to_cpu(net->rx_hdr.frame_count)) {
net->stats.rx_length_errors++; net->stats.rx_length_errors++;
return false; return false;
} }
...@@ -772,8 +772,8 @@ static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf, ...@@ -772,8 +772,8 @@ static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf,
/* Check the frame identifiers are incremented correctly, /* Check the frame identifiers are incremented correctly,
* and id is matching. * and id is matching.
*/ */
if (frame_index != net->rx_hdr.frame_index + 1 || if (frame_index != le16_to_cpu(net->rx_hdr.frame_index) + 1 ||
frame_id != net->rx_hdr.frame_id) { frame_id != le16_to_cpu(net->rx_hdr.frame_id)) {
net->stats.rx_missed_errors++; net->stats.rx_missed_errors++;
return false; return false;
} }
...@@ -873,11 +873,12 @@ static int tbnet_poll(struct napi_struct *napi, int budget) ...@@ -873,11 +873,12 @@ static int tbnet_poll(struct napi_struct *napi, int budget)
TBNET_RX_PAGE_SIZE - hdr_size); TBNET_RX_PAGE_SIZE - hdr_size);
} }
net->rx_hdr.frame_size = frame_size; net->rx_hdr.frame_size = hdr->frame_size;
net->rx_hdr.frame_count = le32_to_cpu(hdr->frame_count); net->rx_hdr.frame_count = hdr->frame_count;
net->rx_hdr.frame_index = le16_to_cpu(hdr->frame_index); net->rx_hdr.frame_index = hdr->frame_index;
net->rx_hdr.frame_id = le16_to_cpu(hdr->frame_id); net->rx_hdr.frame_id = hdr->frame_id;
last = net->rx_hdr.frame_index == net->rx_hdr.frame_count - 1; last = le16_to_cpu(net->rx_hdr.frame_index) ==
le32_to_cpu(net->rx_hdr.frame_count) - 1;
rx_packets++; rx_packets++;
net->stats.rx_bytes += frame_size; net->stats.rx_bytes += frame_size;
...@@ -990,8 +991,10 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb, ...@@ -990,8 +991,10 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb,
{ {
struct thunderbolt_ip_frame_header *hdr = page_address(frames[0]->page); struct thunderbolt_ip_frame_header *hdr = page_address(frames[0]->page);
struct device *dma_dev = tb_ring_dma_device(net->tx_ring.ring); struct device *dma_dev = tb_ring_dma_device(net->tx_ring.ring);
__wsum wsum = htonl(skb->len - skb_transport_offset(skb));
unsigned int i, len, offset = skb_transport_offset(skb); unsigned int i, len, offset = skb_transport_offset(skb);
/* Remove payload length from checksum */
u32 paylen = skb->len - skb_transport_offset(skb);
__wsum wsum = (__force __wsum)htonl(paylen);
__be16 protocol = skb->protocol; __be16 protocol = skb->protocol;
void *data = skb->data; void *data = skb->data;
void *dest = hdr + 1; void *dest = hdr + 1;
...@@ -1027,7 +1030,7 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb, ...@@ -1027,7 +1030,7 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb,
/* Data points on the beginning of packet. /* Data points on the beginning of packet.
* Check is the checksum absolute place in the packet. * Check is the checksum absolute place in the packet.
* ipcso will update IP checksum. * ipcso will update IP checksum.
* tucso will update TCP/UPD checksum. * tucso will update TCP/UDP checksum.
*/ */
if (protocol == htons(ETH_P_IP)) { if (protocol == htons(ETH_P_IP)) {
__sum16 *ipcso = dest + ((void *)&(ip_hdr(skb)->check) - data); __sum16 *ipcso = dest + ((void *)&(ip_hdr(skb)->check) - data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment