usb: gadget: rndis: Add new rndis parameters

Add pkt_alignment_factor rndis parameter. This
parameter along with max_pkt_per_xfer allow rndis
function driver to aggregate more than one IP packets
per transfer. This is done by calling newly added API
rndis_set_pkt_alignment_factor().

Change-Id: Ic9c543c388f872452e708a3a26be4ae82b54c082
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
Hemant Kumar 2016-02-01 18:54:16 -08:00 committed by David Keitel
parent a86fe70b61
commit b4fc5ee2ec
2 changed files with 17 additions and 1 deletions

View file

@ -595,7 +595,7 @@ static int rndis_init_response(struct rndis_params *params,
+ sizeof(struct ethhdr) + sizeof(struct ethhdr)
+ sizeof(struct rndis_packet_msg_type) + sizeof(struct rndis_packet_msg_type)
+ 22)); + 22));
resp->PacketAlignmentFactor = cpu_to_le32(0); resp->PacketAlignmentFactor = cpu_to_le32(params->pkt_alignment_factor);
resp->AFListOffset = cpu_to_le32(0); resp->AFListOffset = cpu_to_le32(0);
resp->AFListSize = cpu_to_le32(0); resp->AFListSize = cpu_to_le32(0);
@ -1209,6 +1209,19 @@ int rndis_rm_hdr(struct gether *port,
} }
EXPORT_SYMBOL_GPL(rndis_rm_hdr); EXPORT_SYMBOL_GPL(rndis_rm_hdr);
void rndis_set_pkt_alignment_factor(struct rndis_params *params,
u8 pkt_alignment_factor)
{
pr_debug("%s:\n", __func__);
if (!params) {
pr_err("%s: failed, params NULL\n", __func__);
return;
}
params->pkt_alignment_factor = pkt_alignment_factor;
}
#ifdef CONFIG_USB_GADGET_DEBUG_FILES #ifdef CONFIG_USB_GADGET_DEBUG_FILES
static int rndis_proc_show(struct seq_file *m, void *v) static int rndis_proc_show(struct seq_file *m, void *v)

View file

@ -192,6 +192,7 @@ typedef struct rndis_params
u32 vendorID; u32 vendorID;
u8 max_pkt_per_xfer; u8 max_pkt_per_xfer;
const char *vendorDescr; const char *vendorDescr;
u8 pkt_alignment_factor;
void (*resp_avail)(void *v); void (*resp_avail)(void *v);
void (*flow_ctrl_enable)(bool enable, void (*flow_ctrl_enable)(bool enable,
struct rndis_params *params); struct rndis_params *params);
@ -224,5 +225,7 @@ int rndis_signal_disconnect(struct rndis_params *params);
int rndis_state(struct rndis_params *params); int rndis_state(struct rndis_params *params);
extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr); extern void rndis_set_host_mac(struct rndis_params *params, const u8 *addr);
void rndis_flow_control(struct rndis_params *params, bool enable_flow_control); void rndis_flow_control(struct rndis_params *params, bool enable_flow_control);
void rndis_set_pkt_alignment_factor(struct rndis_params *params,
u8 pkt_alignment_factor);
#endif /* _LINUX_RNDIS_H */ #endif /* _LINUX_RNDIS_H */