Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 975914b5 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

net: qualcomm: rmnet: Allow configuration of page recycling



This allows userspace to toggle the page recycling feature from
userspace.

CRs-Fixed: 2512312
Change-Id: I9e64cb2d52638c5e48355b2e3ac0bd2136f69480
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 59793164
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -394,6 +394,7 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
		agg_params = nla_data(data[IFLA_RMNET_UL_AGG_PARAMS]);
		rmnet_map_update_ul_agg_config(port, agg_params->agg_size,
					       agg_params->agg_count,
					       agg_params->agg_features,
					       agg_params->agg_time);
	}

+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ struct rmnet_port_priv_stats {

struct rmnet_egress_agg_params {
	u16 agg_size;
	u16 agg_count;
	u8 agg_count;
	u8 agg_features;
	u32 agg_time;
};

+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ void rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port);
void rmnet_map_tx_aggregate_init(struct rmnet_port *port);
void rmnet_map_tx_aggregate_exit(struct rmnet_port *port);
void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u16 size,
				    u16 count, u32 time);
				    u8 count, u8 features, u32 time);
void rmnet_map_dl_hdr_notify(struct rmnet_port *port,
			     struct rmnet_map_dl_ind_hdr *dl_hdr);
void rmnet_map_dl_hdr_notify_v2(struct rmnet_port *port,
+10 −3
Original line number Diff line number Diff line
@@ -1268,6 +1268,9 @@ static struct page *rmnet_get_agg_pages(struct rmnet_port *port)
	struct page *page = NULL;
	int i = 0;

	if (!(port->egress_agg_params.agg_features & RMNET_PAGE_RECYCLE))
		goto alloc;

	do {
		agg_page = port->agg_head;
		if (unlikely(!agg_page))
@@ -1286,6 +1289,7 @@ static struct page *rmnet_get_agg_pages(struct rmnet_port *port)
		i++;
	} while (i <= 5);

alloc:
	if (!page) {
		page =  __dev_alloc_pages(GFP_ATOMIC, port->agg_size_order);
		port->stats.agg.ul_agg_alloc++;
@@ -1431,7 +1435,7 @@ void rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port)
}

void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u16 size,
				    u16 count, u32 time)
				    u8 count, u8 features, u32 time)
{
	unsigned long irq_flags;

@@ -1439,6 +1443,7 @@ void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u16 size,
	port->egress_agg_params.agg_count = count;
	port->egress_agg_params.agg_time = time;
	port->egress_agg_params.agg_size = size;
	port->egress_agg_params.agg_features = features;

	rmnet_free_agg_pages(port);

@@ -1454,6 +1459,7 @@ void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u16 size,
	size -= SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
	port->egress_agg_params.agg_size = size;

	if (port->egress_agg_params.agg_features == RMNET_PAGE_RECYCLE)
		rmnet_alloc_agg_pages(port);

done:
@@ -1470,8 +1476,9 @@ void rmnet_map_tx_aggregate_init(struct rmnet_port *port)
	/* Since PAGE_SIZE - 1 is specified here, no pages are pre-allocated.
	 * This is done to reduce memory usage in cases where
	 * UL aggregation is disabled.
	 * Additionally, the features flag is also set to 0.
	 */
	rmnet_map_update_ul_agg_config(port, PAGE_SIZE - 1, 20, 3000000);
	rmnet_map_update_ul_agg_config(port, PAGE_SIZE - 1, 20, 0, 3000000);

	INIT_WORK(&port->agg_wq, rmnet_map_flush_tx_packet_work);
}
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ RMNET_INGRESS_FORMAT_DL_MARKER_V2)
#define RMNET_INGRESS_FORMAT_PS                 BIT(27)
#define RMNET_FORMAT_PS_NOTIF                   BIT(26)

/* UL Aggregation parameters */
#define RMNET_PAGE_RECYCLE                      BIT(0)

/* Replace skb->dev to a virtual rmnet device and pass up the stack */
#define RMNET_EPMODE_VND (1)
/* Pass the frame directly to another device with dev_queue_xmit() */