Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 189fc7c

Browse files
committed
ath6kl: Fix the byte alignment rule to avoid loss of bytes in a TCP segment
Either first 3 bytes of the first received tcp segment or last one over MTU size file can be loss due to the byte alignment problem. Although ATH6KL_HTC_ALIGN_BYTES was defined for 'extra bytes for htc header alignment' in the patch "Fix buffer alignment for scatter-gather I/O"(1df94a8), there exists the bytes loss issue which means that it will be truncated 3 bytes in the transmitted file contents if a file which has over MTU size is transferred through TCP/IP stack. It doesn't look like TCP/IP stack bug of 3.5 or the latest version of kernel but the byte alignment issue. This patch is to use the roundup() function for the byte alignment rather than the predefined ATH6KL_HTC_ALIGN_BYTES. Signed-off-by: Myoungje Kim <[email protected]>
1 parent c41b381 commit 189fc7c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/net/wireless/ath/ath6kl/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ struct sk_buff *ath6kl_buf_alloc(int size)
201201
u16 reserved;
202202

203203
/* Add chacheline space at front and back of buffer */
204-
reserved = (2 * L1_CACHE_BYTES) + ATH6KL_DATA_OFFSET +
205-
sizeof(struct htc_packet) + ATH6KL_HTC_ALIGN_BYTES;
204+
reserved = roundup((2 * L1_CACHE_BYTES) + ATH6KL_DATA_OFFSET +
205+
sizeof(struct htc_packet) + ATH6KL_HTC_ALIGN_BYTES, 4);
206206
skb = dev_alloc_skb(size + reserved);
207207

208208
if (skb)

drivers/net/wireless/ath/ath6kl/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,9 @@ void init_netdev(struct net_device *dev)
13271327
dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
13281328

13291329
dev->needed_headroom = ETH_HLEN;
1330-
dev->needed_headroom += sizeof(struct ath6kl_llc_snap_hdr) +
1330+
dev->needed_headroom += roundup(sizeof(struct ath6kl_llc_snap_hdr) +
13311331
sizeof(struct wmi_data_hdr) + HTC_HDR_LENGTH
1332-
+ WMI_MAX_TX_META_SZ + ATH6KL_HTC_ALIGN_BYTES;
1332+
+ WMI_MAX_TX_META_SZ + ATH6KL_HTC_ALIGN_BYTES, 4);
13331333

13341334
dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
13351335

0 commit comments

Comments
 (0)