From: Tony Chuang > Sent: 08 July 2019 10:00 > > > > @@ -803,25 +812,14 @@ static void rtw_pci_rx_isr(struct rtw_dev > > *rtwdev, > > > > struct rtw_pci *rtwpci, > > > > skb_put(skb, pkt_stat.pkt_len); > > > > skb_reserve(skb, pkt_offset); > > > > > > > > - /* alloc a smaller skb to mac80211 */ > > > > - new = dev_alloc_skb(pkt_stat.pkt_len); > > > > - if (!new) { > > > > - new = skb; > > > > - } else { > > > > - skb_put_data(new, skb->data, > > skb->len); > > > > - dev_kfree_skb_any(skb); > > > > - } > > > > > > I am not sure if it's fine to deliver every huge SKB to mac80211. > > > Because it will then be delivered to TCP/IP stack. > > > Hence I think either it should be tested to know if the performance > > > would be impacted or find out a more efficient way to send > > > smaller SKB to mac80211 stack. > > > > I remember network stack only processes the skb with(in) pointers > > (skb->data) and the skb->len for data part. It also checks real > > buffer boundary (head and end) of the skb to prevent memory overflow. > > Therefore, I think using the original skb is the most efficient way. > > > > If I misunderstand something, please point out. > > > > It means if we still use a huge SKB (~8K) for every RX packet (~1.5K). > There is about 6.5K not used. And even more if we ping with large packet > size "eg. $ ping -s 65536", I am not sure if those huge SKBs will eat all of > the SKB mem pool, and then ping fails. > > BTW, the original design of RTK_PCI_RX_BUF_SIZE to be (8192 + 24) is to > receive AMSDU packet in one SKB. > (Could probably enlarge it to RX VHT AMSDU ~11K) If you allocate 8192+24 the memory allocated will be either 12k or 16k and the skb truesize set appropriately. (Probably 16k if dma memory.) If this is fed into IP it is quite likely that a single byte of data will end up queued on the socket in 16k of dma-able memory. The 'truesize' stops this using all the system memory, but it isn't good for memory usage. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)