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

Commit 68ac3191 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

sky2: use GFP_KERNEL allocations at device setup



In process and sleep allowed context, favor GFP_KERNEL allocations over
GFP_ATOMIC ones.

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c878d47
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -1362,13 +1362,14 @@ static inline unsigned sky2_rx_pad(const struct sky2_hw *hw)
 * Allocate an skb for receiving. If the MTU is large enough
 * Allocate an skb for receiving. If the MTU is large enough
 * make the skb non-linear with a fragment list of pages.
 * make the skb non-linear with a fragment list of pages.
 */
 */
static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2, gfp_t gfp)
{
{
	struct sk_buff *skb;
	struct sk_buff *skb;
	int i;
	int i;


	skb = netdev_alloc_skb(sky2->netdev,
	skb = __netdev_alloc_skb(sky2->netdev,
			       sky2->rx_data_size + sky2_rx_pad(sky2->hw));
				 sky2->rx_data_size + sky2_rx_pad(sky2->hw),
				 gfp);
	if (!skb)
	if (!skb)
		goto nomem;
		goto nomem;


@@ -1386,7 +1387,7 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
		skb_reserve(skb, NET_IP_ALIGN);
		skb_reserve(skb, NET_IP_ALIGN);


	for (i = 0; i < sky2->rx_nfrags; i++) {
	for (i = 0; i < sky2->rx_nfrags; i++) {
		struct page *page = alloc_page(GFP_ATOMIC);
		struct page *page = alloc_page(gfp);


		if (!page)
		if (!page)
			goto free_partial;
			goto free_partial;
@@ -1416,7 +1417,7 @@ static int sky2_alloc_rx_skbs(struct sky2_port *sky2)
	for (i = 0; i < sky2->rx_pending; i++) {
	for (i = 0; i < sky2->rx_pending; i++) {
		struct rx_ring_info *re = sky2->rx_ring + i;
		struct rx_ring_info *re = sky2->rx_ring + i;


		re->skb = sky2_rx_alloc(sky2);
		re->skb = sky2_rx_alloc(sky2, GFP_KERNEL);
		if (!re->skb)
		if (!re->skb)
			return -ENOMEM;
			return -ENOMEM;


@@ -2384,7 +2385,7 @@ static struct sk_buff *receive_new(struct sky2_port *sky2,
	struct rx_ring_info nre;
	struct rx_ring_info nre;
	unsigned hdr_space = sky2->rx_data_size;
	unsigned hdr_space = sky2->rx_data_size;


	nre.skb = sky2_rx_alloc(sky2);
	nre.skb = sky2_rx_alloc(sky2, GFP_ATOMIC);
	if (unlikely(!nre.skb))
	if (unlikely(!nre.skb))
		goto nobuf;
		goto nobuf;