Skip to content

Commit 2019fc9

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) Fix interrupt name truncation in mv88e6xxx dsa driver, from Andrew Lunn. 2) Process generic XDP even if SKB is cloned, from Toke Høiland-Jørgensen. 3) Fix leak of kernel memory to userspace in smc, from Eric Dumazet. 4) Add some missing netlink attribute validation to matchall and flower, from Davide Caratti. 5) Send icmp responses properly when NAT has been applied to the frame before we get to the tunnel emitting the icmp, from Jason Donenfeld. 6) Make sure there is enough SKB headroom when adding dsa tags for qca and ar9331. From Per Forlin. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (62 commits) netdevice.h: fix all kernel-doc and Sphinx warnings net: dsa: tag_ar9331: Make sure there is headroom for tag net: dsa: tag_qca: Make sure there is headroom for tag net, ip6_tunnel: enhance tunnel locate with link check net/smc: no peer ID in CLC decline for SMCD net/smc: transfer fasync_list in case of fallback net: hns3: fix a copying IPv6 address error in hclge_fd_get_flow_tuples() net: hns3: fix VF bandwidth does not take effect in some case net: hns3: add management table after IMP reset mac80211: fix wrong 160/80+80 MHz setting cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE xfrm: interface: use icmp_ndo_send helper wireguard: device: use icmp_ndo_send helper sunvnet: use icmp_ndo_send helper gtp: use icmp_ndo_send helper icmp: introduce helper for nat'd source address in network device context net/sched: flower: add missing validation of TCA_FLOWER_FLAGS net/sched: matchall: add missing validation of TCA_MATCHALL_FLAGS net/flow_dissector: remove unexist field description page_pool: refill page when alloc.count of pool is zero ...
2 parents 4e03e4e + a1fa83b commit 2019fc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+648
-859
lines changed

drivers/net/dsa/mv88e6xxx/chip.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ struct mv88e6xxx_port {
236236
bool mirror_ingress;
237237
bool mirror_egress;
238238
unsigned int serdes_irq;
239-
char serdes_irq_name[32];
239+
char serdes_irq_name[64];
240240
};
241241

242242
struct mv88e6xxx_chip {
@@ -293,16 +293,16 @@ struct mv88e6xxx_chip {
293293
struct mv88e6xxx_irq g1_irq;
294294
struct mv88e6xxx_irq g2_irq;
295295
int irq;
296-
char irq_name[32];
296+
char irq_name[64];
297297
int device_irq;
298-
char device_irq_name[32];
298+
char device_irq_name[64];
299299
int watchdog_irq;
300-
char watchdog_irq_name[32];
300+
char watchdog_irq_name[64];
301301

302302
int atu_prob_irq;
303-
char atu_prob_irq_name[32];
303+
char atu_prob_irq_name[64];
304304
int vtu_prob_irq;
305-
char vtu_prob_irq_name[32];
305+
char vtu_prob_irq_name[64];
306306
struct kthread_worker *kworker;
307307
struct kthread_delayed_work irq_poll_work;
308308

drivers/net/ethernet/amazon/ena/ena_com.c

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ static void comp_ctxt_release(struct ena_com_admin_queue *queue,
200200
static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue,
201201
u16 command_id, bool capture)
202202
{
203+
if (unlikely(!queue->comp_ctx)) {
204+
pr_err("Completion context is NULL\n");
205+
return NULL;
206+
}
207+
203208
if (unlikely(command_id >= queue->q_depth)) {
204209
pr_err("command id is larger than the queue size. cmd_id: %u queue size %d\n",
205210
command_id, queue->q_depth);
@@ -1041,9 +1046,41 @@ static int ena_com_get_feature(struct ena_com_dev *ena_dev,
10411046
feature_ver);
10421047
}
10431048

1049+
int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev)
1050+
{
1051+
return ena_dev->rss.hash_func;
1052+
}
1053+
1054+
static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev)
1055+
{
1056+
struct ena_admin_feature_rss_flow_hash_control *hash_key =
1057+
(ena_dev->rss).hash_key;
1058+
1059+
netdev_rss_key_fill(&hash_key->key, sizeof(hash_key->key));
1060+
/* The key is stored in the device in u32 array
1061+
* as well as the API requires the key to be passed in this
1062+
* format. Thus the size of our array should be divided by 4
1063+
*/
1064+
hash_key->keys_num = sizeof(hash_key->key) / sizeof(u32);
1065+
}
1066+
10441067
static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
10451068
{
10461069
struct ena_rss *rss = &ena_dev->rss;
1070+
struct ena_admin_feature_rss_flow_hash_control *hash_key;
1071+
struct ena_admin_get_feat_resp get_resp;
1072+
int rc;
1073+
1074+
hash_key = (ena_dev->rss).hash_key;
1075+
1076+
rc = ena_com_get_feature_ex(ena_dev, &get_resp,
1077+
ENA_ADMIN_RSS_HASH_FUNCTION,
1078+
ena_dev->rss.hash_key_dma_addr,
1079+
sizeof(ena_dev->rss.hash_key), 0);
1080+
if (unlikely(rc)) {
1081+
hash_key = NULL;
1082+
return -EOPNOTSUPP;
1083+
}
10471084

10481085
rss->hash_key =
10491086
dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
@@ -1254,30 +1291,6 @@ static int ena_com_ind_tbl_convert_to_device(struct ena_com_dev *ena_dev)
12541291
return 0;
12551292
}
12561293

1257-
static int ena_com_ind_tbl_convert_from_device(struct ena_com_dev *ena_dev)
1258-
{
1259-
u16 dev_idx_to_host_tbl[ENA_TOTAL_NUM_QUEUES] = { (u16)-1 };
1260-
struct ena_rss *rss = &ena_dev->rss;
1261-
u8 idx;
1262-
u16 i;
1263-
1264-
for (i = 0; i < ENA_TOTAL_NUM_QUEUES; i++)
1265-
dev_idx_to_host_tbl[ena_dev->io_sq_queues[i].idx] = i;
1266-
1267-
for (i = 0; i < 1 << rss->tbl_log_size; i++) {
1268-
if (rss->rss_ind_tbl[i].cq_idx > ENA_TOTAL_NUM_QUEUES)
1269-
return -EINVAL;
1270-
idx = (u8)rss->rss_ind_tbl[i].cq_idx;
1271-
1272-
if (dev_idx_to_host_tbl[idx] > ENA_TOTAL_NUM_QUEUES)
1273-
return -EINVAL;
1274-
1275-
rss->host_rss_ind_tbl[i] = dev_idx_to_host_tbl[idx];
1276-
}
1277-
1278-
return 0;
1279-
}
1280-
12811294
static void ena_com_update_intr_delay_resolution(struct ena_com_dev *ena_dev,
12821295
u16 intr_delay_resolution)
12831296
{
@@ -2297,15 +2310,16 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
22972310

22982311
switch (func) {
22992312
case ENA_ADMIN_TOEPLITZ:
2300-
if (key_len > sizeof(hash_key->key)) {
2301-
pr_err("key len (%hu) is bigger than the max supported (%zu)\n",
2302-
key_len, sizeof(hash_key->key));
2303-
return -EINVAL;
2313+
if (key) {
2314+
if (key_len != sizeof(hash_key->key)) {
2315+
pr_err("key len (%hu) doesn't equal the supported size (%zu)\n",
2316+
key_len, sizeof(hash_key->key));
2317+
return -EINVAL;
2318+
}
2319+
memcpy(hash_key->key, key, key_len);
2320+
rss->hash_init_val = init_val;
2321+
hash_key->keys_num = key_len >> 2;
23042322
}
2305-
2306-
memcpy(hash_key->key, key, key_len);
2307-
rss->hash_init_val = init_val;
2308-
hash_key->keys_num = key_len >> 2;
23092323
break;
23102324
case ENA_ADMIN_CRC32:
23112325
rss->hash_init_val = init_val;
@@ -2342,7 +2356,11 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
23422356
if (unlikely(rc))
23432357
return rc;
23442358

2345-
rss->hash_func = get_resp.u.flow_hash_func.selected_func;
2359+
/* ffs() returns 1 in case the lsb is set */
2360+
rss->hash_func = ffs(get_resp.u.flow_hash_func.selected_func);
2361+
if (rss->hash_func)
2362+
rss->hash_func--;
2363+
23462364
if (func)
23472365
*func = rss->hash_func;
23482366

@@ -2606,10 +2624,6 @@ int ena_com_indirect_table_get(struct ena_com_dev *ena_dev, u32 *ind_tbl)
26062624
if (!ind_tbl)
26072625
return 0;
26082626

2609-
rc = ena_com_ind_tbl_convert_from_device(ena_dev);
2610-
if (unlikely(rc))
2611-
return rc;
2612-
26132627
for (i = 0; i < (1 << rss->tbl_log_size); i++)
26142628
ind_tbl[i] = rss->host_rss_ind_tbl[i];
26152629

@@ -2626,9 +2640,15 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size)
26262640
if (unlikely(rc))
26272641
goto err_indr_tbl;
26282642

2643+
/* The following function might return unsupported in case the
2644+
* device doesn't support setting the key / hash function. We can safely
2645+
* ignore this error and have indirection table support only.
2646+
*/
26292647
rc = ena_com_hash_key_allocate(ena_dev);
2630-
if (unlikely(rc))
2648+
if (unlikely(rc) && rc != -EOPNOTSUPP)
26312649
goto err_hash_key;
2650+
else if (rc != -EOPNOTSUPP)
2651+
ena_com_hash_key_fill_default_key(ena_dev);
26322652

26332653
rc = ena_com_hash_ctrl_init(ena_dev);
26342654
if (unlikely(rc))

drivers/net/ethernet/amazon/ena/ena_com.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <linux/spinlock.h>
4545
#include <linux/types.h>
4646
#include <linux/wait.h>
47+
#include <linux/netdevice.h>
4748

4849
#include "ena_common_defs.h"
4950
#include "ena_admin_defs.h"
@@ -655,6 +656,14 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 log_size);
655656
*/
656657
void ena_com_rss_destroy(struct ena_com_dev *ena_dev);
657658

659+
/* ena_com_get_current_hash_function - Get RSS hash function
660+
* @ena_dev: ENA communication layer struct
661+
*
662+
* Return the current hash function.
663+
* @return: 0 or one of the ena_admin_hash_functions values.
664+
*/
665+
int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev);
666+
658667
/* ena_com_fill_hash_function - Fill RSS hash function
659668
* @ena_dev: ENA communication layer struct
660669
* @func: The hash function (Toeplitz or crc)

drivers/net/ethernet/amazon/ena/ena_ethtool.c

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,28 @@ static u32 ena_get_rxfh_key_size(struct net_device *netdev)
636636
return ENA_HASH_KEY_SIZE;
637637
}
638638

639+
static int ena_indirection_table_get(struct ena_adapter *adapter, u32 *indir)
640+
{
641+
struct ena_com_dev *ena_dev = adapter->ena_dev;
642+
int i, rc;
643+
644+
if (!indir)
645+
return 0;
646+
647+
rc = ena_com_indirect_table_get(ena_dev, indir);
648+
if (rc)
649+
return rc;
650+
651+
/* Our internal representation of the indices is: even indices
652+
* for Tx and uneven indices for Rx. We need to convert the Rx
653+
* indices to be consecutive
654+
*/
655+
for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++)
656+
indir[i] = ENA_IO_RXQ_IDX_TO_COMBINED_IDX(indir[i]);
657+
658+
return rc;
659+
}
660+
639661
static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
640662
u8 *hfunc)
641663
{
@@ -644,11 +666,25 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
644666
u8 func;
645667
int rc;
646668

647-
rc = ena_com_indirect_table_get(adapter->ena_dev, indir);
669+
rc = ena_indirection_table_get(adapter, indir);
648670
if (rc)
649671
return rc;
650672

673+
/* We call this function in order to check if the device
674+
* supports getting/setting the hash function.
675+
*/
651676
rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func, key);
677+
678+
if (rc) {
679+
if (rc == -EOPNOTSUPP) {
680+
key = NULL;
681+
hfunc = NULL;
682+
rc = 0;
683+
}
684+
685+
return rc;
686+
}
687+
652688
if (rc)
653689
return rc;
654690

@@ -657,7 +693,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
657693
func = ETH_RSS_HASH_TOP;
658694
break;
659695
case ENA_ADMIN_CRC32:
660-
func = ETH_RSS_HASH_XOR;
696+
func = ETH_RSS_HASH_CRC32;
661697
break;
662698
default:
663699
netif_err(adapter, drv, netdev,
@@ -700,10 +736,13 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
700736
}
701737

702738
switch (hfunc) {
739+
case ETH_RSS_HASH_NO_CHANGE:
740+
func = ena_com_get_current_hash_function(ena_dev);
741+
break;
703742
case ETH_RSS_HASH_TOP:
704743
func = ENA_ADMIN_TOEPLITZ;
705744
break;
706-
case ETH_RSS_HASH_XOR:
745+
case ETH_RSS_HASH_CRC32:
707746
func = ENA_ADMIN_CRC32;
708747
break;
709748
default:
@@ -814,6 +853,7 @@ static const struct ethtool_ops ena_ethtool_ops = {
814853
.set_channels = ena_set_channels,
815854
.get_tunable = ena_get_tunable,
816855
.set_tunable = ena_set_tunable,
856+
.get_ts_info = ethtool_op_get_ts_info,
817857
};
818858

819859
void ena_set_ethtool_ops(struct net_device *netdev)

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,8 +3706,8 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter)
37063706
if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT)
37073707
return;
37083708

3709-
keep_alive_expired = round_jiffies(adapter->last_keep_alive_jiffies +
3710-
adapter->keep_alive_timeout);
3709+
keep_alive_expired = adapter->last_keep_alive_jiffies +
3710+
adapter->keep_alive_timeout;
37113711
if (unlikely(time_is_before_jiffies(keep_alive_expired))) {
37123712
netif_err(adapter, drv, adapter->netdev,
37133713
"Keep alive watchdog timeout.\n");
@@ -3809,7 +3809,7 @@ static void ena_timer_service(struct timer_list *t)
38093809
}
38103810

38113811
/* Reset the timer */
3812-
mod_timer(&adapter->timer_service, jiffies + HZ);
3812+
mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
38133813
}
38143814

38153815
static int ena_calc_max_io_queue_num(struct pci_dev *pdev,

drivers/net/ethernet/amazon/ena/ena_netdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130

131131
#define ENA_IO_TXQ_IDX(q) (2 * (q))
132132
#define ENA_IO_RXQ_IDX(q) (2 * (q) + 1)
133+
#define ENA_IO_TXQ_IDX_TO_COMBINED_IDX(q) ((q) / 2)
134+
#define ENA_IO_RXQ_IDX_TO_COMBINED_IDX(q) (((q) - 1) / 2)
133135

134136
#define ENA_MGMNT_IRQ_IDX 0
135137
#define ENA_IO_IRQ_FIRST_IDX 1

drivers/net/ethernet/cisco/enic/enic_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,10 +2013,10 @@ static int enic_stop(struct net_device *netdev)
20132013
napi_disable(&enic->napi[i]);
20142014

20152015
netif_carrier_off(netdev);
2016-
netif_tx_disable(netdev);
20172016
if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX)
20182017
for (i = 0; i < enic->wq_count; i++)
20192018
napi_disable(&enic->napi[enic_cq_wq(enic, i)]);
2019+
netif_tx_disable(netdev);
20202020

20212021
if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
20222022
enic_dev_del_station_addr(enic);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6113,6 +6113,9 @@ static int hclge_get_all_rules(struct hnae3_handle *handle,
61136113
static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
61146114
struct hclge_fd_rule_tuples *tuples)
61156115
{
6116+
#define flow_ip6_src fkeys->addrs.v6addrs.src.in6_u.u6_addr32
6117+
#define flow_ip6_dst fkeys->addrs.v6addrs.dst.in6_u.u6_addr32
6118+
61166119
tuples->ether_proto = be16_to_cpu(fkeys->basic.n_proto);
61176120
tuples->ip_proto = fkeys->basic.ip_proto;
61186121
tuples->dst_port = be16_to_cpu(fkeys->ports.dst);
@@ -6121,12 +6124,12 @@ static void hclge_fd_get_flow_tuples(const struct flow_keys *fkeys,
61216124
tuples->src_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.src);
61226125
tuples->dst_ip[3] = be32_to_cpu(fkeys->addrs.v4addrs.dst);
61236126
} else {
6124-
memcpy(tuples->src_ip,
6125-
fkeys->addrs.v6addrs.src.in6_u.u6_addr32,
6126-
sizeof(tuples->src_ip));
6127-
memcpy(tuples->dst_ip,
6128-
fkeys->addrs.v6addrs.dst.in6_u.u6_addr32,
6129-
sizeof(tuples->dst_ip));
6127+
int i;
6128+
6129+
for (i = 0; i < IPV6_SIZE; i++) {
6130+
tuples->src_ip[i] = be32_to_cpu(flow_ip6_src[i]);
6131+
tuples->dst_ip[i] = be32_to_cpu(flow_ip6_dst[i]);
6132+
}
61306133
}
61316134
}
61326135

@@ -9834,6 +9837,13 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
98349837
return ret;
98359838
}
98369839

9840+
ret = init_mgr_tbl(hdev);
9841+
if (ret) {
9842+
dev_err(&pdev->dev,
9843+
"failed to reinit manager table, ret = %d\n", ret);
9844+
return ret;
9845+
}
9846+
98379847
ret = hclge_init_fd_config(hdev);
98389848
if (ret) {
98399849
dev_err(&pdev->dev, "fd table init fail, ret=%d\n", ret);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport)
566566
*/
567567
kinfo->num_tc = vport->vport_id ? 1 :
568568
min_t(u16, vport->alloc_tqps, hdev->tm_info.num_tc);
569-
vport->qs_offset = (vport->vport_id ? hdev->tm_info.num_tc : 0) +
569+
vport->qs_offset = (vport->vport_id ? HNAE3_MAX_TC : 0) +
570570
(vport->vport_id ? (vport->vport_id - 1) : 0);
571571

572572
max_rss_size = min_t(u16, hdev->rss_size_max,

0 commit comments

Comments
 (0)