Skip to content

Commit

Permalink
tgupdate: merge t/DO-NOT-MERGE-git-markup-end-common-net-net-next int…
Browse files Browse the repository at this point in the history
…o t/DO-NOT-MERGE-git-markup-net-next base

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>

# Conflicts:
#	drivers/net/ethernet/google/gve/gve.h
  • Loading branch information
matttbe committed Apr 5, 2023
2 parents e432afb + a6a563b commit 5ea299f
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 54 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/google/gve/gve.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

#define GVE_RX_BUFFER_SIZE_DQO 2048

#define GVE_GQ_TX_MIN_PKT_DESC_BYTES 182

#define GVE_XDP_ACTIONS 5

#define GVE_TX_MAX_HEADER_SIZE 182
Expand Down
12 changes: 5 additions & 7 deletions drivers/net/ethernet/google/gve/gve_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ static inline int gve_skb_fifo_bytes_required(struct gve_tx_ring *tx,
int bytes;
int hlen;

hlen = skb_is_gso(skb) ? skb_checksum_start_offset(skb) +
tcp_hdrlen(skb) : skb_headlen(skb);
hlen = skb_is_gso(skb) ? skb_checksum_start_offset(skb) + tcp_hdrlen(skb) :
min_t(int, GVE_GQ_TX_MIN_PKT_DESC_BYTES, skb->len);

pad_bytes = gve_tx_fifo_pad_alloc_one_frag(&tx->tx_fifo,
hlen);
Expand Down Expand Up @@ -522,13 +522,11 @@ static int gve_tx_add_skb_copy(struct gve_priv *priv, struct gve_tx_ring *tx, st
pkt_desc = &tx->desc[idx];

l4_hdr_offset = skb_checksum_start_offset(skb);
/* If the skb is gso, then we want the tcp header in the first segment
* otherwise we want the linear portion of the skb (which will contain
* the checksum because skb->csum_start and skb->csum_offset are given
* relative to skb->head) in the first segment.
/* If the skb is gso, then we want the tcp header alone in the first segment
* otherwise we want the minimum required by the gVNIC spec.
*/
hlen = is_gso ? l4_hdr_offset + tcp_hdrlen(skb) :
skb_headlen(skb);
min_t(int, GVE_GQ_TX_MIN_PKT_DESC_BYTES, skb->len);

info->skb = skb;
/* We don't want to split the header, so if necessary, pad to the end
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6950,7 +6950,7 @@ static void stmmac_napi_del(struct net_device *dev)
int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
{
struct stmmac_priv *priv = netdev_priv(dev);
int ret = 0;
int ret = 0, i;

if (netif_running(dev))
stmmac_release(dev);
Expand All @@ -6959,6 +6959,10 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)

priv->plat->rx_queues_to_use = rx_cnt;
priv->plat->tx_queues_to_use = tx_cnt;
if (!netif_is_rxfh_configured(dev))
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
priv->rss.table[i] = ethtool_rxfh_indir_default(i,
rx_cnt);

stmmac_napi_add(dev);

Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/ti/am65-cpsw-nuss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
am65_cpsw_nuss_phylink_cleanup(common);
am65_cpts_release(common->cpts);
err_of_clear:
of_platform_device_destroy(common->mdio_dev, NULL);
if (common->mdio_dev)
of_platform_device_destroy(common->mdio_dev, NULL);
err_pm_clear:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
Expand Down Expand Up @@ -2987,7 +2988,8 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev)
am65_cpts_release(common->cpts);
am65_cpsw_disable_serdes_phy(common);

of_platform_device_destroy(common->mdio_dev, NULL);
if (common->mdio_dev)
of_platform_device_destroy(common->mdio_dev, NULL);

pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
Expand Down
4 changes: 2 additions & 2 deletions include/net/raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int raw_rcv(struct sock *, struct sk_buff *);
struct raw_hashinfo {
spinlock_t lock;

struct hlist_nulls_head ht[RAW_HTABLE_SIZE] ____cacheline_aligned;
struct hlist_head ht[RAW_HTABLE_SIZE] ____cacheline_aligned;
};

static inline u32 raw_hashfunc(const struct net *net, u32 proto)
Expand All @@ -51,7 +51,7 @@ static inline void raw_hashinfo_init(struct raw_hashinfo *hashinfo)

spin_lock_init(&hashinfo->lock);
for (i = 0; i < RAW_HTABLE_SIZE; i++)
INIT_HLIST_NULLS_HEAD(&hashinfo->ht[i], i);
INIT_HLIST_HEAD(&hashinfo->ht[i]);
}

#ifdef CONFIG_PROC_FS
Expand Down
7 changes: 4 additions & 3 deletions net/ethtool/linkmodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ static int ethnl_update_linkmodes(struct genl_info *info, struct nlattr **tb,
"lanes configuration not supported by device");
return -EOPNOTSUPP;
}
} else if (!lsettings->autoneg) {
/* If autoneg is off and lanes parameter is not passed from user,
* set the lanes parameter to 0.
} else if (!lsettings->autoneg && ksettings->lanes) {
/* If autoneg is off and lanes parameter is not passed from user but
* it was defined previously then set the lanes parameter to 0.
*/
ksettings->lanes = 0;
*mod = true;
}

ret = ethnl_update_bitset(ksettings->link_modes.advertising,
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,13 +1089,13 @@ static struct sock *ping_get_idx(struct seq_file *seq, loff_t pos)
}

void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family)
__acquires(RCU)
__acquires(ping_table.lock)
{
struct ping_iter_state *state = seq->private;
state->bucket = 0;
state->family = family;

rcu_read_lock();
spin_lock(&ping_table.lock);

return *pos ? ping_get_idx(seq, *pos-1) : SEQ_START_TOKEN;
}
Expand All @@ -1121,9 +1121,9 @@ void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos)
EXPORT_SYMBOL_GPL(ping_seq_next);

void ping_seq_stop(struct seq_file *seq, void *v)
__releases(RCU)
__releases(ping_table.lock)
{
rcu_read_unlock();
spin_unlock(&ping_table.lock);
}
EXPORT_SYMBOL_GPL(ping_seq_stop);

Expand Down
36 changes: 19 additions & 17 deletions net/ipv4/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ EXPORT_SYMBOL_GPL(raw_v4_hashinfo);
int raw_hash_sk(struct sock *sk)
{
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
struct hlist_nulls_head *hlist;
struct hlist_head *hlist;

hlist = &h->ht[raw_hashfunc(sock_net(sk), inet_sk(sk)->inet_num)];

spin_lock(&h->lock);
__sk_nulls_add_node_rcu(sk, hlist);
sk_add_node_rcu(sk, hlist);
sock_set_flag(sk, SOCK_RCU_FREE);
spin_unlock(&h->lock);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
Expand All @@ -110,7 +110,7 @@ void raw_unhash_sk(struct sock *sk)
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;

spin_lock(&h->lock);
if (__sk_nulls_del_node_init_rcu(sk))
if (sk_del_node_init_rcu(sk))
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
spin_unlock(&h->lock);
}
Expand Down Expand Up @@ -163,16 +163,15 @@ static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
static int raw_v4_input(struct net *net, struct sk_buff *skb,
const struct iphdr *iph, int hash)
{
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
int sdif = inet_sdif(skb);
struct hlist_head *hlist;
int dif = inet_iif(skb);
int delivered = 0;
struct sock *sk;

hlist = &raw_v4_hashinfo.ht[hash];
rcu_read_lock();
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
if (!raw_v4_match(net, sk, iph->protocol,
iph->saddr, iph->daddr, dif, sdif))
continue;
Expand Down Expand Up @@ -264,10 +263,9 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
{
struct net *net = dev_net(skb->dev);
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
int dif = skb->dev->ifindex;
int sdif = inet_sdif(skb);
struct hlist_head *hlist;
const struct iphdr *iph;
struct sock *sk;
int hash;
Expand All @@ -276,7 +274,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
hlist = &raw_v4_hashinfo.ht[hash];

rcu_read_lock();
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
iph = (const struct iphdr *)skb->data;
if (!raw_v4_match(net, sk, iph->protocol,
iph->daddr, iph->saddr, dif, sdif))
Expand Down Expand Up @@ -950,14 +948,13 @@ static struct sock *raw_get_first(struct seq_file *seq, int bucket)
{
struct raw_hashinfo *h = pde_data(file_inode(seq->file));
struct raw_iter_state *state = raw_seq_private(seq);
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
struct hlist_head *hlist;
struct sock *sk;

for (state->bucket = bucket; state->bucket < RAW_HTABLE_SIZE;
++state->bucket) {
hlist = &h->ht[state->bucket];
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each(sk, hlist) {
if (sock_net(sk) == seq_file_net(seq))
return sk;
}
Expand All @@ -970,7 +967,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
struct raw_iter_state *state = raw_seq_private(seq);

do {
sk = sk_nulls_next(sk);
sk = sk_next(sk);
} while (sk && sock_net(sk) != seq_file_net(seq));

if (!sk)
Expand All @@ -989,9 +986,12 @@ static struct sock *raw_get_idx(struct seq_file *seq, loff_t pos)
}

void *raw_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(RCU)
__acquires(&h->lock)
{
rcu_read_lock();
struct raw_hashinfo *h = pde_data(file_inode(seq->file));

spin_lock(&h->lock);

return *pos ? raw_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
EXPORT_SYMBOL_GPL(raw_seq_start);
Expand All @@ -1010,9 +1010,11 @@ void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos)
EXPORT_SYMBOL_GPL(raw_seq_next);

void raw_seq_stop(struct seq_file *seq, void *v)
__releases(RCU)
__releases(&h->lock)
{
rcu_read_unlock();
struct raw_hashinfo *h = pde_data(file_inode(seq->file));

spin_unlock(&h->lock);
}
EXPORT_SYMBOL_GPL(raw_seq_stop);

Expand Down
10 changes: 4 additions & 6 deletions net/ipv4/raw_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ static bool raw_lookup(struct net *net, const struct sock *sk,
static struct sock *raw_sock_get(struct net *net, const struct inet_diag_req_v2 *r)
{
struct raw_hashinfo *hashinfo = raw_get_hashinfo(r);
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
struct hlist_head *hlist;
struct sock *sk;
int slot;

Expand All @@ -68,7 +67,7 @@ static struct sock *raw_sock_get(struct net *net, const struct inet_diag_req_v2
rcu_read_lock();
for (slot = 0; slot < RAW_HTABLE_SIZE; slot++) {
hlist = &hashinfo->ht[slot];
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
if (raw_lookup(net, sk, r)) {
/*
* Grab it and keep until we fill
Expand Down Expand Up @@ -142,9 +141,8 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
struct raw_hashinfo *hashinfo = raw_get_hashinfo(r);
struct net *net = sock_net(skb->sk);
struct inet_diag_dump_data *cb_data;
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
int num, s_num, slot, s_slot;
struct hlist_head *hlist;
struct sock *sk = NULL;
struct nlattr *bc;

Expand All @@ -161,7 +159,7 @@ static void raw_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
num = 0;

hlist = &hashinfo->ht[slot];
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
struct inet_sock *inet = inet_sk(sk);

if (!net_eq(sock_net(sk), net))
Expand Down
10 changes: 4 additions & 6 deletions net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ EXPORT_SYMBOL(rawv6_mh_filter_unregister);
static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
{
struct net *net = dev_net(skb->dev);
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
const struct in6_addr *saddr;
const struct in6_addr *daddr;
struct hlist_head *hlist;
struct sock *sk;
bool delivered = false;
__u8 hash;
Expand All @@ -155,7 +154,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
hash = raw_hashfunc(net, nexthdr);
hlist = &raw_v6_hashinfo.ht[hash];
rcu_read_lock();
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
int filtered;

if (!raw_v6_match(net, sk, nexthdr, daddr, saddr,
Expand Down Expand Up @@ -331,15 +330,14 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
u8 type, u8 code, int inner_offset, __be32 info)
{
struct net *net = dev_net(skb->dev);
struct hlist_nulls_head *hlist;
struct hlist_nulls_node *hnode;
struct hlist_head *hlist;
struct sock *sk;
int hash;

hash = raw_hashfunc(net, nexthdr);
hlist = &raw_v6_hashinfo.ht[hash];
rcu_read_lock();
sk_nulls_for_each(sk, hnode, hlist) {
sk_for_each_rcu(sk, hlist) {
/* Note: ipv6_hdr(skb) != skb->data */
const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;

Expand Down
15 changes: 9 additions & 6 deletions net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
struct scm_cookie scm;
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
size_t copied;
size_t copied, max_recvmsg_len;
struct sk_buff *skb, *data_skb;
int err, ret;

Expand Down Expand Up @@ -1985,9 +1985,10 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
#endif

/* Record the max length of recvmsg() calls for future allocations */
nlk->max_recvmsg_len = max(nlk->max_recvmsg_len, len);
nlk->max_recvmsg_len = min_t(size_t, nlk->max_recvmsg_len,
SKB_WITH_OVERHEAD(32768));
max_recvmsg_len = max(READ_ONCE(nlk->max_recvmsg_len), len);
max_recvmsg_len = min_t(size_t, max_recvmsg_len,
SKB_WITH_OVERHEAD(32768));
WRITE_ONCE(nlk->max_recvmsg_len, max_recvmsg_len);

copied = data_skb->len;
if (len < copied) {
Expand Down Expand Up @@ -2234,6 +2235,7 @@ static int netlink_dump(struct sock *sk)
struct netlink_ext_ack extack = {};
struct netlink_callback *cb;
struct sk_buff *skb = NULL;
size_t max_recvmsg_len;
struct module *module;
int err = -ENOBUFS;
int alloc_min_size;
Expand All @@ -2256,8 +2258,9 @@ static int netlink_dump(struct sock *sk)
cb = &nlk->cb;
alloc_min_size = max_t(int, cb->min_dump_alloc, NLMSG_GOODSIZE);

if (alloc_min_size < nlk->max_recvmsg_len) {
alloc_size = nlk->max_recvmsg_len;
max_recvmsg_len = READ_ONCE(nlk->max_recvmsg_len);
if (alloc_min_size < max_recvmsg_len) {
alloc_size = max_recvmsg_len;
skb = alloc_skb(alloc_size,
(GFP_KERNEL & ~__GFP_DIRECT_RECLAIM) |
__GFP_NOWARN | __GFP_NORETRY);
Expand Down

0 comments on commit 5ea299f

Please sign in to comment.