wimax/i2400m: support extended data RX protocol (no need to reallocate skbs)
Newer i2400m firmwares (>= v1.4) extend the data RX protocol so that
each packet has a 16 byte header. This header is mainly used to
implement host reordeing (which is addressed in later commits).
However, this header also allows us to overwrite it (once data has
been extracted) with an Ethernet header and deliver to the networking
stack without having to reallocate the skb (as it happened in fw <=
v1.3) to make room for it.
- control.c: indicate the device [dev_initialize()] that the driver
wants to use the extended data RX protocol. Also involves adding the
definition of the needed data types in include/linux/wimax/i2400m.h.
- rx.c: handle the new payload type for the extended RX data
protocol. Prepares the skb for delivery to
netdev.c:i2400m_net_erx().
- netdev.c: Introduce i2400m_net_erx() that adds the fake ethernet
address to a prepared skb and delivers it to the networking
stack.
- cleanup: in most instances in rx.c, the variable 'single' was
renamed to 'single_last' for it better conveys its meaning.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
index c3968b2..4073c3e 100644
--- a/drivers/net/wimax/i2400m/control.c
+++ b/drivers/net/wimax/i2400m/control.c
@@ -1311,6 +1311,7 @@
struct device *dev = i2400m_dev(i2400m);
struct i2400m_tlv_config_idle_parameters idle_params;
struct i2400m_tlv_config_idle_timeout idle_timeout;
+ struct i2400m_tlv_config_d2h_data_format df;
const struct i2400m_tlv_hdr *args[9];
unsigned argc = 0;
@@ -1333,6 +1334,14 @@
args[argc++] = &idle_timeout.hdr;
}
}
+ if (i2400m_ge_v1_4(i2400m)) {
+ df.hdr.type =
+ cpu_to_le16(I2400M_TLV_CONFIG_D2H_DATA_FORMAT);
+ df.hdr.length = cpu_to_le16(
+ sizeof(df) - sizeof(df.hdr));
+ df.format = 1;
+ args[argc++] = &df.hdr;
+ }
result = i2400m_set_init_config(i2400m, args, argc);
if (result < 0)
goto error;