Skip to content

Commit f124c2d

Browse files
committed
Merge: net-core: stable backports from upstream for 10.1 phase 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1126 JIRA: https://issues.redhat.com/browse/RHEL-96620 A couple of fixes addressing critical issues Signed-off-by: Paolo Abeni <pabeni@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents b624a29 + 6318425 commit f124c2d

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

net/core/page_pool.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats)
150150
EXPORT_SYMBOL(page_pool_ethtool_stats_get);
151151

152152
#else
153-
#define alloc_stat_inc(pool, __stat)
154-
#define recycle_stat_inc(pool, __stat)
155-
#define recycle_stat_add(pool, __stat, val)
153+
#define alloc_stat_inc(...) do { } while (0)
154+
#define recycle_stat_inc(...) do { } while (0)
155+
#define recycle_stat_add(...) do { } while (0)
156156
#endif
157157

158158
static bool page_pool_producer_lock(struct page_pool *pool)
@@ -733,19 +733,16 @@ void page_pool_return_page(struct page_pool *pool, netmem_ref netmem)
733733

734734
static bool page_pool_recycle_in_ring(struct page_pool *pool, netmem_ref netmem)
735735
{
736-
int ret;
737-
/* BH protection not needed if current is softirq */
738-
if (in_softirq())
739-
ret = ptr_ring_produce(&pool->ring, (__force void *)netmem);
740-
else
741-
ret = ptr_ring_produce_bh(&pool->ring, (__force void *)netmem);
736+
bool in_softirq, ret;
742737

743-
if (!ret) {
738+
/* BH protection not needed if current is softirq */
739+
in_softirq = page_pool_producer_lock(pool);
740+
ret = !__ptr_ring_produce(&pool->ring, (__force void *)netmem);
741+
if (ret)
744742
recycle_stat_inc(pool, ring);
745-
return true;
746-
}
743+
page_pool_producer_unlock(pool, in_softirq);
747744

748-
return false;
745+
return ret;
749746
}
750747

751748
/* Only allow direct recycling in special circumstances, into the
@@ -1103,10 +1100,14 @@ static void page_pool_scrub(struct page_pool *pool)
11031100

11041101
static int page_pool_release(struct page_pool *pool)
11051102
{
1103+
bool in_softirq;
11061104
int inflight;
11071105

11081106
page_pool_scrub(pool);
11091107
inflight = page_pool_inflight(pool, true);
1108+
/* Acquire producer lock to make sure producers have exited. */
1109+
in_softirq = page_pool_producer_lock(pool);
1110+
page_pool_producer_unlock(pool, in_softirq);
11101111
if (!inflight)
11111112
__page_pool_destroy(pool);
11121113

net/core/rtnetlink.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,9 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
10051005
/* IFLA_VF_STATS_TX_DROPPED */
10061006
nla_total_size_64bit(sizeof(__u64)));
10071007
}
1008+
if (dev->netdev_ops->ndo_get_vf_guid)
1009+
size += num_vfs * 2 *
1010+
nla_total_size(sizeof(struct ifla_vf_guid));
10081011
return size;
10091012
} else
10101013
return 0;

0 commit comments

Comments
 (0)