Skip to contentSkip to conversation

staging: vt6656: Use sk_buff buffer for tx header

PATCH In review Malcolm Priestley 1 participant 1 message May 16, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 staging: vt6656: Use sk_buff buffer for tx header

mac80211 can provide space for the driver to put a tx header on the skb buffer instead coping the entire frame on to a local buffer with the header.

To use this extra_tx_headroom must be set in mac80211 with the largest possible header which is struct vnt_tx_buffer.

The driver has 8 possible combinations of tx header size which are found in vnt_get_hdr_size replacing vnt_mac_hdr_pos.

---
 drivers/staging/vt6656/device.h   |  1 +
 drivers/staging/vt6656/main_usb.c |  1 +
 drivers/staging/vt6656/rxtx.c     | 91 ++++++++++++++++++-------------
 drivers/staging/vt6656/rxtx.h     |  8 ++-
 drivers/staging/vt6656/usbpipe.c  |  2 +-
 5 files changed, 61 insertions(+), 42 deletions(-)
drivers/staging/vt6656/device.h +1 -0
index d19d802b5d4f..074b98dfac91 100644
@@ -240,6 +240,7 @@ struct vnt_usb_send_context {
 	struct sk_buff *skb;
 	struct urb *urb;
 	struct ieee80211_hdr *hdr;
+	void *tx_buffer;
 	unsigned int buf_len;
 	u32 frame_len;
 	u16 tx_hdr_size;
drivers/staging/vt6656/main_usb.c +1 -0
index b5790d4d7152..930ee424ecdf 100644
@@ -1053,6 +1053,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	ieee80211_hw_set(priv->hw, SUPPORTS_PS);
 	ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK);
 
+	priv->hw->extra_tx_headroom = sizeof(struct vnt_tx_buffer);
 	priv->hw->max_signal = 100;
 
 	SET_IEEE80211_DEV(priv->hw, &intf->dev);
drivers/staging/vt6656/rxtx.c +53 -38

145 lines not on this page · raw message

drivers/staging/vt6656/rxtx.h +5 -3
index 3c36a4b893dc..819b45394673 100644
@@ -77,14 +77,12 @@ struct vnt_tx_datahead_g {
 	__le16 duration_a;
 	__le16 time_stamp_off_b;
 	__le16 time_stamp_off_a;
-	struct ieee80211_hdr hdr;
 } __packed;
 
 struct vnt_tx_datahead_ab {
 	struct vnt_phy_field ab;
 	__le16 duration;
 	__le16 time_stamp_off;
-	struct ieee80211_hdr hdr;
 } __packed;
 
 /* RTS buffer header */
@@ -161,10 +159,14 @@ struct vnt_tx_fifo_head {
 	__le16 current_rate;
 } __packed;
 
-struct vnt_tx_buffer {
+struct vnt_tx_usb_header {
 	u8 type;
 	u8 pkt_no;
 	__le16 tx_byte_count;
+} __packed;
+
+struct vnt_tx_buffer {
+	struct vnt_tx_usb_header usb;
 	struct vnt_tx_fifo_head fifo_head;
 	union vnt_tx_head tx_head;
 } __packed;
drivers/staging/vt6656/usbpipe.c +1 -1
index 06dedf291db2..904645fa0eb0 100644
@@ -466,7 +466,7 @@ int vnt_tx_context(struct vnt_private *priv,
 	usb_fill_bulk_urb(urb,
 			  priv->usb,
 			  usb_sndbulkpipe(priv->usb, 3),
-			  context->data,
+			  context->tx_buffer,
 			  context->buf_len,
 			  vnt_tx_context_complete,
 			  context);
Signature · 1 line
2.25.1