commit_title
stringlengths 13
124
| commit_body
stringlengths 0
1.9k
| release_summary
stringclasses 52
values | changes_summary
stringlengths 1
758
| release_affected_domains
stringclasses 33
values | release_affected_drivers
stringclasses 51
values | domain_of_changes
stringlengths 2
571
| language_set
stringclasses 983
values | diffstat_files
int64 1
300
| diffstat_insertions
int64 0
309k
| diffstat_deletions
int64 0
168k
| commit_diff
stringlengths 92
23.4M
| category
stringclasses 108
values | commit_hash
stringlengths 34
40
| related_people
stringlengths 0
370
| domain
stringclasses 21
values | subdomain
stringclasses 241
values | leaf_module
stringlengths 0
912
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
net/mlx5e: add ptp flow steering support
|
when opening ptp channel with mlx5e_ptp_state_rx set, add the corresponding flow steering rules. capture udp packets with destination port 319 and l2 packets with ethertype 0x88f7 and steer them into the rq of the ptp channel. add api that manages the flow steering rules to be used in the following patches via safe_reopen_channels mechanism.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
allow both cqe compression and hw time-stamp ptp to co-exist
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 4
| 146
| 1
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +struct mlx5e_ptp_fs; + struct mlx5e_ptp_fs *ptp_fs; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +#include <linux/ptp_classify.h> +#include "en/fs_tt_redirect.h" + +struct mlx5e_ptp_fs { + struct mlx5_flow_handle *l2_rule; + struct mlx5_flow_handle *udp_v4_rule; + struct mlx5_flow_handle *udp_v6_rule; + bool valid; +}; +static void mlx5e_ptp_rx_unset_fs(struct mlx5e_priv *priv) +{ + struct mlx5e_ptp_fs *ptp_fs = priv->fs.ptp_fs; + + if (!ptp_fs->valid) + return; + + mlx5e_fs_tt_redirect_del_rule(ptp_fs->l2_rule); + mlx5e_fs_tt_redirect_any_destroy(priv); + + mlx5e_fs_tt_redirect_del_rule(ptp_fs->udp_v6_rule); + mlx5e_fs_tt_redirect_del_rule(ptp_fs->udp_v4_rule); + mlx5e_fs_tt_redirect_udp_destroy(priv); + ptp_fs->valid = false; +} + +static int mlx5e_ptp_rx_set_fs(struct mlx5e_priv *priv) +{ + struct mlx5e_ptp_fs *ptp_fs = priv->fs.ptp_fs; + struct mlx5_flow_handle *rule; + u32 tirn = priv->ptp_tir.tirn; + int err; + + if (ptp_fs->valid) + return 0; + + err = mlx5e_fs_tt_redirect_udp_create(priv); + if (err) + goto out_free; + + rule = mlx5e_fs_tt_redirect_udp_add_rule(priv, mlx5e_tt_ipv4_udp, + tirn, ptp_ev_port); + if (is_err(rule)) { + err = ptr_err(rule); + goto out_destroy_fs_udp; + } + ptp_fs->udp_v4_rule = rule; + + rule = mlx5e_fs_tt_redirect_udp_add_rule(priv, mlx5e_tt_ipv6_udp, + tirn, ptp_ev_port); + if (is_err(rule)) { + err = ptr_err(rule); + goto out_destroy_udp_v4_rule; + } + ptp_fs->udp_v6_rule = rule; + + err = mlx5e_fs_tt_redirect_any_create(priv); + if (err) + goto out_destroy_udp_v6_rule; + + rule = mlx5e_fs_tt_redirect_any_add_rule(priv, tirn, eth_p_1588); + if (is_err(rule)) { + err = ptr_err(rule); + goto out_destroy_fs_any; + } + ptp_fs->l2_rule = rule; + ptp_fs->valid = true; + + return 0; + +out_destroy_fs_any: + mlx5e_fs_tt_redirect_any_destroy(priv); +out_destroy_udp_v6_rule: + mlx5e_fs_tt_redirect_del_rule(ptp_fs->udp_v6_rule); +out_destroy_udp_v4_rule: + mlx5e_fs_tt_redirect_del_rule(ptp_fs->udp_v4_rule); +out_destroy_fs_udp: + mlx5e_fs_tt_redirect_udp_destroy(priv); +out_free: + return err; +} + - if (test_bit(mlx5e_ptp_state_rx, c->state)) + if (test_bit(mlx5e_ptp_state_rx, c->state)) { + mlx5e_ptp_rx_set_fs(c->priv); + } + +int mlx5e_ptp_alloc_rx_fs(struct mlx5e_priv *priv) +{ + struct mlx5e_ptp_fs *ptp_fs; + + if (!priv->profile->rx_ptp_support) + return 0; + + ptp_fs = kzalloc(sizeof(*ptp_fs), gfp_kernel); + if (!ptp_fs) + return -enomem; + + priv->fs.ptp_fs = ptp_fs; + return 0; +} + +void mlx5e_ptp_free_rx_fs(struct mlx5e_priv *priv) +{ + struct mlx5e_ptp_fs *ptp_fs = priv->fs.ptp_fs; + + if (!priv->profile->rx_ptp_support) + return; + + mlx5e_ptp_rx_unset_fs(priv); + kfree(ptp_fs); +} + +int mlx5e_ptp_rx_manage_fs(struct mlx5e_priv *priv, bool set) +{ + struct mlx5e_ptp *c = priv->channels.ptp; + + if (!priv->profile->rx_ptp_support) + return 0; + + if (set) { + if (!c || !test_bit(mlx5e_ptp_state_rx, c->state)) { + netdev_warn_once(priv->netdev, "don't try to add ptp rx-fs rules"); + return -einval; + } + return mlx5e_ptp_rx_set_fs(priv); + } + /* set == false */ + if (c && test_bit(mlx5e_ptp_state_rx, c->state)) { + netdev_warn_once(priv->netdev, "don't try to remove ptp rx-fs rules"); + return -einval; + } + mlx5e_ptp_rx_unset_fs(priv); + return 0; +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +int mlx5e_ptp_alloc_rx_fs(struct mlx5e_priv *priv); +void mlx5e_ptp_free_rx_fs(struct mlx5e_priv *priv); +int mlx5e_ptp_rx_manage_fs(struct mlx5e_priv *priv, bool set); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +#include "en/ptp.h" + err = mlx5e_ptp_alloc_rx_fs(priv); + if (err) + goto err_destory_vlan_table; + +err_destory_vlan_table: + mlx5e_destroy_vlan_table(priv); + mlx5e_ptp_free_rx_fs(priv);
|
Networking
|
e5fe49465d463ca6c029869e42e9ba5e895cce02
|
aya levin tariq toukan tariqt nvidia com
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5
|
net/mlx5e: allow coexistence of cqe compression and hw ts ptp
|
update setting hw time-stamp to allow coexistence with cqe compression. turn on rx ptp indication and try to reopen the channels. on success, coexistence with cqe compression is enabled. otherwise, fall-back to turning off cqe compression.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
allow both cqe compression and hw time-stamp ptp to co-exist
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 35
| 12
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h + bool ptp_rx; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c + if (params->ptp_rx) + __set_bit(mlx5e_ptp_state_rx, c->state); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c - if (mlx5e_get_pflag(&chs->params, mlx5e_pflag_tx_port_ts)) { + if (mlx5e_get_pflag(&chs->params, mlx5e_pflag_tx_port_ts) || chs->params.ptp_rx) { + if (priv->channels.params.ptp_rx) + num_rxqs++; +static int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx) +{ + bool set = *(bool *)ctx; + + return mlx5e_ptp_rx_manage_fs(priv, set); +} + + struct mlx5e_channels new_channels = {}; + bool rx_cqe_compress_def; + new_channels.params = priv->channels.params; + rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def; + - /* reset cqe compression to admin default */ - mlx5e_modify_rx_cqe_compression_locked(priv, priv->channels.params.rx_cqe_compress_def); + new_channels.params.ptp_rx = false; - /* disable cqe compression */ - if (mlx5e_get_pflag(&priv->channels.params, mlx5e_pflag_rx_cqe_compress)) - netdev_warn(priv->netdev, "disabling rx cqe compression "); - err = mlx5e_modify_rx_cqe_compression_locked(priv, false); - if (err) { - netdev_err(priv->netdev, "failed disabling cqe compression err=%d ", err); - mutex_unlock(&priv->state_lock); - return err; - } + new_channels.params.ptp_rx = rx_cqe_compress_def; + if (new_channels.params.ptp_rx == priv->channels.params.ptp_rx) + goto out; + + if (!test_bit(mlx5e_state_opened, &priv->state)) { + priv->channels.params = new_channels.params; + goto out; + } + err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_ptp_rx_manage_fs_ctx, + &new_channels.params.ptp_rx); + if (err) { + mutex_unlock(&priv->state_lock); + return err; + } +out:
|
Networking
|
960fbfe222a490622cfb3949061b20f83ef46fb0
|
aya levin tariq toukan tariqt nvidia com
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5
|
net/mlx5e: update ethtool setting of cqe compression
|
remove restriction blocking configuration of cqe compression when ptp rx filter is set. instead turn on indication for rx ptp, and try to reopen the channels.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
allow both cqe compression and hw time-stamp ptp to co-exist
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 10
| 7
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h +int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +#include "en/ptp.h" + if (priv->tstamp.rx_filter != hwtstamp_filter_none) + new_channels.params.ptp_rx = new_val; - err = mlx5e_safe_switch_channels(priv, &new_channels, null, null); + if (new_channels.params.ptp_rx == priv->channels.params.ptp_rx) + err = mlx5e_safe_switch_channels(priv, &new_channels, null, null); + else + err = mlx5e_safe_switch_channels(priv, &new_channels, mlx5e_ptp_rx_manage_fs_ctx, + &new_channels.params.ptp_rx); - if (enable && priv->tstamp.rx_filter != hwtstamp_filter_none) { - netdev_err(netdev, "can't enable cqe compression while timestamping is enabled. "); - return -einval; - } - diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c -static int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx) +int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx)
|
Networking
|
885b8cfb161ed3d8f41e7b37e14d35bd8d3aaf6b
|
aya levin tariq toukan tariqt nvidia com
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, move vport table functions to a new file
|
currently, the vport table functions are in common eswitch offload file. this file is too big. move the vport table create, delete and lookup functions to a separate file. put the file in esw directory.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c', 'makefile']
| 4
| 183
| 182
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/makefile b/drivers/net/ethernet/mellanox/mlx5/core/makefile --- a/drivers/net/ethernet/mellanox/mlx5/core/makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/makefile - esw/devlink_port.o + esw/devlink_port.o esw/vporttbl.o diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c +// spdx-license-identifier: gpl-2.0 or linux-openib +// copyright (c) 2021 mellanox technologies. + +#include "eswitch.h" + +#define mlx5_esw_vport_table_size 128 +#define mlx5_esw_vport_tbl_num_groups 4 + +/* this struct is used as a key to the hash table and we need it to be packed + * so hash result is consistent + */ +struct mlx5_vport_key { + u32 chain; + u16 prio; + u16 vport; + u16 vhca_id; +} __packed; + +struct mlx5_vport_table { + struct hlist_node hlist; + struct mlx5_flow_table *fdb; + u32 num_rules; + struct mlx5_vport_key key; +}; + +static struct mlx5_flow_table * +esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns) +{ + struct mlx5_flow_table_attr ft_attr = {}; + struct mlx5_flow_table *fdb; + + ft_attr.autogroup.max_num_groups = mlx5_esw_vport_tbl_num_groups; + ft_attr.max_fte = mlx5_esw_vport_table_size; + ft_attr.prio = fdb_per_vport; + fdb = mlx5_create_auto_grouped_flow_table(ns, &ft_attr); + if (is_err(fdb)) { + esw_warn(esw->dev, "failed to create per vport fdb table err %ld ", + ptr_err(fdb)); + } + + return fdb; +} + +static u32 flow_attr_to_vport_key(struct mlx5_eswitch *esw, + struct mlx5_vport_tbl_attr *attr, + struct mlx5_vport_key *key) +{ + key->vport = attr->vport; + key->chain = attr->chain; + key->prio = attr->prio; + key->vhca_id = mlx5_cap_gen(esw->dev, vhca_id); + return jhash(key, sizeof(*key), 0); +} + +/* caller must hold vports.lock */ +static struct mlx5_vport_table * +esw_vport_tbl_lookup(struct mlx5_eswitch *esw, struct mlx5_vport_key *skey, u32 key) +{ + struct mlx5_vport_table *e; + + hash_for_each_possible(esw->fdb_table.offloads.vports.table, e, hlist, key) + if (!memcmp(&e->key, skey, sizeof(*skey))) + return e; + + return null; +} + +struct mlx5_flow_table * +esw_vport_tbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) +{ + struct mlx5_core_dev *dev = esw->dev; + struct mlx5_flow_namespace *ns; + struct mlx5_flow_table *fdb; + struct mlx5_vport_table *e; + struct mlx5_vport_key skey; + u32 hkey; + + mutex_lock(&esw->fdb_table.offloads.vports.lock); + hkey = flow_attr_to_vport_key(esw, attr, &skey); + e = esw_vport_tbl_lookup(esw, &skey, hkey); + if (e) { + e->num_rules++; + goto out; + } + + e = kzalloc(sizeof(*e), gfp_kernel); + if (!e) { + fdb = err_ptr(-enomem); + goto err_alloc; + } + + ns = mlx5_get_flow_namespace(dev, mlx5_flow_namespace_fdb); + if (!ns) { + esw_warn(dev, "failed to get fdb namespace "); + fdb = err_ptr(-enoent); + goto err_ns; + } + + fdb = esw_vport_tbl_create(esw, ns); + if (is_err(fdb)) + goto err_ns; + + e->fdb = fdb; + e->num_rules = 1; + e->key = skey; + hash_add(esw->fdb_table.offloads.vports.table, &e->hlist, hkey); +out: + mutex_unlock(&esw->fdb_table.offloads.vports.lock); + return e->fdb; + +err_ns: + kfree(e); +err_alloc: + mutex_unlock(&esw->fdb_table.offloads.vports.lock); + return fdb; +} + +void +esw_vport_tbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) +{ + struct mlx5_vport_table *e; + struct mlx5_vport_key key; + u32 hkey; + + mutex_lock(&esw->fdb_table.offloads.vports.lock); + hkey = flow_attr_to_vport_key(esw, attr, &key); + e = esw_vport_tbl_lookup(esw, &key, hkey); + if (!e || --e->num_rules) + goto out; + + hash_del(&e->hlist); + mlx5_destroy_flow_table(e->fdb); + kfree(e); +out: + mutex_unlock(&esw->fdb_table.offloads.vports.lock); +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h -int mlx5_esw_vport_tbl_get(struct mlx5_eswitch *esw); -void mlx5_esw_vport_tbl_put(struct mlx5_eswitch *esw); +struct mlx5_vport_tbl_attr { + u16 chain; + u16 prio; + u16 vport; +}; + +struct mlx5_flow_table * +esw_vport_tbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); +void +esw_vport_tbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c -/* per vport tables */ - -#define mlx5_esw_vport_table_size 128 - -/* this struct is used as a key to the hash table and we need it to be packed - * so hash result is consistent - */ -struct mlx5_vport_key { - u32 chain; - u16 prio; - u16 vport; - u16 vhca_id; -} __packed; - -struct mlx5_vport_tbl_attr { - u16 chain; - u16 prio; - u16 vport; -}; - -struct mlx5_vport_table { - struct hlist_node hlist; - struct mlx5_flow_table *fdb; - u32 num_rules; - struct mlx5_vport_key key; -}; - -#define mlx5_esw_vport_tbl_num_groups 4 - -static struct mlx5_flow_table * -esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns) -{ - struct mlx5_flow_table_attr ft_attr = {}; - struct mlx5_flow_table *fdb; - - ft_attr.autogroup.max_num_groups = mlx5_esw_vport_tbl_num_groups; - ft_attr.max_fte = mlx5_esw_vport_table_size; - ft_attr.prio = fdb_per_vport; - fdb = mlx5_create_auto_grouped_flow_table(ns, &ft_attr); - if (is_err(fdb)) { - esw_warn(esw->dev, "failed to create per vport fdb table err %ld ", - ptr_err(fdb)); - } - - return fdb; -} - -static u32 flow_attr_to_vport_key(struct mlx5_eswitch *esw, - struct mlx5_vport_tbl_attr *attr, - struct mlx5_vport_key *key) -{ - key->vport = attr->vport; - key->chain = attr->chain; - key->prio = attr->prio; - key->vhca_id = mlx5_cap_gen(esw->dev, vhca_id); - return jhash(key, sizeof(*key), 0); -} - -/* caller must hold vports.lock */ -static struct mlx5_vport_table * -esw_vport_tbl_lookup(struct mlx5_eswitch *esw, struct mlx5_vport_key *skey, u32 key) -{ - struct mlx5_vport_table *e; - - hash_for_each_possible(esw->fdb_table.offloads.vports.table, e, hlist, key) - if (!memcmp(&e->key, skey, sizeof(*skey))) - return e; - - return null; -} - -static void -esw_vport_tbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) -{ - struct mlx5_vport_table *e; - struct mlx5_vport_key key; - u32 hkey; - - mutex_lock(&esw->fdb_table.offloads.vports.lock); - hkey = flow_attr_to_vport_key(esw, attr, &key); - e = esw_vport_tbl_lookup(esw, &key, hkey); - if (!e || --e->num_rules) - goto out; - - hash_del(&e->hlist); - mlx5_destroy_flow_table(e->fdb); - kfree(e); -out: - mutex_unlock(&esw->fdb_table.offloads.vports.lock); -} - -static struct mlx5_flow_table * -esw_vport_tbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) -{ - struct mlx5_core_dev *dev = esw->dev; - struct mlx5_flow_namespace *ns; - struct mlx5_flow_table *fdb; - struct mlx5_vport_table *e; - struct mlx5_vport_key skey; - u32 hkey; - - mutex_lock(&esw->fdb_table.offloads.vports.lock); - hkey = flow_attr_to_vport_key(esw, attr, &skey); - e = esw_vport_tbl_lookup(esw, &skey, hkey); - if (e) { - e->num_rules++; - goto out; - } - - e = kzalloc(sizeof(*e), gfp_kernel); - if (!e) { - fdb = err_ptr(-enomem); - goto err_alloc; - } - - ns = mlx5_get_flow_namespace(dev, mlx5_flow_namespace_fdb); - if (!ns) { - esw_warn(dev, "failed to get fdb namespace "); - fdb = err_ptr(-enoent); - goto err_ns; - } - - fdb = esw_vport_tbl_create(esw, ns); - if (is_err(fdb)) - goto err_ns; - - e->fdb = fdb; - e->num_rules = 1; - e->key = skey; - hash_add(esw->fdb_table.offloads.vports.table, &e->hlist, hkey); -out: - mutex_unlock(&esw->fdb_table.offloads.vports.lock); - return e->fdb; - -err_ns: - kfree(e); -err_alloc: - mutex_unlock(&esw->fdb_table.offloads.vports.lock); - return fdb; -} - -int mlx5_esw_vport_tbl_get(struct mlx5_eswitch *esw) -{ - struct mlx5_vport_tbl_attr attr; - struct mlx5_flow_table *fdb; - struct mlx5_vport *vport; - int i; - - attr.chain = 0; - attr.prio = 1; - mlx5_esw_for_all_vports(esw, i, vport) { - attr.vport = vport->vport; - fdb = esw_vport_tbl_get(esw, &attr); - if (is_err(fdb)) - goto out; - } - return 0; - -out: - mlx5_esw_vport_tbl_put(esw); - return ptr_err(fdb); -} - -void mlx5_esw_vport_tbl_put(struct mlx5_eswitch *esw) -{ - struct mlx5_vport_tbl_attr attr; - struct mlx5_vport *vport; - int i; - - attr.chain = 0; - attr.prio = 1; - mlx5_esw_for_all_vports(esw, i, vport) { - attr.vport = vport->vport; - esw_vport_tbl_put(esw, &attr); - } -} - -/* end: per vport tables */ - +static void mlx5_esw_vport_tbl_put(struct mlx5_eswitch *esw) +{ + struct mlx5_vport_tbl_attr attr; + struct mlx5_vport *vport; + int i; + + attr.chain = 0; + attr.prio = 1; + mlx5_esw_for_all_vports(esw, i, vport) { + attr.vport = vport->vport; + esw_vport_tbl_put(esw, &attr); + } +} + +static int mlx5_esw_vport_tbl_get(struct mlx5_eswitch *esw) +{ + struct mlx5_vport_tbl_attr attr; + struct mlx5_flow_table *fdb; + struct mlx5_vport *vport; + int i; + + attr.chain = 0; + attr.prio = 1; + mlx5_esw_for_all_vports(esw, i, vport) { + attr.vport = vport->vport; + fdb = esw_vport_tbl_get(esw, &attr); + if (is_err(fdb)) + goto out; + } + return 0; + +out: + mlx5_esw_vport_tbl_put(esw); + return ptr_err(fdb); +} +
|
Networking
|
4c7f40287aa5eb6ea8f3a6c3225ab5ebc6a45415
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, rename functions to follow naming convention.
|
public api starts with mlx5 and remove mlx5 for non-public api.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 17
| 17
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c -esw_vport_tbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) +mlx5_esw_vporttbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) -esw_vport_tbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) +mlx5_esw_vporttbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h -esw_vport_tbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); +mlx5_esw_vporttbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); -esw_vport_tbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); +mlx5_esw_vporttbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attr); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c - fdb = esw_vport_tbl_get(esw, &fwd_attr); + fdb = mlx5_esw_vporttbl_get(esw, &fwd_attr); - esw_vport_tbl_put(esw, &fwd_attr); + mlx5_esw_vporttbl_put(esw, &fwd_attr); - fwd_fdb = esw_vport_tbl_get(esw, &fwd_attr); + fwd_fdb = mlx5_esw_vporttbl_get(esw, &fwd_attr); - esw_vport_tbl_put(esw, &fwd_attr); + mlx5_esw_vporttbl_put(esw, &fwd_attr); - esw_vport_tbl_put(esw, &fwd_attr); + mlx5_esw_vporttbl_put(esw, &fwd_attr); - esw_vport_tbl_put(esw, &fwd_attr); + mlx5_esw_vporttbl_put(esw, &fwd_attr); -static void mlx5_esw_vport_tbl_put(struct mlx5_eswitch *esw) +static void esw_vport_tbl_put(struct mlx5_eswitch *esw) - esw_vport_tbl_put(esw, &attr); + mlx5_esw_vporttbl_put(esw, &attr); -static int mlx5_esw_vport_tbl_get(struct mlx5_eswitch *esw) +static int esw_vport_tbl_get(struct mlx5_eswitch *esw) - fdb = esw_vport_tbl_get(esw, &attr); + fdb = mlx5_esw_vporttbl_get(esw, &attr); - mlx5_esw_vport_tbl_put(esw); + esw_vport_tbl_put(esw); - err = mlx5_esw_vport_tbl_get(esw); + err = esw_vport_tbl_get(esw); - mlx5_esw_vport_tbl_put(esw); + esw_vport_tbl_put(esw);
|
Networking
|
0a9e2307870bdb627421b4b0bbac04b1ab8e1688
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, generalize per vport table api
|
currently, per vport table was used only for port mirroring actions. however, sample action will also require a per vport table instance.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 29
| 7
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c -#define mlx5_esw_vport_table_size 128 -#define mlx5_esw_vport_tbl_num_groups 4 - + const struct esw_vport_tbl_namespace *vport_ns; -esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns) +esw_vport_tbl_create(struct mlx5_eswitch *esw, struct mlx5_flow_namespace *ns, + const struct esw_vport_tbl_namespace *vport_ns) - ft_attr.autogroup.max_num_groups = mlx5_esw_vport_tbl_num_groups; - ft_attr.max_fte = mlx5_esw_vport_table_size; + ft_attr.autogroup.max_num_groups = vport_ns->max_num_groups; + ft_attr.max_fte = vport_ns->max_fte; + ft_attr.flags = vport_ns->flags; + key->vport_ns = attr->vport_ns; - fdb = esw_vport_tbl_create(esw, ns); + fdb = esw_vport_tbl_create(esw, ns, attr->vport_ns); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +struct esw_vport_tbl_namespace { + int max_fte; + int max_num_groups; + u32 flags; +}; + + const struct esw_vport_tbl_namespace *vport_ns; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +#define mlx5_esw_vport_tbl_size 128 +#define mlx5_esw_vport_tbl_num_groups 4 + +static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = { + .max_fte = mlx5_esw_vport_tbl_size, + .max_num_groups = mlx5_esw_vport_tbl_num_groups, + .flags = 0, +}; + + fwd_attr.vport_ns = &mlx5_esw_vport_tbl_mirror_ns; + fwd_attr.vport_ns = &mlx5_esw_vport_tbl_mirror_ns; + fwd_attr.vport_ns = &mlx5_esw_vport_tbl_mirror_ns; + attr.vport_ns = &mlx5_esw_vport_tbl_mirror_ns; + attr.vport_ns = &mlx5_esw_vport_tbl_mirror_ns;
|
Networking
|
c796bb7cd2307d5fb815e919b964bf2d65c95ec3
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, set per vport table default group number
|
different per voprt table is created using a different per vport table namespace. because we can't use variable to set the namespace member value. if max group number is 0 in the namespace, use the eswitch default max group number.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 1
| 4
| 1
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c - ft_attr.autogroup.max_num_groups = vport_ns->max_num_groups; + if (vport_ns->max_num_groups) + ft_attr.autogroup.max_num_groups = vport_ns->max_num_groups; + else + ft_attr.autogroup.max_num_groups = esw->params.large_group_num;
|
Networking
|
c1904360dde8fb4f79bec4751c7540df10d57ec2
|
chris mi oz shlomo ozsh nvidia com mark bloch mbloch nvidia com
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5: map register values to restore objects
|
currently reg_c0 lower 16 bits and reg_b are used to store the chain id that missed in fdb and nic tables accordingly. however, the registers' values may index a restore object, rather than a single u32 value. different object types can be used to restore mutually exclusive contexts such as chain id and sample group id.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 7
| 63
| 43
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c - u32 chain = 0, reg_c0, reg_c1, tunnel_id, zone_restore_id; + u32 reg_c0, reg_c1, tunnel_id, zone_restore_id; + struct mlx5_mapped_obj mapped_obj; - err = mlx5_get_chain_for_tag(esw_chains(esw), reg_c0, &chain); + err = mlx5_get_mapped_object(esw_chains(esw), reg_c0, &mapped_obj); - "couldn't find chain for chain tag: %d, err: %d ", + "couldn't find mapped object for reg_c0: %d, err: %d ", - if (chain) { - tc_skb_ext = skb_ext_add(skb, tc_skb_ext); - if (!tc_skb_ext) { - warn_on(1); - return false; - } + if (mapped_obj.type == mlx5_mapped_obj_chain) { + if (mapped_obj.chain) { + tc_skb_ext = skb_ext_add(skb, tc_skb_ext); + if (!tc_skb_ext) { + warn_on(1); + return false; + } - tc_skb_ext->chain = chain; + tc_skb_ext->chain = mapped_obj.chain; - zone_restore_id = reg_c1 & esw_zone_id_mask; + zone_restore_id = reg_c1 & esw_zone_id_mask; - uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, rep_eth); - uplink_priv = &uplink_rpriv->uplink_priv; - if (!mlx5e_tc_ct_restore_flow(uplink_priv->ct_priv, skb, - zone_restore_id)) - return false; + uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, rep_eth); + uplink_priv = &uplink_rpriv->uplink_priv; + if (!mlx5e_tc_ct_restore_flow(uplink_priv->ct_priv, skb, + zone_restore_id)) + return false; + } + } else { + netdev_dbg(priv->netdev, "invalid mapped object type: %d ", mapped_obj.type); + return false; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c + struct mlx5_mapped_obj mapped_obj; - err = mlx5_get_chain_for_tag(nic_chains(priv), chain_tag, &chain); + err = mlx5_get_mapped_object(nic_chains(priv), chain_tag, &mapped_obj); - if (chain) { + if (mapped_obj.type == mlx5_mapped_obj_chain) { + chain = mapped_obj.chain; + } else { + netdev_dbg(priv->netdev, "invalid mapped object type: %d ", mapped_obj.type); + return false; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +enum mlx5_mapped_obj_type { + mlx5_mapped_obj_chain, +}; + +struct mlx5_mapped_obj { + enum mlx5_mapped_obj_type type; + union { + u32 chain; + }; +}; + -u32 -esw_get_max_restore_tag(struct mlx5_eswitch *esw); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c - esw_chain_tag_metadata_mask); + esw_reg_c0_user_data_metadata_mask); -u32 -esw_get_max_restore_tag(struct mlx5_eswitch *esw) -{ - return esw_chain_tag_metadata_mask; -} - - attr.max_restore_tag = esw_get_max_restore_tag(esw); + attr.max_restore_tag = esw_reg_c0_user_data_metadata_mask; - ft_attr.max_fte = 1 << esw_chain_tag_metadata_bits; + ft_attr.max_fte = 1 << esw_reg_c0_user_data_metadata_bits; - esw_chain_tag_metadata_mask); + esw_reg_c0_user_data_metadata_mask); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c - mapping = mapping_create(sizeof(u32), attr->max_restore_tag, - true); + mapping = mapping_create(sizeof(struct mlx5_mapped_obj), attr->max_restore_tag, true); - return mapping_add(chains_mapping(chains), &chain, chain_mapping); + struct mapping_ctx *ctx = chains->chains_mapping; + struct mlx5_mapped_obj mapped_obj = {}; + + mapped_obj.type = mlx5_mapped_obj_chain; + mapped_obj.chain = chain; + return mapping_add(ctx, &mapped_obj, chain_mapping); - return mapping_remove(chains_mapping(chains), chain_mapping); + struct mapping_ctx *ctx = chains->chains_mapping; + + return mapping_remove(ctx, chain_mapping); -int mlx5_get_chain_for_tag(struct mlx5_fs_chains *chains, u32 tag, - u32 *chain) +int +mlx5_get_mapped_object(struct mlx5_fs_chains *chains, u32 tag, struct mlx5_mapped_obj *obj) - err = mapping_find(chains_mapping(chains), tag, chain); + err = mapping_find(chains->chains_mapping, tag, obj); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h +struct mlx5_mapped_obj; -mlx5_get_chain_for_tag(struct mlx5_fs_chains *chains, u32 tag, u32 *chain); +mlx5_get_mapped_object(struct mlx5_fs_chains *chains, u32 tag, struct mlx5_mapped_obj *obj); diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h - * reg c0 = < esw_pfnum_bits(4) | esw_vport bits(12) | esw_chain_tag(16) > + * reg c0 = < esw_pfnum_bits(4) | esw_vport bits(12) | esw_reg_c0_obj(16) > - * for tc chain tag restoration. + * for user data objects managed by a common mapping context. -#define esw_chain_tag_metadata_bits (32 - esw_source_port_metadata_bits) -#define esw_chain_tag_metadata_mask genmask(esw_chain_tag_metadata_bits - 1,\ - 0) +#define esw_reg_c0_user_data_metadata_bits (32 - esw_source_port_metadata_bits) +#define esw_reg_c0_user_data_metadata_mask genmask(esw_reg_c0_user_data_metadata_bits - 1, 0)
|
Networking
|
a91d98a0a2b8e4c433b7341708f7d706e0cf1c8e
|
chris mi
|
drivers
|
net
|
core, en, ethernet, lib, mellanox, mlx5, rep
|
net/mlx5: instantiate separate mapping objects for fdb and nic tables
|
currently, the u32 chain id is mapped to u16 value which is stored on the lower 16 bits of reg_c0 for fdb and reg_b for nic tables. the mapping is internally maintained by the chains object. however, with the introduction of reg_c0 objects the fdb may store more than just the chain id on reg_c0. this is not relevant for nic tables.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c', 'makefile']
| 8
| 43
| 48
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/makefile b/drivers/net/ethernet/mellanox/mlx5/core/makefile --- a/drivers/net/ethernet/mellanox/mlx5/core/makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/makefile - en_rep.o en/rep/bond.o en/mod_hdr.o + en_rep.o en/rep/bond.o en/mod_hdr.o \ + en/mapping.o - en/mapping.o lib/fs_chains.o en/tc_tun.o \ + lib/fs_chains.o en/tc_tun.o \ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h + struct mapping_ctx *mapping; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c - err = mlx5_get_mapped_object(esw_chains(esw), reg_c0, &mapped_obj); + err = mapping_find(esw->offloads.reg_c0_obj_pool, reg_c0, &mapped_obj); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c + struct mapping_ctx *chains_mapping; - if (mlx5_cap_flowtable_nic_rx(priv->mdev, ignore_flow_level)) { + chains_mapping = mapping_create(sizeof(struct mlx5_mapped_obj), + mlx5e_tc_table_chain_tag_mask, true); + if (is_err(chains_mapping)) { + err = ptr_err(chains_mapping); + goto err_mapping; + } + tc->mapping = chains_mapping; + + if (mlx5_cap_flowtable_nic_rx(priv->mdev, ignore_flow_level)) - attr.max_restore_tag = mlx5e_tc_table_chain_tag_mask; - } + attr.mapping = chains_mapping; + mapping_destroy(chains_mapping); +err_mapping: + mapping_destroy(tc->mapping); - err = mlx5_get_mapped_object(nic_chains(priv), chain_tag, &mapped_obj); + err = mapping_find(tc->mapping, chain_tag, &mapped_obj); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h + struct mapping_ctx *reg_c0_obj_pool; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +#include "en/mapping.h" - attr.max_restore_tag = esw_reg_c0_user_data_metadata_mask; + attr.mapping = esw->offloads.reg_c0_obj_pool; + struct mapping_ctx *reg_c0_obj_pool; + reg_c0_obj_pool = mapping_create(sizeof(struct mlx5_mapped_obj), + esw_reg_c0_user_data_metadata_mask, + true); + if (is_err(reg_c0_obj_pool)) { + err = ptr_err(reg_c0_obj_pool); + goto err_pool; + } + esw->offloads.reg_c0_obj_pool = reg_c0_obj_pool; + + mapping_destroy(reg_c0_obj_pool); +err_pool: + mapping_destroy(esw->offloads.reg_c0_obj_pool); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c -#include "mlx5_core.h" -#include "eswitch.h" -#include "en.h" -#define chains_mapping(chains) ((chains)->chains_mapping) - err = mapping_add(chains_mapping(chains), &chain->chain, &index); + err = mlx5_chains_get_chain_mapping(chains, chain->chain, &index); - err = mapping_add(chains_mapping(chains), - &chain->chain, &index); - mapping_remove(chains_mapping(chains), - mlx5_fs_default_flow_tag); + err = mlx5_chains_get_chain_mapping(chains, chain->chain, &index); + mapping_remove(chains->chains_mapping, mlx5_fs_default_flow_tag); - mapping_remove(chains_mapping(chains), chain->id); + mapping_remove(chains->chains_mapping, chain->id); - mapping_remove(chains_mapping(chains), chain->id); + mapping_remove(chains->chains_mapping, chain->id); - struct mapping_ctx *mapping; + chains_priv->chains_mapping = attr->mapping; - mapping = mapping_create(sizeof(struct mlx5_mapped_obj), attr->max_restore_tag, true); - if (is_err(mapping)) { - err = ptr_err(mapping); - goto mapping_err; - } - chains_mapping(chains_priv) = mapping; - -mapping_err: - rhashtable_destroy(&prios_ht(chains_priv)); - mapping_destroy(chains_mapping(chains)); - -int -mlx5_get_mapped_object(struct mlx5_fs_chains *chains, u32 tag, struct mlx5_mapped_obj *obj) -{ - int err; - - err = mapping_find(chains->chains_mapping, tag, obj); - if (err) { - mlx5_core_warn(chains->dev, "can't find chain for tag: %d ", tag); - return -enoent; - } - - return 0; -} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h - u32 max_restore_tag; + struct mapping_ctx *mapping; -int -mlx5_get_mapped_object(struct mlx5_fs_chains *chains, u32 tag, struct mlx5_mapped_obj *obj); -
|
Networking
|
c935568271b5b25baea65ad623f146de72570cd7
|
chris mi
|
drivers
|
net
|
core, en, ethernet, lib, mellanox, mlx5, rep
|
net/mlx5e: tc, parse sample action
|
parse tc sample action and save sample parameters in flow attribute data structure.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 4
| 44
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h + mlx5e_tc_flow_flag_sample = mlx5e_tc_flow_base + 11, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +#include <net/psample.h> + kfree(flow->attr->esw_attr->sample); + struct mlx5_sample_attr sample = {}; + if (flow_flag_test(flow, sample)) { + nl_set_err_msg_mod(extack, "sample action with connection tracking is not supported"); + return -eopnotsupp; + } + case flow_action_sample: + if (flow_flag_test(flow, ct)) { + nl_set_err_msg_mod(extack, "sample action with connection tracking is not supported"); + return -eopnotsupp; + } + sample.rate = act->sample.rate; + sample.group_num = act->sample.psample_group->group_num; + if (act->sample.truncate) + sample.trunc_size = act->sample.trunc_size; + flow_flag_set(flow, sample); + break; + /* allocate sample attribute only when there is a sample action and + * no errors after parsing. + */ + if (flow_flag_test(flow, sample)) { + esw_attr->sample = kzalloc(sizeof(*esw_attr->sample), gfp_kernel); + if (!esw_attr->sample) + return -enomem; + *esw_attr->sample = sample; + } + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +/* spdx-license-identifier: gpl-2.0 or linux-openib */ +/* copyright (c) 2021 mellanox technologies. */ + +#ifndef __mlx5_en_tc_sample_h__ +#define __mlx5_en_tc_sample_h__ + +struct mlx5_sample_attr { + u32 group_num; + u32 rate; + u32 trunc_size; +}; + +#endif /* __mlx5_en_tc_sample_h__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +#include "esw/sample.h" + struct mlx5_sample_attr *sample;
|
Networking
|
41c2fd949803a5ff8acfed1d81c0bbd62d8f660d
|
chris mi oz shlomo ozsh nvidia com mark bloch mbloch nvidia com
|
drivers
|
net
|
core, en, esw, ethernet, mellanox, mlx5
|
net/mlx5e: tc, add sampler termination table api
|
sampled packets are sent to software using termination tables. there is only one rule in that table that is to forward sampled packets to the e-switch management vport.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'kconfig', 'c', 'makefile']
| 6
| 129
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/kconfig b/drivers/net/ethernet/mellanox/mlx5/core/kconfig --- a/drivers/net/ethernet/mellanox/mlx5/core/kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/kconfig +config mlx5_tc_sample + bool "mlx5 tc sample offload support" + depends on mlx5_cls_act + default y + help + say y here if you want to support offloading sample rules via tc + sample action. + if set to n, will not be able to configure tc rules with sample + action. + + if unsure, set to y + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/makefile b/drivers/net/ethernet/mellanox/mlx5/core/makefile --- a/drivers/net/ethernet/mellanox/mlx5/core/makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/makefile +mlx5_core-$(config_mlx5_tc_sample) += esw/sample.o diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h + struct mlx5_esw_psample *esw_psample; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +#include "esw/sample.h" +#if is_enabled(config_mlx5_tc_sample) + uplink_priv->esw_psample = mlx5_esw_sample_init(netdev_priv(priv->netdev)); +#endif + +#if is_enabled(config_mlx5_tc_sample) + mlx5_esw_sample_cleanup(uplink_priv->esw_psample); +#endif +#if is_enabled(config_mlx5_tc_sample) + mlx5_esw_sample_cleanup(uplink_priv->esw_psample); +#endif diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +// spdx-license-identifier: gpl-2.0 or linux-openib +/* copyright (c) 2021 mellanox technologies. */ + +#include "esw/sample.h" +#include "eswitch.h" + +struct mlx5_esw_psample { + struct mlx5e_priv *priv; + struct mlx5_flow_table *termtbl; + struct mlx5_flow_handle *termtbl_rule; +}; + +static int +sampler_termtbl_create(struct mlx5_esw_psample *esw_psample) +{ + struct mlx5_core_dev *dev = esw_psample->priv->mdev; + struct mlx5_eswitch *esw = dev->priv.eswitch; + struct mlx5_flow_table_attr ft_attr = {}; + struct mlx5_flow_destination dest = {}; + struct mlx5_flow_namespace *root_ns; + struct mlx5_flow_act act = {}; + int err; + + if (!mlx5_cap_esw_flowtable_fdb(dev, termination_table)) { + mlx5_core_warn(dev, "termination table is not supported "); + return -eopnotsupp; + } + + root_ns = mlx5_get_flow_namespace(dev, mlx5_flow_namespace_fdb); + if (!root_ns) { + mlx5_core_warn(dev, "failed to get fdb flow namespace "); + return -eopnotsupp; + } + + ft_attr.flags = mlx5_flow_table_termination | mlx5_flow_table_unmanaged; + ft_attr.autogroup.max_num_groups = 1; + ft_attr.prio = fdb_slow_path; + ft_attr.max_fte = 1; + ft_attr.level = 1; + esw_psample->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); + if (is_err(esw_psample->termtbl)) { + err = ptr_err(esw_psample->termtbl); + mlx5_core_warn(dev, "failed to create termtbl, err: %d ", err); + return err; + } + + act.action = mlx5_flow_context_action_fwd_dest; + dest.vport.num = esw->manager_vport; + esw_psample->termtbl_rule = mlx5_add_flow_rules(esw_psample->termtbl, null, &act, &dest, 1); + if (is_err(esw_psample->termtbl_rule)) { + err = ptr_err(esw_psample->termtbl_rule); + mlx5_core_warn(dev, "failed to create termtbl rule, err: %d ", err); + mlx5_destroy_flow_table(esw_psample->termtbl); + return err; + } + + return 0; +} + +static void +sampler_termtbl_destroy(struct mlx5_esw_psample *esw_psample) +{ + mlx5_del_flow_rules(esw_psample->termtbl_rule); + mlx5_destroy_flow_table(esw_psample->termtbl); +} + +struct mlx5_esw_psample * +mlx5_esw_sample_init(struct mlx5e_priv *priv) +{ + struct mlx5_esw_psample *esw_psample; + int err; + + esw_psample = kzalloc(sizeof(*esw_psample), gfp_kernel); + if (!esw_psample) + return err_ptr(-enomem); + esw_psample->priv = priv; + err = sampler_termtbl_create(esw_psample); + if (err) + goto err_termtbl; + + return esw_psample; + +err_termtbl: + kfree(esw_psample); + return err_ptr(err); +} + +void +mlx5_esw_sample_cleanup(struct mlx5_esw_psample *esw_psample) +{ + if (is_err_or_null(esw_psample)) + return; + + sampler_termtbl_destroy(esw_psample); + kfree(esw_psample); +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +#include "en.h" + +struct mlx5_esw_psample * +mlx5_esw_sample_init(struct mlx5e_priv *priv); + +void +mlx5_esw_sample_cleanup(struct mlx5_esw_psample *esw_psample); +
|
Networking
|
2a9ab10a5689a4612d441df1cc628c381dc75ed3
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5e: tc, add sampler object api
|
in order to offload sample action, hw introduces sampler object. the sampler object samples packets according to the provided sample ratio. sampled packets are duplicated. one copy is processed by a termination table, named the sample table, which sends the packet up to software. the second copy is processed by the default table.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 1
| 131
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +#include "en_tc.h" +#include "fs_core.h" + declare_hashtable(hashtbl, 8); + struct mutex ht_lock; /* protect hashtbl */ +}; + +struct mlx5_sampler { + struct hlist_node hlist; + u32 sampler_id; + u32 sample_ratio; + u32 sample_table_id; + u32 default_table_id; + int count; +}; + +struct mlx5_sample_flow { + struct mlx5_sampler *sampler; +static int +sampler_obj_create(struct mlx5_core_dev *mdev, struct mlx5_sampler *sampler) +{ + u32 in[mlx5_st_sz_dw(create_sampler_obj_in)] = {}; + u32 out[mlx5_st_sz_dw(general_obj_out_cmd_hdr)]; + u64 general_obj_types; + void *obj; + int err; + + general_obj_types = mlx5_cap_gen_64(mdev, general_obj_types); + if (!(general_obj_types & mlx5_hca_cap_general_object_types_sampler)) + return -eopnotsupp; + if (!mlx5_cap_esw_flowtable_fdb(mdev, ignore_flow_level)) + return -eopnotsupp; + + obj = mlx5_addr_of(create_sampler_obj_in, in, sampler_object); + mlx5_set(sampler_obj, obj, table_type, fs_ft_fdb); + mlx5_set(sampler_obj, obj, ignore_flow_level, 1); + mlx5_set(sampler_obj, obj, level, 1); + mlx5_set(sampler_obj, obj, sample_ratio, sampler->sample_ratio); + mlx5_set(sampler_obj, obj, sample_table_id, sampler->sample_table_id); + mlx5_set(sampler_obj, obj, default_table_id, sampler->default_table_id); + mlx5_set(general_obj_in_cmd_hdr, in, opcode, mlx5_cmd_op_create_general_object); + mlx5_set(general_obj_in_cmd_hdr, in, obj_type, mlx5_general_object_types_sampler); + + err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); + if (!err) + sampler->sampler_id = mlx5_get(general_obj_out_cmd_hdr, out, obj_id); + + return err; +} + +static void +sampler_obj_destroy(struct mlx5_core_dev *mdev, u32 sampler_id) +{ + u32 in[mlx5_st_sz_dw(general_obj_in_cmd_hdr)] = {}; + u32 out[mlx5_st_sz_dw(general_obj_out_cmd_hdr)]; + + mlx5_set(general_obj_in_cmd_hdr, in, opcode, mlx5_cmd_op_destroy_general_object); + mlx5_set(general_obj_in_cmd_hdr, in, obj_type, mlx5_general_object_types_sampler); + mlx5_set(general_obj_in_cmd_hdr, in, obj_id, sampler_id); + + mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); +} + +static u32 +sampler_hash(u32 sample_ratio, u32 default_table_id) +{ + return jhash_2words(sample_ratio, default_table_id, 0); +} + +static int +sampler_cmp(u32 sample_ratio1, u32 default_table_id1, u32 sample_ratio2, u32 default_table_id2) +{ + return sample_ratio1 != sample_ratio2 || default_table_id1 != default_table_id2; +} + +static struct mlx5_sampler * +sampler_get(struct mlx5_esw_psample *esw_psample, u32 sample_ratio, u32 default_table_id) +{ + struct mlx5_sampler *sampler; + u32 hash_key; + int err; + + mutex_lock(&esw_psample->ht_lock); + hash_key = sampler_hash(sample_ratio, default_table_id); + hash_for_each_possible(esw_psample->hashtbl, sampler, hlist, hash_key) + if (!sampler_cmp(sampler->sample_ratio, sampler->default_table_id, + sample_ratio, default_table_id)) + goto add_ref; + + sampler = kzalloc(sizeof(*sampler), gfp_kernel); + if (!sampler) { + err = -enomem; + goto err_alloc; + } + + sampler->sample_table_id = esw_psample->termtbl->id; + sampler->default_table_id = default_table_id; + sampler->sample_ratio = sample_ratio; + + err = sampler_obj_create(esw_psample->priv->mdev, sampler); + if (err) + goto err_create; + + hash_add(esw_psample->hashtbl, &sampler->hlist, hash_key); + +add_ref: + sampler->count++; + mutex_unlock(&esw_psample->ht_lock); + return sampler; + +err_create: + kfree(sampler); +err_alloc: + mutex_unlock(&esw_psample->ht_lock); + return err_ptr(err); +} + +static void +sampler_put(struct mlx5_esw_psample *esw_psample, struct mlx5_sampler *sampler) +{ + mutex_lock(&esw_psample->ht_lock); + if (--sampler->count == 0) { + hash_del(&sampler->hlist); + sampler_obj_destroy(esw_psample->priv->mdev, sampler->sampler_id); + kfree(sampler); + } + mutex_unlock(&esw_psample->ht_lock); +} + + mutex_init(&esw_psample->ht_lock); + + mutex_destroy(&esw_psample->ht_lock);
|
Networking
|
11ecd6c60b4ee6f5d5bcd91f5b87e50bad8f142a
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5e: tc, add sampler restore handle api
|
use common object pool to create an object id to map sample parameters. allocate a modify header action to write the object id to reg_c0 lower 16 bits. create a restore rule to pass the object id to software. so software can identify sampled packets via the object id and send it to userspace.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 1
| 108
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +#include <linux/skbuff.h> +#include <net/psample.h> + declare_hashtable(restore_hashtbl, 8); + struct mutex restore_lock; /* protect restore_hashtbl */ + struct mlx5_sample_restore *restore; +}; + +struct mlx5_sample_restore { + struct hlist_node hlist; + struct mlx5_modify_hdr *modify_hdr; + struct mlx5_flow_handle *rule; + u32 obj_id; + int count; +static struct mlx5_modify_hdr * +sample_metadata_rule_get(struct mlx5_core_dev *mdev, u32 obj_id) +{ + struct mlx5e_tc_mod_hdr_acts mod_acts = {}; + struct mlx5_modify_hdr *modify_hdr; + int err; + + err = mlx5e_tc_match_to_reg_set(mdev, &mod_acts, mlx5_flow_namespace_fdb, + chain_to_reg, obj_id); + if (err) + goto err_set_regc0; + + modify_hdr = mlx5_modify_header_alloc(mdev, mlx5_flow_namespace_fdb, + mod_acts.num_actions, + mod_acts.actions); + if (is_err(modify_hdr)) { + err = ptr_err(modify_hdr); + goto err_modify_hdr; + } + + dealloc_mod_hdr_actions(&mod_acts); + return modify_hdr; + +err_modify_hdr: + dealloc_mod_hdr_actions(&mod_acts); +err_set_regc0: + return err_ptr(err); +} + +static struct mlx5_sample_restore * +sample_restore_get(struct mlx5_esw_psample *esw_psample, u32 obj_id) +{ + struct mlx5_core_dev *mdev = esw_psample->priv->mdev; + struct mlx5_eswitch *esw = mdev->priv.eswitch; + struct mlx5_sample_restore *restore; + struct mlx5_modify_hdr *modify_hdr; + int err; + + mutex_lock(&esw_psample->restore_lock); + hash_for_each_possible(esw_psample->restore_hashtbl, restore, hlist, obj_id) + if (restore->obj_id == obj_id) + goto add_ref; + + restore = kzalloc(sizeof(*restore), gfp_kernel); + if (!restore) { + err = -enomem; + goto err_alloc; + } + restore->obj_id = obj_id; + + modify_hdr = sample_metadata_rule_get(mdev, obj_id); + if (is_err(modify_hdr)) { + err = ptr_err(modify_hdr); + goto err_modify_hdr; + } + restore->modify_hdr = modify_hdr; + + restore->rule = esw_add_restore_rule(esw, obj_id); + if (is_err(restore->rule)) { + err = ptr_err(restore->rule); + goto err_restore; + } + + hash_add(esw_psample->restore_hashtbl, &restore->hlist, obj_id); +add_ref: + restore->count++; + mutex_unlock(&esw_psample->restore_lock); + return restore; + +err_restore: + mlx5_modify_header_dealloc(mdev, restore->modify_hdr); +err_modify_hdr: + kfree(restore); +err_alloc: + mutex_unlock(&esw_psample->restore_lock); + return err_ptr(err); +} + +static void +sample_restore_put(struct mlx5_esw_psample *esw_psample, struct mlx5_sample_restore *restore) +{ + mutex_lock(&esw_psample->restore_lock); + if (--restore->count == 0) + hash_del(&restore->hlist); + mutex_unlock(&esw_psample->restore_lock); + + if (!restore->count) { + mlx5_del_flow_rules(restore->rule); + mlx5_modify_header_dealloc(esw_psample->priv->mdev, restore->modify_hdr); + kfree(restore); + } +} + + mutex_init(&esw_psample->restore_lock); + mutex_destroy(&esw_psample->restore_lock);
|
Networking
|
36a3196256bf3310e5e7142b0e61787f7a201abd
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5e: tc, refactor tc update skb function
|
as a pre-step to process sampled packet in this function.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 1
| 33
| 26
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c + +static bool mlx5e_restore_skb(struct sk_buff *skb, u32 chain, u32 reg_c1, + struct mlx5e_tc_update_priv *tc_priv) +{ + struct mlx5e_priv *priv = netdev_priv(skb->dev); + u32 tunnel_id = reg_c1 >> esw_tun_offset; + + if (chain) { + struct mlx5_rep_uplink_priv *uplink_priv; + struct mlx5e_rep_priv *uplink_rpriv; + struct tc_skb_ext *tc_skb_ext; + struct mlx5_eswitch *esw; + u32 zone_restore_id; + + tc_skb_ext = skb_ext_add(skb, tc_skb_ext); + if (!tc_skb_ext) { + warn_on(1); + return false; + } + tc_skb_ext->chain = chain; + zone_restore_id = reg_c1 & esw_zone_id_mask; + esw = priv->mdev->priv.eswitch; + uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, rep_eth); + uplink_priv = &uplink_rpriv->uplink_priv; + if (!mlx5e_tc_ct_restore_flow(uplink_priv->ct_priv, skb, + zone_restore_id)) + return false; + } + return mlx5e_restore_tunnel(priv, skb, tc_priv, tunnel_id); +} -#if is_enabled(config_net_tc_skb_ext) - u32 reg_c0, reg_c1, tunnel_id, zone_restore_id; - struct mlx5_rep_uplink_priv *uplink_priv; - struct mlx5e_rep_priv *uplink_rpriv; - struct tc_skb_ext *tc_skb_ext; + u32 reg_c0, reg_c1; - +#if is_enabled(config_net_tc_skb_ext) - if (mapped_obj.chain) { - tc_skb_ext = skb_ext_add(skb, tc_skb_ext); - if (!tc_skb_ext) { - warn_on(1); - return false; - } - - tc_skb_ext->chain = mapped_obj.chain; - - zone_restore_id = reg_c1 & esw_zone_id_mask; - - uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, rep_eth); - uplink_priv = &uplink_rpriv->uplink_priv; - if (!mlx5e_tc_ct_restore_flow(uplink_priv->ct_priv, skb, - zone_restore_id)) - return false; - } + return mlx5e_restore_skb(skb, mapped_obj.chain, reg_c1, tc_priv); - - tunnel_id = reg_c1 >> esw_tun_offset; - return mlx5e_restore_tunnel(priv, skb, tc_priv, tunnel_id);
|
Networking
|
7319a1cc3ca9f719e4ef1b1882f6fdb57d0719b8
|
chris mi
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5, rep
|
net/mlx5e: tc, handle sampled packets
|
mark the sampled packets with a sample restore object. send sampled packets using the psample api.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 4
| 35
| 3
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +#include "esw/sample.h" - if (mapped_obj.type == mlx5_mapped_obj_chain) { + if (mapped_obj.type == mlx5_mapped_obj_chain) - } else { +#endif /* config_net_tc_skb_ext */ +#if is_enabled(config_mlx5_tc_sample) + if (mapped_obj.type == mlx5_mapped_obj_sample) { + mlx5_esw_sample_skb(skb, &mapped_obj); + return false; + } +#endif /* config_mlx5_tc_sample */ + if (mapped_obj.type != mlx5_mapped_obj_sample && + mapped_obj.type != mlx5_mapped_obj_chain) { -#endif /* config_net_tc_skb_ext */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +void mlx5_esw_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj) +{ + u32 trunc_size = mapped_obj->sample.trunc_size; + struct psample_group psample_group = {}; + struct psample_metadata md = {}; + + md.trunc_size = trunc_size ? min(trunc_size, skb->len) : skb->len; + md.in_ifindex = skb->dev->ifindex; + psample_group.group_num = mapped_obj->sample.group_id; + psample_group.net = &init_net; + skb_push(skb, skb->mac_len); + + psample_sample_packet(&psample_group, skb, mapped_obj->sample.rate, &md); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +#include "eswitch.h" +void mlx5_esw_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h + mlx5_mapped_obj_sample, + struct { + u32 group_id; + u32 rate; + u32 trunc_size; + } sample;
|
Networking
|
be9dc0047450f7d8c0462a6ef3f7c26bced16911
|
chris mi oz shlomo ozsh nvidia com mark bloch mbloch nvidia com
|
drivers
|
net
|
core, en, esw, ethernet, mellanox, mlx5, rep
|
net/mlx5e: tc, add support to offload sample action
|
the following diagram illustrates the hardware model for tc sample action:
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce tc sample offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 5
| 328
| 2
|
+---------------------+ + original flow table + +---------------------+ + original match + +---------------------+ +------------------------------------------------+ + flow sampler object + +------------------------------------------------+ + sample ratio + +------------------------------------------------+ + sample table id | default table id + +------------------------------------------------+ +-----------------------------+ +----------------------------------------+ + sample table + + default table per <vport, chain, prio> + +-----------------------------+ +----------------------------------------+ + forward to management vport + + original match + +-----------------------------+ +----------------------------------------+ + other actions + +----------------------------------------+ --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +#if is_enabled(config_mlx5_tc_sample) +static struct mlx5_esw_psample * +get_sample_priv(struct mlx5e_priv *priv) +{ + struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; + struct mlx5_rep_uplink_priv *uplink_priv; + struct mlx5e_rep_priv *uplink_rpriv; + + if (is_mdev_switchdev_mode(priv->mdev)) { + uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, rep_eth); + uplink_priv = &uplink_rpriv->uplink_priv; + + return uplink_priv->esw_psample; + } + + return null; +} +#endif + +#if is_enabled(config_mlx5_tc_sample) + } else if (flow_flag_test(flow, sample)) { + rule = mlx5_esw_sample_offload(get_sample_priv(flow->priv), spec, attr); +#endif +#if is_enabled(config_mlx5_tc_sample) + if (flow_flag_test(flow, sample)) { + mlx5_esw_sample_unoffload(get_sample_priv(flow->priv), flow->rule[0], attr); + return; + } +#endif + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.c +#include "en/mapping.h" +#define mlx5_esw_vport_tbl_size_sample (64 * 1024) + +static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_sample_ns = { + .max_fte = mlx5_esw_vport_tbl_size_sample, + .max_num_groups = 0, /* default num of groups */ + .flags = mlx5_flow_table_tunnel_en_reformat | mlx5_flow_table_tunnel_en_decap, +}; + + struct mlx5_flow_attr *pre_attr; + struct mlx5_flow_handle *pre_rule; + struct mlx5_flow_handle *rule; +/* for the following typical flow table: + * + * +-------------------------------+ + * + original flow table + + * +-------------------------------+ + * + original match + + * +-------------------------------+ + * + sample action + other actions + + * +-------------------------------+ + * + * we translate the tc filter with sample action to the following hw model: + * + * +---------------------+ + * + original flow table + + * +---------------------+ + * + original match + + * +---------------------+ + * | + * v + * +------------------------------------------------+ + * + flow sampler object + + * +------------------------------------------------+ + * + sample ratio + + * +------------------------------------------------+ + * + sample table id | default table id + + * +------------------------------------------------+ + * | | + * v v + * +-----------------------------+ +----------------------------------------+ + * + sample table + + default table per <vport, chain, prio> + + * +-----------------------------+ +----------------------------------------+ + * + forward to management vport + + original match + + * +-----------------------------+ +----------------------------------------+ + * + other actions + + * +----------------------------------------+ + */ +struct mlx5_flow_handle * +mlx5_esw_sample_offload(struct mlx5_esw_psample *esw_psample, + struct mlx5_flow_spec *spec, + struct mlx5_flow_attr *attr) +{ + struct mlx5_esw_flow_attr *esw_attr = attr->esw_attr; + struct mlx5_vport_tbl_attr per_vport_tbl_attr; + struct mlx5_esw_flow_attr *pre_esw_attr; + struct mlx5_mapped_obj restore_obj = {}; + struct mlx5_sample_flow *sample_flow; + struct mlx5_sample_attr *sample_attr; + struct mlx5_flow_table *default_tbl; + struct mlx5_flow_attr *pre_attr; + struct mlx5_eswitch *esw; + u32 obj_id; + int err; + + if (is_err_or_null(esw_psample)) + return err_ptr(-eopnotsupp); + + /* if slow path flag is set, eg. when the neigh is invalid for encap, + * don't offload sample action. + */ + esw = esw_psample->priv->mdev->priv.eswitch; + if (attr->flags & mlx5_esw_attr_flag_slow_path) + return mlx5_eswitch_add_offloaded_rule(esw, spec, attr); + + sample_flow = kzalloc(sizeof(*sample_flow), gfp_kernel); + if (!sample_flow) + return err_ptr(-enomem); + esw_attr->sample->sample_flow = sample_flow; + + /* allocate default table per vport, chain and prio. otherwise, there is + * only one default table for the same sampler object. rules with different + * prio and chain may overlap. for ct sample action, per vport default + * table is needed to resotre the metadata. + */ + per_vport_tbl_attr.chain = attr->chain; + per_vport_tbl_attr.prio = attr->prio; + per_vport_tbl_attr.vport = esw_attr->in_rep->vport; + per_vport_tbl_attr.vport_ns = &mlx5_esw_vport_tbl_sample_ns; + default_tbl = mlx5_esw_vporttbl_get(esw, &per_vport_tbl_attr); + if (is_err(default_tbl)) { + err = ptr_err(default_tbl); + goto err_default_tbl; + } + + /* perform the original matches on the default table. + * offload all actions except the sample action. + */ + esw_attr->sample->sample_default_tbl = default_tbl; + /* when offloading sample and encap action, if there is no valid + * neigh data struct, a slow path rule is offloaded first. source + * port metadata match is set at that time. a per vport table is + * already allocated. no need to match it again. so clear the source + * port metadata match. + */ + mlx5_eswitch_clear_rule_source_port(esw, spec); + sample_flow->rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr); + if (is_err(sample_flow->rule)) { + err = ptr_err(sample_flow->rule); + goto err_offload_rule; + } + + /* create sampler object. */ + sample_flow->sampler = sampler_get(esw_psample, esw_attr->sample->rate, default_tbl->id); + if (is_err(sample_flow->sampler)) { + err = ptr_err(sample_flow->sampler); + goto err_sampler; + } + + /* create an id mapping reg_c0 value to sample object. */ + restore_obj.type = mlx5_mapped_obj_sample; + restore_obj.sample.group_id = esw_attr->sample->group_num; + restore_obj.sample.rate = esw_attr->sample->rate; + restore_obj.sample.trunc_size = esw_attr->sample->trunc_size; + err = mapping_add(esw->offloads.reg_c0_obj_pool, &restore_obj, &obj_id); + if (err) + goto err_obj_id; + esw_attr->sample->restore_obj_id = obj_id; + + /* create sample restore context. */ + sample_flow->restore = sample_restore_get(esw_psample, obj_id); + if (is_err(sample_flow->restore)) { + err = ptr_err(sample_flow->restore); + goto err_sample_restore; + } + + /* perform the original matches on the original table. offload the + * sample action. the destination is the sampler object. + */ + pre_attr = mlx5_alloc_flow_attr(mlx5_flow_namespace_fdb); + if (!pre_attr) { + err = -enomem; + goto err_alloc_flow_attr; + } + sample_attr = kzalloc(sizeof(*sample_attr), gfp_kernel); + if (!sample_attr) { + err = -enomem; + goto err_alloc_sample_attr; + } + pre_esw_attr = pre_attr->esw_attr; + pre_attr->action = mlx5_flow_context_action_fwd_dest | mlx5_flow_context_action_mod_hdr; + pre_attr->modify_hdr = sample_flow->restore->modify_hdr; + pre_attr->flags = mlx5_esw_attr_flag_sample; + pre_attr->chain = attr->chain; + pre_attr->prio = attr->prio; + pre_esw_attr->sample = sample_attr; + pre_esw_attr->sample->sampler_id = sample_flow->sampler->sampler_id; + pre_esw_attr->in_mdev = esw_attr->in_mdev; + pre_esw_attr->in_rep = esw_attr->in_rep; + sample_flow->pre_rule = mlx5_eswitch_add_offloaded_rule(esw, spec, pre_attr); + if (is_err(sample_flow->pre_rule)) { + err = ptr_err(sample_flow->pre_rule); + goto err_pre_offload_rule; + } + sample_flow->pre_attr = pre_attr; + + return sample_flow->rule; + +err_pre_offload_rule: + kfree(sample_attr); +err_alloc_sample_attr: + kfree(pre_attr); +err_alloc_flow_attr: + sample_restore_put(esw_psample, sample_flow->restore); +err_sample_restore: + mapping_remove(esw->offloads.reg_c0_obj_pool, obj_id); +err_obj_id: + sampler_put(esw_psample, sample_flow->sampler); +err_sampler: + /* for sample offload, rule is added in default_tbl. no need to call + * mlx5_esw_chains_put_table() + */ + attr->prio = 0; + attr->chain = 0; + mlx5_eswitch_del_offloaded_rule(esw, sample_flow->rule, attr); +err_offload_rule: + mlx5_esw_vporttbl_put(esw, &per_vport_tbl_attr); +err_default_tbl: + return err_ptr(err); +} + +void +mlx5_esw_sample_unoffload(struct mlx5_esw_psample *esw_psample, + struct mlx5_flow_handle *rule, + struct mlx5_flow_attr *attr) +{ + struct mlx5_esw_flow_attr *esw_attr = attr->esw_attr; + struct mlx5_sample_flow *sample_flow; + struct mlx5_vport_tbl_attr tbl_attr; + struct mlx5_flow_attr *pre_attr; + struct mlx5_eswitch *esw; + + if (is_err_or_null(esw_psample)) + return; + + /* if slow path flag is set, sample action is not offloaded. + * no need to delete sample rule. + */ + esw = esw_psample->priv->mdev->priv.eswitch; + if (attr->flags & mlx5_esw_attr_flag_slow_path) { + mlx5_eswitch_del_offloaded_rule(esw, rule, attr); + return; + } + + sample_flow = esw_attr->sample->sample_flow; + pre_attr = sample_flow->pre_attr; + memset(pre_attr, 0, sizeof(*pre_attr)); + esw = esw_psample->priv->mdev->priv.eswitch; + mlx5_eswitch_del_offloaded_rule(esw, sample_flow->pre_rule, pre_attr); + mlx5_eswitch_del_offloaded_rule(esw, sample_flow->rule, attr); + + sample_restore_put(esw_psample, sample_flow->restore); + mapping_remove(esw->offloads.reg_c0_obj_pool, esw_attr->sample->restore_obj_id); + sampler_put(esw_psample, sample_flow->sampler); + tbl_attr.chain = attr->chain; + tbl_attr.prio = attr->prio; + tbl_attr.vport = esw_attr->in_rep->vport; + tbl_attr.vport_ns = &mlx5_esw_vport_tbl_sample_ns; + mlx5_esw_vporttbl_put(esw, &tbl_attr); + + kfree(pre_attr->esw_attr->sample); + kfree(pre_attr); + kfree(sample_flow); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/sample.h +struct mlx5e_priv; +struct mlx5_flow_attr; +struct mlx5_esw_psample; + + u32 restore_obj_id; + u32 sampler_id; + struct mlx5_flow_table *sample_default_tbl; + struct mlx5_sample_flow *sample_flow; +struct mlx5_flow_handle * +mlx5_esw_sample_offload(struct mlx5_esw_psample *sample_priv, + struct mlx5_flow_spec *spec, + struct mlx5_flow_attr *attr); + +void +mlx5_esw_sample_unoffload(struct mlx5_esw_psample *sample_priv, + struct mlx5_flow_handle *rule, + struct mlx5_flow_attr *attr); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +void +mlx5_eswitch_clear_rule_source_port(struct mlx5_eswitch *esw, struct mlx5_flow_spec *spec); + + mlx5_esw_attr_flag_sample = bit(4), diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +/* actually only the upper 16 bits of reg c0 need to be cleared, but the lower 16 bits + * are not needed as well in the following process. so clear them all for simplicity. + */ +void +mlx5_eswitch_clear_rule_source_port(struct mlx5_eswitch *esw, struct mlx5_flow_spec *spec) +{ + if (mlx5_eswitch_vport_match_metadata_enabled(esw)) { + void *misc2; + + misc2 = mlx5_addr_of(fte_match_param, spec->match_value, misc_parameters_2); + mlx5_set(fte_match_set_misc2, misc2, metadata_reg_c_0, 0); + + misc2 = mlx5_addr_of(fte_match_param, spec->match_criteria, misc_parameters_2); + mlx5_set(fte_match_set_misc2, misc2, metadata_reg_c_0, 0); + + if (!memchr_inv(misc2, 0, mlx5_st_sz_bytes(fte_match_set_misc2))) + spec->match_criteria_enable &= ~mlx5_match_misc_parameters_2; + } +} + +static int +esw_setup_sampler_dest(struct mlx5_flow_destination *dest, + struct mlx5_flow_act *flow_act, + struct mlx5_esw_flow_attr *esw_attr, + int i) +{ + flow_act->flags |= flow_act_ignore_flow_level; + dest[i].type = mlx5_flow_destination_type_flow_sampler; + dest[i].sampler_id = esw_attr->sample->sampler_id; + + return 0; +} + - if (attr->dest_ft) { + if (attr->flags & mlx5_esw_attr_flag_sample) { + esw_setup_sampler_dest(dest, flow_act, esw_attr, *i); + (*i)++; + } else if (attr->dest_ft) { - if (split) { + /* esw_attr->sample is allocated only when there is a sample action */ + if (esw_attr->sample && esw_attr->sample->sample_default_tbl) { + fdb = esw_attr->sample->sample_default_tbl; + } else if (split) {
|
Networking
|
f94d6389f6a8abd04760dcd015d14961260a8000
|
chris mi
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5e: allow to match on icmp parameters
|
support matching on icmpv4/6 type and code parameters using misc3 section of match parameters.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
tc support for icmp parameters
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 2
| 49
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c + void *misc_c_3 = mlx5_addr_of(fte_match_param, spec->match_criteria, + misc_parameters_3); + void *misc_v_3 = mlx5_addr_of(fte_match_param, spec->match_value, + misc_parameters_3); + bit(flow_dissector_key_icmp) | + if (flow_rule_match_key(rule, flow_dissector_key_icmp)) { + struct flow_match_icmp match; + flow_rule_match_icmp(rule, &match); + switch (ip_proto) { + case ipproto_icmp: + if (!(mlx5_cap_gen(priv->mdev, flex_parser_protocols) & + mlx5_flex_proto_icmp)) + return -eopnotsupp; + mlx5_set(fte_match_set_misc3, misc_c_3, icmp_type, + match.mask->type); + mlx5_set(fte_match_set_misc3, misc_v_3, icmp_type, + match.key->type); + mlx5_set(fte_match_set_misc3, misc_c_3, icmp_code, + match.mask->code); + mlx5_set(fte_match_set_misc3, misc_v_3, icmp_code, + match.key->code); + break; + case ipproto_icmpv6: + if (!(mlx5_cap_gen(priv->mdev, flex_parser_protocols) & + mlx5_flex_proto_icmpv6)) + return -eopnotsupp; + mlx5_set(fte_match_set_misc3, misc_c_3, icmpv6_type, + match.mask->type); + mlx5_set(fte_match_set_misc3, misc_v_3, icmpv6_type, + match.key->type); + mlx5_set(fte_match_set_misc3, misc_c_3, icmpv6_code, + match.mask->code); + mlx5_set(fte_match_set_misc3, misc_v_3, icmpv6_code, + match.key->code); + break; + default: + nl_set_err_msg_mod(extack, + "code and type matching only with icmp and icmpv6"); + netdev_err(priv->netdev, + "code and type matching only with icmp and icmpv6 "); + return -einval; + } + if (match.mask->code || match.mask->type) { + *match_level = mlx5_match_l4; + spec->match_criteria_enable |= mlx5_match_misc_parameters_3; + } + } diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h + mlx5_flex_proto_icmp = 1 << 8, + mlx5_flex_proto_icmpv6 = 1 << 9,
|
Networking
|
a3222a2da0a2d6c7682252d4bfdff05721a82b95
|
maor dickman roi dayan roid nvidia com
|
include
|
linux
|
core, ethernet, mellanox, mlx5
|
mlx5: implement ethtool::get_fec_stats
|
report corrected bits.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
implement ethtool::get_fec_stats
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 38
| 2
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +static void mlx5e_get_fec_stats(struct net_device *netdev, + struct ethtool_fec_stats *fec_stats) +{ + struct mlx5e_priv *priv = netdev_priv(netdev); + + mlx5e_stats_fec_get(priv, fec_stats); +} + + .get_fec_stats = mlx5e_get_fec_stats, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c -#define mlx5e_read_ctr64_be_f(ptr, c) \ +#define mlx5e_read_ctr64_be_f(ptr, set, c) \ - counter_set.eth_802_3_cntrs_grp_data_layout.c##_high))) + counter_set.set.c##_high))) + eth_802_3_cntrs_grp_data_layout, + eth_802_3_cntrs_grp_data_layout, +void mlx5e_stats_fec_get(struct mlx5e_priv *priv, + struct ethtool_fec_stats *fec_stats) +{ + u32 ppcnt_phy_statistical[mlx5_st_sz_dw(ppcnt_reg)]; + struct mlx5_core_dev *mdev = priv->mdev; + u32 in[mlx5_st_sz_dw(ppcnt_reg)] = {0}; + int sz = mlx5_st_sz_bytes(ppcnt_reg); + + if (!mlx5_cap_pcam_feature(mdev, ppcnt_statistical_group)) + return; + + mlx5_set(ppcnt_reg, in, local_port, 1); + mlx5_set(ppcnt_reg, in, grp, mlx5_physical_layer_statistical_group); + if (mlx5_core_access_reg(mdev, in, sz, ppcnt_phy_statistical, + sz, mlx5_reg_ppcnt, 0, 0)) + return; + + fec_stats->corrected_bits.total = + mlx5e_read_ctr64_be_f(ppcnt_phy_statistical, + phys_layer_statistical_cntrs, + phy_corrected_bits); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +void mlx5e_stats_fec_get(struct mlx5e_priv *priv, + struct ethtool_fec_stats *fec_stats);
|
Networking
|
1703bb50df0e4248b8def88fc6dd43a505479c66
|
jakub kicinski
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5e: add ethtool extended link state
|
in case the interface was set up but cannot establish the link, ethtool will print more information to help the user troubleshoot the state.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add ethtool extended link state
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 1
| 171
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +static int query_port_status_opcode(struct mlx5_core_dev *mdev, u32 *status_opcode) +{ + struct mlx5_ifc_pddr_troubleshooting_page_bits *pddr_troubleshooting_page; + u32 in[mlx5_st_sz_dw(pddr_reg)] = {}; + u32 out[mlx5_st_sz_dw(pddr_reg)]; + int err; + + mlx5_set(pddr_reg, in, local_port, 1); + mlx5_set(pddr_reg, in, page_select, + mlx5_pddr_reg_page_select_troubleshooting_info_page); + + pddr_troubleshooting_page = mlx5_addr_of(pddr_reg, in, page_data); + mlx5_set(pddr_troubleshooting_page, pddr_troubleshooting_page, + group_opcode, mlx5_pddr_reg_trblsh_group_opcode_monitor); + err = mlx5_core_access_reg(mdev, in, sizeof(in), out, + sizeof(out), mlx5_reg_pddr, 0, 0); + if (err) + return err; + + pddr_troubleshooting_page = mlx5_addr_of(pddr_reg, out, page_data); + *status_opcode = mlx5_get(pddr_troubleshooting_page, pddr_troubleshooting_page, + status_opcode); + return 0; +} + +struct mlx5e_ethtool_link_ext_state_opcode_mapping { + u32 status_opcode; + enum ethtool_link_ext_state link_ext_state; + u8 link_ext_substate; +}; + +static const struct mlx5e_ethtool_link_ext_state_opcode_mapping +mlx5e_link_ext_state_opcode_map[] = { + /* states relating to the autonegotiation or issues therein */ + {2, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_no_partner_detected}, + {3, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_ack_not_received}, + {4, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_next_page_exchange_failed}, + {36, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_no_partner_detected_force_mode}, + {38, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_fec_mismatch_during_override}, + {39, ethtool_link_ext_state_autoneg, + ethtool_link_ext_substate_an_no_hcd}, + + /* failure during link training */ + {5, ethtool_link_ext_state_link_training_failure, + ethtool_link_ext_substate_lt_kr_frame_lock_not_acquired}, + {6, ethtool_link_ext_state_link_training_failure, + ethtool_link_ext_substate_lt_kr_link_inhibit_timeout}, + {7, ethtool_link_ext_state_link_training_failure, + ethtool_link_ext_substate_lt_kr_link_partner_did_not_set_receiver_ready}, + {8, ethtool_link_ext_state_link_training_failure, 0}, + {14, ethtool_link_ext_state_link_training_failure, + ethtool_link_ext_substate_lt_remote_fault}, + + /* logical mismatch in physical coding sublayer or forward error correction sublayer */ + {9, ethtool_link_ext_state_link_logical_mismatch, + ethtool_link_ext_substate_llm_pcs_did_not_acquire_block_lock}, + {10, ethtool_link_ext_state_link_logical_mismatch, + ethtool_link_ext_substate_llm_pcs_did_not_acquire_am_lock}, + {11, ethtool_link_ext_state_link_logical_mismatch, + ethtool_link_ext_substate_llm_pcs_did_not_get_align_status}, + {12, ethtool_link_ext_state_link_logical_mismatch, + ethtool_link_ext_substate_llm_fc_fec_is_not_locked}, + {13, ethtool_link_ext_state_link_logical_mismatch, + ethtool_link_ext_substate_llm_rs_fec_is_not_locked}, + + /* signal integrity issues */ + {15, ethtool_link_ext_state_bad_signal_integrity, 0}, + {17, ethtool_link_ext_state_bad_signal_integrity, + ethtool_link_ext_substate_bsi_large_number_of_physical_errors}, + {42, ethtool_link_ext_state_bad_signal_integrity, + ethtool_link_ext_substate_bsi_unsupported_rate}, + + /* no cable connected */ + {1024, ethtool_link_ext_state_no_cable, 0}, + + /* failure is related to cable, e.g., unsupported cable */ + {16, ethtool_link_ext_state_cable_issue, + ethtool_link_ext_substate_ci_unsupported_cable}, + {20, ethtool_link_ext_state_cable_issue, + ethtool_link_ext_substate_ci_unsupported_cable}, + {29, ethtool_link_ext_state_cable_issue, + ethtool_link_ext_substate_ci_unsupported_cable}, + {1025, ethtool_link_ext_state_cable_issue, + ethtool_link_ext_substate_ci_unsupported_cable}, + {1029, ethtool_link_ext_state_cable_issue, + ethtool_link_ext_substate_ci_unsupported_cable}, + {1031, ethtool_link_ext_state_cable_issue, 0}, + + /* failure is related to eeprom, e.g., failure during reading or parsing the data */ + {1027, ethtool_link_ext_state_eeprom_issue, 0}, + + /* failure during calibration algorithm */ + {23, ethtool_link_ext_state_calibration_failure, 0}, + + /* the hardware is not able to provide the power required from cable or module */ + {1032, ethtool_link_ext_state_power_budget_exceeded, 0}, + + /* the module is overheated */ + {1030, ethtool_link_ext_state_overheat, 0}, +}; + +static void +mlx5e_set_link_ext_state(struct mlx5e_ethtool_link_ext_state_opcode_mapping + link_ext_state_mapping, + struct ethtool_link_ext_state_info *link_ext_state_info) +{ + switch (link_ext_state_mapping.link_ext_state) { + case ethtool_link_ext_state_autoneg: + link_ext_state_info->autoneg = + link_ext_state_mapping.link_ext_substate; + break; + case ethtool_link_ext_state_link_training_failure: + link_ext_state_info->link_training = + link_ext_state_mapping.link_ext_substate; + break; + case ethtool_link_ext_state_link_logical_mismatch: + link_ext_state_info->link_logical_mismatch = + link_ext_state_mapping.link_ext_substate; + break; + case ethtool_link_ext_state_bad_signal_integrity: + link_ext_state_info->bad_signal_integrity = + link_ext_state_mapping.link_ext_substate; + break; + case ethtool_link_ext_state_cable_issue: + link_ext_state_info->cable_issue = + link_ext_state_mapping.link_ext_substate; + break; + default: + break; + } + + link_ext_state_info->link_ext_state = link_ext_state_mapping.link_ext_state; +} + +static int +mlx5e_get_link_ext_state(struct net_device *dev, + struct ethtool_link_ext_state_info *link_ext_state_info) +{ + struct mlx5e_ethtool_link_ext_state_opcode_mapping link_ext_state_mapping; + struct mlx5e_priv *priv = netdev_priv(dev); + u32 status_opcode = 0; + int i; + + /* exit without data if the interface state is ok, since no extended data is + * available in such case + */ + if (netif_carrier_ok(dev)) + return -enodata; + + if (query_port_status_opcode(priv->mdev, &status_opcode) || + !status_opcode) + return -enodata; + + for (i = 0; i < array_size(mlx5e_link_ext_state_opcode_map); i++) { + link_ext_state_mapping = mlx5e_link_ext_state_opcode_map[i]; + if (link_ext_state_mapping.status_opcode == status_opcode) { + mlx5e_set_link_ext_state(link_ext_state_mapping, + link_ext_state_info); + return 0; + } + } + + return -enodata; +} + + .get_link_ext_state = mlx5e_get_link_ext_state,
|
Networking
|
b3446acb2b9ae6128587cd2d311214950adfb68b
|
moshe tal
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5e: add offload stats ndos to nic netdev ops
|
we will re-use the native nic port net device instance for the uplink representor, hence same ndos must be used.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add offload stats ndos to nic netdev ops
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 37
| 3
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c + +static bool +mlx5e_has_offload_stats(const struct net_device *dev, int attr_id) +{ + struct mlx5e_priv *priv = netdev_priv(dev); + + if (!mlx5e_is_uplink_rep(priv)) + return false; + + return mlx5e_rep_has_offload_stats(dev, attr_id); +} + +static int +mlx5e_get_offload_stats(int attr_id, const struct net_device *dev, + void *sp) +{ + struct mlx5e_priv *priv = netdev_priv(dev); + + if (!mlx5e_is_uplink_rep(priv)) + return -eopnotsupp; + + return mlx5e_rep_get_offload_stats(attr_id, dev, sp); +} + .ndo_has_offload_stats = mlx5e_has_offload_stats, + .ndo_get_offload_stats = mlx5e_get_offload_stats, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c -static bool mlx5e_rep_has_offload_stats(const struct net_device *dev, int attr_id) +bool mlx5e_rep_has_offload_stats(const struct net_device *dev, int attr_id) -static int mlx5e_rep_get_offload_stats(int attr_id, const struct net_device *dev, - void *sp) +int mlx5e_rep_get_offload_stats(int attr_id, const struct net_device *dev, + void *sp) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +bool mlx5e_rep_has_offload_stats(const struct net_device *dev, int attr_id); +int mlx5e_rep_get_offload_stats(int attr_id, const struct net_device *dev, + void *sp); + +static inline bool mlx5e_rep_has_offload_stats(const struct net_device *dev, + int attr_id) { return false; } +static inline int mlx5e_rep_get_offload_stats(int attr_id, + const struct net_device *dev, + void *sp) { return -eopnotsupp; }
|
Networking
|
ee5260307c54f9b1b964a44863751ac220424844
|
roi dayan saeed mahameed saeedm nvidia com
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: enhance diagnostics info for tx/rx reporters
|
add ts_format to 'common config' section of the tx/rx devlink reporters diagnostics info. possible values for ts_format: 'rt' or 'frc' which stands for: real time and free running counters correspondingly.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
enhance diagnostics info for tx/rx reporters
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['c']
| 2
| 12
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c + bool real_time; + real_time = mlx5_is_real_time_rq(priv->mdev); + err = devlink_fmsg_string_pair_put(fmsg, "ts_format", real_time ? "rt" : "frc"); + if (err) + return err; + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c + bool real_time; + real_time = mlx5_is_real_time_sq(txqsq->mdev); + err = devlink_fmsg_string_pair_put(fmsg, "ts_format", real_time ? "rt" : "frc"); + if (err) + return err; +
|
Networking
|
95742c1cc59d0a6aa2ca9e75bd21f2a8721f5129
|
aya levin
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5
|
pci/iov: add sysfs msi-x vector assignment interface
|
a typical cloud provider sr-iov use case is to create many vfs for use by guest vms. the vfs may not be assigned to a vm until a customer requests a vm of a certain size, e.g., number of cpus. a vf may need msi-x vectors proportional to the number of cpus in the vm, but there is no standard way to change the number of msi-x vectors supported by a vf.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dynamically assign msi-x vectors count
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['sysfs-bus-pci', 'h', 'c']
| 5
| 137
| 8
|
--- diff --git a/documentation/abi/testing/sysfs-bus-pci b/documentation/abi/testing/sysfs-bus-pci --- a/documentation/abi/testing/sysfs-bus-pci +++ b/documentation/abi/testing/sysfs-bus-pci + +what: /sys/bus/pci/devices/.../sriov_vf_total_msix +date: january 2021 +contact: leon romanovsky <leonro@nvidia.com> +description: + this file is associated with a sr-iov physical function (pf). + it contains the total number of msi-x vectors available for + assignment to all virtual functions (vfs) associated with pf. + the value will be zero if the device doesn't support this + functionality. for supported devices, the value will be + constant and won't be changed after msi-x vectors assignment. + +what: /sys/bus/pci/devices/.../sriov_vf_msix_count +date: january 2021 +contact: leon romanovsky <leonro@nvidia.com> +description: + this file is associated with a sr-iov virtual function (vf). + it allows configuration of the number of msi-x vectors for + the vf. this allows devices that have a global pool of msi-x + vectors to optimally divide them between vfs based on vf usage. + + the values accepted are: + * > 0 - this number will be reported as the table size in the + vf's msi-x capability + * < 0 - not valid + * = 0 - will reset to the device default value + + the file is writable if the pf is bound to a driver that + implements ->sriov_set_msix_vec_count(). diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c +export_symbol_gpl(pci_iov_virtfn_devfn); +#ifdef config_pci_msi +static ssize_t sriov_vf_total_msix_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct pci_dev *pdev = to_pci_dev(dev); + u32 vf_total_msix = 0; + + device_lock(dev); + if (!pdev->driver || !pdev->driver->sriov_get_vf_total_msix) + goto unlock; + + vf_total_msix = pdev->driver->sriov_get_vf_total_msix(pdev); +unlock: + device_unlock(dev); + return sysfs_emit(buf, "%u ", vf_total_msix); +} +static device_attr_ro(sriov_vf_total_msix); + +static ssize_t sriov_vf_msix_count_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct pci_dev *vf_dev = to_pci_dev(dev); + struct pci_dev *pdev = pci_physfn(vf_dev); + int val, ret; + + ret = kstrtoint(buf, 0, &val); + if (ret) + return ret; + + if (val < 0) + return -einval; + + device_lock(&pdev->dev); + if (!pdev->driver || !pdev->driver->sriov_set_msix_vec_count) { + ret = -eopnotsupp; + goto err_pdev; + } + + device_lock(&vf_dev->dev); + if (vf_dev->driver) { + /* + * a driver is already attached to this vf and has configured + * itself based on the current msi-x vector count. changing + * the vector size could mess up the driver, so block it. + */ + ret = -ebusy; + goto err_dev; + } + + ret = pdev->driver->sriov_set_msix_vec_count(vf_dev, val); + +err_dev: + device_unlock(&vf_dev->dev); +err_pdev: + device_unlock(&pdev->dev); + return ret ? : count; +} +static device_attr_wo(sriov_vf_msix_count); +#endif + +static struct attribute *sriov_vf_dev_attrs[] = { +#ifdef config_pci_msi + &dev_attr_sriov_vf_msix_count.attr, +#endif + null, +}; + +static umode_t sriov_vf_attrs_are_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = kobj_to_dev(kobj); + struct pci_dev *pdev = to_pci_dev(dev); + + if (!pdev->is_virtfn) + return 0; + + return a->mode; +} + +const struct attribute_group sriov_vf_dev_attr_group = { + .attrs = sriov_vf_dev_attrs, + .is_visible = sriov_vf_attrs_are_visible, +}; + -static struct attribute *sriov_dev_attrs[] = { +static struct attribute *sriov_pf_dev_attrs[] = { +#ifdef config_pci_msi + &dev_attr_sriov_vf_total_msix.attr, +#endif -static umode_t sriov_attrs_are_visible(struct kobject *kobj, - struct attribute *a, int n) +static umode_t sriov_pf_attrs_are_visible(struct kobject *kobj, + struct attribute *a, int n) -const struct attribute_group sriov_dev_attr_group = { - .attrs = sriov_dev_attrs, - .is_visible = sriov_attrs_are_visible, +const struct attribute_group sriov_pf_dev_attr_group = { + .attrs = sriov_pf_dev_attrs, + .is_visible = sriov_pf_attrs_are_visible, diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c - &sriov_dev_attr_group, + &sriov_pf_dev_attr_group, + &sriov_vf_dev_attr_group, diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h -extern const struct attribute_group sriov_dev_attr_group; +extern const struct attribute_group sriov_pf_dev_attr_group; +extern const struct attribute_group sriov_vf_dev_attr_group; diff --git a/include/linux/pci.h b/include/linux/pci.h --- a/include/linux/pci.h +++ b/include/linux/pci.h + * @sriov_set_msix_vec_count: pf driver callback to change number of msi-x + * vectors on a vf. triggered via sysfs "sriov_vf_msix_count". + * this will change msi-x table size in the vf message control + * registers. + * @sriov_get_vf_total_msix: pf driver callback to get the total number of + * msi-x vectors available for distribution to the vfs. + int (*sriov_set_msix_vec_count)(struct pci_dev *vf, int msix_vec_count); /* on pf */ + u32 (*sriov_get_vf_total_msix)(struct pci_dev *pf);
|
Networking
|
c3d5c2d96d69f2578d6fbf66e39cc2cf840d9812
|
leon romanovsky
|
drivers
|
pci
|
testing
|
net/mlx5: add dynamic msi-x capabilities bits
|
these new fields declare the number of msi-x vectors that is possible to allocate on the vf through pf configuration.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dynamically assign msi-x vectors count
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h']
| 1
| 10
| 1
|
--- diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h - u8 reserved_at_700[0x80]; + u8 reserved_at_700[0x8]; + u8 num_total_dynamic_vf_msix[0x18]; + u8 reserved_at_720[0x14]; + u8 dynamic_msix_table_size[0xc]; + u8 reserved_at_740[0xc]; + u8 min_dynamic_vf_msix_table_size[0x4]; + u8 reserved_at_750[0x4]; + u8 max_dynamic_vf_msix_table_size[0xc]; + + u8 reserved_at_760[0x20];
|
Networking
|
0b989c1e37053196676b2238f82195bd5a339d58
|
leon romanovsky
|
include
|
linux
|
mlx5
|
net/mlx5: dynamically assign msi-x vectors count
|
the number of msi-x vectors is a pci property visible through lspci. the field is read-only and configured by the device. the mlx5 devices work in a static or dynamic assignment mode.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dynamically assign msi-x vectors count
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 4
| 93
| 2
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c + if (mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix)) + mlx5_set(cmd_hca_cap, set_hca_cap, num_total_dynamic_vf_msix, + mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix)); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h + +int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int devfn, + int msix_vec_count); +int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +/** + * mlx5_get_default_msix_vec_count - get the default number of msi-x vectors + * to be ssigned to each vf. + * @dev: pf to work on + * @num_vfs: number of enabled vfs + */ +int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs) +{ + int num_vf_msix, min_msix, max_msix; + + num_vf_msix = mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix); + if (!num_vf_msix) + return 0; + + min_msix = mlx5_cap_gen(dev, min_dynamic_vf_msix_table_size); + max_msix = mlx5_cap_gen(dev, max_dynamic_vf_msix_table_size); + + /* limit maximum number of msi-x vectors so the default configuration + * has some available in the pool. this will allow the user to increase + * the number of vectors in a vf without having to first size-down other + * vfs. + */ + return max(min(num_vf_msix / num_vfs, max_msix / 2), min_msix); +} + +/** + * mlx5_set_msix_vec_count - set dynamically allocated msi-x on the vf + * @dev: pf to work on + * @function_id: internal pci vf function idd + * @msix_vec_count: number of msi-x vectors to set + */ +int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, + int msix_vec_count) +{ + int sz = mlx5_st_sz_bytes(set_hca_cap_in); + int num_vf_msix, min_msix, max_msix; + void *hca_cap, *cap; + int ret; + + num_vf_msix = mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix); + if (!num_vf_msix) + return 0; + + if (!mlx5_cap_gen(dev, vport_group_manager) || !mlx5_core_is_pf(dev)) + return -eopnotsupp; + + min_msix = mlx5_cap_gen(dev, min_dynamic_vf_msix_table_size); + max_msix = mlx5_cap_gen(dev, max_dynamic_vf_msix_table_size); + + if (msix_vec_count < min_msix) + return -einval; + + if (msix_vec_count > max_msix) + return -eoverflow; + + hca_cap = kzalloc(sz, gfp_kernel); + if (!hca_cap) + return -enomem; + + cap = mlx5_addr_of(set_hca_cap_in, hca_cap, capability); + mlx5_set(cmd_hca_cap, cap, dynamic_msix_table_size, msix_vec_count); + + mlx5_set(set_hca_cap_in, hca_cap, opcode, mlx5_cmd_op_set_hca_cap); + mlx5_set(set_hca_cap_in, hca_cap, other_function, 1); + mlx5_set(set_hca_cap_in, hca_cap, function_id, function_id); + + mlx5_set(set_hca_cap_in, hca_cap, op_mod, + mlx5_set_hca_cap_op_mod_general_device << 1); + ret = mlx5_cmd_exec_in(dev, set_hca_cap, hca_cap); + kfree(hca_cap); + return ret; +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c - int err; - int vf; + int err, vf, num_msix_count; + num_msix_count = mlx5_get_default_msix_vec_count(dev, num_vfs); + + err = mlx5_set_msix_vec_count(dev, vf + 1, num_msix_count); + if (err) { + mlx5_core_warn(dev, + "failed to set msi-x vector counts vf %d, err %d ", + vf, err); + continue; + } +
|
Networking
|
604774add516c6847745cb381d46907e229ab0bf
|
leon romanovsky
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: implement sriov_get_vf_total_msix/count() callbacks
|
the mlx5 implementation executes a firmware command on the pf to change the configuration of the selected vf.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dynamically assign msi-x vectors count
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 44
| 0
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c + .sriov_get_vf_total_msix = mlx5_sriov_get_vf_total_msix, + .sriov_set_msix_vec_count = mlx5_core_sriov_set_msix_vec_count, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +int mlx5_core_sriov_set_msix_vec_count(struct pci_dev *vf, int msix_vec_count); +static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev) +{ + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); + + return mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix); +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c +int mlx5_core_sriov_set_msix_vec_count(struct pci_dev *vf, int msix_vec_count) +{ + struct pci_dev *pf = pci_physfn(vf); + struct mlx5_core_sriov *sriov; + struct mlx5_core_dev *dev; + int num_vf_msix, id; + + dev = pci_get_drvdata(pf); + num_vf_msix = mlx5_cap_gen_max(dev, num_total_dynamic_vf_msix); + if (!num_vf_msix) + return -eopnotsupp; + + if (!msix_vec_count) + msix_vec_count = + mlx5_get_default_msix_vec_count(dev, pci_num_vf(pf)); + + sriov = &dev->priv.sriov; + + /* reversed translation of pci vf function number to the internal + * function_id, which exists in the name of virtfn symlink. + */ + for (id = 0; id < pci_num_vf(pf); id++) { + if (!sriov->vfs_ctx[id].enabled) + continue; + + if (vf->devfn == pci_iov_virtfn_devfn(pf, id)) + break; + } + + if (id == pci_num_vf(pf) || !sriov->vfs_ctx[id].enabled) + return -einval; + + return mlx5_set_msix_vec_count(dev, id + 1, msix_vec_count); +} +
|
Networking
|
e71b75f73763d88665b3a19c5a4d52d559aa7732
|
leon romanovsky bjorn helgaas bhelgaas google com
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
rdma/mlx5: allow larger pages in devx umem
|
the umem dma list calculation was locked at 4k pages due to confusion around how this api works and is used when larger pages are present.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
allow larger pages in devx umem
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 2
| 55
| 10
|
- umem's cannot extend past what is mapped into the process, so creating - umem's must always have a page offset of zero, except for sub page_size - the feature of umem_offset to create multiple objects inside a umem --- diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c --- a/drivers/infiniband/hw/mlx5/devx.c +++ b/drivers/infiniband/hw/mlx5/devx.c +static unsigned int devx_umem_find_best_pgsize(struct ib_umem *umem, + unsigned long pgsz_bitmap) +{ + unsigned long page_size; + + /* don't bother checking larger page sizes as offset must be zero and + * total devx umem length must be equal to total umem length. + */ + pgsz_bitmap &= genmask_ull(max_t(u64, order_base_2(umem->length), + page_shift), + mlx5_adapter_page_shift); + if (!pgsz_bitmap) + return 0; + + page_size = ib_umem_find_best_pgoff(umem, pgsz_bitmap, u64_max); + if (!page_size) + return 0; + + /* if the page_size is less than the cpu page size then we can use the + * offset and create a umem which is a subset of the page list. + * for larger page sizes we can't be sure the dma list reflects the + * va so we must ensure that the umem extent is exactly equal to the + * page list. reduce the page size until one of these cases is true. + */ + while ((ib_umem_dma_offset(umem, page_size) != 0 || + (umem->length % page_size) != 0) && + page_size > page_size) + page_size /= 2; + + return page_size; +} + + unsigned long pgsz_bitmap; + int ret; - * we don't know what the user intends to use this umem for, but the hw - * restrictions must be met. mr, doorbell records, qp, wq and cq all - * have different requirements. since we have no idea how to sort this - * out, only support page_size with the expectation that userspace will - * provide the necessary alignments inside the known page_size and that - * fw will check everything. + * if the user does not pass in pgsz_bitmap then the user promises not + * to use umem_offset!=0 in any commands that allocate on top of the + * umem. + * + * if the user wants to use a umem_offset then it must pass in + * pgsz_bitmap which guides the maximum page size and thus maximum + * object alignment inside the umem. see the prm. + * + * users are not allowed to use iova here, mkeys are not supported on + * umem. - page_size = ib_umem_find_best_pgoff( - obj->umem, page_size, - __mlx5_page_offset_to_bitmask(__mlx5_bit_sz(umem, page_offset), - 0)); + ret = uverbs_get_const_default(&pgsz_bitmap, attrs, + mlx5_ib_attr_devx_umem_reg_pgsz_bitmap, + genmask_ull(63, + min(page_shift, mlx5_adapter_page_shift))); + if (ret) + return ret; + + page_size = devx_umem_find_best_pgsize(obj->umem, pgsz_bitmap); + uverbs_attr_const_in(mlx5_ib_attr_devx_umem_reg_pgsz_bitmap, + u64), diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h b/include/uapi/rdma/mlx5_user_ioctl_cmds.h --- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h +++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h + mlx5_ib_attr_devx_umem_reg_pgsz_bitmap,
|
Networking
|
7610ab57de5616631b664ea31c11bad527810391
|
jason gunthorpe
|
drivers
|
infiniband
|
hw, mlx5, rdma
|
rdma/mlx5: expose private query port
|
expose a non standard query port via ioctl that will be used to expose port attributes that are specific to mlx5 devices.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
expose private query port
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mlx5 ']
|
['h', 'c']
| 3
| 207
| 0
|
--- diff --git a/drivers/infiniband/hw/mlx5/std_types.c b/drivers/infiniband/hw/mlx5/std_types.c --- a/drivers/infiniband/hw/mlx5/std_types.c +++ b/drivers/infiniband/hw/mlx5/std_types.c +#include <linux/mlx5/eswitch.h> +#include <linux/mlx5/vport.h> +static int fill_vport_icm_addr(struct mlx5_core_dev *mdev, u16 vport, + struct mlx5_ib_uapi_query_port *info) +{ + u32 out[mlx5_st_sz_dw(query_esw_vport_context_out)] = {}; + u32 in[mlx5_st_sz_dw(query_esw_vport_context_in)] = {}; + bool sw_owner_supp; + u64 icm_rx; + u64 icm_tx; + int err; + + sw_owner_supp = mlx5_cap_esw_flowtable_fdb(mdev, sw_owner) || + mlx5_cap_esw_flowtable_fdb(mdev, sw_owner_v2); + + if (vport == mlx5_vport_uplink) { + icm_rx = mlx5_cap64_esw_flowtable(mdev, + sw_steering_uplink_icm_address_rx); + icm_tx = mlx5_cap64_esw_flowtable(mdev, + sw_steering_uplink_icm_address_tx); + } else { + mlx5_set(query_esw_vport_context_in, in, opcode, + mlx5_cmd_op_query_esw_vport_context); + mlx5_set(query_esw_vport_context_in, in, vport_number, vport); + mlx5_set(query_esw_vport_context_in, in, other_vport, true); + + err = mlx5_cmd_exec_inout(mdev, query_esw_vport_context, in, + out); + + if (err) + return err; + + icm_rx = mlx5_get64( + query_esw_vport_context_out, out, + esw_vport_context.sw_steering_vport_icm_address_rx); + + icm_tx = mlx5_get64( + query_esw_vport_context_out, out, + esw_vport_context.sw_steering_vport_icm_address_tx); + } + + if (sw_owner_supp && icm_rx) { + info->vport_steering_icm_rx = icm_rx; + info->flags |= + mlx5_ib_uapi_query_port_vport_steering_icm_rx; + } + + if (sw_owner_supp && icm_tx) { + info->vport_steering_icm_tx = icm_tx; + info->flags |= + mlx5_ib_uapi_query_port_vport_steering_icm_tx; + } + + return 0; +} + +static int fill_vport_vhca_id(struct mlx5_core_dev *mdev, u16 vport, + struct mlx5_ib_uapi_query_port *info) +{ + size_t out_sz = mlx5_st_sz_bytes(query_hca_cap_out); + u32 in[mlx5_st_sz_dw(query_hca_cap_in)] = {}; + void *out; + int err; + + out = kzalloc(out_sz, gfp_kernel); + if (!out) + return -enomem; + + mlx5_set(query_hca_cap_in, in, opcode, mlx5_cmd_op_query_hca_cap); + mlx5_set(query_hca_cap_in, in, other_function, true); + mlx5_set(query_hca_cap_in, in, function_id, vport); + mlx5_set(query_hca_cap_in, in, op_mod, + mlx5_set_hca_cap_op_mod_general_device | + hca_cap_opmod_get_cur); + + err = mlx5_cmd_exec(mdev, in, sizeof(in), out, out_sz); + if (err) + goto out; + + info->vport_vhca_id = mlx5_get(query_hca_cap_out, out, + capability.cmd_hca_cap.vhca_id); + + info->flags |= mlx5_ib_uapi_query_port_vport_vhca_id; +out: + kfree(out); + return err; +} + +static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num, + struct mlx5_ib_uapi_query_port *info) +{ + struct mlx5_core_dev *mdev = dev->mdev; + struct mlx5_eswitch_rep *rep; + int err; + + rep = dev->port[port_num - 1].rep; + if (!rep) + return -eopnotsupp; + + info->vport = rep->vport; + info->flags |= mlx5_ib_uapi_query_port_vport; + + if (rep->vport != mlx5_vport_uplink) { + err = fill_vport_vhca_id(mdev, rep->vport, info); + if (err) + return err; + } + + info->esw_owner_vhca_id = mlx5_cap_gen(mdev, vhca_id); + info->flags |= mlx5_ib_uapi_query_port_esw_owner_vhca_id; + + err = fill_vport_icm_addr(mdev, rep->vport, info); + if (err) + return err; + + if (mlx5_eswitch_vport_match_metadata_enabled(mdev->priv.eswitch)) { + info->reg_c0.value = mlx5_eswitch_get_vport_metadata_for_match( + mdev->priv.eswitch, rep->vport); + info->reg_c0.mask = mlx5_eswitch_get_vport_metadata_mask(); + info->flags |= mlx5_ib_uapi_query_port_vport_reg_c0; + } + + return 0; +} + +static int uverbs_handler(mlx5_ib_method_query_port)( + struct uverbs_attr_bundle *attrs) +{ + struct mlx5_ib_uapi_query_port info = {}; + struct mlx5_ib_ucontext *c; + struct mlx5_ib_dev *dev; + u32 port_num; + int ret; + + if (uverbs_copy_from(&port_num, attrs, + mlx5_ib_attr_query_port_port_num)) + return -efault; + + c = to_mucontext(ib_uverbs_get_ucontext(attrs)); + if (is_err(c)) + return ptr_err(c); + dev = to_mdev(c->ibucontext.device); + + if (!rdma_is_port_valid(&dev->ib_dev, port_num)) + return -einval; + + if (mlx5_eswitch_mode(dev->mdev) == mlx5_eswitch_offloads) { + ret = fill_switchdev_info(dev, port_num, &info); + if (ret) + return ret; + } + + return uverbs_copy_to_struct_or_zero(attrs, mlx5_ib_attr_query_port, &info, + sizeof(info)); +} + +declare_uverbs_named_method( + mlx5_ib_method_query_port, + uverbs_attr_ptr_in(mlx5_ib_attr_query_port_port_num, + uverbs_attr_type(u32), ua_mandatory), + uverbs_attr_ptr_out( + mlx5_ib_attr_query_port, + uverbs_attr_struct(struct mlx5_ib_uapi_query_port, + reg_c0), + ua_mandatory)); + +add_uverbs_methods(mlx5_ib_device, + uverbs_object_device, + &uverbs_method(mlx5_ib_method_query_port)); + + uapi_def_chain_obj_tree( + uverbs_object_device, + &mlx5_ib_device), diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h b/include/uapi/rdma/mlx5_user_ioctl_cmds.h --- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h +++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h +enum mlx5_ib_device_methods { + mlx5_ib_method_query_port = (1u << uverbs_id_ns_shift), +}; + +enum mlx5_ib_query_port_attrs { + mlx5_ib_attr_query_port_port_num = (1u << uverbs_id_ns_shift), + mlx5_ib_attr_query_port, +}; + diff --git a/include/uapi/rdma/mlx5_user_ioctl_verbs.h b/include/uapi/rdma/mlx5_user_ioctl_verbs.h --- a/include/uapi/rdma/mlx5_user_ioctl_verbs.h +++ b/include/uapi/rdma/mlx5_user_ioctl_verbs.h +enum mlx5_ib_uapi_query_port_flags { + mlx5_ib_uapi_query_port_vport = 1 << 0, + mlx5_ib_uapi_query_port_vport_vhca_id = 1 << 1, + mlx5_ib_uapi_query_port_vport_steering_icm_rx = 1 << 2, + mlx5_ib_uapi_query_port_vport_steering_icm_tx = 1 << 3, + mlx5_ib_uapi_query_port_vport_reg_c0 = 1 << 4, + mlx5_ib_uapi_query_port_esw_owner_vhca_id = 1 << 5, +}; + +struct mlx5_ib_uapi_reg { + __u32 value; + __u32 mask; +}; + +struct mlx5_ib_uapi_query_port { + __aligned_u64 flags; + __u16 vport; + __u16 vport_vhca_id; + __u16 esw_owner_vhca_id; + __u16 rsvd0; + __aligned_u64 vport_steering_icm_rx; + __aligned_u64 vport_steering_icm_tx; + struct mlx5_ib_uapi_reg reg_c0; +}; +
|
Networking
|
9a89d3ad6d39cbdc9de47f776fc7f7e4b1145c70
|
mark bloch
|
drivers
|
infiniband
|
hw, mlx5, rdma
|
mt76: add functions for parsing rate power limits from dt
|
this subnode can be used to set per-rate tx power limits either per country code / regdomain or globally. these limits are typically provided by the device manufacturers and are used to limit sideband emissions and stay within regulatory limits
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 2
| 216
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c +static bool mt76_string_prop_find(struct property *prop, const char *str) +{ + const char *cp = null; + + if (!prop || !str || !str[0]) + return false; + + while ((cp = of_prop_next_string(prop, cp)) != null) + if (!strcasecmp(cp, str)) + return true; + + return false; +} + +static struct device_node * +mt76_find_power_limits_node(struct mt76_dev *dev) +{ + struct device_node *np = dev->dev->of_node; + const char *const region_names[] = { + [nl80211_dfs_etsi] = "etsi", + [nl80211_dfs_fcc] = "fcc", + [nl80211_dfs_jp] = "jp", + }; + struct device_node *cur, *fallback = null; + const char *region_name = null; + + if (dev->region < array_size(region_names)) + region_name = region_names[dev->region]; + + np = of_get_child_by_name(np, "power-limits"); + if (!np) + return null; + + for_each_child_of_node(np, cur) { + struct property *country = of_find_property(cur, "country", null); + struct property *regd = of_find_property(cur, "regdomain", null); + + if (!country && !regd) { + fallback = cur; + continue; + } + + if (mt76_string_prop_find(country, dev->alpha2) || + mt76_string_prop_find(regd, region_name)) + return cur; + } + + return fallback; +} + +static const __be32 * +mt76_get_of_array(struct device_node *np, char *name, size_t *len, int min) +{ + struct property *prop = of_find_property(np, name, null); + + if (!prop || !prop->value || prop->length < min * 4) + return null; + + *len = prop->length; + + return prop->value; +} + +static struct device_node * +mt76_find_channel_node(struct device_node *np, struct ieee80211_channel *chan) +{ + struct device_node *cur; + const __be32 *val; + size_t len; + + for_each_child_of_node(np, cur) { + val = mt76_get_of_array(cur, "channels", &len, 2); + if (!val) + continue; + + while (len >= 2 * sizeof(*val)) { + if (chan->hw_value >= be32_to_cpu(val[0]) && + chan->hw_value <= be32_to_cpu(val[1])) + return cur; + + val += 2; + len -= 2 * sizeof(*val); + } + } + + return null; +} + +static s8 +mt76_get_txs_delta(struct device_node *np, u8 nss) +{ + const __be32 *val; + size_t len; + + val = mt76_get_of_array(np, "txs-delta", &len, nss); + if (!val) + return 0; + + return be32_to_cpu(val[nss - 1]); +} + +static void +mt76_apply_array_limit(s8 *pwr, size_t pwr_len, const __be32 *data, + s8 target_power, s8 nss_delta, s8 *max_power) +{ + int i; + + if (!data) + return; + + for (i = 0; i < pwr_len; i++) { + pwr[i] = min_t(s8, target_power, + be32_to_cpu(data[i]) + nss_delta); + *max_power = max(*max_power, pwr[i]); + } +} + +s8 mt76_get_rate_power_limits(struct mt76_phy *phy, + struct ieee80211_channel *chan, + struct mt76_power_limits *dest, + s8 target_power) +{ + struct mt76_dev *dev = phy->dev; + struct device_node *np; + const __be32 *val; + char name[16]; + u32 mcs_rates = dev->drv->mcs_rates; + char band; + size_t len; + int i, cur; + s8 max_power = 0; + s8 txs_delta; + + if (!mcs_rates) + mcs_rates = 10; + + memset(dest, target_power, sizeof(*dest)); + + if (!is_enabled(config_of)) + return target_power; + + np = mt76_find_power_limits_node(dev); + if (!np) + return target_power; + + switch (chan->band) { + case nl80211_band_2ghz: + band = '2'; + break; + case nl80211_band_5ghz: + band = '5'; + break; + default: + return target_power; + } + + snprintf(name, sizeof(name), "txpower-%cg", band); + np = of_get_child_by_name(np, name); + if (!np) + return target_power; + + np = mt76_find_channel_node(np, chan); + if (!np) + return target_power; + + txs_delta = mt76_get_txs_delta(np, hweight8(phy->antenna_mask)); + + val = mt76_get_of_array(np, "rates-cck", &len, array_size(dest->cck)); + mt76_apply_array_limit(dest->cck, array_size(dest->cck), val, + target_power, txs_delta, &max_power); + + val = mt76_get_of_array(np, "rates-ofdm", + &len, array_size(dest->ofdm)); + mt76_apply_array_limit(dest->ofdm, array_size(dest->ofdm), val, + target_power, txs_delta, &max_power); + + val = mt76_get_of_array(np, "rates-mcs", &len, mcs_rates + 1); + if (!val) + return max_power; + + len /= 4; + cur = be32_to_cpu(val[0]); + for (i = 0; i < array_size(dest->mcs); i++) { + if (len < mcs_rates + 1) + break; + + mt76_apply_array_limit(dest->mcs[i], array_size(dest->mcs[i]), + val + 1, target_power, txs_delta, + &max_power); + if (--cur > 0) + continue; + + val += mcs_rates + 1; + len -= mcs_rates + 1; + if (!len) + break; + + cur = be32_to_cpu(val[0]); + } + + return max_power; +} +export_symbol_gpl(mt76_get_rate_power_limits); + diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h + u8 mcs_rates; +struct mt76_power_limits { + s8 cck[4]; + s8 ofdm[8]; + s8 mcs[4][10]; +}; + +s8 mt76_get_rate_power_limits(struct mt76_phy *phy, + struct ieee80211_channel *chan, + struct mt76_power_limits *dest, + s8 target_power); +
|
Networking
|
22b980badc0fc746431b81b9d402cf0612f59a7a
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, wireless
|
mt76: extend dt rate power limits to support 11ax devices
|
enable parsing per-rate txpower limits from dt for 11ax chipsets.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 2
| 40
| 23
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c +static void +mt76_apply_multi_array_limit(s8 *pwr, size_t pwr_len, s8 pwr_num, + const __be32 *data, size_t len, s8 target_power, + s8 nss_delta, s8 *max_power) +{ + int i, cur; + + if (!data) + return; + + len /= 4; + cur = be32_to_cpu(data[0]); + for (i = 0; i < pwr_num; i++) { + if (len < pwr_len + 1) + break; + + mt76_apply_array_limit(pwr + pwr_len * i, pwr_len, data + 1, + target_power, nss_delta, max_power); + if (--cur > 0) + continue; + + data += pwr_len + 1; + len -= pwr_len + 1; + if (!len) + break; + + cur = be32_to_cpu(data[0]); + } +} + + u32 ru_rates = array_size(dest->ru[0]); - int i, cur; - if (!val) - return max_power; - - len /= 4; - cur = be32_to_cpu(val[0]); - for (i = 0; i < array_size(dest->mcs); i++) { - if (len < mcs_rates + 1) - break; - - mt76_apply_array_limit(dest->mcs[i], array_size(dest->mcs[i]), - val + 1, target_power, txs_delta, - &max_power); - if (--cur > 0) - continue; - - val += mcs_rates + 1; - len -= mcs_rates + 1; - if (!len) - break; - - cur = be32_to_cpu(val[0]); - } + mt76_apply_multi_array_limit(dest->mcs[0], array_size(dest->mcs[0]), + array_size(dest->mcs), val, len, + target_power, txs_delta, &max_power); + + val = mt76_get_of_array(np, "rates-ru", &len, ru_rates + 1); + mt76_apply_multi_array_limit(dest->ru[0], array_size(dest->ru[0]), + array_size(dest->ru), val, len, + target_power, txs_delta, &max_power); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h + s8 ru[7][12];
|
Networking
|
a9627d992b5e3aa18315094b501eba0f4d883419
|
shayne chen evelyn tsai evelyn tsai mediatek com
|
drivers
|
net
|
mediatek, mt76, wireless
|
mt76: mt7615: implement support for using dt rate power limits
|
limits are used to update the channel max_power settings and also passed to the firmware on channel changes
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 2
| 69
| 2
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c + struct mt76_power_limits limits; - target_power = div_round_up(target_power + delta, 2); + target_power = mt76_get_rate_power_limits(&dev->mphy, chan, + &limits, + target_power); + target_power += delta; + target_power = div_round_up(target_power, 2); + mt7615_init_txpower(dev, &mphy->sband_2g.sband); + mt7615_init_txpower(dev, &mphy->sband_5g.sband); + diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c + struct mt76_power_limits limits; + s8 *limits_array = (s8 *)&limits; + static const u8 sku_mapping[] = { +#define sku_field(_type, _field) \ + [mt_sku_##_type] = offsetof(struct mt76_power_limits, _field) + sku_field(cck_1_2, cck[0]), + sku_field(cck_55_11, cck[2]), + sku_field(ofdm_6_9, ofdm[0]), + sku_field(ofdm_12_18, ofdm[2]), + sku_field(ofdm_24_36, ofdm[4]), + sku_field(ofdm_48, ofdm[6]), + sku_field(ofdm_54, ofdm[7]), + sku_field(ht20_0_8, mcs[0][0]), + sku_field(ht20_32, ofdm[0]), + sku_field(ht20_1_2_9_10, mcs[0][1]), + sku_field(ht20_3_4_11_12, mcs[0][3]), + sku_field(ht20_5_13, mcs[0][5]), + sku_field(ht20_6_14, mcs[0][6]), + sku_field(ht20_7_15, mcs[0][7]), + sku_field(ht40_0_8, mcs[1][0]), + sku_field(ht40_32, ofdm[0]), + sku_field(ht40_1_2_9_10, mcs[1][1]), + sku_field(ht40_3_4_11_12, mcs[1][3]), + sku_field(ht40_5_13, mcs[1][5]), + sku_field(ht40_6_14, mcs[1][6]), + sku_field(ht40_7_15, mcs[1][7]), + sku_field(vht20_0, mcs[0][0]), + sku_field(vht20_1_2, mcs[0][1]), + sku_field(vht20_3_4, mcs[0][3]), + sku_field(vht20_5_6, mcs[0][5]), + sku_field(vht20_7, mcs[0][7]), + sku_field(vht20_8, mcs[0][8]), + sku_field(vht20_9, mcs[0][9]), + sku_field(vht40_0, mcs[1][0]), + sku_field(vht40_1_2, mcs[1][1]), + sku_field(vht40_3_4, mcs[1][3]), + sku_field(vht40_5_6, mcs[1][5]), + sku_field(vht40_7, mcs[1][7]), + sku_field(vht40_8, mcs[1][8]), + sku_field(vht40_9, mcs[1][9]), + sku_field(vht80_0, mcs[2][0]), + sku_field(vht80_1_2, mcs[2][1]), + sku_field(vht80_3_4, mcs[2][3]), + sku_field(vht80_5_6, mcs[2][5]), + sku_field(vht80_7, mcs[2][7]), + sku_field(vht80_8, mcs[2][8]), + sku_field(vht80_9, mcs[2][9]), + sku_field(vht160_0, mcs[3][0]), + sku_field(vht160_1_2, mcs[3][1]), + sku_field(vht160_3_4, mcs[3][3]), + sku_field(vht160_5_6, mcs[3][5]), + sku_field(vht160_7, mcs[3][7]), + sku_field(vht160_8, mcs[3][8]), + sku_field(vht160_9, mcs[3][9]), +#undef sku_field + }; + + tx_power = mt76_get_rate_power_limits(mphy, mphy->chandef.chan, + &limits, tx_power); - sku[i] = tx_power; + sku[i] = limits_array[sku_mapping[i]];
|
Networking
|
fb0d90540b66523069d15ac05acab4ceb8e01055
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: mt7615: do not use mt7615 single-sku values for mt7663
|
mt7663 mcu relies on different apis to configure apis per-rate power limit respect to mt7615 driver.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 1
| 5
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c + if (is_mt7663(mphy->dev)) { + memset(sku, tx_power, mt_sku_4ss_delta + 1); + return; + } +
|
Networking
|
729d3dbd3bf23d03b8259e692c5505d6a647726a
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: introduce single-sku support for mt7663/mt7921
|
introduce support for rate-txpower compensation for mt7663/mt7921 chipsets. rate-txpower limit is specified through dts
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 6
| 170
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c - if (mt7615_firmware_offload(phy->dev)) + + if (mt7615_firmware_offload(phy->dev)) { + mt76_connac_mcu_set_rate_txpower(mphy); + } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c + + ret = mt76_connac_mcu_set_rate_txpower(phy->mt76); + if (ret) + goto out; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +static void +mt76_connac_mcu_build_sku(struct mt76_dev *dev, s8 *sku, + struct mt76_power_limits *limits, + enum nl80211_band band) +{ + int max_power = is_mt7921(dev) ? 127 : 63; + int i, offset = sizeof(limits->cck); + + memset(sku, max_power, mt_sku_power_limit); + + if (band == nl80211_band_2ghz) { + /* cck */ + memcpy(sku, limits->cck, sizeof(limits->cck)); + } + + /* ofdm */ + memcpy(&sku[offset], limits->ofdm, sizeof(limits->ofdm)); + offset += sizeof(limits->ofdm); + + /* ht */ + for (i = 0; i < 2; i++) { + memcpy(&sku[offset], limits->mcs[i], 8); + offset += 8; + } + sku[offset++] = limits->mcs[0][0]; + + /* vht */ + for (i = 0; i < array_size(limits->mcs); i++) { + memcpy(&sku[offset], limits->mcs[i], + array_size(limits->mcs[i])); + offset += 12; + } + + if (!is_mt7921(dev)) + return; + + /* he */ + for (i = 0; i < array_size(limits->ru); i++) { + memcpy(&sku[offset], limits->ru[i], array_size(limits->ru[i])); + offset += array_size(limits->ru[i]); + } +} + +static int +mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, + enum nl80211_band band) +{ + struct mt76_dev *dev = phy->dev; + int sku_len, batch_len = is_mt7921(dev) ? 8 : 16; + static const u8 chan_list_2ghz[] = { + 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14 + }; + static const u8 chan_list_5ghz[] = { + 36, 38, 40, 42, 44, 46, 48, + 50, 52, 54, 56, 58, 60, 62, + 64, 100, 102, 104, 106, 108, 110, + 112, 114, 116, 118, 120, 122, 124, + 126, 128, 132, 134, 136, 138, 140, + 142, 144, 149, 151, 153, 155, 157, + 159, 161, 165 + }; + struct mt76_connac_sku_tlv sku_tlbv; + int i, n_chan, batch_size, idx = 0; + struct mt76_power_limits limits; + const u8 *ch_list; + + sku_len = is_mt7921(dev) ? sizeof(sku_tlbv) : sizeof(sku_tlbv) - 92; + + if (band == nl80211_band_2ghz) { + n_chan = array_size(chan_list_2ghz); + ch_list = chan_list_2ghz; + } else { + n_chan = array_size(chan_list_5ghz); + ch_list = chan_list_5ghz; + } + batch_size = div_round_up(n_chan, batch_len); + + for (i = 0; i < batch_size; i++) { + bool last_msg = i == batch_size - 1; + int num_ch = last_msg ? n_chan % batch_len : batch_len; + struct mt76_connac_tx_power_limit_tlv tx_power_tlv = { + .band = band == nl80211_band_2ghz ? 1 : 2, + .n_chan = num_ch, + .last_msg = last_msg, + }; + struct sk_buff *skb; + int j, err, msg_len; + + msg_len = sizeof(tx_power_tlv) + num_ch * sizeof(sku_tlbv); + skb = mt76_mcu_msg_alloc(dev, null, msg_len); + if (!skb) + return -enomem; + + build_bug_on(sizeof(dev->alpha2) > sizeof(tx_power_tlv.alpha2)); + memcpy(tx_power_tlv.alpha2, dev->alpha2, sizeof(dev->alpha2)); + + skb_put_data(skb, &tx_power_tlv, sizeof(tx_power_tlv)); + for (j = 0; j < num_ch; j++, idx++) { + struct ieee80211_channel chan = { + .hw_value = ch_list[idx], + .band = band, + }; + + mt76_get_rate_power_limits(phy, &chan, &limits, 127); + + sku_tlbv.channel = ch_list[idx]; + mt76_connac_mcu_build_sku(dev, sku_tlbv.pwr_limit, + &limits, band); + skb_put_data(skb, &sku_tlbv, sku_len); + } + + err = mt76_mcu_skb_send_msg(dev, skb, + mcu_cmd_set_rate_tx_power, false); + if (err < 0) + return err; + } + + return 0; +} + +int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy) +{ + int err; + + err = mt76_connac_mcu_rate_txpower_band(phy, nl80211_band_2ghz); + if (err < 0) + return err; + + return mt76_connac_mcu_rate_txpower_band(phy, nl80211_band_5ghz); +} +export_symbol_gpl(mt76_connac_mcu_set_rate_txpower); + diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +#define mt_sku_power_limit 161 + +struct mt76_connac_sku_tlv { + u8 channel; + s8 pwr_limit[mt_sku_power_limit]; +} __packed; + +struct mt76_connac_tx_power_limit_tlv { + /* dw0 - common info*/ + u8 ver; + u8 pad0; + __le16 len; + /* dw1 - cmd hint */ + u8 n_chan; /* # channel */ + u8 band; /* 2.4ghz - 5ghz */ + u8 last_msg; + u8 pad1; + /* dw3 */ + u8 alpha2[4]; /* regulatory_request.alpha2 */ + u8 pad2[32]; +} __packed; + +int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c + struct mt7921_phy *phy = mt7921_hw_phy(hw); + mt76_connac_mcu_set_rate_txpower(phy->mt76); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c + err = mt76_connac_mcu_set_rate_txpower(phy->mt76); + if (err) + return err; +
|
Networking
|
18369a4f9d73bf0ccd43d8df691d394281ee3ed4
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7615, mt7921, wireless
|
mt76: mt7921: add dumping tx power table
|
dump the tx power table saved in offload firmware.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce single-sku support for mt7663/mt7921 drivers
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 5
| 151
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h + mcu_cmd_get_txpwr = mcu_ce_prefix | 0xd0, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +static void +mt7921_seq_puts_array(struct seq_file *file, const char *str, + s8 *val, int len) +{ + int i; + + seq_printf(file, "%-16s:", str); + for (i = 0; i < len; i++) + if (val[i] == 127) + seq_printf(file, " %6s", "n.a"); + else + seq_printf(file, " %6d", val[i]); + seq_puts(file, " "); +} + +#define mt7921_print_txpwr_entry(prefix, rate) \ +({ \ + mt7921_seq_puts_array(s, #prefix " (user)", \ + txpwr.data[txpwr_user].rate, \ + array_size(txpwr.data[txpwr_user].rate)); \ + mt7921_seq_puts_array(s, #prefix " (eeprom)", \ + txpwr.data[txpwr_eeprom].rate, \ + array_size(txpwr.data[txpwr_eeprom].rate)); \ + mt7921_seq_puts_array(s, #prefix " (tmac)", \ + txpwr.data[txpwr_mac].rate, \ + array_size(txpwr.data[txpwr_mac].rate)); \ +}) + +static int +mt7921_txpwr(struct seq_file *s, void *data) +{ + struct mt7921_dev *dev = dev_get_drvdata(s->private); + struct mt7921_txpwr txpwr; + int ret; + + ret = mt7921_get_txpwr_info(dev, &txpwr); + if (ret) + return ret; + + seq_printf(s, "tx power table (channel %d) ", txpwr.ch); + seq_printf(s, "%-16s %6s %6s %6s %6s ", + " ", "1m", "2m", "5m", "11m"); + mt7921_print_txpwr_entry(cck, cck); + + seq_printf(s, "%-16s %6s %6s %6s %6s %6s %6s %6s %6s ", + " ", "6m", "9m", "12m", "18m", "24m", "36m", + "48m", "54m"); + mt7921_print_txpwr_entry(ofdm, ofdm); + + seq_printf(s, "%-16s %6s %6s %6s %6s %6s %6s %6s %6s ", + " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5", + "mcs6", "mcs7"); + mt7921_print_txpwr_entry(ht20, ht20); + + seq_printf(s, "%-16s %6s %6s %6s %6s %6s %6s %6s %6s %6s ", + " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5", + "mcs6", "mcs7", "mcs32"); + mt7921_print_txpwr_entry(ht40, ht40); + + seq_printf(s, "%-16s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s ", + " ", "mcs0", "mcs1", "mcs2", "mcs3", "mcs4", "mcs5", + "mcs6", "mcs7", "mcs8", "mcs9", "mcs10", "mcs11"); + mt7921_print_txpwr_entry(vht20, vht20); + mt7921_print_txpwr_entry(vht40, vht40); + mt7921_print_txpwr_entry(vht80, vht80); + mt7921_print_txpwr_entry(vht160, vht160); + mt7921_print_txpwr_entry(he26, he26); + mt7921_print_txpwr_entry(he52, he52); + mt7921_print_txpwr_entry(he106, he106); + mt7921_print_txpwr_entry(he242, he242); + mt7921_print_txpwr_entry(he484, he484); + mt7921_print_txpwr_entry(he996, he996); + mt7921_print_txpwr_entry(he996x2, he996x2); + + return 0; +} + + debugfs_create_devm_seqfile(dev->mt76.dev, "txpower_sku", dir, + mt7921_txpwr); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c + +int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr) +{ + struct mt7921_txpwr_event *event; + struct mt7921_txpwr_req req = { + .dbdc_idx = 0, + }; + struct sk_buff *skb; + int ret; + + ret = mt76_mcu_send_and_get_msg(&dev->mt76, mcu_cmd_get_txpwr, + &req, sizeof(req), true, &skb); + if (ret) + return ret; + + event = (struct mt7921_txpwr_event *)skb->data; + warn_on(skb->len != le16_to_cpu(event->len)); + memcpy(txpwr, &event->txpwr, sizeof(event->txpwr)); + + dev_kfree_skb(skb); + + return 0; +} diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h + mcu_event_txpwr = 0xd0, + +struct mt7921_txpwr_req { + u8 ver; + u8 action; + __le16 len; + u8 dbdc_idx; + u8 rsv[3]; +} __packed; + +struct mt7921_txpwr_event { + u8 ver; + u8 action; + __le16 len; + struct mt7921_txpwr txpwr; +} __packed; + diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +enum { + txpwr_user, + txpwr_eeprom, + txpwr_mac, + txpwr_max_num, +}; + +struct mt7921_txpwr { + u8 ch; + u8 rsv[3]; + struct { + u8 ch; + u8 cck[4]; + u8 ofdm[8]; + u8 ht20[8]; + u8 ht40[9]; + u8 vht20[12]; + u8 vht40[12]; + u8 vht80[12]; + u8 vht160[12]; + u8 he26[12]; + u8 he52[12]; + u8 he106[12]; + u8 he242[12]; + u8 he484[12]; + u8 he996[12]; + u8 he996x2[12]; + } data[txpwr_max_num]; +}; + +int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr);
|
Networking
|
ea29acc97c555bc4c295cd0ad78083a33b0272a2
|
sean wang
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: report rx timestamp
|
frame reception timestamp (low 32-bits) that indicates the value of the local tsf timer value at the time the first bit of the mac header in the received frame (ppdu unit) arriving at the mac.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
report rx timestamp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 15
| 89
| 63
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c --- a/drivers/net/wireless/mediatek/mt76/agg-rx.c +++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c - if (!time_after(jiffies, - status->reorder_time + - mt76_aggr_tid_to_timeo(tid->num))) + if (!time_after32(jiffies, + status->reorder_time + + mt76_aggr_tid_to_timeo(tid->num))) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c + status->device_timestamp = mstat.timestamp; + status->mactime = mstat.timestamp; diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h - unsigned long reorder_time; + u32 reorder_time; + u32 timestamp; diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c + hw->radiotap_timestamp.units_pos = + ieee80211_radiotap_timestamp_unit_us; + diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c - if (!(rxd2 & (mt_rxd2_normal_non_ampdu_sub | - mt_rxd2_normal_non_ampdu))) { - status->flag |= rx_flag_ampdu_details; - - /* all subframes of an a-mpdu have the same timestamp */ - if (dev->rx_ampdu_ts != rxd[12]) { - if (!++dev->ampdu_ref) - dev->ampdu_ref++; - } - dev->rx_ampdu_ts = rxd[12]; - - status->ampdu_ref = dev->ampdu_ref; - } - + status->timestamp = le32_to_cpu(rxd[0]); + status->flag |= rx_flag_mactime_start; + + if (!(rxd2 & (mt_rxd2_normal_non_ampdu_sub | + mt_rxd2_normal_non_ampdu))) { + status->flag |= rx_flag_ampdu_details; + + /* all subframes of an a-mpdu have the same timestamp */ + if (dev->rx_ampdu_ts != status->timestamp) { + if (!++dev->ampdu_ref) + dev->ampdu_ref++; + } + dev->rx_ampdu_ts = status->timestamp; + + status->ampdu_ref = dev->ampdu_ref; + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h --- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h - __le32 rx_ampdu_ts; + u32 rx_ampdu_ts; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c + hw->radiotap_timestamp.units_pos = + ieee80211_radiotap_timestamp_unit_us; + diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - __le32 rxd12 = rxd[12]; + status->timestamp = le32_to_cpu(rxd[0]); + status->flag |= rx_flag_mactime_start; + + if (!(rxd2 & (mt_rxd2_normal_non_ampdu_sub | + mt_rxd2_normal_non_ampdu))) { + status->flag |= rx_flag_ampdu_details; + + /* all subframes of an a-mpdu have the same timestamp */ + if (phy->rx_ampdu_ts != status->timestamp) { + if (!++phy->ampdu_ref) + phy->ampdu_ref++; + } + phy->rx_ampdu_ts = status->timestamp; + + status->ampdu_ref = phy->ampdu_ref; + } + - if (!(rxd2 & (mt_rxd2_normal_non_ampdu_sub | - mt_rxd2_normal_non_ampdu))) { - status->flag |= rx_flag_ampdu_details; - - /* all subframes of an a-mpdu have the same timestamp */ - if (phy->rx_ampdu_ts != rxd12) { - if (!++phy->ampdu_ref) - phy->ampdu_ref++; - } - phy->rx_ampdu_ts = rxd12; - - status->ampdu_ref = phy->ampdu_ref; - } - diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h - __le32 rx_ampdu_ts; + u32 rx_ampdu_ts; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c + hw->radiotap_timestamp.units_pos = + ieee80211_radiotap_timestamp_unit_us; + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c - if (!(rxd2 & mt_rxd2_normal_non_ampdu)) { - status->flag |= rx_flag_ampdu_details; - - /* all subframes of an a-mpdu have the same timestamp */ - if (phy->rx_ampdu_ts != rxd[14]) { - if (!++phy->ampdu_ref) - phy->ampdu_ref++; - } - phy->rx_ampdu_ts = rxd[14]; - - status->ampdu_ref = phy->ampdu_ref; - } - + status->timestamp = le32_to_cpu(rxd[0]); + status->flag |= rx_flag_mactime_start; + + if (!(rxd2 & mt_rxd2_normal_non_ampdu)) { + status->flag |= rx_flag_ampdu_details; + + /* all subframes of an a-mpdu have the same timestamp */ + if (phy->rx_ampdu_ts != status->timestamp) { + if (!++phy->ampdu_ref) + phy->ampdu_ref++; + } + phy->rx_ampdu_ts = status->timestamp; + + status->ampdu_ref = phy->ampdu_ref; + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h - __le32 rx_ampdu_ts; + u32 rx_ampdu_ts; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c + hw->radiotap_timestamp.units_pos = + ieee80211_radiotap_timestamp_unit_us; + diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c - if (!(rxd2 & mt_rxd2_normal_non_ampdu)) { - status->flag |= rx_flag_ampdu_details; - - /* all subframes of an a-mpdu have the same timestamp */ - if (phy->rx_ampdu_ts != rxd[14]) { - if (!++phy->ampdu_ref) - phy->ampdu_ref++; - } - phy->rx_ampdu_ts = rxd[14]; - - status->ampdu_ref = phy->ampdu_ref; - } - + status->timestamp = le32_to_cpu(rxd[0]); + status->flag |= rx_flag_mactime_start; + + if (!(rxd2 & mt_rxd2_normal_non_ampdu)) { + status->flag |= rx_flag_ampdu_details; + + /* all subframes of an a-mpdu have the same timestamp */ + if (phy->rx_ampdu_ts != status->timestamp) { + if (!++phy->ampdu_ref) + phy->ampdu_ref++; + } + phy->rx_ampdu_ts = status->timestamp; + + status->ampdu_ref = phy->ampdu_ref; + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h - __le32 rx_ampdu_ts; + u32 rx_ampdu_ts;
|
Networking
|
0fda6d7bb5a29b241fba8d37b92567c6bec79655
|
ryder lee
|
drivers
|
net
|
mediatek, mt76, mt7603, mt7615, mt7915, mt7921, wireless
|
mt76: mt7921: introduce mcu_event_lp_info event parsing
|
report trace event related to mcu_event_lp_info that is sent by the mcu when it is ready to enter in deep sleep state
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
introduce mcu_event_lp_info event parsing
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7921']
|
['h', 'c', 'makefile']
| 5
| 86
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/makefile b/drivers/net/wireless/mediatek/mt76/mt7921/makefile --- a/drivers/net/wireless/mediatek/mt76/mt7921/makefile +++ b/drivers/net/wireless/mediatek/mt76/mt7921/makefile -mt7921e-y := pci.o mac.o mcu.o dma.o eeprom.o main.o init.o debugfs.o +cflags_trace.o := -i$(src) + +mt7921e-y := pci.o mac.o mcu.o dma.o eeprom.o main.o init.o debugfs.o trace.o diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +#include "mt7921_trace.h" +static void +mt7921_mcu_low_power_event(struct mt7921_dev *dev, struct sk_buff *skb) +{ + struct mt7921_mcu_lp_event { + u8 state; + u8 reserved[3]; + } __packed * event; + + skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); + event = (struct mt7921_mcu_lp_event *)skb->data; + + trace_lp_event(dev, event->state); +} + + case mcu_event_lp_info: + mt7921_mcu_low_power_event(dev, skb); + break; + rxd->eid == mcu_event_lp_info || diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h + mcu_event_lp_info = 0x07, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921_trace.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921_trace.h --- /dev/null +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921_trace.h +/* spdx-license-identifier: isc */ +/* + * copyright (c) 2021 lorenzo bianconi <lorenzo@kernel.org> + */ + +#if !defined(__mt7921_trace_h) || defined(trace_header_multi_read) +#define __mt7921_trace_h + +#include <linux/tracepoint.h> +#include "mt7921.h" + +#undef trace_system +#define trace_system mt7921 + +#define maxname 32 +#define dev_entry __array(char, wiphy_name, 32) +#define dev_assign strlcpy(__entry->wiphy_name, \ + wiphy_name(mt76_hw(dev)->wiphy), maxname) +#define dev_pr_fmt "%s" +#define dev_pr_arg __entry->wiphy_name +#define lp_state_pr_arg __entry->lp_state ? "lp ready" : "lp not ready" + +trace_event(lp_event, + tp_proto(struct mt7921_dev *dev, u8 lp_state), + + tp_args(dev, lp_state), + + tp_struct__entry( + dev_entry + __field(u8, lp_state) + ), + + tp_fast_assign( + dev_assign; + __entry->lp_state = lp_state; + ), + + tp_printk( + dev_pr_fmt " %s", + dev_pr_arg, lp_state_pr_arg + ) +); + +#endif + +#undef trace_include_path +#define trace_include_path . +#undef trace_include_file +#define trace_include_file mt7921_trace + +#include <trace/define_trace.h> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/trace.c b/drivers/net/wireless/mediatek/mt76/mt7921/trace.c --- /dev/null +++ b/drivers/net/wireless/mediatek/mt76/mt7921/trace.c +// spdx-license-identifier: isc +/* + * copyright (c) 2021 lorenzo bianconi <lorenzo@kernel.org> + */ + +#include <linux/module.h> + +#ifndef __checker__ +#define create_trace_points +#include "mt7921_trace.h" + +#endif
|
Networking
|
2afd17b4d0fc15cba0144e7a4c26549b0e829ce9
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: mt7921: enable random mac addr during scanning
|
notify mac80211 mt7921 devices support random mac address during hw frequency scanning
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
enable random mac addr during scanning
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7921']
|
['c']
| 1
| 1
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c + wiphy->features |= nl80211_feature_scan_random_mac_addr;
|
Networking
|
c1941b8902794c55328a220c5bf3654b1b54ba09
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: mt7921: add wifi reset support
|
introduce wifi chip reset support for mt7921 device to recover mcu hangs.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add wifi reset support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7921']
|
['h', 'c']
| 5
| 155
| 60
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c -static void mt7921_mac_init(struct mt7921_dev *dev) +void mt7921_mac_init(struct mt7921_dev *dev) - init_waitqueue_head(&dev->reset_wait); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c -static bool -mt7921_wait_reset_state(struct mt7921_dev *dev, u32 state) +static int +mt7921_wfsys_reset(struct mt7921_dev *dev) - bool ret; + mt76_set(dev, 0x70002600, bit(0)); + msleep(200); + mt76_clear(dev, 0x70002600, bit(0)); - ret = wait_event_timeout(dev->reset_wait, - (read_once(dev->reset_state) & state), - mt7921_reset_timeout); - - warn(!ret, "timeout waiting for mcu reset state %x ", state); - return ret; + return __mt76_poll_msec(&dev->mt76, mt_wfsys_sw_rst_b, + wfsys_sw_init_done, wfsys_sw_init_done, 500); -mt7921_dma_reset(struct mt7921_phy *phy) +mt7921_dma_reset(struct mt7921_dev *dev) - struct mt7921_dev *dev = phy->dev; + /* reset */ + mt76_clear(dev, mt_wfdma0_rst, + mt_wfdma0_rst_dmashdl_all_rst | mt_wfdma0_rst_logic_rst); + + mt76_set(dev, mt_wfdma0_rst, + mt_wfdma0_rst_dmashdl_all_rst | mt_wfdma0_rst_logic_rst); + + /* disable wfdma0 */ - mt_wfdma0_glo_cfg_tx_dma_en | mt_wfdma0_glo_cfg_rx_dma_en); + mt_wfdma0_glo_cfg_tx_dma_en | mt_wfdma0_glo_cfg_rx_dma_en | + mt_wfdma0_glo_cfg_csr_disp_base_ptr_chain_en | + mt_wfdma0_glo_cfg_omit_tx_info | + mt_wfdma0_glo_cfg_omit_rx_info | + mt_wfdma0_glo_cfg_omit_rx_info_pfet2); - usleep_range(1000, 2000); + mt76_poll(dev, mt_wfdma0_glo_cfg, + mt_wfdma0_glo_cfg_tx_dma_busy | + mt_wfdma0_glo_cfg_rx_dma_busy, 0, 1000); - mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[mt_mcuq_wa], true); + /* reset hw queues */ - mt76_queue_tx_cleanup(dev, phy->mt76->q_tx[i], true); + mt76_queue_reset(dev, dev->mphy.q_tx[i]); - mt76_for_each_q_rx(&dev->mt76, i) { - mt76_queue_rx_reset(dev, i); - } + for (i = 0; i < __mt_mcuq_max; i++) + mt76_queue_reset(dev, dev->mt76.q_mcu[i]); + + mt76_for_each_q_rx(&dev->mt76, i) + mt76_queue_reset(dev, &dev->mt76.q_rx[i]); - /* re-init prefetch settings after reset */ + /* configure perfetch settings */ + /* reset dma idx */ + mt76_wr(dev, mt_wfdma0_rst_dtx_ptr, ~0); + + /* configure delay interrupt */ + mt76_wr(dev, mt_wfdma0_pri_dly_int_cfg0, 0); + + mt76_set(dev, mt_wfdma0_glo_cfg, + mt_wfdma0_glo_cfg_tx_wb_ddone | + mt_wfdma0_glo_cfg_fifo_little_endian | + mt_wfdma0_glo_cfg_clk_gat_dis | + mt_wfdma0_glo_cfg_omit_tx_info | + mt_wfdma0_glo_cfg_csr_disp_base_ptr_chain_en | + mt_wfdma0_glo_cfg_omit_rx_info_pfet2); + + + mt76_set(dev, 0x54000120, bit(1)); + + /* enable interrupts for tx/rx rings */ + mt7921_irq_enable(dev, + mt_int_rx_done_all | mt_int_tx_done_all | + mt_int_mcu_cmd); -/* system error recovery */ -void mt7921_mac_reset_work(struct work_struct *work) +static void +mt7921_vif_connect_iter(void *priv, u8 *mac, + struct ieee80211_vif *vif) - struct mt7921_dev *dev; + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct mt7921_dev *dev = mvif->phy->dev; - dev = container_of(work, struct mt7921_dev, reset_work); + ieee80211_disconnect(vif, true); - if (!(read_once(dev->reset_state) & mt_mcu_cmd_stop_dma)) - return; + mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, true); + mt7921_mcu_set_tx(dev, vif); +} + +static int +mt7921_mac_reset(struct mt7921_dev *dev) +{ + int i, err; + + mt76_connac_free_pending_tx_skbs(&dev->pm, null); - ieee80211_stop_queues(mt76_hw(dev)); + mt76_wr(dev, mt_wfdma0_host_int_ena, 0); + mt76_wr(dev, mt_pcie_mac_int_enable, 0x0); - set_bit(mt76_reset, &dev->mphy.state); - cancel_delayed_work_sync(&dev->mphy.mac_work); + skb_queue_purge(&dev->mt76.mcu.res_q); - /* lock/unlock all queues to ensure that no tx is pending */ - napi_disable(&dev->mt76.napi[0]); - napi_disable(&dev->mt76.napi[1]); - napi_disable(&dev->mt76.napi[2]); + napi_disable(&dev->mt76.napi[mt_rxq_main]); + napi_disable(&dev->mt76.napi[mt_rxq_mcu]); + napi_disable(&dev->mt76.napi[mt_rxq_mcu_wa]); - mt7921_mutex_acquire(dev); - - mt76_wr(dev, mt_mcu_int_event, mt_mcu_int_event_dma_stopped); - - if (mt7921_wait_reset_state(dev, mt_mcu_cmd_reset_done)) { - mt7921_dma_reset(&dev->phy); + /* clean up hw queues */ + for (i = 0; i < array_size(dev->mt76.phy.q_tx); i++) + mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[i], true); - mt76_wr(dev, mt_mcu_int_event, mt_mcu_int_event_dma_init); - mt7921_wait_reset_state(dev, mt_mcu_cmd_recovery_done); - } + for (i = 0; i < array_size(dev->mt76.q_mcu); i++) + mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[i], true); - clear_bit(mt76_mcu_reset, &dev->mphy.state); - clear_bit(mt76_reset, &dev->mphy.state); + mt76_for_each_q_rx(&dev->mt76, i) + mt76_queue_rx_cleanup(dev, &dev->mt76.q_rx[i]); + + mt7921_wfsys_reset(dev); + mt7921_dma_reset(dev); + + mt76_for_each_q_rx(&dev->mt76, i) { + mt76_queue_rx_reset(dev, i); + napi_enable(&dev->mt76.napi[i]); + napi_schedule(&dev->mt76.napi[i]); + } - mt76_worker_enable(&dev->mt76.tx_worker); + mt76_worker_enable(&dev->mt76.tx_worker); - napi_enable(&dev->mt76.napi[0]); - napi_schedule(&dev->mt76.napi[0]); + clear_bit(mt76_mcu_reset, &dev->mphy.state); - napi_enable(&dev->mt76.napi[1]); - napi_schedule(&dev->mt76.napi[1]); + mt76_wr(dev, mt_wfdma0_host_int_ena, 0); + mt76_wr(dev, mt_pcie_mac_int_enable, 0xff); + mt7921_irq_enable(dev, + mt_int_rx_done_all | mt_int_tx_done_all | + mt_int_mcu_cmd); - napi_enable(&dev->mt76.napi[2]); - napi_schedule(&dev->mt76.napi[2]); + err = mt7921_run_firmware(dev); + if (err) + return err; - ieee80211_wake_queues(mt76_hw(dev)); + err = mt7921_mcu_set_eeprom(dev); + if (err) + return err; - mt76_wr(dev, mt_mcu_int_event, mt_mcu_int_event_reset_done); - mt7921_wait_reset_state(dev, mt_mcu_cmd_normal_state); + mt7921_mac_init(dev); + return __mt7921_start(&dev->phy); +} - mt7921_mutex_release(dev); +/* system error recovery */ +void mt7921_mac_reset_work(struct work_struct *work) +{ + struct ieee80211_hw *hw; + struct mt7921_dev *dev; + int i; - ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work, - mt7921_watchdog_time); + dev = container_of(work, struct mt7921_dev, reset_work); + hw = mt76_hw(dev); + + dev_err(dev->mt76.dev, "chip reset "); + ieee80211_stop_queues(hw); + + cancel_delayed_work_sync(&dev->mphy.mac_work); + cancel_delayed_work_sync(&dev->pm.ps_work); + cancel_work_sync(&dev->pm.wake_work); + + mutex_lock(&dev->mt76.mutex); + for (i = 0; i < 10; i++) { + if (!mt7921_mac_reset(dev)) + break; + } + mutex_unlock(&dev->mt76.mutex); + + if (i == 10) + dev_err(dev->mt76.dev, "chip reset failed "); + + ieee80211_wake_queues(hw); + ieee80211_iterate_active_interfaces(hw, + ieee80211_iface_iter_resume_all, + mt7921_vif_connect_iter, 0); +} + +void mt7921_reset(struct mt76_dev *mdev) +{ + struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); + + queue_work(dev->mt76.wq, &dev->reset_work); + mt7921_reset(&dev->mt76); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c + .mcu_reset = mt7921_reset, + mt7921_reset(&dev->mt76); + mt7921_reset(&dev->mt76); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h - wait_queue_head_t reset_wait; - u32 reset_state; +void mt7921_mac_init(struct mt7921_dev *dev); +void mt7921_reset(struct mt76_dev *mdev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/regs.h b/drivers/net/wireless/mediatek/mt76/mt7921/regs.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/regs.h +#define mt_wfsys_sw_rst_b 0x18000140 +#define wfsys_sw_rst_b bit(0) +#define wfsys_sw_init_done bit(4) +
|
Networking
|
0c1ce988460765ece1ba8eacd00533eefb6e666a
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: mt7921: add wifisys reset support in debugfs
|
introduce chip_reset knob in mt7921 debugfs to export a way to users able to trigger wifi reset, and group the similar operations previously defined in chip_config in the same knob.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add wifi reset support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7921']
|
['c']
| 1
| 17
| 8
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c -static int mt7921_config(void *data, u64 val) +static int mt7921_chip_reset(void *data, u64 val) - int ret; - - mt7921_mutex_acquire(dev); - ret = mt76_connac_mcu_chip_config(&dev->mt76); - mt7921_mutex_release(dev); + int ret = 0; + + switch (val) { + case 1: + /* reset wifisys directly. */ + mt7921_reset(&dev->mt76); + break; + default: + /* collect the core dump before reset wifisys. */ + mt7921_mutex_acquire(dev); + ret = mt76_connac_mcu_chip_config(&dev->mt76); + mt7921_mutex_release(dev); + break; + } -define_debugfs_attribute(fops_config, null, mt7921_config, "%lld "); +define_debugfs_attribute(fops_reset, null, mt7921_chip_reset, "%lld "); - debugfs_create_file("chip_config", 0600, dir, dev, &fops_config); + debugfs_create_file("chip_reset", 0600, dir, dev, &fops_reset);
|
Networking
|
f1ae92bbc43b68521bc0e866327dc896f10c11ee
|
sean wang
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: add support for 802.3 rx frames
|
do not try to access the header when receiving them
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 8
| 32
| 18
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c --- a/drivers/net/wireless/mediatek/mt76/agg-rx.c +++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c + u8 tidno = status->qos_ctl & ieee80211_qos_ctl_tid_mask; - status->tid = le16_to_cpu(bar->control) >> 12; + status->qos_ctl = tidno = le16_to_cpu(bar->control) >> 12; - tid = rcu_dereference(wcid->aggr[status->tid]); + tid = rcu_dereference(wcid->aggr[tidno]); - struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb); + u8 tidno = status->qos_ctl & ieee80211_qos_ctl_tid_mask; - if (!status->aggr) { + if (!status->aggr && !(status->flag & rx_flag_8023)) { - ackp = *ieee80211_get_qos_ctl(hdr) & ieee80211_qos_ctl_ack_policy_mask; + ackp = status->qos_ctl & ieee80211_qos_ctl_ack_policy_mask; - tid = rcu_dereference(wcid->aggr[status->tid]); + tid = rcu_dereference(wcid->aggr[tidno]); diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c + u8 tidno = status->qos_ctl & ieee80211_qos_ctl_tid_mask; - ret = memcmp(status->iv, wcid->rx_key_pn[status->tid], + ret = memcmp(status->iv, wcid->rx_key_pn[tidno], - memcpy(wcid->rx_key_pn[status->tid], status->iv, sizeof(status->iv)); + memcpy(wcid->rx_key_pn[tidno], status->iv, sizeof(status->iv)); + u8 tidno = status->qos_ctl & ieee80211_qos_ctl_tid_mask; - ieee80211_sta_register_airtime(sta, status->tid, 0, airtime); + ieee80211_sta_register_airtime(sta, tidno, 0, airtime); - struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb); + struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb); + + if (status->flag & rx_flag_8023) + return; + + u8 tidno = status->qos_ctl & ieee80211_qos_ctl_tid_mask; - if (ieee80211_is_pspoll(hdr->frame_control) && !wcid) { + if (ieee80211_is_pspoll(hdr->frame_control) && !wcid && + !(status->flag & rx_flag_8023)) { + if (status->flag & rx_flag_8023) + return; + - ieee80211_sta_uapsd_trigger(sta, status->tid); + ieee80211_sta_uapsd_trigger(sta, tidno); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h - u8 tid; + u8 qos_ctl; diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c - status->tid = *ieee80211_get_qos_ctl(hdr) & ieee80211_qos_ctl_tid_mask; + status->qos_ctl = *ieee80211_get_qos_ctl(hdr); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - status->tid = *ieee80211_get_qos_ctl(hdr) & ieee80211_qos_ctl_tid_mask; + status->qos_ctl = *ieee80211_get_qos_ctl(hdr); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c + struct ieee80211_hdr *hdr; - status->tid = field_get(mt_rxwi_tid, tid_sn); + hdr = (struct ieee80211_hdr *)skb->data; + status->qos_ctl = *ieee80211_get_qos_ctl(hdr); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c - status->tid = *ieee80211_get_qos_ctl(hdr) & ieee80211_qos_ctl_tid_mask; + status->qos_ctl = *ieee80211_get_qos_ctl(hdr); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c - status->tid = *ieee80211_get_qos_ctl(hdr) & ieee80211_qos_ctl_tid_mask; + status->qos_ctl = *ieee80211_get_qos_ctl(hdr);
|
Networking
|
e195dad1411594809cb955c96a7a514bcc4ad638
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7603, mt7615, mt7915, mt7921, wireless
|
mt76: mt7915: enable hw rx-amsdu de-aggregation
|
enable hw rx-amsdu de-aggregation support available in 7915 devices. this is a preliminary patch to enable rx checksum offload
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 5
| 76
| 4
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c +static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q) +{ + struct sk_buff *skb = phy->rx_amsdu[q].head; + struct mt76_dev *dev = phy->dev; + + phy->rx_amsdu[q].head = null; + phy->rx_amsdu[q].tail = null; + __skb_queue_tail(&dev->rx_skb[q], skb); +} + +static void mt76_rx_release_burst(struct mt76_phy *phy, enum mt76_rxq_id q, + struct sk_buff *skb) +{ + struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb; + + if (phy->rx_amsdu[q].head && + (!status->amsdu || status->first_amsdu || + status->seqno != phy->rx_amsdu[q].seqno)) + mt76_rx_release_amsdu(phy, q); + + if (!phy->rx_amsdu[q].head) { + phy->rx_amsdu[q].tail = &skb_shinfo(skb)->frag_list; + phy->rx_amsdu[q].seqno = status->seqno; + phy->rx_amsdu[q].head = skb; + } else { + *phy->rx_amsdu[q].tail = skb; + phy->rx_amsdu[q].tail = &skb->next; + } + + if (!status->amsdu || status->last_amsdu) + mt76_rx_release_amsdu(phy, q); +} + - __skb_queue_tail(&dev->rx_skb[q], skb); + + mt76_rx_release_burst(phy, q, skb); + struct sk_buff *nskb = skb_shinfo(skb)->frag_list; + + skb_shinfo(skb)->frag_list = null; + + /* subsequent amsdu frames */ + while (nskb) { + skb = nskb; + nskb = nskb->next; + skb->next = null; + + mt76_rx_convert(dev, skb, &hw, &sta); + ieee80211_rx_list(hw, sta, skb, &list); + } diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h + u8 amsdu:1, first_amsdu:1, last_amsdu:1; + + struct { + struct sk_buff *head; + struct sk_buff **tail; + u16 seqno; + } rx_amsdu[__mt_rxq_max]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c - /* disable hardware de-agg */ - mt76_clear(dev, mt_mdp_dcr0, mt_mdp_dcr0_damsdu_en); + /* enable hardware de-agg */ + mt76_set(dev, mt_mdp_dcr0, mt_mdp_dcr0_damsdu_en); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c + u32 rxd4 = le32_to_cpu(rxd[4]); - u8 remove_pad; + u8 remove_pad, amsdu_info; + if (rxd2 & mt_rxd2_normal_amsdu_err) + return -einval; + + amsdu_info = field_get(mt_rxd4_normal_payload_format, rxd4); + status->amsdu = !!amsdu_info; + if (status->amsdu) { + status->first_amsdu = amsdu_info == mt_rxd4_first_amsdu_frame; + status->last_amsdu = amsdu_info == mt_rxd4_last_amsdu_frame; + memmove(skb->data + 2, skb->data, + ieee80211_get_hdrlen_from_skb(skb)); + skb_pull(skb, 2); + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h +#define mt_rxd4_first_amsdu_frame genmask(1, 0) +#define mt_rxd4_mid_amsdu_frame bit(1) +#define mt_rxd4_last_amsdu_frame bit(0) +
|
Networking
|
cc4b3c139ad308fcd0086baa9dc13bf60e1b802f
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7915, wireless
|
mt76: mt7915: add rx checksum offload support
|
set skb->ip_summed to checksum_unnecessary if the hardware has validated the ip and tcp/udp checksum
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 2
| 6
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c + hw->netdev_features = netif_f_rxcsum; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c + u32 rxd0 = le32_to_cpu(rxd[0]); + u32 csum_mask = mt_rxd0_normal_ip_sum | mt_rxd0_normal_udp_tcp_sum; + if ((rxd0 & csum_mask) == csum_mask) + skb->ip_summed = checksum_unnecessary; +
|
Networking
|
94244d2ea503455cddec5a4de28d59c74e1aaf47
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7915, wireless
|
mt76: mt7915: add support for rx decapsulation offload
|
for ap and client mode, the hardware can pass received packets as 802.3 frames that can be passed to the network stack as-is.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 6
| 92
| 11
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h + mt_wcid_flag_hdr_trans, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c + ieee80211_hw_set(hw, supports_rx_decap_offload); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c + bool hdr_trans; + u16 seq_ctrl = 0; + u8 qos_ctl = 0; + __le16 fc = 0; + hdr_trans = rxd2 & mt_rxd2_normal_hdr_trans; + u32 v0 = le32_to_cpu(rxd[0]); + u32 v2 = le32_to_cpu(rxd[2]); + + fc = cpu_to_le16(field_get(mt_rxd6_frame_control, v0)); + qos_ctl = field_get(mt_rxd8_qos_ctl, v2); + seq_ctrl = field_get(mt_rxd8_seq_ctrl, v2); + - memmove(skb->data + 2, skb->data, - ieee80211_get_hdrlen_from_skb(skb)); - skb_pull(skb, 2); + if (!hdr_trans) { + memmove(skb->data + 2, skb->data, + ieee80211_get_hdrlen_from_skb(skb)); + skb_pull(skb, 2); + } - if (insert_ccmp_hdr) { + if (insert_ccmp_hdr && !hdr_trans) { + if (!hdr_trans) { + hdr = mt76_skb_get_hdr(skb); + fc = hdr->frame_control; + if (ieee80211_is_data_qos(fc)) { + seq_ctrl = le16_to_cpu(hdr->seq_ctrl); + qos_ctl = *ieee80211_get_qos_ctl(hdr); + } + } else { + status->flag &= ~(rx_flag_radiotap_he | + rx_flag_radiotap_he_mu); + status->flag |= rx_flag_8023; + } + - hdr = mt76_skb_get_hdr(skb); - if (!status->wcid || !ieee80211_is_data_qos(hdr->frame_control)) + if (!status->wcid || !ieee80211_is_data_qos(fc)) - !ieee80211_is_qos_nullfunc(hdr->frame_control); - status->qos_ctl = *ieee80211_get_qos_ctl(hdr); - status->seqno = ieee80211_seq_to_sn(le16_to_cpu(hdr->seq_ctrl)); + !ieee80211_is_qos_nullfunc(fc); + status->qos_ctl = qos_ctl; + status->seqno = ieee80211_seq_to_sn(seq_ctrl); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.h +/* rxd group4 */ +#define mt_rxd6_frame_control genmask(15, 0) +#define mt_rxd6_ta_lo genmask(31, 16) + +#define mt_rxd7_ta_hi genmask(31, 0) + +#define mt_rxd8_seq_ctrl genmask(15, 0) +#define mt_rxd8_qos_ctl genmask(31, 16) + +#define mt_rxd9_ht_control genmask(31, 0) + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c - mt7915_mcu_set_mac(dev, 0, true, false); + mt7915_mcu_set_mac(dev, 0, true, true); - mt7915_mcu_set_mac(dev, 1, true, false); + mt7915_mcu_set_mac(dev, 1, true, true); +static void mt7915_sta_set_decap_offload(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + bool enabled) +{ + struct mt7915_dev *dev = mt7915_hw_dev(hw); + struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; + + if (enabled) + set_bit(mt_wcid_flag_hdr_trans, &msta->wcid.flags); + else + clear_bit(mt_wcid_flag_hdr_trans, &msta->wcid.flags); + + mt7915_mcu_sta_update_hdr_trans(dev, vif, sta); +} + + .sta_set_decap_offload = mt7915_sta_set_decap_offload, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c + htr->no_rx_trans = !test_bit(mt_wcid_flag_hdr_trans, &msta->wcid.flags); +static int +mt7915_mcu_set_rx_hdr_trans_blacklist(struct mt7915_dev *dev, int band) +{ + struct { + u8 operation; + u8 count; + u8 _rsv[2]; + u8 index; + u8 enable; + __le16 etype; + } req = { + .operation = 1, + .count = 1, + .enable = 1, + .etype = cpu_to_le16(eth_p_pae), + }; + + return mt76_mcu_send_msg(&dev->mt76, mcu_ext_cmd(rx_hdr_trans), + &req, sizeof(req), false); +} + + if (hdr_trans) + mt7915_mcu_set_rx_hdr_trans_blacklist(dev, band); +
|
Networking
|
90e3abf07c80a70f31227eea861f306312d5dbea
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7915, wireless
|
mt76: mt7615: fix key set/delete issues
|
there were multiple issues in the current key set/remove code: - deleting a key with the previous key index deletes the current key - bip key would only be uploaded correctly initially and corrupted on rekey
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 3
| 65
| 51
|
- deleting a key with the previous key index deletes the current key - bip key would only be uploaded correctly initially and corrupted on rekey --- diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h + u8 hw_key_idx2; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - enum mt7615_cipher_type cipher, + enum mt7615_cipher_type cipher, u16 cipher_mask, - if (cipher != mt_cipher_bip_cmac_128 && wcid->cipher) - memmove(data + 16, data, 16); - if (cipher != mt_cipher_bip_cmac_128 || !wcid->cipher) + if (cipher_mask == bit(cipher)) - else if (cipher == mt_cipher_bip_cmac_128) + else if (cipher != mt_cipher_bip_cmac_128) + memcpy(data, key->key, 16); + if (cipher == mt_cipher_bip_cmac_128) - if (wcid->cipher & ~bit(cipher)) { - if (cipher != mt_cipher_bip_cmac_128) - memmove(data, data + 16, 16); + if (cipher == mt_cipher_bip_cmac_128) - } else { + else if (cipher_mask) + memset(data, 0, 16); + if (!cipher_mask) - } + - enum mt7615_cipher_type cipher, + enum mt7615_cipher_type cipher, u16 cipher_mask, - if (cmd == set_key) { - w0 |= mt_wtbl_w0_rx_key_valid | - field_prep(mt_wtbl_w0_rx_ik_valid, - cipher == mt_cipher_bip_cmac_128); - if (cipher != mt_cipher_bip_cmac_128 || - !wcid->cipher) - w0 |= field_prep(mt_wtbl_w0_key_idx, keyidx); - } else { - if (!(wcid->cipher & ~bit(cipher))) - w0 &= ~(mt_wtbl_w0_rx_key_valid | - mt_wtbl_w0_key_idx); - if (cipher == mt_cipher_bip_cmac_128) - w0 &= ~mt_wtbl_w0_rx_ik_valid; + + if (cipher_mask) + w0 |= mt_wtbl_w0_rx_key_valid; + else + w0 &= ~(mt_wtbl_w0_rx_key_valid | mt_wtbl_w0_key_idx); + if (cipher_mask & bit(mt_cipher_bip_cmac_128)) + w0 |= mt_wtbl_w0_rx_ik_valid; + else + w0 &= ~mt_wtbl_w0_rx_ik_valid; + + if (cmd == set_key && + (cipher != mt_cipher_bip_cmac_128 || + cipher_mask == bit(cipher))) { + w0 &= ~mt_wtbl_w0_key_idx; + w0 |= field_prep(mt_wtbl_w0_key_idx, keyidx); + - enum mt7615_cipher_type cipher, + enum mt7615_cipher_type cipher, u16 cipher_mask, - if (cmd == set_key) { - if (cipher != mt_cipher_bip_cmac_128 || !wcid->cipher) - mt76_rmw(dev, addr + 2 * 4, mt_wtbl_w2_key_type, - field_prep(mt_wtbl_w2_key_type, cipher)); - } else { - if (cipher != mt_cipher_bip_cmac_128 && - wcid->cipher & bit(mt_cipher_bip_cmac_128)) - mt76_rmw(dev, addr + 2 * 4, mt_wtbl_w2_key_type, - field_prep(mt_wtbl_w2_key_type, - mt_cipher_bip_cmac_128)); - else if (!(wcid->cipher & ~bit(cipher))) - mt76_clear(dev, addr + 2 * 4, mt_wtbl_w2_key_type); + if (!cipher_mask) { + mt76_clear(dev, addr + 2 * 4, mt_wtbl_w2_key_type); + return; + + if (cmd != set_key) + return; + + if (cipher == mt_cipher_bip_cmac_128 && + cipher_mask & ~bit(mt_cipher_bip_cmac_128)) + return; + + mt76_rmw(dev, addr + 2 * 4, mt_wtbl_w2_key_type, + field_prep(mt_wtbl_w2_key_type, cipher)); + u16 cipher_mask = wcid->cipher; - mt7615_mac_wtbl_update_cipher(dev, wcid, cipher, cmd); - err = mt7615_mac_wtbl_update_key(dev, wcid, key, cipher, cmd); + if (cmd == set_key) + cipher_mask |= bit(cipher); + else + cipher_mask &= ~bit(cipher); + + mt7615_mac_wtbl_update_cipher(dev, wcid, cipher, cipher_mask, cmd); + err = mt7615_mac_wtbl_update_key(dev, wcid, key, cipher, cipher_mask, + cmd); - err = mt7615_mac_wtbl_update_pk(dev, wcid, cipher, key->keyidx, cmd); + err = mt7615_mac_wtbl_update_pk(dev, wcid, cipher, cipher_mask, + key->keyidx, cmd); - if (cmd == set_key) - wcid->cipher |= bit(cipher); - else - wcid->cipher &= ~bit(cipher); + wcid->cipher = cipher_mask; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c - int idx = key->keyidx, err; + int idx = key->keyidx, err = 0; + u8 *wcid_keyidx = &wcid->hw_key_idx; + wcid_keyidx = &wcid->hw_key_idx2; - if (cmd == set_key) { - key->hw_key_idx = wcid->idx; - wcid->hw_key_idx = idx; - } else if (idx == wcid->hw_key_idx) { - wcid->hw_key_idx = -1; - } + if (cmd == set_key) + *wcid_keyidx = idx; + else if (idx == *wcid_keyidx) + *wcid_keyidx = -1; + else + goto out; + +out:
|
Networking
|
730d6d0da8d8f5905faafe645a5b3c08ac3f5a8f
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: mt7615: fix tx skb dma unmap
|
the first pointer in the txp needs to be unmapped as well, otherwise it will leak dma mapping entries
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for 802.3 rx frames
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 1
| 1
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - for (i = 1; i < txp->nbuf; i++) + for (i = 0; i < txp->nbuf; i++)
|
Networking
|
ebee7885bb12a8fe2c2f9bac87dbd87a05b645f9
|
felix fietkau
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: mt7915: add support for applying pre-calibration data
|
when the eeprom data is read from flash, it can contain pre-calibration data, which can save calibration time.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for applying pre-calibration data
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7915']
|
['h', 'c']
| 9
| 199
| 10
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c -static int -mt76_get_of_eeprom(struct mt76_dev *dev, int len) +int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) - int offset = 0; - ret = mtd_read(mtd, offset, len, &retlen, dev->eeprom.data); + ret = mtd_read(mtd, offset, len, &retlen, eep); - u8 *data = (u8 *)dev->eeprom.data; + u8 *data = (u8 *)eep; +export_symbol_gpl(mt76_get_of_eeprom); - return !mt76_get_of_eeprom(dev, len); + return !mt76_get_of_eeprom(dev, dev->eeprom.data, 0, len); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h +int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +static int mt7915_eeprom_load_precal(struct mt7915_dev *dev) +{ + struct mt76_dev *mdev = &dev->mt76; + u32 val; + + val = mt7915_eeprom_read(dev, mt_ee_do_pre_cal); + if (val != (mt_ee_wifi_cal_dpd | mt_ee_wifi_cal_group)) + return 0; + + val = mt_ee_cal_group_size + mt_ee_cal_dpd_size; + dev->cal = devm_kzalloc(mdev->dev, val, gfp_kernel); + if (!dev->cal) + return -enomem; + + return mt76_get_of_eeprom(mdev, dev->cal, mt_ee_precal, val); +} + - if (ret) + if (ret) { - else + ret = mt7915_eeprom_load_precal(dev); + } else { + } - return 0; + return ret; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h + mt_ee_do_pre_cal = 0x062, - __mt_ee_max = 0xe00 + __mt_ee_max = 0xe00, + /* 0xe10 ~ 0x5780 used to save group cal data */ + mt_ee_precal = 0xe10 +#define mt_ee_wifi_cal_group bit(0) +#define mt_ee_wifi_cal_dpd genmask(2, 1) +#define mt_ee_cal_unit 1024 +#define mt_ee_cal_group_size (44 * mt_ee_cal_unit) +#define mt_ee_cal_dpd_size (54 * mt_ee_cal_unit) + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c + + if (dev->flash_mode) { + ret = mt7915_mcu_apply_group_cal(dev); + if (ret) + return ret; + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c + if (dev->flash_mode) { + ret = mt7915_mcu_apply_tx_dpd(phy); + if (ret) + goto out; + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +static int mt7915_mcu_set_pre_cal(struct mt7915_dev *dev, u8 idx, + u8 *data, u32 len, int cmd) +{ + struct { + u8 dir; + u8 valid; + __le16 bitmap; + s8 precal; + u8 action; + u8 band; + u8 idx; + u8 rsv[4]; + __le32 len; + } req; + struct sk_buff *skb; + + skb = mt76_mcu_msg_alloc(&dev->mt76, null, sizeof(req) + len); + if (!skb) + return -enomem; + + req.idx = idx; + req.len = cpu_to_le32(len); + skb_put_data(skb, &req, sizeof(req)); + skb_put_data(skb, data, len); + + return mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, false); +} + +int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev) +{ + u8 idx = 0, *cal = dev->cal, *eep = dev->mt76.eeprom.data; + u32 total = mt_ee_cal_group_size; + + if (!(eep[mt_ee_do_pre_cal] & mt_ee_wifi_cal_group)) + return 0; + + /* + * items: rx dcoc, rssi dcoc, tx tssi dcoc, tx lpfg + * tx fdiq, tx dciq, rx fdiq, rx fiiq, adcdcoc + */ + while (total > 0) { + int ret, len; + + len = min_t(u32, total, mt_ee_cal_unit); + + ret = mt7915_mcu_set_pre_cal(dev, idx, cal, len, + mcu_ext_cmd(group_pre_cal_info)); + if (ret) + return ret; + + total -= len; + cal += len; + idx++; + } + + return 0; +} + +static int mt7915_find_freq_idx(const u16 *freqs, int n_freqs, u16 cur) +{ + int i; + + for (i = 0; i < n_freqs; i++) + if (cur == freqs[i]) + return i; + + return -1; +} + +static int mt7915_dpd_freq_idx(u16 freq, u8 bw) +{ + static const u16 freq_list[] = { + 5180, 5200, 5220, 5240, + 5260, 5280, 5300, 5320, + 5500, 5520, 5540, 5560, + 5580, 5600, 5620, 5640, + 5660, 5680, 5700, 5745, + 5765, 5785, 5805, 5825 + }; + int offset_2g = array_size(freq_list); + int idx; + + if (freq < 4000) { + if (freq < 2432) + return offset_2g; + if (freq < 2457) + return offset_2g + 1; + + return offset_2g + 2; + } + + if (bw == nl80211_chan_width_80p80 || bw == nl80211_chan_width_160) + return -1; + + if (bw != nl80211_chan_width_20) { + idx = mt7915_find_freq_idx(freq_list, array_size(freq_list), + freq + 10); + if (idx >= 0) + return idx; + + idx = mt7915_find_freq_idx(freq_list, array_size(freq_list), + freq - 10); + if (idx >= 0) + return idx; + } + + return mt7915_find_freq_idx(freq_list, array_size(freq_list), freq); +} + +int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy) +{ + struct mt7915_dev *dev = phy->dev; + struct cfg80211_chan_def *chandef = &phy->mt76->chandef; + u16 total = 2, idx, center_freq = chandef->center_freq1; + u8 *cal = dev->cal, *eep = dev->mt76.eeprom.data; + + if (!(eep[mt_ee_do_pre_cal] & mt_ee_wifi_cal_dpd)) + return 0; + + idx = mt7915_dpd_freq_idx(center_freq, chandef->width); + if (idx < 0) + return -einval; + + /* items: tx dpd, tx flatness */ + idx = idx * 2; + cal += mt_ee_cal_group_size; + + while (total--) { + int ret; + + cal += (idx * mt_ee_cal_unit); + ret = mt7915_mcu_set_pre_cal(dev, idx, cal, mt_ee_cal_unit, + mcu_ext_cmd(dpd_pre_cal_info)); + if (ret) + return ret; + + idx++; + } + + return 0; +} + diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h + mcu_ext_cmd_group_pre_cal_info = 0xab, + mcu_ext_cmd_dpd_pre_cal_info = 0xac, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h + + void *cal; +int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev); +int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
|
Networking
|
495184ac91bb866ad7d794ad6ceb064e191319d4
|
ryder lee
|
drivers
|
net
|
mediatek, mt76, mt7915, wireless
|
mt76: mt76x0u: add support for tp-link t2uhp(un) v1
|
there are two variants of tp-link archer t2uhp v1, which are us and un:
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for tp-link t2uhp(un) v1
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt76x0u']
|
['c']
| 1
| 2
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c - { usb_device(0x2357, 0x0123) }, /* tp-link t2uhp */ + { usb_device(0x2357, 0x0123) }, /* tp-link t2uhp_us_v1 */ + { usb_device(0x2357, 0x010b) }, /* tp-link t2uhp_un_v1 */
|
Networking
|
51bf9d60fb927b850ec2abdc1f9f72de523098a3
|
eric y y wong
|
drivers
|
net
|
mediatek, mt76, mt76x0, wireless
|
mt76: mt7921: improve doze opportunity
|
increase mt7921 mac work timeout in oder to have move sleep opportunities
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
improve runtime-pm support for mt7663/mt7921
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 2
| 3
| 3
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c - if (++mphy->mac_work_count == 5) { + if (++mphy->mac_work_count == 2) { - if (++phy->sta_work_count == 10) { + if (++phy->sta_work_count == 4) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h -#define mt7921_watchdog_time (hz / 10) +#define mt7921_watchdog_time (hz / 4)
|
Networking
|
c18ba14c4bc953250aa497d03855592bd133ccde
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7921, wireless
|
mt76: mt7663: add awake and doze time accounting
|
similar to mt7921, introduce awake and doze time accounting for runtime pm.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
improve runtime-pm support for mt7663/mt7921
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 3
| 52
| 6
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c + struct mt76_connac_pm *pm = &dev->pm; + if (val == pm->enable) + return 0; + - dev->pm.enable = val; + if (!pm->enable) { + pm->stats.last_wake_event = jiffies; + pm->stats.last_doze_event = jiffies; + } + pm->enable = val; +static int +mt7615_pm_stats(struct seq_file *s, void *data) +{ + struct mt7615_dev *dev = dev_get_drvdata(s->private); + struct mt76_connac_pm *pm = &dev->pm; + unsigned long awake_time = pm->stats.awake_time; + unsigned long doze_time = pm->stats.doze_time; + + if (!test_bit(mt76_state_pm, &dev->mphy.state)) + awake_time += jiffies - pm->stats.last_wake_event; + else + doze_time += jiffies - pm->stats.last_doze_event; + + seq_printf(s, "awake time: %14u doze time: %15u ", + jiffies_to_msecs(awake_time), + jiffies_to_msecs(doze_time)); + + return 0; +} + + debugfs_create_devm_seqfile(dev->mt76.dev, "runtime_pm_stats", dir, + mt7615_pm_stats); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c + dev->pm.stats.last_wake_event = jiffies; + dev->pm.stats.last_doze_event = jiffies; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c + struct mt76_connac_pm *pm = &dev->pm; + pm->stats.last_wake_event = jiffies; + pm->stats.doze_time += pm->stats.last_wake_event - + pm->stats.last_doze_event; + + struct mt76_connac_pm *pm = &dev->pm; - mutex_lock(&dev->pm.mutex); + mutex_lock(&pm->mutex); + pm->stats.last_wake_event = jiffies; + pm->stats.doze_time += pm->stats.last_wake_event - + pm->stats.last_doze_event; - mutex_unlock(&dev->pm.mutex); + mutex_unlock(&pm->mutex); + struct mt76_connac_pm *pm = &dev->pm; - mutex_lock(&dev->pm.mutex); + mutex_lock(&pm->mutex); - if (mt76_connac_skip_fw_pmctrl(mphy, &dev->pm)) + if (mt76_connac_skip_fw_pmctrl(mphy, pm)) + + pm->stats.last_doze_event = jiffies; + pm->stats.awake_time += pm->stats.last_doze_event - + pm->stats.last_wake_event; - mutex_unlock(&dev->pm.mutex); + mutex_unlock(&pm->mutex);
|
Networking
|
abe912ae3cd42f95beeff8eb67acbe0ca8b8aedd
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: connac: unschedule mac_work before going to sleep
|
in order to wake the device less frequently and so reduce power consumpation, unschedule mac_work before going to sleep
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
improve runtime-pm support for mt7663/mt7921
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 3
| 7
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, + mt7615_watchdog_time); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c - if (!test_bit(mt76_state_pm, &phy->state)) + if (!test_bit(mt76_state_pm, &phy->state)) { + cancel_delayed_work(&phy->mac_work); + } diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, + mt7921_watchdog_time);
|
Networking
|
b1bd7bb8121d89518b2248357a070d4bf8defd3e
|
lorenzo bianconi
|
drivers
|
net
|
mediatek, mt76, mt7615, mt7921, wireless
|
mt76: mt7921: mt7921_stop should put device in fw_own state
|
mt7921_stop should put device in fw_own state to reduce power consumption.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
improve runtime-pm support for mt7663/mt7921
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 1
| 1
| 1
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c - if (!pm->enable || !test_bit(mt76_state_running, &phy->state)) + if (!pm->enable)
|
Networking
|
081b37aea5085fd1535651150c5742e19ccfea82
|
sean wang
|
drivers
|
net
|
mediatek, mt76, wireless
|
mt76: mt7615: enable hw rx-amsdu de-aggregation
|
enable hw rx-amsdu de-aggregation support. this is a preliminary patch to enable rx checksum offload.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
enable hw rx-amsdu de-aggregation
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7615']
|
['h', 'c']
| 4
| 19
| 3
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c - /* disable hdr translation and hw amsdu */ - mt_dma_dcr0_rx_vec_drop); + mt_dma_dcr0_rx_vec_drop | mt_dma_dcr0_damsdu_en); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - u8 chfreq; + u8 chfreq, amsdu_info; + if (rxd2 & mt_rxd2_normal_amsdu_err) + return -einval; + + amsdu_info = field_get(mt_rxd1_normal_payload_format, rxd1); + status->amsdu = !!amsdu_info; + if (status->amsdu) { + status->first_amsdu = amsdu_info == mt_rxd1_first_amsdu_frame; + status->last_amsdu = amsdu_info == mt_rxd1_last_amsdu_frame; + memmove(skb->data + 2, skb->data, + ieee80211_get_hdrlen_from_skb(skb)); + skb_pull(skb, 2); + } + diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h +#define mt_rxd1_first_amsdu_frame genmask(1, 0) +#define mt_rxd1_mid_amsdu_frame bit(1) +#define mt_rxd1_last_amsdu_frame bit(0) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h +#define mt_dma_dcr0_damsdu_en bit(16)
|
Networking
|
e78d73e01db3309bbc099be87a5157d3c710fcc8
|
ryder lee
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: mt7615: add support for rx decapsulation offload
|
for ap and client mode, the hardware can pass received packets as 802.3 frames that can be passed to the network stack as-is.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for rx decapsulation offload
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7615']
|
['h', 'c']
| 9
| 127
| 13
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c - mt_dma_dcr0_rx_vec_drop | mt_dma_dcr0_damsdu_en); + mt_dma_dcr0_rx_vec_drop | mt_dma_dcr0_damsdu_en | + mt_dma_dcr0_rx_hdr_trans_en); + mt7615_mcu_set_rx_hdr_trans_blacklist(dev); + ieee80211_hw_set(hw, supports_rx_decap_offload); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c - bool unicast, remove_pad, insert_ccmp_hdr = false; + bool unicast, hdr_trans, remove_pad, insert_ccmp_hdr = false; - u8 chfreq, amsdu_info; + u8 chfreq, amsdu_info, qos_ctl = 0; + u16 seq_ctrl = 0; + __le16 fc = 0; + hdr_trans = rxd1 & mt_rxd1_normal_hdr_trans; + u32 v0 = le32_to_cpu(rxd[0]); + u32 v2 = le32_to_cpu(rxd[2]); + + fc = cpu_to_le16(field_get(mt_rxd4_frame_control, v0)); + qos_ctl = field_get(mt_rxd6_qos_ctl, v2); + seq_ctrl = field_get(mt_rxd6_seq_ctrl, v2); + - memmove(skb->data + 2, skb->data, - ieee80211_get_hdrlen_from_skb(skb)); - skb_pull(skb, 2); + if (!hdr_trans) { + memmove(skb->data + 2, skb->data, + ieee80211_get_hdrlen_from_skb(skb)); + skb_pull(skb, 2); + } - if (insert_ccmp_hdr) { + if (insert_ccmp_hdr && !hdr_trans) { - hdr = (struct ieee80211_hdr *)skb->data; - if (!status->wcid || !ieee80211_is_data_qos(hdr->frame_control)) + if (!hdr_trans) { + hdr = (struct ieee80211_hdr *)skb->data; + fc = hdr->frame_control; + if (ieee80211_is_data_qos(fc)) { + seq_ctrl = le16_to_cpu(hdr->seq_ctrl); + qos_ctl = *ieee80211_get_qos_ctl(hdr); + } + } else { + status->flag |= rx_flag_8023; + } + + if (!status->wcid || !ieee80211_is_data_qos(fc)) - !ieee80211_is_qos_nullfunc(hdr->frame_control); - status->qos_ctl = *ieee80211_get_qos_ctl(hdr); - status->seqno = ieee80211_seq_to_sn(le16_to_cpu(hdr->seq_ctrl)); + !ieee80211_is_qos_nullfunc(fc); + status->qos_ctl = qos_ctl; + status->seqno = ieee80211_seq_to_sn(seq_ctrl); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h +#define mt_rxd4_frame_control genmask(15, 0) + +#define mt_rxd6_seq_ctrl genmask(15, 0) +#define mt_rxd6_qos_ctl genmask(31, 16) + diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c +static void mt7615_sta_set_decap_offload(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + bool enabled) +{ + struct mt7615_dev *dev = mt7615_hw_dev(hw); + struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv; + + if (enabled) + set_bit(mt_wcid_flag_hdr_trans, &msta->wcid.flags); + else + clear_bit(mt_wcid_flag_hdr_trans, &msta->wcid.flags); + + mt7615_mcu_sta_update_hdr_trans(dev, vif, sta); +} + + .sta_set_decap_offload = mt7615_sta_set_decap_offload, diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +int mt7615_mcu_sta_update_hdr_trans(struct mt7615_dev *dev, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta) +{ + struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv; + struct wtbl_req_hdr *wtbl_hdr; + struct sk_buff *skb = null; + + wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid, + wtbl_set, null, &skb); + if (is_err(wtbl_hdr)) + return ptr_err(wtbl_hdr); + + mt76_connac_mcu_wtbl_hdr_trans_tlv(skb, vif, sta, null, wtbl_hdr); + + return mt76_mcu_skb_send_msg(&dev->mt76, skb, mcu_ext_cmd_wtbl_update, + true); +} + +int mt7615_mcu_set_rx_hdr_trans_blacklist(struct mt7615_dev *dev) +{ + struct { + u8 operation; + u8 count; + u8 _rsv[2]; + u8 index; + u8 enable; + __le16 etype; + } req = { + .operation = 1, + .count = 1, + .enable = 1, + .etype = cpu_to_le16(eth_p_pae), + }; + + return mt76_mcu_send_msg(&dev->mt76, mcu_ext_cmd_rx_hdr_trans, + &req, sizeof(req), false); +} + diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +int mt7615_mcu_sta_update_hdr_trans(struct mt7615_dev *dev, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta); +int mt7615_mcu_set_rx_hdr_trans_blacklist(struct mt7615_dev *dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h --- a/drivers/net/wireless/mediatek/mt76/mt7615/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/regs.h +#define mt_dma_dcr0_rx_hdr_trans_en bit(19) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +void mt76_connac_mcu_wtbl_hdr_trans_tlv(struct sk_buff *skb, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + void *sta_wtbl, void *wtbl_tlv) +{ + struct mt76_wcid *wcid; + struct wtbl_hdr_trans *htr; + struct tlv *tlv; + + tlv = mt76_connac_mcu_add_nested_tlv(skb, wtbl_hdr_trans, + sizeof(*htr), + wtbl_tlv, sta_wtbl); + htr = (struct wtbl_hdr_trans *)tlv; + + wcid = (struct mt76_wcid *)sta->drv_priv; + htr->no_rx_trans = !test_bit(mt_wcid_flag_hdr_trans, &wcid->flags); +} +export_symbol_gpl(mt76_connac_mcu_wtbl_hdr_trans_tlv); + diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h - u8 disable_rx_trans; + u8 no_rx_trans; +void mt76_connac_mcu_wtbl_hdr_trans_tlv(struct sk_buff *skb, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + void *sta_wtbl, void *wtbl_tlv);
|
Networking
|
d4b98c63d7a772cfc2ed68c646915d5b3988e934
|
ryder lee frank wunderlich frank w public files de
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt76: mt7615: add rx checksum offload support
|
set skb->ip_summed to checksum_unnecessary if the hardware has validated the ip and tcp/udp checksum
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add rx checksum offload support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7615']
|
['c']
| 2
| 5
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c + hw->netdev_features = netif_f_rxcsum; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c + u32 csum_mask = mt_rxd0_normal_ip_sum | mt_rxd0_normal_udp_tcp_sum; + if ((rxd0 & csum_mask) == csum_mask) + skb->ip_summed = checksum_unnecessary; +
|
Networking
|
2122dfbfd0bd951a6bded5fbd9a1e87b37c41caa
|
ryder lee
|
drivers
|
net
|
mediatek, mt76, mt7615, wireless
|
mt7601u: enable tdls support
|
notify mac80211 the mt7601u chipset support 802.11 tdls. the feature has been tested with a mt7610u peer.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
enable tdls support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'mt7601u']
|
['c']
| 1
| 1
| 0
|
--- diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c --- a/drivers/net/wireless/mediatek/mt7601u/init.c +++ b/drivers/net/wireless/mediatek/mt7601u/init.c + wiphy->flags |= wiphy_flag_supports_tdls;
|
Networking
|
670d9e53886c942b7f29c475b2b494278e586921
|
lorenzo bianconi jakub kicinski kuba kernel org
|
drivers
|
net
|
mediatek, mt7601u, wireless
|
net/mlx5: e-switch, let user to enable disable metadata
|
currently each packet inserted in eswitch is tagged with a internal metadata to indicate source vport. metadata tagging is not always needed. metadata insertion is needed for multi-port roce, failover between representors and stacked devices. in many other cases, metadata enablement is not needed.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c', 'rst']
| 5
| 122
| 7
|
---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- --- - added performance numbers in commit log - updated commit log and documentation for switchdev mode - added explicit note on when user can disable metadata in --- diff --git a/documentation/networking/device_drivers/ethernet/mellanox/mlx5.rst b/documentation/networking/device_drivers/ethernet/mellanox/mlx5.rst --- a/documentation/networking/device_drivers/ethernet/mellanox/mlx5.rst +++ b/documentation/networking/device_drivers/ethernet/mellanox/mlx5.rst +esw_port_metadata: eswitch port metadata state +---------------------------------------------- +when applicable, disabling eswitch metadata can increase packet rate +up to 20% depending on the use case and packet sizes. + +eswitch port metadata state controls whether to internally tag packets with +metadata. metadata tagging must be enabled for multi-port roce, failover +between representors and stacked devices. +by default metadata is enabled on the supported devices in e-switch. +metadata is applicable only for e-switch in switchdev mode and +users may disable it when none of the below use cases will be in use: +1. hca is in dual/multi-port roce mode. +2. vf/sf representor bonding (usually used for live migration) +3. stacked devices + +when metadata is disabled, the above use cases will fail to initialize if +users try to enable them. + +- show eswitch port metadata:: + + $ devlink dev param show pci/0000:06:00.0 name esw_port_metadata + pci/0000:06:00.0: + name esw_port_metadata type driver-specific + values: + cmode runtime value true + +- disable eswitch port metadata:: + + $ devlink dev param set pci/0000:06:00.0 name esw_port_metadata value false cmode runtime + +- change eswitch mode to switchdev mode where after choosing the metadata value:: + + $ devlink dev eswitch set pci/0000:06:00.0 mode switchdev + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c + +static int mlx5_devlink_esw_port_metadata_set(struct devlink *devlink, u32 id, + struct devlink_param_gset_ctx *ctx) +{ + struct mlx5_core_dev *dev = devlink_priv(devlink); + + if (!mlx5_eswitch_manager(dev)) + return -eopnotsupp; + + return mlx5_esw_offloads_vport_metadata_set(dev->priv.eswitch, ctx->val.vbool); +} + +static int mlx5_devlink_esw_port_metadata_get(struct devlink *devlink, u32 id, + struct devlink_param_gset_ctx *ctx) +{ + struct mlx5_core_dev *dev = devlink_priv(devlink); + + if (!mlx5_eswitch_manager(dev)) + return -eopnotsupp; + + ctx->val.vbool = mlx5_eswitch_vport_match_metadata_enabled(dev->priv.eswitch); + return 0; +} + +static int mlx5_devlink_esw_port_metadata_validate(struct devlink *devlink, u32 id, + union devlink_param_value val, + struct netlink_ext_ack *extack) +{ + struct mlx5_core_dev *dev = devlink_priv(devlink); + u8 esw_mode; + + if (!mlx5_eswitch_manager(dev)) { + nl_set_err_msg_mod(extack, "e-switch is unsupported"); + return -eopnotsupp; + } + esw_mode = mlx5_eswitch_mode(dev); + if (esw_mode == mlx5_eswitch_offloads) { + nl_set_err_msg_mod(extack, + "e-switch must either disabled or non switchdev mode"); + return -ebusy; + } + return 0; +} + + devlink_param_driver(mlx5_devlink_param_id_esw_port_metadata, + "esw_port_metadata", devlink_param_type_bool, + bit(devlink_param_cmode_runtime), + mlx5_devlink_esw_port_metadata_get, + mlx5_devlink_esw_port_metadata_set, + mlx5_devlink_esw_port_metadata_validate), + + if (mlx5_eswitch_manager(dev)) { + if (mlx5_esw_vport_match_metadata_supported(dev->priv.eswitch)) { + dev->priv.eswitch->flags |= mlx5_eswitch_vport_match_metadata; + value.vbool = true; + } else { + value.vbool = false; + } + devlink_param_driverinit_value_set(devlink, + mlx5_devlink_param_id_esw_port_metadata, + value); + } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.h + mlx5_devlink_param_id_esw_port_metadata, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +bool mlx5_esw_vport_match_metadata_supported(const struct mlx5_eswitch *esw); +int mlx5_esw_offloads_vport_metadata_set(struct mlx5_eswitch *esw, bool enable); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c -static bool -esw_check_vport_match_metadata_supported(const struct mlx5_eswitch *esw) +bool mlx5_esw_vport_match_metadata_supported(const struct mlx5_eswitch *esw) +int mlx5_esw_offloads_vport_metadata_set(struct mlx5_eswitch *esw, bool enable) +{ + int err = 0; + + down_write(&esw->mode_lock); + if (esw->mode != mlx5_eswitch_none) { + err = -ebusy; + goto done; + } + if (!mlx5_esw_vport_match_metadata_supported(esw)) { + err = -eopnotsupp; + goto done; + } + if (enable) + esw->flags |= mlx5_eswitch_vport_match_metadata; + else + esw->flags &= ~mlx5_eswitch_vport_match_metadata; +done: + up_write(&esw->mode_lock); + return err; +} + - if (esw_check_vport_match_metadata_supported(esw)) - esw->flags |= mlx5_eswitch_vport_match_metadata; - - esw->flags &= ~mlx5_eswitch_vport_match_metadata; - esw->flags &= ~mlx5_eswitch_vport_match_metadata;
|
Networking
|
7bf481d7e75a474e2a0f564b4de6bc2f1eeafc9a
|
parav pandit
|
documentation
|
networking
|
core, device_drivers, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, skip querying sf enabled bits
|
with vhca events, sf state is queried through the vhca events. device no longer expects sf bitmap in the query eswitch functions command.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 1
| 0
| 6
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c - u16 max_sf_vports; - max_sf_vports = mlx5_sf_max_functions(dev); - /* device interface is array of 64-bits */ - if (max_sf_vports) - outlen += div_round_up(max_sf_vports, bits_per_type(__be64)) * sizeof(__be64); -
|
Networking
|
7d5ae47891929235c4a269b91996ab951cbf3c20
|
parav pandit
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, make vport number u16
|
vport number is 16-bit field in hardware. make it u16.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 3
| 4
| 4
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h - int vport; + u16 vport; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c - int num_vfs, vport_num, rule_idx = 0, err = 0; + int num_vfs, rule_idx = 0, err = 0; + u16 vport_num; diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h -mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw, - int vport_num) +mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw, u16 vport_num)
|
Networking
|
6308a5f06be08f3ea1f1a895a9ef54c7b65c4c35
|
parav pandit
|
include
|
linux
|
core, ethernet, mellanox, mlx5
|
net/mlx5: e-switch make cleanup sequence mirror of init
|
make cleanup sequence mirror of init sequence for cleaning up reps and freeing vports.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['c']
| 1
| 1
| 2
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c - esw_offloads_cleanup_reps(esw); - esw_offloads_cleanup_reps(esw); + esw_offloads_cleanup_reps(esw);
|
Networking
|
13795553a84dd3411d0870e161d40fee9c4ebe5c
|
parav pandit
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, convert a macro to a helper routine
|
convert esw_allowed macro to a helper routine so that it can be used in other eswitch files.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 2
| 20
| 17
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c -#define esw_allowed(esw) ((esw) && mlx5_eswitch_manager((esw)->dev)) - - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - return esw_allowed(esw) ? esw->mode : mlx5_eswitch_none; + return mlx5_esw_allowed(esw) ? esw->mode : mlx5_eswitch_none; - return esw_allowed(esw) ? esw->offloads.encap : + return mlx5_esw_allowed(esw) ? esw->offloads.encap : - if (!esw_allowed(esw)) + if (!mlx5_esw_allowed(esw)) - if (esw_allowed(esw)) + if (mlx5_esw_allowed(esw)) - if (esw_allowed(esw)) + if (mlx5_esw_allowed(esw)) - if (esw_allowed(esw)) + if (mlx5_esw_allowed(esw)) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +static inline bool mlx5_esw_allowed(const struct mlx5_eswitch *esw) +{ + return esw && mlx5_eswitch_manager(esw->dev); +} +
|
Networking
|
b16f2bb6b6ca926e303273913288461091ba8cd8
|
parav pandit
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, move legacy code to a individual file
|
currently eswitch offers two modes. legacy and offloads. offloads code is already in its own file eswitch_offloads.c
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c', 'makefile']
| 5
| 539
| 507
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/makefile b/drivers/net/ethernet/mellanox/mlx5/core/makefile --- a/drivers/net/ethernet/mellanox/mlx5/core/makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/makefile - ecpf.o rdma.o + ecpf.o rdma.o esw/legacy.o diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +// spdx-license-identifier: gpl-2.0 or linux-openib +/* copyright (c) 2021 mellanox technologies ltd */ + +#include <linux/etherdevice.h> +#include <linux/mlx5/driver.h> +#include <linux/mlx5/mlx5_ifc.h> +#include <linux/mlx5/vport.h> +#include <linux/mlx5/fs.h> +#include "esw/acl/lgcy.h" +#include "esw/legacy.h" +#include "mlx5_core.h" +#include "eswitch.h" +#include "fs_core.h" + +enum { + legacy_vepa_prio = 0, + legacy_fdb_prio, +}; + +static int esw_create_legacy_vepa_table(struct mlx5_eswitch *esw) +{ + struct mlx5_flow_table_attr ft_attr = {}; + struct mlx5_core_dev *dev = esw->dev; + struct mlx5_flow_namespace *root_ns; + struct mlx5_flow_table *fdb; + int err; + + root_ns = mlx5_get_fdb_sub_ns(dev, 0); + if (!root_ns) { + esw_warn(dev, "failed to get fdb flow namespace "); + return -eopnotsupp; + } + + /* num fte 2, num fg 2 */ + ft_attr.prio = legacy_vepa_prio; + ft_attr.max_fte = 2; + ft_attr.autogroup.max_num_groups = 2; + fdb = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); + if (is_err(fdb)) { + err = ptr_err(fdb); + esw_warn(dev, "failed to create vepa fdb err %d ", err); + return err; + } + esw->fdb_table.legacy.vepa_fdb = fdb; + + return 0; +} + +static void esw_destroy_legacy_fdb_table(struct mlx5_eswitch *esw) +{ + esw_debug(esw->dev, "destroy fdb table "); + if (!esw->fdb_table.legacy.fdb) + return; + + if (esw->fdb_table.legacy.promisc_grp) + mlx5_destroy_flow_group(esw->fdb_table.legacy.promisc_grp); + if (esw->fdb_table.legacy.allmulti_grp) + mlx5_destroy_flow_group(esw->fdb_table.legacy.allmulti_grp); + if (esw->fdb_table.legacy.addr_grp) + mlx5_destroy_flow_group(esw->fdb_table.legacy.addr_grp); + mlx5_destroy_flow_table(esw->fdb_table.legacy.fdb); + + esw->fdb_table.legacy.fdb = null; + esw->fdb_table.legacy.addr_grp = null; + esw->fdb_table.legacy.allmulti_grp = null; + esw->fdb_table.legacy.promisc_grp = null; + atomic64_set(&esw->user_count, 0); +} + +static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw) +{ + int inlen = mlx5_st_sz_bytes(create_flow_group_in); + struct mlx5_flow_table_attr ft_attr = {}; + struct mlx5_core_dev *dev = esw->dev; + struct mlx5_flow_namespace *root_ns; + struct mlx5_flow_table *fdb; + struct mlx5_flow_group *g; + void *match_criteria; + int table_size; + u32 *flow_group_in; + u8 *dmac; + int err = 0; + + esw_debug(dev, "create fdb log_max_size(%d) ", + mlx5_cap_esw_flowtable_fdb(dev, log_max_ft_size)); + + root_ns = mlx5_get_fdb_sub_ns(dev, 0); + if (!root_ns) { + esw_warn(dev, "failed to get fdb flow namespace "); + return -eopnotsupp; + } + + flow_group_in = kvzalloc(inlen, gfp_kernel); + if (!flow_group_in) + return -enomem; + + table_size = bit(mlx5_cap_esw_flowtable_fdb(dev, log_max_ft_size)); + ft_attr.max_fte = table_size; + ft_attr.prio = legacy_fdb_prio; + fdb = mlx5_create_flow_table(root_ns, &ft_attr); + if (is_err(fdb)) { + err = ptr_err(fdb); + esw_warn(dev, "failed to create fdb table err %d ", err); + goto out; + } + esw->fdb_table.legacy.fdb = fdb; + + /* addresses group : full match unicast/multicast addresses */ + mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, + mlx5_match_outer_headers); + match_criteria = mlx5_addr_of(create_flow_group_in, flow_group_in, match_criteria); + dmac = mlx5_addr_of(fte_match_param, match_criteria, outer_headers.dmac_47_16); + mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, 0); + /* preserve 2 entries for allmulti and promisc rules*/ + mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 3); + eth_broadcast_addr(dmac); + g = mlx5_create_flow_group(fdb, flow_group_in); + if (is_err(g)) { + err = ptr_err(g); + esw_warn(dev, "failed to create flow group err(%d) ", err); + goto out; + } + esw->fdb_table.legacy.addr_grp = g; + + /* allmulti group : one rule that forwards any mcast traffic */ + mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, + mlx5_match_outer_headers); + mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, table_size - 2); + mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 2); + eth_zero_addr(dmac); + dmac[0] = 0x01; + g = mlx5_create_flow_group(fdb, flow_group_in); + if (is_err(g)) { + err = ptr_err(g); + esw_warn(dev, "failed to create allmulti flow group err(%d) ", err); + goto out; + } + esw->fdb_table.legacy.allmulti_grp = g; + + /* promiscuous group : + * one rule that forward all unmatched traffic from previous groups + */ + eth_zero_addr(dmac); + mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, + mlx5_match_misc_parameters); + mlx5_set_to_ones(fte_match_param, match_criteria, misc_parameters.source_port); + mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, table_size - 1); + mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 1); + g = mlx5_create_flow_group(fdb, flow_group_in); + if (is_err(g)) { + err = ptr_err(g); + esw_warn(dev, "failed to create promisc flow group err(%d) ", err); + goto out; + } + esw->fdb_table.legacy.promisc_grp = g; + +out: + if (err) + esw_destroy_legacy_fdb_table(esw); + + kvfree(flow_group_in); + return err; +} + +static void esw_destroy_legacy_vepa_table(struct mlx5_eswitch *esw) +{ + esw_debug(esw->dev, "destroy vepa table "); + if (!esw->fdb_table.legacy.vepa_fdb) + return; + + mlx5_destroy_flow_table(esw->fdb_table.legacy.vepa_fdb); + esw->fdb_table.legacy.vepa_fdb = null; +} + +static int esw_create_legacy_table(struct mlx5_eswitch *esw) +{ + int err; + + memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb)); + atomic64_set(&esw->user_count, 0); + + err = esw_create_legacy_vepa_table(esw); + if (err) + return err; + + err = esw_create_legacy_fdb_table(esw); + if (err) + esw_destroy_legacy_vepa_table(esw); + + return err; +} + +static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw) +{ + if (esw->fdb_table.legacy.vepa_uplink_rule) + mlx5_del_flow_rules(esw->fdb_table.legacy.vepa_uplink_rule); + + if (esw->fdb_table.legacy.vepa_star_rule) + mlx5_del_flow_rules(esw->fdb_table.legacy.vepa_star_rule); + + esw->fdb_table.legacy.vepa_uplink_rule = null; + esw->fdb_table.legacy.vepa_star_rule = null; +} + +static void esw_destroy_legacy_table(struct mlx5_eswitch *esw) +{ + esw_cleanup_vepa_rules(esw); + esw_destroy_legacy_fdb_table(esw); + esw_destroy_legacy_vepa_table(esw); +} + +#define mlx5_legacy_sriov_vport_events (mlx5_vport_uc_addr_change | \ + mlx5_vport_mc_addr_change | \ + mlx5_vport_promisc_change) + +int esw_legacy_enable(struct mlx5_eswitch *esw) +{ + struct mlx5_vport *vport; + int ret, i; + + ret = esw_create_legacy_table(esw); + if (ret) + return ret; + + mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) + vport->info.link_state = mlx5_vport_admin_state_auto; + + ret = mlx5_eswitch_enable_pf_vf_vports(esw, mlx5_legacy_sriov_vport_events); + if (ret) + esw_destroy_legacy_table(esw); + return ret; +} + +void esw_legacy_disable(struct mlx5_eswitch *esw) +{ + struct esw_mc_addr *mc_promisc; + + mlx5_eswitch_disable_pf_vf_vports(esw); + + mc_promisc = &esw->mc_promisc; + if (mc_promisc->uplink_rule) + mlx5_del_flow_rules(mc_promisc->uplink_rule); + + esw_destroy_legacy_table(esw); +} + +static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, + u8 setting) +{ + struct mlx5_flow_destination dest = {}; + struct mlx5_flow_act flow_act = {}; + struct mlx5_flow_handle *flow_rule; + struct mlx5_flow_spec *spec; + int err = 0; + void *misc; + + if (!setting) { + esw_cleanup_vepa_rules(esw); + return 0; + } + + if (esw->fdb_table.legacy.vepa_uplink_rule) + return 0; + + spec = kvzalloc(sizeof(*spec), gfp_kernel); + if (!spec) + return -enomem; + + /* uplink rule forward uplink traffic to fdb */ + misc = mlx5_addr_of(fte_match_param, spec->match_value, misc_parameters); + mlx5_set(fte_match_set_misc, misc, source_port, mlx5_vport_uplink); + + misc = mlx5_addr_of(fte_match_param, spec->match_criteria, misc_parameters); + mlx5_set_to_ones(fte_match_set_misc, misc, source_port); + + spec->match_criteria_enable = mlx5_match_misc_parameters; + dest.type = mlx5_flow_destination_type_flow_table; + dest.ft = esw->fdb_table.legacy.fdb; + flow_act.action = mlx5_flow_context_action_fwd_dest; + flow_rule = mlx5_add_flow_rules(esw->fdb_table.legacy.vepa_fdb, spec, + &flow_act, &dest, 1); + if (is_err(flow_rule)) { + err = ptr_err(flow_rule); + goto out; + } else { + esw->fdb_table.legacy.vepa_uplink_rule = flow_rule; + } + + /* star rule to forward all traffic to uplink vport */ + memset(&dest, 0, sizeof(dest)); + dest.type = mlx5_flow_destination_type_vport; + dest.vport.num = mlx5_vport_uplink; + flow_act.action = mlx5_flow_context_action_fwd_dest; + flow_rule = mlx5_add_flow_rules(esw->fdb_table.legacy.vepa_fdb, null, + &flow_act, &dest, 1); + if (is_err(flow_rule)) { + err = ptr_err(flow_rule); + goto out; + } else { + esw->fdb_table.legacy.vepa_star_rule = flow_rule; + } + +out: + kvfree(spec); + if (err) + esw_cleanup_vepa_rules(esw); + return err; +} + +int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting) +{ + int err = 0; + + if (!esw) + return -eopnotsupp; + + if (!mlx5_esw_allowed(esw)) + return -eperm; + + mutex_lock(&esw->state_lock); + if (esw->mode != mlx5_eswitch_legacy) { + err = -eopnotsupp; + goto out; + } + + err = _mlx5_eswitch_set_vepa_locked(esw, setting); + +out: + mutex_unlock(&esw->state_lock); + return err; +} + +int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting) +{ + if (!esw) + return -eopnotsupp; + + if (!mlx5_esw_allowed(esw)) + return -eperm; + + if (esw->mode != mlx5_eswitch_legacy) + return -eopnotsupp; + + *setting = esw->fdb_table.legacy.vepa_uplink_rule ? 1 : 0; + return 0; +} + +int esw_legacy_vport_acl_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) +{ + int ret; + + /* only non manager vports need acl in legacy mode */ + if (mlx5_esw_is_manager_vport(esw, vport->vport)) + return 0; + + ret = esw_acl_ingress_lgcy_setup(esw, vport); + if (ret) + goto ingress_err; + + ret = esw_acl_egress_lgcy_setup(esw, vport); + if (ret) + goto egress_err; + + return 0; + +egress_err: + esw_acl_ingress_lgcy_cleanup(esw, vport); +ingress_err: + return ret; +} + +void esw_legacy_vport_acl_cleanup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) +{ + if (mlx5_esw_is_manager_vport(esw, vport->vport)) + return; + + esw_acl_egress_lgcy_cleanup(esw, vport); + esw_acl_ingress_lgcy_cleanup(esw, vport); +} + +int mlx5_esw_query_vport_drop_stats(struct mlx5_core_dev *dev, + struct mlx5_vport *vport, + struct mlx5_vport_drop_stats *stats) +{ + u64 rx_discard_vport_down, tx_discard_vport_down; + struct mlx5_eswitch *esw = dev->priv.eswitch; + u64 bytes = 0; + int err = 0; + + if (esw->mode != mlx5_eswitch_legacy) + return 0; + + mutex_lock(&esw->state_lock); + if (!vport->enabled) + goto unlock; + + if (!is_err_or_null(vport->egress.legacy.drop_counter)) + mlx5_fc_query(dev, vport->egress.legacy.drop_counter, + &stats->rx_dropped, &bytes); + + if (vport->ingress.legacy.drop_counter) + mlx5_fc_query(dev, vport->ingress.legacy.drop_counter, + &stats->tx_dropped, &bytes); + + if (!mlx5_cap_gen(dev, receive_discard_vport_down) && + !mlx5_cap_gen(dev, transmit_discard_vport_down)) + goto unlock; + + err = mlx5_query_vport_down_stats(dev, vport->vport, 1, + &rx_discard_vport_down, + &tx_discard_vport_down); + if (err) + goto unlock; + + if (mlx5_cap_gen(dev, receive_discard_vport_down)) + stats->rx_dropped += rx_discard_vport_down; + if (mlx5_cap_gen(dev, transmit_discard_vport_down)) + stats->tx_dropped += tx_discard_vport_down; + +unlock: + mutex_unlock(&esw->state_lock); + return err; +} + +int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, + u16 vport, u16 vlan, u8 qos) +{ + u8 set_flags = 0; + int err = 0; + + if (!mlx5_esw_allowed(esw)) + return -eperm; + + if (vlan || qos) + set_flags = set_vlan_strip | set_vlan_insert; + + mutex_lock(&esw->state_lock); + if (esw->mode != mlx5_eswitch_legacy) { + if (!vlan) + goto unlock; /* compatibility with libvirt */ + + err = -eopnotsupp; + goto unlock; + } + + err = __mlx5_eswitch_set_vport_vlan(esw, vport, vlan, qos, set_flags); + +unlock: + mutex_unlock(&esw->state_lock); + return err; +} + +int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, + u16 vport, bool spoofchk) +{ + struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); + bool pschk; + int err = 0; + + if (!mlx5_esw_allowed(esw)) + return -eperm; + if (is_err(evport)) + return ptr_err(evport); + + mutex_lock(&esw->state_lock); + if (esw->mode != mlx5_eswitch_legacy) { + err = -eopnotsupp; + goto unlock; + } + pschk = evport->info.spoofchk; + evport->info.spoofchk = spoofchk; + if (pschk && !is_valid_ether_addr(evport->info.mac)) + mlx5_core_warn(esw->dev, + "spoofchk in set while mac is invalid, vport(%d) ", + evport->vport); + if (evport->enabled && esw->mode == mlx5_eswitch_legacy) + err = esw_acl_ingress_lgcy_setup(esw, evport); + if (err) + evport->info.spoofchk = pschk; + +unlock: + mutex_unlock(&esw->state_lock); + return err; +} + +int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw, + u16 vport, bool setting) +{ + struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); + int err = 0; + + if (!mlx5_esw_allowed(esw)) + return -eperm; + if (is_err(evport)) + return ptr_err(evport); + + mutex_lock(&esw->state_lock); + if (esw->mode != mlx5_eswitch_legacy) { + err = -eopnotsupp; + goto unlock; + } + evport->info.trusted = setting; + if (evport->enabled) + esw_vport_change_handle_locked(evport); + +unlock: + mutex_unlock(&esw->state_lock); + return err; +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.h b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.h --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.h +/* spdx-license-identifier: gpl-2.0 or linux-openib */ +/* copyright (c) 2021 mellanox technologies ltd */ + +#ifndef __mlx5_esw_legacy_h__ +#define __mlx5_esw_legacy_h__ + +#define mlx5_legacy_sriov_vport_events (mlx5_vport_uc_addr_change | \ + mlx5_vport_mc_addr_change | \ + mlx5_vport_promisc_change) + +struct mlx5_eswitch; + +int esw_legacy_enable(struct mlx5_eswitch *esw); +void esw_legacy_disable(struct mlx5_eswitch *esw); + +int esw_legacy_vport_acl_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport); +void esw_legacy_vport_acl_cleanup(struct mlx5_eswitch *esw, struct mlx5_vport *vport); + +int mlx5_esw_query_vport_drop_stats(struct mlx5_core_dev *dev, + struct mlx5_vport *vport, + struct mlx5_vport_drop_stats *stats); +#endif diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +#include "esw/legacy.h" -static void esw_destroy_legacy_fdb_table(struct mlx5_eswitch *esw); -static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw); - -enum { - legacy_vepa_prio = 0, - legacy_fdb_prio, -}; - -static int esw_create_legacy_vepa_table(struct mlx5_eswitch *esw) -{ - struct mlx5_flow_table_attr ft_attr = {}; - struct mlx5_core_dev *dev = esw->dev; - struct mlx5_flow_namespace *root_ns; - struct mlx5_flow_table *fdb; - int err; - - root_ns = mlx5_get_fdb_sub_ns(dev, 0); - if (!root_ns) { - esw_warn(dev, "failed to get fdb flow namespace "); - return -eopnotsupp; - } - - /* num fte 2, num fg 2 */ - ft_attr.prio = legacy_vepa_prio; - ft_attr.max_fte = 2; - ft_attr.autogroup.max_num_groups = 2; - fdb = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); - if (is_err(fdb)) { - err = ptr_err(fdb); - esw_warn(dev, "failed to create vepa fdb err %d ", err); - return err; - } - esw->fdb_table.legacy.vepa_fdb = fdb; - - return 0; -} - -static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw) -{ - int inlen = mlx5_st_sz_bytes(create_flow_group_in); - struct mlx5_flow_table_attr ft_attr = {}; - struct mlx5_core_dev *dev = esw->dev; - struct mlx5_flow_namespace *root_ns; - struct mlx5_flow_table *fdb; - struct mlx5_flow_group *g; - void *match_criteria; - int table_size; - u32 *flow_group_in; - u8 *dmac; - int err = 0; - - esw_debug(dev, "create fdb log_max_size(%d) ", - mlx5_cap_esw_flowtable_fdb(dev, log_max_ft_size)); - - root_ns = mlx5_get_fdb_sub_ns(dev, 0); - if (!root_ns) { - esw_warn(dev, "failed to get fdb flow namespace "); - return -eopnotsupp; - } - - flow_group_in = kvzalloc(inlen, gfp_kernel); - if (!flow_group_in) - return -enomem; - - table_size = bit(mlx5_cap_esw_flowtable_fdb(dev, log_max_ft_size)); - ft_attr.max_fte = table_size; - ft_attr.prio = legacy_fdb_prio; - fdb = mlx5_create_flow_table(root_ns, &ft_attr); - if (is_err(fdb)) { - err = ptr_err(fdb); - esw_warn(dev, "failed to create fdb table err %d ", err); - goto out; - } - esw->fdb_table.legacy.fdb = fdb; - - /* addresses group : full match unicast/multicast addresses */ - mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, - mlx5_match_outer_headers); - match_criteria = mlx5_addr_of(create_flow_group_in, flow_group_in, match_criteria); - dmac = mlx5_addr_of(fte_match_param, match_criteria, outer_headers.dmac_47_16); - mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, 0); - /* preserve 2 entries for allmulti and promisc rules*/ - mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 3); - eth_broadcast_addr(dmac); - g = mlx5_create_flow_group(fdb, flow_group_in); - if (is_err(g)) { - err = ptr_err(g); - esw_warn(dev, "failed to create flow group err(%d) ", err); - goto out; - } - esw->fdb_table.legacy.addr_grp = g; - - /* allmulti group : one rule that forwards any mcast traffic */ - mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, - mlx5_match_outer_headers); - mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, table_size - 2); - mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 2); - eth_zero_addr(dmac); - dmac[0] = 0x01; - g = mlx5_create_flow_group(fdb, flow_group_in); - if (is_err(g)) { - err = ptr_err(g); - esw_warn(dev, "failed to create allmulti flow group err(%d) ", err); - goto out; - } - esw->fdb_table.legacy.allmulti_grp = g; - - /* promiscuous group : - * one rule that forward all unmatched traffic from previous groups - */ - eth_zero_addr(dmac); - mlx5_set(create_flow_group_in, flow_group_in, match_criteria_enable, - mlx5_match_misc_parameters); - mlx5_set_to_ones(fte_match_param, match_criteria, misc_parameters.source_port); - mlx5_set(create_flow_group_in, flow_group_in, start_flow_index, table_size - 1); - mlx5_set(create_flow_group_in, flow_group_in, end_flow_index, table_size - 1); - g = mlx5_create_flow_group(fdb, flow_group_in); - if (is_err(g)) { - err = ptr_err(g); - esw_warn(dev, "failed to create promisc flow group err(%d) ", err); - goto out; - } - esw->fdb_table.legacy.promisc_grp = g; - -out: - if (err) - esw_destroy_legacy_fdb_table(esw); - - kvfree(flow_group_in); - return err; -} - -static void esw_destroy_legacy_vepa_table(struct mlx5_eswitch *esw) -{ - esw_debug(esw->dev, "destroy vepa table "); - if (!esw->fdb_table.legacy.vepa_fdb) - return; - - mlx5_destroy_flow_table(esw->fdb_table.legacy.vepa_fdb); - esw->fdb_table.legacy.vepa_fdb = null; -} - -static void esw_destroy_legacy_fdb_table(struct mlx5_eswitch *esw) -{ - esw_debug(esw->dev, "destroy fdb table "); - if (!esw->fdb_table.legacy.fdb) - return; - - if (esw->fdb_table.legacy.promisc_grp) - mlx5_destroy_flow_group(esw->fdb_table.legacy.promisc_grp); - if (esw->fdb_table.legacy.allmulti_grp) - mlx5_destroy_flow_group(esw->fdb_table.legacy.allmulti_grp); - if (esw->fdb_table.legacy.addr_grp) - mlx5_destroy_flow_group(esw->fdb_table.legacy.addr_grp); - mlx5_destroy_flow_table(esw->fdb_table.legacy.fdb); - - esw->fdb_table.legacy.fdb = null; - esw->fdb_table.legacy.addr_grp = null; - esw->fdb_table.legacy.allmulti_grp = null; - esw->fdb_table.legacy.promisc_grp = null; - atomic64_set(&esw->user_count, 0); -} - -static int esw_create_legacy_table(struct mlx5_eswitch *esw) -{ - int err; - - memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb)); - atomic64_set(&esw->user_count, 0); - - err = esw_create_legacy_vepa_table(esw); - if (err) - return err; - - err = esw_create_legacy_fdb_table(esw); - if (err) - esw_destroy_legacy_vepa_table(esw); - - return err; -} - -static void esw_destroy_legacy_table(struct mlx5_eswitch *esw) -{ - esw_cleanup_vepa_rules(esw); - esw_destroy_legacy_fdb_table(esw); - esw_destroy_legacy_vepa_table(esw); -} - -#define mlx5_legacy_sriov_vport_events (mlx5_vport_uc_addr_change | \ - mlx5_vport_mc_addr_change | \ - mlx5_vport_promisc_change) - -static int esw_legacy_enable(struct mlx5_eswitch *esw) -{ - struct mlx5_vport *vport; - int ret, i; - - ret = esw_create_legacy_table(esw); - if (ret) - return ret; - - mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) - vport->info.link_state = mlx5_vport_admin_state_auto; - - ret = mlx5_eswitch_enable_pf_vf_vports(esw, mlx5_legacy_sriov_vport_events); - if (ret) - esw_destroy_legacy_table(esw); - return ret; -} - -static void esw_legacy_disable(struct mlx5_eswitch *esw) -{ - struct esw_mc_addr *mc_promisc; - - mlx5_eswitch_disable_pf_vf_vports(esw); - - mc_promisc = &esw->mc_promisc; - if (mc_promisc->uplink_rule) - mlx5_del_flow_rules(mc_promisc->uplink_rule); - - esw_destroy_legacy_table(esw); -} - -static void esw_vport_change_handle_locked(struct mlx5_vport *vport) +void esw_vport_change_handle_locked(struct mlx5_vport *vport) -static int esw_vport_create_legacy_acl_tables(struct mlx5_eswitch *esw, - struct mlx5_vport *vport) -{ - int ret; - - /* only non manager vports need acl in legacy mode */ - if (mlx5_esw_is_manager_vport(esw, vport->vport)) - return 0; - - ret = esw_acl_ingress_lgcy_setup(esw, vport); - if (ret) - goto ingress_err; - - ret = esw_acl_egress_lgcy_setup(esw, vport); - if (ret) - goto egress_err; - - return 0; - -egress_err: - esw_acl_ingress_lgcy_cleanup(esw, vport); -ingress_err: - return ret; -} - - return esw_vport_create_legacy_acl_tables(esw, vport); + return esw_legacy_vport_acl_setup(esw, vport); -static void esw_vport_destroy_legacy_acl_tables(struct mlx5_eswitch *esw, - struct mlx5_vport *vport) - -{ - if (mlx5_esw_is_manager_vport(esw, vport->vport)) - return; - - esw_acl_egress_lgcy_cleanup(esw, vport); - esw_acl_ingress_lgcy_cleanup(esw, vport); -} - - esw_vport_destroy_legacy_acl_tables(esw, vport); + esw_legacy_vport_acl_cleanup(esw, vport); -int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, - u16 vport, u16 vlan, u8 qos) -{ - u8 set_flags = 0; - int err = 0; - - if (!mlx5_esw_allowed(esw)) - return -eperm; - - if (vlan || qos) - set_flags = set_vlan_strip | set_vlan_insert; - - mutex_lock(&esw->state_lock); - if (esw->mode != mlx5_eswitch_legacy) { - if (!vlan) - goto unlock; /* compatibility with libvirt */ - - err = -eopnotsupp; - goto unlock; - } - - err = __mlx5_eswitch_set_vport_vlan(esw, vport, vlan, qos, set_flags); - -unlock: - mutex_unlock(&esw->state_lock); - return err; -} - -int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, - u16 vport, bool spoofchk) -{ - struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); - bool pschk; - int err = 0; - - if (!mlx5_esw_allowed(esw)) - return -eperm; - if (is_err(evport)) - return ptr_err(evport); - - mutex_lock(&esw->state_lock); - if (esw->mode != mlx5_eswitch_legacy) { - err = -eopnotsupp; - goto unlock; - } - pschk = evport->info.spoofchk; - evport->info.spoofchk = spoofchk; - if (pschk && !is_valid_ether_addr(evport->info.mac)) - mlx5_core_warn(esw->dev, - "spoofchk in set while mac is invalid, vport(%d) ", - evport->vport); - if (evport->enabled && esw->mode == mlx5_eswitch_legacy) - err = esw_acl_ingress_lgcy_setup(esw, evport); - if (err) - evport->info.spoofchk = pschk; - -unlock: - mutex_unlock(&esw->state_lock); - return err; -} - -static void esw_cleanup_vepa_rules(struct mlx5_eswitch *esw) -{ - if (esw->fdb_table.legacy.vepa_uplink_rule) - mlx5_del_flow_rules(esw->fdb_table.legacy.vepa_uplink_rule); - - if (esw->fdb_table.legacy.vepa_star_rule) - mlx5_del_flow_rules(esw->fdb_table.legacy.vepa_star_rule); - - esw->fdb_table.legacy.vepa_uplink_rule = null; - esw->fdb_table.legacy.vepa_star_rule = null; -} - -static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, - u8 setting) -{ - struct mlx5_flow_destination dest = {}; - struct mlx5_flow_act flow_act = {}; - struct mlx5_flow_handle *flow_rule; - struct mlx5_flow_spec *spec; - int err = 0; - void *misc; - - if (!setting) { - esw_cleanup_vepa_rules(esw); - return 0; - } - - if (esw->fdb_table.legacy.vepa_uplink_rule) - return 0; - - spec = kvzalloc(sizeof(*spec), gfp_kernel); - if (!spec) - return -enomem; - - /* uplink rule forward uplink traffic to fdb */ - misc = mlx5_addr_of(fte_match_param, spec->match_value, misc_parameters); - mlx5_set(fte_match_set_misc, misc, source_port, mlx5_vport_uplink); - - misc = mlx5_addr_of(fte_match_param, spec->match_criteria, misc_parameters); - mlx5_set_to_ones(fte_match_set_misc, misc, source_port); - - spec->match_criteria_enable = mlx5_match_misc_parameters; - dest.type = mlx5_flow_destination_type_flow_table; - dest.ft = esw->fdb_table.legacy.fdb; - flow_act.action = mlx5_flow_context_action_fwd_dest; - flow_rule = mlx5_add_flow_rules(esw->fdb_table.legacy.vepa_fdb, spec, - &flow_act, &dest, 1); - if (is_err(flow_rule)) { - err = ptr_err(flow_rule); - goto out; - } else { - esw->fdb_table.legacy.vepa_uplink_rule = flow_rule; - } - - /* star rule to forward all traffic to uplink vport */ - memset(&dest, 0, sizeof(dest)); - dest.type = mlx5_flow_destination_type_vport; - dest.vport.num = mlx5_vport_uplink; - flow_act.action = mlx5_flow_context_action_fwd_dest; - flow_rule = mlx5_add_flow_rules(esw->fdb_table.legacy.vepa_fdb, null, - &flow_act, &dest, 1); - if (is_err(flow_rule)) { - err = ptr_err(flow_rule); - goto out; - } else { - esw->fdb_table.legacy.vepa_star_rule = flow_rule; - } - -out: - kvfree(spec); - if (err) - esw_cleanup_vepa_rules(esw); - return err; -} - -int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting) -{ - int err = 0; - - if (!esw) - return -eopnotsupp; - - if (!mlx5_esw_allowed(esw)) - return -eperm; - - mutex_lock(&esw->state_lock); - if (esw->mode != mlx5_eswitch_legacy) { - err = -eopnotsupp; - goto out; - } - - err = _mlx5_eswitch_set_vepa_locked(esw, setting); - -out: - mutex_unlock(&esw->state_lock); - return err; -} - -int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting) -{ - if (!esw) - return -eopnotsupp; - - if (!mlx5_esw_allowed(esw)) - return -eperm; - - if (esw->mode != mlx5_eswitch_legacy) - return -eopnotsupp; - - *setting = esw->fdb_table.legacy.vepa_uplink_rule ? 1 : 0; - return 0; -} - -int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw, - u16 vport, bool setting) -{ - struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); - int err = 0; - - if (!mlx5_esw_allowed(esw)) - return -eperm; - if (is_err(evport)) - return ptr_err(evport); - - mutex_lock(&esw->state_lock); - if (esw->mode != mlx5_eswitch_legacy) { - err = -eopnotsupp; - goto unlock; - } - evport->info.trusted = setting; - if (evport->enabled) - esw_vport_change_handle_locked(evport); - -unlock: - mutex_unlock(&esw->state_lock); - return err; -} - -static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev, - struct mlx5_vport *vport, - struct mlx5_vport_drop_stats *stats) -{ - struct mlx5_eswitch *esw = dev->priv.eswitch; - u64 rx_discard_vport_down, tx_discard_vport_down; - u64 bytes = 0; - int err = 0; - - if (esw->mode != mlx5_eswitch_legacy) - return 0; - - mutex_lock(&esw->state_lock); - if (!vport->enabled) - goto unlock; - - if (!is_err_or_null(vport->egress.legacy.drop_counter)) - mlx5_fc_query(dev, vport->egress.legacy.drop_counter, - &stats->rx_dropped, &bytes); - - if (vport->ingress.legacy.drop_counter) - mlx5_fc_query(dev, vport->ingress.legacy.drop_counter, - &stats->tx_dropped, &bytes); - - if (!mlx5_cap_gen(dev, receive_discard_vport_down) && - !mlx5_cap_gen(dev, transmit_discard_vport_down)) - goto unlock; - - err = mlx5_query_vport_down_stats(dev, vport->vport, 1, - &rx_discard_vport_down, - &tx_discard_vport_down); - if (err) - goto unlock; - - if (mlx5_cap_gen(dev, receive_discard_vport_down)) - stats->rx_dropped += rx_discard_vport_down; - if (mlx5_cap_gen(dev, transmit_discard_vport_down)) - stats->tx_dropped += tx_discard_vport_down; - -unlock: - mutex_unlock(&esw->state_lock); - return err; -} - - err = mlx5_eswitch_query_vport_drop_stats(esw->dev, vport, &stats); + err = mlx5_esw_query_vport_drop_stats(esw->dev, vport, &stats); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +void esw_vport_change_handle_locked(struct mlx5_vport *vport); +
|
Networking
|
b55b35382e51c84bcddc45bd87cf8fa16621452b
|
parav pandit
|
drivers
|
net
|
core, esw, ethernet, mellanox, mlx5
|
net/mlx5: e-switch, initialize eswitch acls ns when eswitch is enabled
|
currently eswitch flow steering (fs) namespace of vport's ingress and egress acl are enabled when fs layer is initialized. this is done even when eswitch is diabled. this demands that total eswitch ports to be known to fs layer without eswitch in use.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
devlink parameter to control mlx5 metadata enablement for e-switch
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 3
| 93
| 55
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +static int mlx5_esw_acls_ns_init(struct mlx5_eswitch *esw) +{ + struct mlx5_core_dev *dev = esw->dev; + int total_vports; + int err; + + total_vports = mlx5_eswitch_get_total_vports(dev); + + if (mlx5_cap_esw_egress_acl(dev, ft_support)) { + err = mlx5_fs_egress_acls_init(dev, total_vports); + if (err) + return err; + } else { + esw_warn(dev, "engress acl is not supported by fw "); + } + + if (mlx5_cap_esw_ingress_acl(dev, ft_support)) { + err = mlx5_fs_ingress_acls_init(dev, total_vports); + if (err) + goto err; + } else { + esw_warn(dev, "ingress acl is not supported by fw "); + } + return 0; + +err: + if (mlx5_cap_esw_egress_acl(dev, ft_support)) + mlx5_fs_egress_acls_cleanup(dev); + return err; +} + +static void mlx5_esw_acls_ns_cleanup(struct mlx5_eswitch *esw) +{ + struct mlx5_core_dev *dev = esw->dev; + + if (mlx5_cap_esw_ingress_acl(dev, ft_support)) + mlx5_fs_ingress_acls_cleanup(dev); + if (mlx5_cap_esw_egress_acl(dev, ft_support)) + mlx5_fs_egress_acls_cleanup(dev); +} + - if (!mlx5_cap_esw_ingress_acl(esw->dev, ft_support)) - esw_warn(esw->dev, "ingress acl is not supported by fw "); - - if (!mlx5_cap_esw_egress_acl(esw->dev, ft_support)) - esw_warn(esw->dev, "engress acl is not supported by fw "); - + err = mlx5_esw_acls_ns_init(esw); + if (err) + return err; + + mlx5_esw_acls_ns_cleanup(esw); + mlx5_esw_acls_ns_cleanup(esw); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c - if (!steering || vport >= mlx5_eswitch_get_total_vports(dev)) + if (!steering) + if (vport >= steering->esw_egress_acl_vports) + return null; + if (vport >= steering->esw_ingress_acl_vports) + return null; -static void cleanup_egress_acls_root_ns(struct mlx5_core_dev *dev) -{ - struct mlx5_flow_steering *steering = dev->priv.steering; - int i; - - if (!steering->esw_egress_root_ns) - return; - - for (i = 0; i < mlx5_eswitch_get_total_vports(dev); i++) - cleanup_root_ns(steering->esw_egress_root_ns[i]); - - kfree(steering->esw_egress_root_ns); - steering->esw_egress_root_ns = null; -} - -static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev) -{ - struct mlx5_flow_steering *steering = dev->priv.steering; - int i; - - if (!steering->esw_ingress_root_ns) - return; - - for (i = 0; i < mlx5_eswitch_get_total_vports(dev); i++) - cleanup_root_ns(steering->esw_ingress_root_ns[i]); - - kfree(steering->esw_ingress_root_ns); - steering->esw_ingress_root_ns = null; -} - - cleanup_egress_acls_root_ns(dev); - cleanup_ingress_acls_root_ns(dev); -static int init_egress_acls_root_ns(struct mlx5_core_dev *dev) +int mlx5_fs_egress_acls_init(struct mlx5_core_dev *dev, int total_vports) - int total_vports = mlx5_eswitch_get_total_vports(dev); - + steering->esw_egress_acl_vports = total_vports; -static int init_ingress_acls_root_ns(struct mlx5_core_dev *dev) +void mlx5_fs_egress_acls_cleanup(struct mlx5_core_dev *dev) +{ + struct mlx5_flow_steering *steering = dev->priv.steering; + int i; + + if (!steering->esw_egress_root_ns) + return; + + for (i = 0; i < steering->esw_egress_acl_vports; i++) + cleanup_root_ns(steering->esw_egress_root_ns[i]); + + kfree(steering->esw_egress_root_ns); + steering->esw_egress_root_ns = null; +} + +int mlx5_fs_ingress_acls_init(struct mlx5_core_dev *dev, int total_vports) - int total_vports = mlx5_eswitch_get_total_vports(dev); - + steering->esw_ingress_acl_vports = total_vports; +void mlx5_fs_ingress_acls_cleanup(struct mlx5_core_dev *dev) +{ + struct mlx5_flow_steering *steering = dev->priv.steering; + int i; + + if (!steering->esw_ingress_root_ns) + return; + + for (i = 0; i < steering->esw_ingress_acl_vports; i++) + cleanup_root_ns(steering->esw_ingress_root_ns[i]); + + kfree(steering->esw_ingress_root_ns); + steering->esw_ingress_root_ns = null; +} + - if (mlx5_cap_esw_egress_acl(dev, ft_support)) { - err = init_egress_acls_root_ns(dev); - if (err) - goto err; - } - if (mlx5_cap_esw_ingress_acl(dev, ft_support)) { - err = init_ingress_acls_root_ns(dev); - if (err) - goto err; - } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h + int esw_egress_acl_vports; + int esw_ingress_acl_vports; +int mlx5_fs_egress_acls_init(struct mlx5_core_dev *dev, int total_vports); +void mlx5_fs_egress_acls_cleanup(struct mlx5_core_dev *dev); +int mlx5_fs_ingress_acls_init(struct mlx5_core_dev *dev, int total_vports); +void mlx5_fs_ingress_acls_cleanup(struct mlx5_core_dev *dev); +
|
Networking
|
57b92bdd9e14f969de85d25cefc10abc3f73defd
|
parav pandit
|
drivers
|
net
|
core, ethernet, mellanox, mlx5
|
net/mlx5: add memic operations related bits
|
add the memic operations bits and structures to the mlx5_ifc file.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h']
| 1
| 41
| 1
|
--- diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h + mlx5_cmd_op_modify_memic = 0x207, - u8 reserved_at_180[0x680]; + u8 reserved_at_180[0x80]; + + u8 memic_operations[0x20]; + + u8 reserved_at_220[0x5e0]; +enum { + mlx5_modify_memic_op_mod_alloc, + mlx5_modify_memic_op_mod_dealloc, +}; + +struct mlx5_ifc_modify_memic_in_bits { + u8 opcode[0x10]; + u8 uid[0x10]; + + u8 reserved_at_20[0x10]; + u8 op_mod[0x10]; + + u8 reserved_at_40[0x20]; + + u8 reserved_at_60[0x18]; + u8 memic_operation_type[0x8]; + + u8 memic_start_addr[0x40]; + + u8 reserved_at_c0[0x140]; +}; + +struct mlx5_ifc_modify_memic_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; + + u8 memic_operation_addr[0x40]; + + u8 reserved_at_c0[0x140]; +}; +
|
Networking
|
63f9c44bca5e10fb1fd86aee7e38039ed98f95cc
|
maor gottlieb
|
include
|
linux
|
mlx5
|
rdma/uverbs: make uverbs_object_methods to consider line number
|
in order to support multiple methods declaration in the same file we should use the line number as part of the name.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h']
| 1
| 1
| 1
|
--- diff --git a/include/rdma/uverbs_named_ioctl.h b/include/rdma/uverbs_named_ioctl.h --- a/include/rdma/uverbs_named_ioctl.h +++ b/include/rdma/uverbs_named_ioctl.h -#define uverbs_object_methods(object_id) _object_methods_##object_id +#define uverbs_object_methods(object_id) _uverbs_name(_object_methods_##object_id, __line__)
|
Networking
|
7ca2b8a378ca0d4ce52edc63d6b160467d8a10c1
|
maor gottlieb
|
include
|
rdma
| |
rdma/mlx5: move all dm logic to separate file
|
move all device memory related code to a separate file.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c', 'makefile']
| 8
| 388
| 362
|
--- diff --git a/drivers/infiniband/hw/mlx5/makefile b/drivers/infiniband/hw/mlx5/makefile --- a/drivers/infiniband/hw/mlx5/makefile +++ b/drivers/infiniband/hw/mlx5/makefile + dm.o \ diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c --- a/drivers/infiniband/hw/mlx5/cmd.c +++ b/drivers/infiniband/hw/mlx5/cmd.c -int mlx5_cmd_alloc_memic(struct mlx5_dm *dm, phys_addr_t *addr, - u64 length, u32 alignment) -{ - struct mlx5_core_dev *dev = dm->dev; - u64 num_memic_hw_pages = mlx5_cap_dev_mem(dev, memic_bar_size) - >> page_shift; - u64 hw_start_addr = mlx5_cap64_dev_mem(dev, memic_bar_start_addr); - u32 max_alignment = mlx5_cap_dev_mem(dev, log_max_memic_addr_alignment); - u32 num_pages = div_round_up(length, page_size); - u32 out[mlx5_st_sz_dw(alloc_memic_out)] = {}; - u32 in[mlx5_st_sz_dw(alloc_memic_in)] = {}; - u32 mlx5_alignment; - u64 page_idx = 0; - int ret = 0; - - if (!length || (length & mlx5_memic_alloc_size_mask)) - return -einval; - - /* mlx5 device sets alignment as 64*2^driver_value - * so normalizing is needed. - */ - mlx5_alignment = (alignment < mlx5_memic_base_align) ? 0 : - alignment - mlx5_memic_base_align; - if (mlx5_alignment > max_alignment) - return -einval; - - mlx5_set(alloc_memic_in, in, opcode, mlx5_cmd_op_alloc_memic); - mlx5_set(alloc_memic_in, in, range_size, num_pages * page_size); - mlx5_set(alloc_memic_in, in, memic_size, length); - mlx5_set(alloc_memic_in, in, log_memic_addr_alignment, - mlx5_alignment); - - while (page_idx < num_memic_hw_pages) { - spin_lock(&dm->lock); - page_idx = bitmap_find_next_zero_area(dm->memic_alloc_pages, - num_memic_hw_pages, - page_idx, - num_pages, 0); - - if (page_idx < num_memic_hw_pages) - bitmap_set(dm->memic_alloc_pages, - page_idx, num_pages); - - spin_unlock(&dm->lock); - - if (page_idx >= num_memic_hw_pages) - break; - - mlx5_set64(alloc_memic_in, in, range_start_addr, - hw_start_addr + (page_idx * page_size)); - - ret = mlx5_cmd_exec_inout(dev, alloc_memic, in, out); - if (ret) { - spin_lock(&dm->lock); - bitmap_clear(dm->memic_alloc_pages, - page_idx, num_pages); - spin_unlock(&dm->lock); - - if (ret == -eagain) { - page_idx++; - continue; - } - - return ret; - } - - *addr = dev->bar_addr + - mlx5_get64(alloc_memic_out, out, memic_start_addr); - - return 0; - } - - return -enomem; -} - -void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr, u64 length) -{ - struct mlx5_core_dev *dev = dm->dev; - u64 hw_start_addr = mlx5_cap64_dev_mem(dev, memic_bar_start_addr); - u32 num_pages = div_round_up(length, page_size); - u32 in[mlx5_st_sz_dw(dealloc_memic_in)] = {}; - u64 start_page_idx; - int err; - - addr -= dev->bar_addr; - start_page_idx = (addr - hw_start_addr) >> page_shift; - - mlx5_set(dealloc_memic_in, in, opcode, mlx5_cmd_op_dealloc_memic); - mlx5_set64(dealloc_memic_in, in, memic_start_addr, addr); - mlx5_set(dealloc_memic_in, in, memic_size, length); - - err = mlx5_cmd_exec_in(dev, dealloc_memic, in); - if (err) - return; - - spin_lock(&dm->lock); - bitmap_clear(dm->memic_alloc_pages, - start_page_idx, num_pages); - spin_unlock(&dm->lock); -} - diff --git a/drivers/infiniband/hw/mlx5/cmd.h b/drivers/infiniband/hw/mlx5/cmd.h --- a/drivers/infiniband/hw/mlx5/cmd.h +++ b/drivers/infiniband/hw/mlx5/cmd.h -int mlx5_cmd_alloc_memic(struct mlx5_dm *dm, phys_addr_t *addr, - u64 length, u32 alignment); -void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr, u64 length); diff --git a/drivers/infiniband/hw/mlx5/dm.c b/drivers/infiniband/hw/mlx5/dm.c --- /dev/null +++ b/drivers/infiniband/hw/mlx5/dm.c +// spdx-license-identifier: gpl-2.0 or linux-openib +/* + * copyright (c) 2021, mellanox technologies inc. all rights reserved. + */ + +#include <rdma/uverbs_std_types.h> +#include "dm.h" + +#define uverbs_module_name mlx5_ib +#include <rdma/uverbs_named_ioctl.h> + +static int mlx5_cmd_alloc_memic(struct mlx5_dm *dm, phys_addr_t *addr, + u64 length, u32 alignment) +{ + struct mlx5_core_dev *dev = dm->dev; + u64 num_memic_hw_pages = mlx5_cap_dev_mem(dev, memic_bar_size) + >> page_shift; + u64 hw_start_addr = mlx5_cap64_dev_mem(dev, memic_bar_start_addr); + u32 max_alignment = mlx5_cap_dev_mem(dev, log_max_memic_addr_alignment); + u32 num_pages = div_round_up(length, page_size); + u32 out[mlx5_st_sz_dw(alloc_memic_out)] = {}; + u32 in[mlx5_st_sz_dw(alloc_memic_in)] = {}; + u32 mlx5_alignment; + u64 page_idx = 0; + int ret = 0; + + if (!length || (length & mlx5_memic_alloc_size_mask)) + return -einval; + + /* mlx5 device sets alignment as 64*2^driver_value + * so normalizing is needed. + */ + mlx5_alignment = (alignment < mlx5_memic_base_align) ? 0 : + alignment - mlx5_memic_base_align; + if (mlx5_alignment > max_alignment) + return -einval; + + mlx5_set(alloc_memic_in, in, opcode, mlx5_cmd_op_alloc_memic); + mlx5_set(alloc_memic_in, in, range_size, num_pages * page_size); + mlx5_set(alloc_memic_in, in, memic_size, length); + mlx5_set(alloc_memic_in, in, log_memic_addr_alignment, + mlx5_alignment); + + while (page_idx < num_memic_hw_pages) { + spin_lock(&dm->lock); + page_idx = bitmap_find_next_zero_area(dm->memic_alloc_pages, + num_memic_hw_pages, + page_idx, + num_pages, 0); + + if (page_idx < num_memic_hw_pages) + bitmap_set(dm->memic_alloc_pages, + page_idx, num_pages); + + spin_unlock(&dm->lock); + + if (page_idx >= num_memic_hw_pages) + break; + + mlx5_set64(alloc_memic_in, in, range_start_addr, + hw_start_addr + (page_idx * page_size)); + + ret = mlx5_cmd_exec_inout(dev, alloc_memic, in, out); + if (ret) { + spin_lock(&dm->lock); + bitmap_clear(dm->memic_alloc_pages, + page_idx, num_pages); + spin_unlock(&dm->lock); + + if (ret == -eagain) { + page_idx++; + continue; + } + + return ret; + } + + *addr = dev->bar_addr + + mlx5_get64(alloc_memic_out, out, memic_start_addr); + + return 0; + } + + return -enomem; +} + +void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr, + u64 length) +{ + struct mlx5_core_dev *dev = dm->dev; + u64 hw_start_addr = mlx5_cap64_dev_mem(dev, memic_bar_start_addr); + u32 num_pages = div_round_up(length, page_size); + u32 in[mlx5_st_sz_dw(dealloc_memic_in)] = {}; + u64 start_page_idx; + int err; + + addr -= dev->bar_addr; + start_page_idx = (addr - hw_start_addr) >> page_shift; + + mlx5_set(dealloc_memic_in, in, opcode, mlx5_cmd_op_dealloc_memic); + mlx5_set64(dealloc_memic_in, in, memic_start_addr, addr); + mlx5_set(dealloc_memic_in, in, memic_size, length); + + err = mlx5_cmd_exec_in(dev, dealloc_memic, in); + if (err) + return; + + spin_lock(&dm->lock); + bitmap_clear(dm->memic_alloc_pages, + start_page_idx, num_pages); + spin_unlock(&dm->lock); +} + +static int add_dm_mmap_entry(struct ib_ucontext *context, + struct mlx5_ib_dm *mdm, u64 address) +{ + mdm->mentry.mmap_flag = mlx5_ib_mmap_type_memic; + mdm->mentry.address = address; + return rdma_user_mmap_entry_insert_range( + context, &mdm->mentry.rdma_entry, mdm->size, + mlx5_ib_mmap_device_mem << 16, + (mlx5_ib_mmap_device_mem << 16) + (1ul << 16) - 1); +} + +static inline int check_dm_type_support(struct mlx5_ib_dev *dev, u32 type) +{ + switch (type) { + case mlx5_ib_uapi_dm_type_memic: + if (!mlx5_cap_dev_mem(dev->mdev, memic)) + return -eopnotsupp; + break; + case mlx5_ib_uapi_dm_type_steering_sw_icm: + case mlx5_ib_uapi_dm_type_header_modify_sw_icm: + if (!capable(cap_sys_rawio) || !capable(cap_net_raw)) + return -eperm; + + if (!(mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner) || + mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner) || + mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner_v2) || + mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner_v2))) + return -eopnotsupp; + break; + } + + return 0; +} + +static int handle_alloc_dm_memic(struct ib_ucontext *ctx, struct mlx5_ib_dm *dm, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs) +{ + struct mlx5_dm *dm_db = &to_mdev(ctx->device)->dm; + u64 start_offset; + u16 page_idx; + int err; + u64 address; + + dm->size = roundup(attr->length, mlx5_memic_base_size); + + err = mlx5_cmd_alloc_memic(dm_db, &dm->dev_addr, + dm->size, attr->alignment); + if (err) { + kfree(dm); + return err; + } + + address = dm->dev_addr & page_mask; + err = add_dm_mmap_entry(ctx, dm, address); + if (err) { + mlx5_cmd_dealloc_memic(dm_db, dm->dev_addr, dm->size); + kfree(dm); + return err; + } + + page_idx = dm->mentry.rdma_entry.start_pgoff & 0xffff; + err = uverbs_copy_to(attrs, + mlx5_ib_attr_alloc_dm_resp_page_index, + &page_idx, + sizeof(page_idx)); + if (err) + goto err_copy; + + start_offset = dm->dev_addr & ~page_mask; + err = uverbs_copy_to(attrs, + mlx5_ib_attr_alloc_dm_resp_start_offset, + &start_offset, sizeof(start_offset)); + if (err) + goto err_copy; + + return 0; + +err_copy: + rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); + + return err; +} + +static int handle_alloc_dm_sw_icm(struct ib_ucontext *ctx, + struct mlx5_ib_dm *dm, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs, int type) +{ + struct mlx5_core_dev *dev = to_mdev(ctx->device)->mdev; + u64 act_size; + int err; + + /* allocation size must a multiple of the basic block size + * and a power of 2. + */ + act_size = round_up(attr->length, mlx5_sw_icm_block_size(dev)); + act_size = roundup_pow_of_two(act_size); + + dm->size = act_size; + err = mlx5_dm_sw_icm_alloc(dev, type, act_size, attr->alignment, + to_mucontext(ctx)->devx_uid, &dm->dev_addr, + &dm->icm_dm.obj_id); + if (err) + return err; + + err = uverbs_copy_to(attrs, mlx5_ib_attr_alloc_dm_resp_start_offset, + &dm->dev_addr, sizeof(dm->dev_addr)); + if (err) + mlx5_dm_sw_icm_dealloc(dev, type, dm->size, + to_mucontext(ctx)->devx_uid, + dm->dev_addr, dm->icm_dm.obj_id); + + return err; +} + +struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev, + struct ib_ucontext *context, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs) +{ + struct mlx5_ib_dm *dm; + enum mlx5_ib_uapi_dm_type type; + int err; + + err = uverbs_get_const_default(&type, attrs, + mlx5_ib_attr_alloc_dm_req_type, + mlx5_ib_uapi_dm_type_memic); + if (err) + return err_ptr(err); + + mlx5_ib_dbg(to_mdev(ibdev), "alloc_dm req: dm_type=%d user_length=0x%llx log_alignment=%d ", + type, attr->length, attr->alignment); + + err = check_dm_type_support(to_mdev(ibdev), type); + if (err) + return err_ptr(err); + + dm = kzalloc(sizeof(*dm), gfp_kernel); + if (!dm) + return err_ptr(-enomem); + + dm->type = type; + + switch (type) { + case mlx5_ib_uapi_dm_type_memic: + err = handle_alloc_dm_memic(context, dm, + attr, + attrs); + break; + case mlx5_ib_uapi_dm_type_steering_sw_icm: + err = handle_alloc_dm_sw_icm(context, dm, + attr, attrs, + mlx5_sw_icm_type_steering); + break; + case mlx5_ib_uapi_dm_type_header_modify_sw_icm: + err = handle_alloc_dm_sw_icm(context, dm, + attr, attrs, + mlx5_sw_icm_type_header_modify); + break; + default: + err = -eopnotsupp; + } + + if (err) + goto err_free; + + return &dm->ibdm; + +err_free: + kfree(dm); + return err_ptr(err); +} + +int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs) +{ + struct mlx5_ib_ucontext *ctx = rdma_udata_to_drv_context( + &attrs->driver_udata, struct mlx5_ib_ucontext, ibucontext); + struct mlx5_core_dev *dev = to_mdev(ibdm->device)->mdev; + struct mlx5_ib_dm *dm = to_mdm(ibdm); + int ret; + + switch (dm->type) { + case mlx5_ib_uapi_dm_type_memic: + rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); + return 0; + case mlx5_ib_uapi_dm_type_steering_sw_icm: + ret = mlx5_dm_sw_icm_dealloc(dev, mlx5_sw_icm_type_steering, + dm->size, ctx->devx_uid, + dm->dev_addr, dm->icm_dm.obj_id); + if (ret) + return ret; + break; + case mlx5_ib_uapi_dm_type_header_modify_sw_icm: + ret = mlx5_dm_sw_icm_dealloc(dev, + mlx5_sw_icm_type_header_modify, + dm->size, ctx->devx_uid, + dm->dev_addr, dm->icm_dm.obj_id); + if (ret) + return ret; + break; + default: + return -eopnotsupp; + } + + kfree(dm); + + return 0; +} + +add_uverbs_attributes_simple( + mlx5_ib_dm, uverbs_object_dm, uverbs_method_dm_alloc, + uverbs_attr_ptr_out(mlx5_ib_attr_alloc_dm_resp_start_offset, + uverbs_attr_type(u64), ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_alloc_dm_resp_page_index, + uverbs_attr_type(u16), ua_optional), + uverbs_attr_const_in(mlx5_ib_attr_alloc_dm_req_type, + enum mlx5_ib_uapi_dm_type, ua_optional)); + +const struct uapi_definition mlx5_ib_dm_defs[] = { + uapi_def_chain_obj_tree(uverbs_object_dm, &mlx5_ib_dm), + {}, +}; + +const struct ib_device_ops mlx5_ib_dev_dm_ops = { + .alloc_dm = mlx5_ib_alloc_dm, + .dealloc_dm = mlx5_ib_dealloc_dm, + .reg_dm_mr = mlx5_ib_reg_dm_mr, +}; diff --git a/drivers/infiniband/hw/mlx5/dm.h b/drivers/infiniband/hw/mlx5/dm.h --- /dev/null +++ b/drivers/infiniband/hw/mlx5/dm.h +/* spdx-license-identifier: gpl-2.0 or linux-openib */ +/* + * copyright (c) 2021, mellanox technologies inc. all rights reserved. + */ + +#ifndef _mlx5_ib_dm_h +#define _mlx5_ib_dm_h + +#include "mlx5_ib.h" + + +extern const struct ib_device_ops mlx5_ib_dev_dm_ops; +extern const struct uapi_definition mlx5_ib_dm_defs[]; + +struct mlx5_ib_dm { + struct ib_dm ibdm; + phys_addr_t dev_addr; + u32 type; + size_t size; + union { + struct { + u32 obj_id; + } icm_dm; + /* other dm types specific params should be added here */ + }; + struct mlx5_user_mmap_entry mentry; +}; + +static inline struct mlx5_ib_dm *to_mdm(struct ib_dm *ibdm) +{ + return container_of(ibdm, struct mlx5_ib_dm, ibdm); +} + +struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev, + struct ib_ucontext *context, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs); +int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs); +void mlx5_cmd_dealloc_memic(struct mlx5_dm *dm, phys_addr_t addr, + u64 length); + +#endif /* _mlx5_ib_dm_h */ diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c +#include "dm.h" -static int add_dm_mmap_entry(struct ib_ucontext *context, - struct mlx5_ib_dm *mdm, - u64 address) -{ - mdm->mentry.mmap_flag = mlx5_ib_mmap_type_memic; - mdm->mentry.address = address; - return rdma_user_mmap_entry_insert_range( - context, &mdm->mentry.rdma_entry, - mdm->size, - mlx5_ib_mmap_device_mem << 16, - (mlx5_ib_mmap_device_mem << 16) + (1ul << 16) - 1); -} - -static inline int check_dm_type_support(struct mlx5_ib_dev *dev, - u32 type) -{ - switch (type) { - case mlx5_ib_uapi_dm_type_memic: - if (!mlx5_cap_dev_mem(dev->mdev, memic)) - return -eopnotsupp; - break; - case mlx5_ib_uapi_dm_type_steering_sw_icm: - case mlx5_ib_uapi_dm_type_header_modify_sw_icm: - if (!capable(cap_sys_rawio) || - !capable(cap_net_raw)) - return -eperm; - - if (!(mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner) || - mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner) || - mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner_v2) || - mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner_v2))) - return -eopnotsupp; - break; - } - - return 0; -} - -static int handle_alloc_dm_memic(struct ib_ucontext *ctx, - struct mlx5_ib_dm *dm, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs) -{ - struct mlx5_dm *dm_db = &to_mdev(ctx->device)->dm; - u64 start_offset; - u16 page_idx; - int err; - u64 address; - - dm->size = roundup(attr->length, mlx5_memic_base_size); - - err = mlx5_cmd_alloc_memic(dm_db, &dm->dev_addr, - dm->size, attr->alignment); - if (err) - return err; - - address = dm->dev_addr & page_mask; - err = add_dm_mmap_entry(ctx, dm, address); - if (err) - goto err_dealloc; - - page_idx = dm->mentry.rdma_entry.start_pgoff & 0xffff; - err = uverbs_copy_to(attrs, - mlx5_ib_attr_alloc_dm_resp_page_index, - &page_idx, - sizeof(page_idx)); - if (err) - goto err_copy; - - start_offset = dm->dev_addr & ~page_mask; - err = uverbs_copy_to(attrs, - mlx5_ib_attr_alloc_dm_resp_start_offset, - &start_offset, sizeof(start_offset)); - if (err) - goto err_copy; - - return 0; - -err_copy: - rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); -err_dealloc: - mlx5_cmd_dealloc_memic(dm_db, dm->dev_addr, dm->size); - - return err; -} - -static int handle_alloc_dm_sw_icm(struct ib_ucontext *ctx, - struct mlx5_ib_dm *dm, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs, - int type) -{ - struct mlx5_core_dev *dev = to_mdev(ctx->device)->mdev; - u64 act_size; - int err; - - /* allocation size must a multiple of the basic block size - * and a power of 2. - */ - act_size = round_up(attr->length, mlx5_sw_icm_block_size(dev)); - act_size = roundup_pow_of_two(act_size); - - dm->size = act_size; - err = mlx5_dm_sw_icm_alloc(dev, type, act_size, attr->alignment, - to_mucontext(ctx)->devx_uid, &dm->dev_addr, - &dm->icm_dm.obj_id); - if (err) - return err; - - err = uverbs_copy_to(attrs, - mlx5_ib_attr_alloc_dm_resp_start_offset, - &dm->dev_addr, sizeof(dm->dev_addr)); - if (err) - mlx5_dm_sw_icm_dealloc(dev, type, dm->size, - to_mucontext(ctx)->devx_uid, dm->dev_addr, - dm->icm_dm.obj_id); - - return err; -} - -struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev, - struct ib_ucontext *context, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs) -{ - struct mlx5_ib_dm *dm; - enum mlx5_ib_uapi_dm_type type; - int err; - - err = uverbs_get_const_default(&type, attrs, - mlx5_ib_attr_alloc_dm_req_type, - mlx5_ib_uapi_dm_type_memic); - if (err) - return err_ptr(err); - - mlx5_ib_dbg(to_mdev(ibdev), "alloc_dm req: dm_type=%d user_length=0x%llx log_alignment=%d ", - type, attr->length, attr->alignment); - - err = check_dm_type_support(to_mdev(ibdev), type); - if (err) - return err_ptr(err); - - dm = kzalloc(sizeof(*dm), gfp_kernel); - if (!dm) - return err_ptr(-enomem); - - dm->type = type; - - switch (type) { - case mlx5_ib_uapi_dm_type_memic: - err = handle_alloc_dm_memic(context, dm, - attr, - attrs); - break; - case mlx5_ib_uapi_dm_type_steering_sw_icm: - err = handle_alloc_dm_sw_icm(context, dm, - attr, attrs, - mlx5_sw_icm_type_steering); - break; - case mlx5_ib_uapi_dm_type_header_modify_sw_icm: - err = handle_alloc_dm_sw_icm(context, dm, - attr, attrs, - mlx5_sw_icm_type_header_modify); - break; - default: - err = -eopnotsupp; - } - - if (err) - goto err_free; - - return &dm->ibdm; - -err_free: - kfree(dm); - return err_ptr(err); -} - -int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs) -{ - struct mlx5_ib_ucontext *ctx = rdma_udata_to_drv_context( - &attrs->driver_udata, struct mlx5_ib_ucontext, ibucontext); - struct mlx5_core_dev *dev = to_mdev(ibdm->device)->mdev; - struct mlx5_ib_dm *dm = to_mdm(ibdm); - int ret; - - switch (dm->type) { - case mlx5_ib_uapi_dm_type_memic: - rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); - return 0; - case mlx5_ib_uapi_dm_type_steering_sw_icm: - ret = mlx5_dm_sw_icm_dealloc(dev, mlx5_sw_icm_type_steering, - dm->size, ctx->devx_uid, dm->dev_addr, - dm->icm_dm.obj_id); - if (ret) - return ret; - break; - case mlx5_ib_uapi_dm_type_header_modify_sw_icm: - ret = mlx5_dm_sw_icm_dealloc(dev, mlx5_sw_icm_type_header_modify, - dm->size, ctx->devx_uid, dm->dev_addr, - dm->icm_dm.obj_id); - if (ret) - return ret; - break; - default: - return -eopnotsupp; - } - - kfree(dm); - - return 0; -} - -add_uverbs_attributes_simple( - mlx5_ib_dm, - uverbs_object_dm, - uverbs_method_dm_alloc, - uverbs_attr_ptr_out(mlx5_ib_attr_alloc_dm_resp_start_offset, - uverbs_attr_type(u64), - ua_mandatory), - uverbs_attr_ptr_out(mlx5_ib_attr_alloc_dm_resp_page_index, - uverbs_attr_type(u16), - ua_optional), - uverbs_attr_const_in(mlx5_ib_attr_alloc_dm_req_type, - enum mlx5_ib_uapi_dm_type, - ua_optional)); - + uapi_def_chain(mlx5_ib_dm_defs), - uapi_def_chain_obj_tree(uverbs_object_dm, &mlx5_ib_dm), -static const struct ib_device_ops mlx5_ib_dev_dm_ops = { - .alloc_dm = mlx5_ib_alloc_dm, - .dealloc_dm = mlx5_ib_dealloc_dm, - .reg_dm_mr = mlx5_ib_reg_dm_mr, -}; - diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h -struct mlx5_ib_dm { - struct ib_dm ibdm; - phys_addr_t dev_addr; - u32 type; - size_t size; - union { - struct { - u32 obj_id; - } icm_dm; - /* other dm types specific params should be added here */ - }; - struct mlx5_user_mmap_entry mentry; -}; - -static inline struct mlx5_ib_dm *to_mdm(struct ib_dm *ibdm) -{ - return container_of(ibdm, struct mlx5_ib_dm, ibdm); -} - -struct ib_dm *mlx5_ib_alloc_dm(struct ib_device *ibdev, - struct ib_ucontext *context, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs); -int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs); diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c +#include "dm.h"
|
Networking
|
831df88381f73bca0f5624b69ab985cac3d036bc
|
maor gottlieb
|
drivers
|
infiniband
|
hw, mlx5
|
rdma/mlx5: re-organize the dm code
|
1. inline the checks from check_dm_type_support() into their respective allocation functions. 2. fix use after free when driver fails to copy the memic address to the user by moving the allocation code into their respective functions, hence we avoid the explicit call to free the dm in the error flow. 3. split mlx5_ib_dm struct to memic and icm proper typesafety throughout.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 3
| 114
| 116
|
--- diff --git a/drivers/infiniband/hw/mlx5/dm.c b/drivers/infiniband/hw/mlx5/dm.c --- a/drivers/infiniband/hw/mlx5/dm.c +++ b/drivers/infiniband/hw/mlx5/dm.c - struct mlx5_ib_dm *mdm, u64 address) + struct mlx5_ib_dm_memic *mdm, u64 address) - context, &mdm->mentry.rdma_entry, mdm->size, + context, &mdm->mentry.rdma_entry, mdm->base.size, -static inline int check_dm_type_support(struct mlx5_ib_dev *dev, u32 type) -{ - switch (type) { - case mlx5_ib_uapi_dm_type_memic: - if (!mlx5_cap_dev_mem(dev->mdev, memic)) - return -eopnotsupp; - break; - case mlx5_ib_uapi_dm_type_steering_sw_icm: - case mlx5_ib_uapi_dm_type_header_modify_sw_icm: - if (!capable(cap_sys_rawio) || !capable(cap_net_raw)) - return -eperm; - - if (!(mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner) || - mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner) || - mlx5_cap_flowtable_nic_rx(dev->mdev, sw_owner_v2) || - mlx5_cap_flowtable_nic_tx(dev->mdev, sw_owner_v2))) - return -eopnotsupp; - break; - } - - return 0; -} - -static int handle_alloc_dm_memic(struct ib_ucontext *ctx, struct mlx5_ib_dm *dm, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs) +static struct ib_dm *handle_alloc_dm_memic(struct ib_ucontext *ctx, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs) + struct mlx5_ib_dm_memic *dm; - dm->size = roundup(attr->length, mlx5_memic_base_size); + if (!mlx5_cap_dev_mem(dm_db->dev, memic)) + return err_ptr(-eopnotsupp); + + dm = kzalloc(sizeof(*dm), gfp_kernel); + if (!dm) + return err_ptr(-enomem); + + dm->base.type = mlx5_ib_uapi_dm_type_memic; + dm->base.size = roundup(attr->length, mlx5_memic_base_size); - err = mlx5_cmd_alloc_memic(dm_db, &dm->dev_addr, - dm->size, attr->alignment); + err = mlx5_cmd_alloc_memic(dm_db, &dm->base.dev_addr, + dm->base.size, attr->alignment); - return err; + return err_ptr(err); - address = dm->dev_addr & page_mask; + address = dm->base.dev_addr & page_mask; - mlx5_cmd_dealloc_memic(dm_db, dm->dev_addr, dm->size); + mlx5_cmd_dealloc_memic(dm_db, dm->base.dev_addr, dm->base.size); - return err; + return err_ptr(err); - start_offset = dm->dev_addr & ~page_mask; + start_offset = dm->base.dev_addr & ~page_mask; - return 0; + return &dm->base.ibdm; - - return err; + return err_ptr(err); -static int handle_alloc_dm_sw_icm(struct ib_ucontext *ctx, - struct mlx5_ib_dm *dm, - struct ib_dm_alloc_attr *attr, - struct uverbs_attr_bundle *attrs, int type) +static struct ib_dm *handle_alloc_dm_sw_icm(struct ib_ucontext *ctx, + struct ib_dm_alloc_attr *attr, + struct uverbs_attr_bundle *attrs, + int type) + struct mlx5_ib_dm_icm *dm; + dm = kzalloc(sizeof(*dm), gfp_kernel); + if (!dm) + return err_ptr(-enomem); + + dm->base.type = type; + + if (!capable(cap_sys_rawio) || !capable(cap_net_raw)) { + err = -eperm; + goto free; + } + + if (!(mlx5_cap_flowtable_nic_rx(dev, sw_owner) || + mlx5_cap_flowtable_nic_tx(dev, sw_owner) || + mlx5_cap_flowtable_nic_rx(dev, sw_owner_v2) || + mlx5_cap_flowtable_nic_tx(dev, sw_owner_v2))) { + err = -eopnotsupp; + goto free; + } + - dm->size = act_size; + dm->base.size = act_size; - to_mucontext(ctx)->devx_uid, &dm->dev_addr, - &dm->icm_dm.obj_id); + to_mucontext(ctx)->devx_uid, + &dm->base.dev_addr, &dm->obj_id); - return err; + goto free; - &dm->dev_addr, sizeof(dm->dev_addr)); - if (err) - mlx5_dm_sw_icm_dealloc(dev, type, dm->size, + &dm->base.dev_addr, sizeof(dm->base.dev_addr)); + if (err) { + mlx5_dm_sw_icm_dealloc(dev, type, dm->base.size, - dm->dev_addr, dm->icm_dm.obj_id); - - return err; + dm->base.dev_addr, dm->obj_id); + goto free; + } + return &dm->base.ibdm; +free: + kfree(dm); + return err_ptr(err); - struct mlx5_ib_dm *dm; - err = check_dm_type_support(to_mdev(ibdev), type); - if (err) - return err_ptr(err); - - dm = kzalloc(sizeof(*dm), gfp_kernel); - if (!dm) - return err_ptr(-enomem); - - dm->type = type; - - err = handle_alloc_dm_memic(context, dm, - attr, - attrs); - break; + return handle_alloc_dm_memic(context, attr, attrs); - err = handle_alloc_dm_sw_icm(context, dm, - attr, attrs, + return handle_alloc_dm_sw_icm(context, attr, attrs, - break; - err = handle_alloc_dm_sw_icm(context, dm, - attr, attrs, - mlx5_sw_icm_type_header_modify); - break; + return handle_alloc_dm_sw_icm(context, attr, attrs, + mlx5_sw_icm_type_header_modify); - err = -eopnotsupp; + return err_ptr(-eopnotsupp); +} - if (err) - goto err_free; +static void mlx5_dm_memic_dealloc(struct mlx5_ib_dm_memic *dm) +{ + rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); +} - return &dm->ibdm; +static int mlx5_dm_icm_dealloc(struct mlx5_ib_ucontext *ctx, + struct mlx5_ib_dm_icm *dm) +{ + enum mlx5_sw_icm_type type = + dm->base.type == mlx5_ib_uapi_dm_type_steering_sw_icm ? + mlx5_sw_icm_type_steering : + mlx5_sw_icm_type_header_modify; + struct mlx5_core_dev *dev = to_mdev(dm->base.ibdm.device)->mdev; + int err; -err_free: - kfree(dm); - return err_ptr(err); + err = mlx5_dm_sw_icm_dealloc(dev, type, dm->base.size, ctx->devx_uid, + dm->base.dev_addr, dm->obj_id); + if (!err) + kfree(dm); + return 0; -int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs) +static int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, + struct uverbs_attr_bundle *attrs) - struct mlx5_core_dev *dev = to_mdev(ibdm->device)->mdev; - int ret; - rdma_user_mmap_entry_remove(&dm->mentry.rdma_entry); + mlx5_dm_memic_dealloc(to_memic(ibdm)); - ret = mlx5_dm_sw_icm_dealloc(dev, mlx5_sw_icm_type_steering, - dm->size, ctx->devx_uid, - dm->dev_addr, dm->icm_dm.obj_id); - if (ret) - return ret; - break; - ret = mlx5_dm_sw_icm_dealloc(dev, - mlx5_sw_icm_type_header_modify, - dm->size, ctx->devx_uid, - dm->dev_addr, dm->icm_dm.obj_id); - if (ret) - return ret; - break; + return mlx5_dm_icm_dealloc(ctx, to_icm(ibdm)); - - kfree(dm); - - return 0; diff --git a/drivers/infiniband/hw/mlx5/dm.h b/drivers/infiniband/hw/mlx5/dm.h --- a/drivers/infiniband/hw/mlx5/dm.h +++ b/drivers/infiniband/hw/mlx5/dm.h - - phys_addr_t dev_addr; + phys_addr_t dev_addr; - union { - struct { - u32 obj_id; - } icm_dm; - /* other dm types specific params should be added here */ - }; +}; + +struct mlx5_ib_dm_memic { + struct mlx5_ib_dm base; +struct mlx5_ib_dm_icm { + struct mlx5_ib_dm base; + u32 obj_id; +}; + +static inline struct mlx5_ib_dm_memic *to_memic(struct ib_dm *ibdm) +{ + return container_of(ibdm, struct mlx5_ib_dm_memic, base.ibdm); +} + +static inline struct mlx5_ib_dm_icm *to_icm(struct ib_dm *ibdm) +{ + return container_of(ibdm, struct mlx5_ib_dm_icm, base.ibdm); +} + -int mlx5_ib_dealloc_dm(struct ib_dm *ibdm, struct uverbs_attr_bundle *attrs); diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c - struct mlx5_ib_dm *mdm; + struct mlx5_ib_dm_memic *mdm; - mdm = container_of(mentry, struct mlx5_ib_dm, mentry); - mlx5_cmd_dealloc_memic(&dev->dm, mdm->dev_addr, - mdm->size); + mdm = container_of(mentry, struct mlx5_ib_dm_memic, mentry); + mlx5_cmd_dealloc_memic(&dev->dm, mdm->base.dev_addr, + mdm->base.size);
|
Networking
|
251b9d7887505d67dbe5089f78ad5f8d610b2c2f
|
maor gottlieb
|
drivers
|
infiniband
|
hw, mlx5
|
rdma/mlx5: add support to modify_memic command
|
add two functions to allocate and deallocate memic operations by using the modify_memic command.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 2
| 38
| 0
|
--- diff --git a/drivers/infiniband/hw/mlx5/dm.c b/drivers/infiniband/hw/mlx5/dm.c --- a/drivers/infiniband/hw/mlx5/dm.c +++ b/drivers/infiniband/hw/mlx5/dm.c +void mlx5_cmd_dealloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr, + u8 operation) +{ + u32 in[mlx5_st_sz_dw(modify_memic_in)] = {}; + struct mlx5_core_dev *dev = dm->dev; + + mlx5_set(modify_memic_in, in, opcode, mlx5_cmd_op_modify_memic); + mlx5_set(modify_memic_in, in, op_mod, mlx5_modify_memic_op_mod_dealloc); + mlx5_set(modify_memic_in, in, memic_operation_type, operation); + mlx5_set64(modify_memic_in, in, memic_start_addr, addr - dev->bar_addr); + + mlx5_cmd_exec_in(dev, modify_memic, in); +} + +static int mlx5_cmd_alloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr, + u8 operation, phys_addr_t *op_addr) +{ + u32 out[mlx5_st_sz_dw(modify_memic_out)] = {}; + u32 in[mlx5_st_sz_dw(modify_memic_in)] = {}; + struct mlx5_core_dev *dev = dm->dev; + int err; + + mlx5_set(modify_memic_in, in, opcode, mlx5_cmd_op_modify_memic); + mlx5_set(modify_memic_in, in, op_mod, mlx5_modify_memic_op_mod_alloc); + mlx5_set(modify_memic_in, in, memic_operation_type, operation); + mlx5_set64(modify_memic_in, in, memic_start_addr, addr - dev->bar_addr); + + err = mlx5_cmd_exec_inout(dev, modify_memic, in, out); + if (err) + return err; + + *op_addr = dev->bar_addr + + mlx5_get64(modify_memic_out, out, memic_operation_addr); + return 0; +} + diff --git a/drivers/infiniband/hw/mlx5/dm.h b/drivers/infiniband/hw/mlx5/dm.h --- a/drivers/infiniband/hw/mlx5/dm.h +++ b/drivers/infiniband/hw/mlx5/dm.h +void mlx5_cmd_dealloc_memic_op(struct mlx5_dm *dm, phys_addr_t addr, + u8 operation);
|
Networking
|
39cc792ff2e8d7814b322547514ef1e3ce5c36a5
|
maor gottlieb
|
drivers
|
infiniband
|
hw, mlx5
|
rdma/mlx5: add support in memic operations
|
memic buffer, in addition to regular read and write operations, can support atomic operations from the host.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 5
| 209
| 14
|
--- diff --git a/drivers/infiniband/hw/mlx5/dm.c b/drivers/infiniband/hw/mlx5/dm.c --- a/drivers/infiniband/hw/mlx5/dm.c +++ b/drivers/infiniband/hw/mlx5/dm.c - struct mlx5_ib_dm_memic *mdm, u64 address) + struct mlx5_user_mmap_entry *mentry, u8 mmap_flag, + size_t size, u64 address) - mdm->mentry.mmap_flag = mlx5_ib_mmap_type_memic; - mdm->mentry.address = address; + mentry->mmap_flag = mmap_flag; + mentry->address = address; + - context, &mdm->mentry.rdma_entry, mdm->base.size, + context, &mentry->rdma_entry, size, +static void mlx5_ib_dm_memic_free(struct kref *kref) +{ + struct mlx5_ib_dm_memic *dm = + container_of(kref, struct mlx5_ib_dm_memic, ref); + struct mlx5_ib_dev *dev = to_mdev(dm->base.ibdm.device); + + mlx5_cmd_dealloc_memic(&dev->dm, dm->base.dev_addr, dm->base.size); + kfree(dm); +} + +static int copy_op_to_user(struct mlx5_ib_dm_op_entry *op_entry, + struct uverbs_attr_bundle *attrs) +{ + u64 start_offset; + u16 page_idx; + int err; + + page_idx = op_entry->mentry.rdma_entry.start_pgoff & 0xffff; + start_offset = op_entry->op_addr & ~page_mask; + err = uverbs_copy_to(attrs, mlx5_ib_attr_dm_map_op_addr_resp_page_index, + &page_idx, sizeof(page_idx)); + if (err) + return err; + + return uverbs_copy_to(attrs, + mlx5_ib_attr_dm_map_op_addr_resp_start_offset, + &start_offset, sizeof(start_offset)); +} + +static int map_existing_op(struct mlx5_ib_dm_memic *dm, u8 op, + struct uverbs_attr_bundle *attrs) +{ + struct mlx5_ib_dm_op_entry *op_entry; + + op_entry = xa_load(&dm->ops, op); + if (!op_entry) + return -enoent; + + return copy_op_to_user(op_entry, attrs); +} + +static int uverbs_handler(mlx5_ib_method_dm_map_op_addr)( + struct uverbs_attr_bundle *attrs) +{ + struct ib_uobject *uobj = uverbs_attr_get_uobject( + attrs, mlx5_ib_attr_dm_map_op_addr_req_handle); + struct mlx5_ib_dev *dev = to_mdev(uobj->context->device); + struct ib_dm *ibdm = uobj->object; + struct mlx5_ib_dm_memic *dm = to_memic(ibdm); + struct mlx5_ib_dm_op_entry *op_entry; + int err; + u8 op; + + err = uverbs_copy_from(&op, attrs, mlx5_ib_attr_dm_map_op_addr_req_op); + if (err) + return err; + + if (!(mlx5_cap_dev_mem(dev->mdev, memic_operations) & bit(op))) + return -eopnotsupp; + + mutex_lock(&dm->ops_xa_lock); + err = map_existing_op(dm, op, attrs); + if (!err || err != -enoent) + goto err_unlock; + + op_entry = kzalloc(sizeof(*op_entry), gfp_kernel); + if (!op_entry) + goto err_unlock; + + err = mlx5_cmd_alloc_memic_op(&dev->dm, dm->base.dev_addr, op, + &op_entry->op_addr); + if (err) { + kfree(op_entry); + goto err_unlock; + } + op_entry->op = op; + op_entry->dm = dm; + + err = add_dm_mmap_entry(uobj->context, &op_entry->mentry, + mlx5_ib_mmap_type_memic_op, dm->base.size, + op_entry->op_addr & page_mask); + if (err) { + mlx5_cmd_dealloc_memic_op(&dev->dm, dm->base.dev_addr, op); + kfree(op_entry); + goto err_unlock; + } + /* from this point, entry will be freed by mmap_free */ + kref_get(&dm->ref); + + err = copy_op_to_user(op_entry, attrs); + if (err) + goto err_remove; + + err = xa_insert(&dm->ops, op, op_entry, gfp_kernel); + if (err) + goto err_remove; + mutex_unlock(&dm->ops_xa_lock); + + return 0; + +err_remove: + rdma_user_mmap_entry_remove(&op_entry->mentry.rdma_entry); +err_unlock: + mutex_unlock(&dm->ops_xa_lock); + + return err; +} + + dm->base.ibdm.device = ctx->device; + + kref_init(&dm->ref); + xa_init(&dm->ops); + mutex_init(&dm->ops_xa_lock); - err = add_dm_mmap_entry(ctx, dm, address); + err = add_dm_mmap_entry(ctx, &dm->mentry, mlx5_ib_mmap_type_memic, + dm->base.size, address); - err = uverbs_copy_to(attrs, - mlx5_ib_attr_alloc_dm_resp_page_index, - &page_idx, - sizeof(page_idx)); + err = uverbs_copy_to(attrs, mlx5_ib_attr_alloc_dm_resp_page_index, + &page_idx, sizeof(page_idx)); + dm->base.ibdm.device = ctx->device; +static void dm_memic_remove_ops(struct mlx5_ib_dm_memic *dm) +{ + struct mlx5_ib_dm_op_entry *entry; + unsigned long idx; + + mutex_lock(&dm->ops_xa_lock); + xa_for_each(&dm->ops, idx, entry) { + xa_erase(&dm->ops, idx); + rdma_user_mmap_entry_remove(&entry->mentry.rdma_entry); + } + mutex_unlock(&dm->ops_xa_lock); +} + + dm_memic_remove_ops(dm); +void mlx5_ib_dm_mmap_free(struct mlx5_ib_dev *dev, + struct mlx5_user_mmap_entry *mentry) +{ + struct mlx5_ib_dm_op_entry *op_entry; + struct mlx5_ib_dm_memic *mdm; + + switch (mentry->mmap_flag) { + case mlx5_ib_mmap_type_memic: + mdm = container_of(mentry, struct mlx5_ib_dm_memic, mentry); + kref_put(&mdm->ref, mlx5_ib_dm_memic_free); + break; + case mlx5_ib_mmap_type_memic_op: + op_entry = container_of(mentry, struct mlx5_ib_dm_op_entry, + mentry); + mdm = op_entry->dm; + mlx5_cmd_dealloc_memic_op(&dev->dm, mdm->base.dev_addr, + op_entry->op); + kfree(op_entry); + kref_put(&mdm->ref, mlx5_ib_dm_memic_free); + break; + default: + warn_on(true); + } +} + +declare_uverbs_named_method( + mlx5_ib_method_dm_map_op_addr, + uverbs_attr_idr(mlx5_ib_attr_dm_map_op_addr_req_handle, + uverbs_object_dm, + uverbs_access_read, + ua_mandatory), + uverbs_attr_ptr_in(mlx5_ib_attr_dm_map_op_addr_req_op, + uverbs_attr_type(u8), + ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_dm_map_op_addr_resp_start_offset, + uverbs_attr_type(u64), + ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_dm_map_op_addr_resp_page_index, + uverbs_attr_type(u16), + ua_optional)); + +declare_uverbs_global_methods(uverbs_object_dm, + &uverbs_method(mlx5_ib_method_dm_map_op_addr)); + + uapi_def_chain_obj_tree_named(uverbs_object_dm), diff --git a/drivers/infiniband/hw/mlx5/dm.h b/drivers/infiniband/hw/mlx5/dm.h --- a/drivers/infiniband/hw/mlx5/dm.h +++ b/drivers/infiniband/hw/mlx5/dm.h +struct mlx5_ib_dm_op_entry { + struct mlx5_user_mmap_entry mentry; + phys_addr_t op_addr; + struct mlx5_ib_dm_memic *dm; + u8 op; +}; + + struct xarray ops; + struct mutex ops_xa_lock; + struct kref ref; +void mlx5_ib_dm_mmap_free(struct mlx5_ib_dev *dev, + struct mlx5_user_mmap_entry *mentry); diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c - struct mlx5_ib_dm_memic *mdm; - mdm = container_of(mentry, struct mlx5_ib_dm_memic, mentry); - mlx5_cmd_dealloc_memic(&dev->dm, mdm->base.dev_addr, - mdm->base.size); - kfree(mdm); + case mlx5_ib_mmap_type_memic_op: + mlx5_ib_dm_mmap_free(dev, mentry); diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h + mlx5_ib_mmap_type_memic_op = 5, diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h b/include/uapi/rdma/mlx5_user_ioctl_cmds.h --- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h +++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h +enum mlx5_ib_dm_methods { + mlx5_ib_method_dm_map_op_addr = (1u << uverbs_id_ns_shift), +}; + +enum mlx5_ib_dm_map_op_addr_attrs { + mlx5_ib_attr_dm_map_op_addr_req_handle = (1u << uverbs_id_ns_shift), + mlx5_ib_attr_dm_map_op_addr_req_op, + mlx5_ib_attr_dm_map_op_addr_resp_start_offset, + mlx5_ib_attr_dm_map_op_addr_resp_page_index, +}; +
|
Networking
|
cea85fa5dbc2e0206b58095c0c12ff035b11d129
|
maor gottlieb
|
drivers
|
infiniband
|
hw, mlx5, rdma
|
rdma/mlx5: expose uapi to query dm
|
expose uapi to query memic dm, this will let user space application that didn't allocate the dm but has access to by owning the matching command fd to retrieve its information.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add memic operations support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 3
| 55
| 1
|
--- diff --git a/drivers/infiniband/hw/mlx5/dm.c b/drivers/infiniband/hw/mlx5/dm.c --- a/drivers/infiniband/hw/mlx5/dm.c +++ b/drivers/infiniband/hw/mlx5/dm.c + dm->req_length = attr->length; +static int uverbs_handler(mlx5_ib_method_dm_query)( + struct uverbs_attr_bundle *attrs) +{ + struct ib_dm *ibdm = + uverbs_attr_get_obj(attrs, mlx5_ib_attr_query_dm_req_handle); + struct mlx5_ib_dm *dm = to_mdm(ibdm); + struct mlx5_ib_dm_memic *memic; + u64 start_offset; + u16 page_idx; + int err; + + if (dm->type != mlx5_ib_uapi_dm_type_memic) + return -eopnotsupp; + + memic = to_memic(ibdm); + page_idx = memic->mentry.rdma_entry.start_pgoff & 0xffff; + err = uverbs_copy_to(attrs, mlx5_ib_attr_query_dm_resp_page_index, + &page_idx, sizeof(page_idx)); + if (err) + return err; + + start_offset = memic->base.dev_addr & ~page_mask; + err = uverbs_copy_to(attrs, mlx5_ib_attr_query_dm_resp_start_offset, + &start_offset, sizeof(start_offset)); + if (err) + return err; + + return uverbs_copy_to(attrs, mlx5_ib_attr_query_dm_resp_length, + &memic->req_length, + sizeof(memic->req_length)); +} + +declare_uverbs_named_method( + mlx5_ib_method_dm_query, + uverbs_attr_idr(mlx5_ib_attr_query_dm_req_handle, uverbs_object_dm, + uverbs_access_read, ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_query_dm_resp_start_offset, + uverbs_attr_type(u64), ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_query_dm_resp_page_index, + uverbs_attr_type(u16), ua_mandatory), + uverbs_attr_ptr_out(mlx5_ib_attr_query_dm_resp_length, + uverbs_attr_type(u64), ua_mandatory)); + - &uverbs_method(mlx5_ib_method_dm_map_op_addr)); + &uverbs_method(mlx5_ib_method_dm_map_op_addr), + &uverbs_method(mlx5_ib_method_dm_query)); diff --git a/drivers/infiniband/hw/mlx5/dm.h b/drivers/infiniband/hw/mlx5/dm.h --- a/drivers/infiniband/hw/mlx5/dm.h +++ b/drivers/infiniband/hw/mlx5/dm.h + size_t req_length; diff --git a/include/uapi/rdma/mlx5_user_ioctl_cmds.h b/include/uapi/rdma/mlx5_user_ioctl_cmds.h --- a/include/uapi/rdma/mlx5_user_ioctl_cmds.h +++ b/include/uapi/rdma/mlx5_user_ioctl_cmds.h + mlx5_ib_method_dm_query, +enum mlx5_ib_query_dm_attrs { + mlx5_ib_attr_query_dm_req_handle = (1u << uverbs_id_ns_shift), + mlx5_ib_attr_query_dm_resp_start_offset, + mlx5_ib_attr_query_dm_resp_page_index, + mlx5_ib_attr_query_dm_resp_length, +}; +
|
Networking
|
18731642d4e1f73e446710389d3b01233d6fbc78
|
maor gottlieb
|
drivers
|
infiniband
|
hw, mlx5, rdma
|
net/mlx5: ct: add support for matching on ct_state inv and rel flags
|
add support for matching on ct_state inv and rel flags.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for matching on ct_state inv and rel flags
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'ct']
|
['c']
| 1
| 24
| 2
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +#define mlx5_ct_state_related_bit bit(5) +#define mlx5_ct_state_invalid_bit bit(6) + bool trk, est, untrk, unest, new, rpl, unrpl, rel, unrel, inv, uninv; - bool trk, est, untrk, unest, new, rpl, unrpl; - tca_flower_key_ct_flags_reply)) { + tca_flower_key_ct_flags_reply | + tca_flower_key_ct_flags_related | + tca_flower_key_ct_flags_invalid)) { + rel = ct_state_on & tca_flower_key_ct_flags_related; + inv = ct_state_on & tca_flower_key_ct_flags_invalid; + unrel = ct_state_off & tca_flower_key_ct_flags_related; + uninv = ct_state_off & tca_flower_key_ct_flags_invalid; + ctstate_mask |= unrel ? mlx5_ct_state_related_bit : 0; + ctstate_mask |= uninv ? mlx5_ct_state_invalid_bit : 0; + + if (rel) { + nl_set_err_msg_mod(extack, + "matching on ct_state +rel isn't supported"); + return -eopnotsupp; + } + + if (inv) { + nl_set_err_msg_mod(extack, + "matching on ct_state +inv isn't supported"); + return -eopnotsupp; + }
|
Networking
|
116c76c51035ec49af0894e8e8ad71334f9ad7aa
|
ariel levkovich
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5
|
net/mlx5: ct: add support for mirroring
|
add support for mirroring before the ct action by spliting the pre ct rule. mirror outputs are done first on the tc chain,prio table rule (the fwd rule), which will then forward to a per port fwd table. on this fwd table, we insert the original pre ct rule that forwards to ct/ct nat table.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for mirroring
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ', 'ct']
|
['c']
| 2
| 14
| 9
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c + /* splits were handled before ct */ + if (ct_priv->ns_type == mlx5_flow_namespace_fdb) + ct_flow->post_ct_attr->esw_attr->split_count = 0; + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c - return mlx5_tc_ct_flow_offload(get_ct_priv(flow->priv), + rule = mlx5_tc_ct_flow_offload(get_ct_priv(flow->priv), + } else { + rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr); - rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr); - mlx5_eswitch_del_offloaded_rule(esw, rule, attr); + if (flow_flag_test(flow, ct)) + mlx5_tc_ct_delete_flow(get_ct_priv(flow->priv), flow, attr); + else + mlx5_eswitch_del_offloaded_rule(esw, rule, attr); - if (flow->attr->esw_attr->split_count && ct_flow) { + if (flow->attr->esw_attr->split_count && ct_flow && + !mlx5_cap_gen(flow->attr->esw_attr->in_mdev, reg_c_preserve)) { + esw_attr->split_count = esw_attr->out_count; - if (attr->action & mlx5_flow_context_action_fwd_dest) { - nl_set_err_msg_mod(extack, - "mirroring goto chain rules isn't supported"); - return -eopnotsupp; - }
|
Networking
|
69e2916ebce4410c0f6ba6c59c4f6e9eb228e5ec
|
paul blakey roi dayan roid nvidia com
|
drivers
|
net
|
core, en, ethernet, mellanox, mlx5
|
net/mlx5: dr, add support for dynamic flex parser
|
flex parser is a hw parser that can support protocols that are not natively supported by the hca, such as geneve (tlv options) and gtp-u. there are 8 such parsers, and each of them can be assigned to parse a specific set of protocols. this patch adds misc4 match params which allows using a correct flex parser that was programmed to the required protocol.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dr, add support for dynamic flex parser
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 7
| 279
| 1
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +static bool dr_mask_is_flex_parser_id_0_3_set(u32 flex_parser_id, + u32 flex_parser_value) +{ + if (flex_parser_id) + return flex_parser_id <= dr_ste_max_flex_0_id; + + /* using flex_parser 0 means that id is zero, thus value must be set. */ + return flex_parser_value; +} + +static bool dr_mask_is_flex_parser_0_3_set(struct mlx5dr_match_misc4 *misc4) +{ + return (dr_mask_is_flex_parser_id_0_3_set(misc4->prog_sample_field_id_0, + misc4->prog_sample_field_value_0) || + dr_mask_is_flex_parser_id_0_3_set(misc4->prog_sample_field_id_1, + misc4->prog_sample_field_value_1) || + dr_mask_is_flex_parser_id_0_3_set(misc4->prog_sample_field_id_2, + misc4->prog_sample_field_value_2) || + dr_mask_is_flex_parser_id_0_3_set(misc4->prog_sample_field_id_3, + misc4->prog_sample_field_value_3)); +} + +static bool dr_mask_is_flex_parser_id_4_7_set(u32 flex_parser_id) +{ + return flex_parser_id > dr_ste_max_flex_0_id && + flex_parser_id <= dr_ste_max_flex_1_id; +} + +static bool dr_mask_is_flex_parser_4_7_set(struct mlx5dr_match_misc4 *misc4) +{ + return (dr_mask_is_flex_parser_id_4_7_set(misc4->prog_sample_field_id_0) || + dr_mask_is_flex_parser_id_4_7_set(misc4->prog_sample_field_id_1) || + dr_mask_is_flex_parser_id_4_7_set(misc4->prog_sample_field_id_2) || + dr_mask_is_flex_parser_id_4_7_set(misc4->prog_sample_field_id_3)); +} + + if (matcher->match_criteria & dr_matcher_criteria_misc4) + mask.misc4 = matcher->mask.misc4; + + + if (matcher->match_criteria & dr_matcher_criteria_misc4) { + if (dr_mask_is_flex_parser_0_3_set(&mask.misc4)) + mlx5dr_ste_build_flex_parser_0(ste_ctx, &sb[idx++], + &mask, false, rx); + + if (dr_mask_is_flex_parser_4_7_set(&mask.misc4)) + mlx5dr_ste_build_flex_parser_1(ste_ctx, &sb[idx++], + &mask, false, rx); + } + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c + + if (match_criteria & dr_matcher_criteria_misc4) { + s_idx = offsetof(struct mlx5dr_match_param, misc4); + e_idx = min(s_idx + sizeof(param->misc4), value_size); + + if (!dr_rule_cmp_value_to_mask(mask_p, param_p, s_idx, e_idx)) { + mlx5dr_err(matcher->tbl->dmn, + "rule misc4 parameters contains a value not specified by mask "); + return false; + } + } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +static void dr_ste_copy_mask_misc4(char *mask, struct mlx5dr_match_misc4 *spec) +{ + spec->prog_sample_field_id_0 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_id_0); + spec->prog_sample_field_value_0 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_value_0); + spec->prog_sample_field_id_1 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_id_1); + spec->prog_sample_field_value_1 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_value_1); + spec->prog_sample_field_id_2 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_id_2); + spec->prog_sample_field_value_2 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_value_2); + spec->prog_sample_field_id_3 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_id_3); + spec->prog_sample_field_value_3 = + mlx5_get(fte_match_set_misc4, mask, prog_sample_field_value_3); +} + + + param_location += sizeof(struct mlx5dr_match_misc3); + + if (match_criteria & dr_matcher_criteria_misc4) { + if (mask->match_sz < param_location + + sizeof(struct mlx5dr_match_misc4)) { + memcpy(tail_param, data + param_location, + mask->match_sz - param_location); + buff = tail_param; + } else { + buff = data + param_location; + } + dr_ste_copy_mask_misc4(buff, &set_param->misc4); + } +void mlx5dr_ste_build_flex_parser_0(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx) +{ + sb->rx = rx; + sb->inner = inner; + ste_ctx->build_flex_parser_0_init(sb, mask); +} + +void mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx) +{ + sb->rx = rx; + sb->inner = inner; + ste_ctx->build_flex_parser_1_init(sb, mask); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +static inline u8 * +dr_ste_calc_flex_parser_offset(u8 *tag, u8 parser_id) +{ + /* calculate tag byte offset based on flex parser id */ + return tag + 4 * (3 - (parser_id % 4)); +} + + void dr_ste_ctx_builder(flex_parser_0); + void dr_ste_ctx_builder(flex_parser_1); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +static void dr_ste_v0_set_flex_parser(u32 *misc4_field_id, + u32 *misc4_field_value, + bool *parser_is_used, + u8 *tag) +{ + u32 id = *misc4_field_id; + u8 *parser_ptr; + + if (parser_is_used[id]) + return; + + parser_is_used[id] = true; + parser_ptr = dr_ste_calc_flex_parser_offset(tag, id); + + *(__be32 *)parser_ptr = cpu_to_be32(*misc4_field_value); + *misc4_field_id = 0; + *misc4_field_value = 0; +} + +static int dr_ste_v0_build_flex_parser_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + u8 *tag) +{ + struct mlx5dr_match_misc4 *misc_4_mask = &value->misc4; + bool parser_is_used[dr_num_of_flex_parsers] = {}; + + dr_ste_v0_set_flex_parser(&misc_4_mask->prog_sample_field_id_0, + &misc_4_mask->prog_sample_field_value_0, + parser_is_used, tag); + + dr_ste_v0_set_flex_parser(&misc_4_mask->prog_sample_field_id_1, + &misc_4_mask->prog_sample_field_value_1, + parser_is_used, tag); + + dr_ste_v0_set_flex_parser(&misc_4_mask->prog_sample_field_id_2, + &misc_4_mask->prog_sample_field_value_2, + parser_is_used, tag); + + dr_ste_v0_set_flex_parser(&misc_4_mask->prog_sample_field_id_3, + &misc_4_mask->prog_sample_field_value_3, + parser_is_used, tag); + + return 0; +} + +static void dr_ste_v0_build_flex_parser_0_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + sb->lu_type = dr_ste_v0_lu_type_flex_parser_0; + dr_ste_v0_build_flex_parser_tag(mask, sb, sb->bit_mask); + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_flex_parser_tag; +} + +static void dr_ste_v0_build_flex_parser_1_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + sb->lu_type = dr_ste_v0_lu_type_flex_parser_1; + dr_ste_v0_build_flex_parser_tag(mask, sb, sb->bit_mask); + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_flex_parser_tag; +} + + .build_flex_parser_0_init = &dr_ste_v0_build_flex_parser_0_init, + .build_flex_parser_1_init = &dr_ste_v0_build_flex_parser_1_init, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +static void dr_ste_v1_set_flex_parser(u32 *misc4_field_id, + u32 *misc4_field_value, + bool *parser_is_used, + u8 *tag) +{ + u32 id = *misc4_field_id; + u8 *parser_ptr; + + if (parser_is_used[id]) + return; + + parser_is_used[id] = true; + parser_ptr = dr_ste_calc_flex_parser_offset(tag, id); + + *(__be32 *)parser_ptr = cpu_to_be32(*misc4_field_value); + *misc4_field_id = 0; + *misc4_field_value = 0; +} + +static int dr_ste_v1_build_felx_parser_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + u8 *tag) +{ + struct mlx5dr_match_misc4 *misc_4_mask = &value->misc4; + bool parser_is_used[dr_num_of_flex_parsers] = {}; + + dr_ste_v1_set_flex_parser(&misc_4_mask->prog_sample_field_id_0, + &misc_4_mask->prog_sample_field_value_0, + parser_is_used, tag); + + dr_ste_v1_set_flex_parser(&misc_4_mask->prog_sample_field_id_1, + &misc_4_mask->prog_sample_field_value_1, + parser_is_used, tag); + + dr_ste_v1_set_flex_parser(&misc_4_mask->prog_sample_field_id_2, + &misc_4_mask->prog_sample_field_value_2, + parser_is_used, tag); + + dr_ste_v1_set_flex_parser(&misc_4_mask->prog_sample_field_id_3, + &misc_4_mask->prog_sample_field_value_3, + parser_is_used, tag); + + return 0; +} + +static void dr_ste_v1_build_flex_parser_0_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + sb->lu_type = dr_ste_v1_lu_type_flex_parser_0; + dr_ste_v1_build_felx_parser_tag(mask, sb, sb->bit_mask); + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_felx_parser_tag; +} + +static void dr_ste_v1_build_flex_parser_1_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + sb->lu_type = dr_ste_v1_lu_type_flex_parser_1; + dr_ste_v1_build_felx_parser_tag(mask, sb, sb->bit_mask); + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_felx_parser_tag; +} + + .build_flex_parser_0_init = &dr_ste_v1_build_flex_parser_0_init, + .build_flex_parser_1_init = &dr_ste_v1_build_flex_parser_1_init, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +#define dr_num_of_flex_parsers 8 +#define dr_ste_max_flex_0_id 3 +#define dr_ste_max_flex_1_id 7 - dr_matcher_criteria_max = 1 << 5, + dr_matcher_criteria_misc4 = 1 << 5, + dr_matcher_criteria_max = 1 << 6, +void mlx5dr_ste_build_flex_parser_0(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx); +void mlx5dr_ste_build_flex_parser_1(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx); +struct mlx5dr_match_misc4 { + u32 prog_sample_field_value_0; + u32 prog_sample_field_id_0; + u32 prog_sample_field_value_1; + u32 prog_sample_field_id_1; + u32 prog_sample_field_value_2; + u32 prog_sample_field_id_2; + u32 prog_sample_field_value_3; + u32 prog_sample_field_id_3; +}; + + struct mlx5dr_match_misc4 misc4;
|
Networking
|
160e9cb37a8496edfe4ce74abe33ade103f59db2
|
yevgeny kliteynik
|
drivers
|
net
|
core, ethernet, mellanox, mlx5, steering
|
net/mlx5: dr, add support for force-loopback qp
|
when supported by the device, sw steering roce rc qp that is used to write/read to/from icm will be created with force-loopback attribute. such qp doesn't require gid index upon creation.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dr, add support for force-loopback qp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 4
| 77
| 7
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +static int dr_cmd_query_nic_vport_roce_en(struct mlx5_core_dev *mdev, + u16 vport, bool *roce_en) +{ + u32 out[mlx5_st_sz_dw(query_nic_vport_context_out)] = {}; + u32 in[mlx5_st_sz_dw(query_nic_vport_context_in)] = {}; + int err; + + mlx5_set(query_nic_vport_context_in, in, opcode, + mlx5_cmd_op_query_nic_vport_context); + mlx5_set(query_nic_vport_context_in, in, vport_number, vport); + mlx5_set(query_nic_vport_context_in, in, other_vport, !!vport); + + err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); + if (err) + return err; + + *roce_en = mlx5_get(query_nic_vport_context_out, out, + nic_vport_context.roce_en); + return 0; +} + + bool roce_en; + int err; + + if (mlx5_cap_gen(mdev, roce)) { + err = dr_cmd_query_nic_vport_roce_en(mdev, 0, &roce_en); + if (err) + return err; + + caps->roce_caps.roce_en = roce_en; + caps->roce_caps.fl_rc_qp_when_roce_disabled = + mlx5_cap_roce(mdev, fl_rc_qp_when_roce_disabled); + caps->roce_caps.fl_rc_qp_when_roce_enabled = + mlx5_cap_roce(mdev, fl_rc_qp_when_roce_enabled); + } + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c + u8 fl:1; + mlx5_set(qpc, qpc, primary_address_path.fl, attr->fl); +static bool dr_send_allow_fl(struct mlx5dr_cmd_caps *caps) +{ + /* check whether rc roce qp creation with force loopback is allowed. + * there are two separate capability bits for this: + * - force loopback when roce is enabled + * - force loopback when roce is disabled + */ + return ((caps->roce_caps.roce_en && + caps->roce_caps.fl_rc_qp_when_roce_enabled) || + (!caps->roce_caps.roce_en && + caps->roce_caps.fl_rc_qp_when_roce_disabled)); +} + - ret = mlx5dr_cmd_query_gid(dmn->mdev, port, gid_index, &rtr_attr.dgid_attr); - if (ret) - return ret; - - rtr_attr.sgid_index = gid_index; + /* if qp creation with force loopback is allowed, then there + * is no need for gid index when creating the qp. + * otherwise we query gid attributes and use gid index. + */ + rtr_attr.fl = dr_send_allow_fl(&dmn->info.caps); + if (!rtr_attr.fl) { + ret = mlx5dr_cmd_query_gid(dmn->mdev, port, gid_index, + &rtr_attr.dgid_attr); + if (ret) + return ret; + + rtr_attr.sgid_index = gid_index; + } + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +struct mlx5dr_roce_cap { + u8 roce_en:1; + u8 fl_rc_qp_when_roce_disabled:1; + u8 fl_rc_qp_when_roce_enabled:1; +}; + + struct mlx5dr_roce_cap roce_caps; diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h - u8 reserved_at_5[0x19]; + u8 fl_rc_qp_when_roce_disabled[0x1]; + u8 fl_rc_qp_when_roce_enabled[0x1]; + u8 reserved_at_7[0x17]; - u8 reserved_at_10[0x3]; + u8 reserved_at_10[0x2]; + u8 isolate_vl_tc[0x1];
|
Networking
|
7304d603a57a1edecfecfbcc26f85edcda4cae81
|
yevgeny kliteynik
|
drivers
|
net
|
core, ethernet, mellanox, mlx5, steering
|
net/mlx5: dr, add support for isolate_vl_tc qp
|
when using sw steering, rule insertion rate depends on the rdma rc qp performance used for writing to the icm. during stress this qp is competing on the hw resources with all the other qps that are used to send data. to protect sw steering qp's performance in such cases, we set this qp to use isolated vl. the vl number is reserved by fw and is not exposed to the driver. support for this qp on isolated vl exists only when both force-loopback and isolate_vl_tc capabilities are set.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dr, add support for isolate_vl_tc qp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 4
| 14
| 1
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c + caps->isolate_vl_tc = mlx5_cap_gen(mdev, isolate_vl_tc_new); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c + u8 isolate_vl_tc:1; + mlx5_set(qpc, qpc, isolate_vl_tc, attr->isolate_vl_tc); + + /* isolated vl is applicable only if force loopback is supported */ + if (dr_send_allow_fl(&dmn->info.caps)) + init_attr.isolate_vl_tc = dmn->info.caps.isolate_vl_tc; + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h + u8 isolate_vl_tc:1; + u8 isolate_vl_tc:1; diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h - u8 reserved_at_91[0x7]; + u8 reserved_at_91[0x2]; + u8 isolate_vl_tc_new[0x1]; + u8 reserved_at_94[0x4];
|
Networking
|
aeacb52a8de7046be5399ba311f49bce96e1b269
|
yevgeny kliteynik
|
drivers
|
net
|
core, ethernet, mellanox, mlx5, steering
|
net/mlx5: dr, add support for matching on geneve tlv option
|
enable matching on tunnel geneve tlv option using the flex parser.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dr, add support for matching on geneve tlv option
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 7
| 107
| 4
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c + if (caps->flex_protocols & mlx5_flex_parser_geneve_tlv_option_0_enabled) + caps->flex_parser_id_geneve_tlv_option_0 = + mlx5_cap_gen(mdev, flex_parser_id_geneve_tlv_option_0); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +static bool dr_mask_is_tnl_geneve_tlv_opt(struct mlx5dr_match_misc3 *misc3) +{ + return misc3->geneve_tlv_option_0_data; +} + - else if (dr_mask_is_tnl_geneve(&mask, dmn)) + else if (dr_mask_is_tnl_geneve(&mask, dmn)) { - + if (dr_mask_is_tnl_geneve_tlv_opt(&mask.misc3)) + mlx5dr_ste_build_tnl_geneve_tlv_opt(ste_ctx, &sb[idx++], + &mask, &dmn->info.caps, + inner, rx); + } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c + spec->geneve_tlv_option_0_data = + mlx5_get(fte_match_set_misc3, mask, geneve_tlv_option_0_data); +void mlx5dr_ste_build_tnl_geneve_tlv_opt(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx) +{ + sb->rx = rx; + sb->caps = caps; + sb->inner = inner; + ste_ctx->build_tnl_geneve_tlv_opt_init(sb, mask); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h + void dr_ste_ctx_builder(tnl_geneve_tlv_opt); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +static int +dr_ste_v0_build_flex_parser_tnl_geneve_tlv_opt_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + u8 *tag) +{ + struct mlx5dr_match_misc3 *misc3 = &value->misc3; + u8 parser_id = sb->caps->flex_parser_id_geneve_tlv_option_0; + u8 *parser_ptr = dr_ste_calc_flex_parser_offset(tag, parser_id); + + mlx5_set(ste_flex_parser_0, parser_ptr, flex_parser_3, + misc3->geneve_tlv_option_0_data); + misc3->geneve_tlv_option_0_data = 0; + + return 0; +} + +static void +dr_ste_v0_build_flex_parser_tnl_geneve_tlv_opt_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v0_build_flex_parser_tnl_geneve_tlv_opt_tag(mask, sb, sb->bit_mask); + + /* stes with lookup type flex_parser_{0/1} includes + * flex parsers_{0-3}/{4-7} respectively. + */ + sb->lu_type = sb->caps->flex_parser_id_geneve_tlv_option_0 > 3 ? + dr_ste_v0_lu_type_flex_parser_1 : + dr_ste_v0_lu_type_flex_parser_0; + + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_flex_parser_tnl_geneve_tlv_opt_tag; +} + + .build_tnl_geneve_tlv_opt_init = &dr_ste_v0_build_flex_parser_tnl_geneve_tlv_opt_init, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +static int +dr_ste_v1_build_flex_parser_tnl_geneve_tlv_opt_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + u8 *tag) +{ + struct mlx5dr_match_misc3 *misc3 = &value->misc3; + u8 parser_id = sb->caps->flex_parser_id_geneve_tlv_option_0; + u8 *parser_ptr = dr_ste_calc_flex_parser_offset(tag, parser_id); + + mlx5_set(ste_flex_parser_0, parser_ptr, flex_parser_3, + misc3->geneve_tlv_option_0_data); + misc3->geneve_tlv_option_0_data = 0; + + return 0; +} + +static void +dr_ste_v1_build_flex_parser_tnl_geneve_tlv_opt_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v1_build_flex_parser_tnl_geneve_tlv_opt_tag(mask, sb, sb->bit_mask); + + /* stes with lookup type flex_parser_{0/1} includes + * flex parsers_{0-3}/{4-7} respectively. + */ + sb->lu_type = sb->caps->flex_parser_id_geneve_tlv_option_0 > 3 ? + dr_ste_v1_lu_type_flex_parser_1 : + dr_ste_v1_lu_type_flex_parser_0; + + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_flex_parser_tnl_geneve_tlv_opt_tag; +} + + .build_tnl_geneve_tlv_opt_init = &dr_ste_v1_build_flex_parser_tnl_geneve_tlv_opt_init, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h -#define dr_rule_max_stes 17 +#define dr_rule_max_stes 18 +void mlx5dr_ste_build_tnl_geneve_tlv_opt(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx); - u8 reserved_auto3[0x1c]; + u32 geneve_tlv_option_0_data; + u8 reserved_auto3[0x18]; + u8 flex_parser_id_geneve_tlv_option_0;
|
Networking
|
3442e0335e70f348728c17bca924ec507ad6358a
|
yevgeny kliteynik
|
drivers
|
net
|
core, ethernet, mellanox, mlx5, steering
|
net/mlx5: dr, add support for matching tunnel gtp-u
|
enable matching on tunnel gtp-u and gtp-u first extension header using dynamic flex parser.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
dr, add support for matching tunnel gtp-u
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mt76 ']
|
['h', 'c']
| 8
| 397
| 1
|
--- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c + if (caps->flex_protocols & mlx5_flex_parser_gtpu_dw_0_enabled) + caps->flex_parser_id_gtpu_dw_0 = + mlx5_cap_gen(mdev, flex_parser_id_gtpu_dw_0); + + if (caps->flex_protocols & mlx5_flex_parser_gtpu_teid_enabled) + caps->flex_parser_id_gtpu_teid = + mlx5_cap_gen(mdev, flex_parser_id_gtpu_teid); + + if (caps->flex_protocols & mlx5_flex_parser_gtpu_dw_2_enabled) + caps->flex_parser_id_gtpu_dw_2 = + mlx5_cap_gen(mdev, flex_parser_id_gtpu_dw_2); + + if (caps->flex_protocols & mlx5_flex_parser_gtpu_first_ext_dw_0_enabled) + caps->flex_parser_id_gtpu_first_ext_dw_0 = + mlx5_cap_gen(mdev, flex_parser_id_gtpu_first_ext_dw_0); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +static bool dr_mask_is_tnl_gtpu_set(struct mlx5dr_match_misc3 *misc3) +{ + return misc3->gtpu_msg_flags || misc3->gtpu_msg_type || misc3->gtpu_teid; +} + +static bool dr_matcher_supp_tnl_gtpu(struct mlx5dr_cmd_caps *caps) +{ + return caps->flex_protocols & mlx5_flex_parser_gtpu_enabled; +} + +static bool dr_mask_is_tnl_gtpu(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return dr_mask_is_tnl_gtpu_set(&mask->misc3) && + dr_matcher_supp_tnl_gtpu(&dmn->info.caps); +} + +static int dr_matcher_supp_tnl_gtpu_dw_0(struct mlx5dr_cmd_caps *caps) +{ + return caps->flex_protocols & mlx5_flex_parser_gtpu_dw_0_enabled; +} + +static bool dr_mask_is_tnl_gtpu_dw_0(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return mask->misc3.gtpu_dw_0 && + dr_matcher_supp_tnl_gtpu_dw_0(&dmn->info.caps); +} + +static int dr_matcher_supp_tnl_gtpu_teid(struct mlx5dr_cmd_caps *caps) +{ + return caps->flex_protocols & mlx5_flex_parser_gtpu_teid_enabled; +} + +static bool dr_mask_is_tnl_gtpu_teid(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return mask->misc3.gtpu_teid && + dr_matcher_supp_tnl_gtpu_teid(&dmn->info.caps); +} + +static int dr_matcher_supp_tnl_gtpu_dw_2(struct mlx5dr_cmd_caps *caps) +{ + return caps->flex_protocols & mlx5_flex_parser_gtpu_dw_2_enabled; +} + +static bool dr_mask_is_tnl_gtpu_dw_2(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return mask->misc3.gtpu_dw_2 && + dr_matcher_supp_tnl_gtpu_dw_2(&dmn->info.caps); +} + +static int dr_matcher_supp_tnl_gtpu_first_ext(struct mlx5dr_cmd_caps *caps) +{ + return caps->flex_protocols & mlx5_flex_parser_gtpu_first_ext_dw_0_enabled; +} + +static bool dr_mask_is_tnl_gtpu_first_ext(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return mask->misc3.gtpu_first_ext_dw_0 && + dr_matcher_supp_tnl_gtpu_first_ext(&dmn->info.caps); +} + +static bool dr_mask_is_tnl_gtpu_flex_parser_0(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + struct mlx5dr_cmd_caps *caps = &dmn->info.caps; + + return (dr_is_flex_parser_0_id(caps->flex_parser_id_gtpu_dw_0) && + dr_mask_is_tnl_gtpu_dw_0(mask, dmn)) || + (dr_is_flex_parser_0_id(caps->flex_parser_id_gtpu_teid) && + dr_mask_is_tnl_gtpu_teid(mask, dmn)) || + (dr_is_flex_parser_0_id(caps->flex_parser_id_gtpu_dw_2) && + dr_mask_is_tnl_gtpu_dw_2(mask, dmn)) || + (dr_is_flex_parser_0_id(caps->flex_parser_id_gtpu_first_ext_dw_0) && + dr_mask_is_tnl_gtpu_first_ext(mask, dmn)); +} + +static bool dr_mask_is_tnl_gtpu_flex_parser_1(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + struct mlx5dr_cmd_caps *caps = &dmn->info.caps; + + return (dr_is_flex_parser_1_id(caps->flex_parser_id_gtpu_dw_0) && + dr_mask_is_tnl_gtpu_dw_0(mask, dmn)) || + (dr_is_flex_parser_1_id(caps->flex_parser_id_gtpu_teid) && + dr_mask_is_tnl_gtpu_teid(mask, dmn)) || + (dr_is_flex_parser_1_id(caps->flex_parser_id_gtpu_dw_2) && + dr_mask_is_tnl_gtpu_dw_2(mask, dmn)) || + (dr_is_flex_parser_1_id(caps->flex_parser_id_gtpu_first_ext_dw_0) && + dr_mask_is_tnl_gtpu_first_ext(mask, dmn)); +} + +static bool dr_mask_is_tnl_gtpu_any(struct mlx5dr_match_param *mask, + struct mlx5dr_domain *dmn) +{ + return dr_mask_is_tnl_gtpu_flex_parser_0(mask, dmn) || + dr_mask_is_tnl_gtpu_flex_parser_1(mask, dmn) || + dr_mask_is_tnl_gtpu(mask, dmn); +} + + } else if (dr_mask_is_tnl_gtpu_any(&mask, dmn)) { + if (dr_mask_is_tnl_gtpu_flex_parser_0(&mask, dmn)) + mlx5dr_ste_build_tnl_gtpu_flex_parser_0(ste_ctx, &sb[idx++], + &mask, &dmn->info.caps, + inner, rx); + + if (dr_mask_is_tnl_gtpu_flex_parser_1(&mask, dmn)) + mlx5dr_ste_build_tnl_gtpu_flex_parser_1(ste_ctx, &sb[idx++], + &mask, &dmn->info.caps, + inner, rx); + + if (dr_mask_is_tnl_gtpu(&mask, dmn)) + mlx5dr_ste_build_tnl_gtpu(ste_ctx, &sb[idx++], + &mask, inner, rx); + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c + spec->gtpu_msg_flags = mlx5_get(fte_match_set_misc3, mask, gtpu_msg_flags); + spec->gtpu_msg_type = mlx5_get(fte_match_set_misc3, mask, gtpu_msg_type); + spec->gtpu_teid = mlx5_get(fte_match_set_misc3, mask, gtpu_teid); + spec->gtpu_dw_0 = mlx5_get(fte_match_set_misc3, mask, gtpu_dw_0); + spec->gtpu_dw_2 = mlx5_get(fte_match_set_misc3, mask, gtpu_dw_2); + spec->gtpu_first_ext_dw_0 = + mlx5_get(fte_match_set_misc3, mask, gtpu_first_ext_dw_0); +void mlx5dr_ste_build_tnl_gtpu(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx) +{ + sb->rx = rx; + sb->inner = inner; + ste_ctx->build_tnl_gtpu_init(sb, mask); +} + +void mlx5dr_ste_build_tnl_gtpu_flex_parser_0(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx) +{ + sb->rx = rx; + sb->caps = caps; + sb->inner = inner; + ste_ctx->build_tnl_gtpu_flex_parser_0_init(sb, mask); +} + +void mlx5dr_ste_build_tnl_gtpu_flex_parser_1(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx) +{ + sb->rx = rx; + sb->caps = caps; + sb->inner = inner; + ste_ctx->build_tnl_gtpu_flex_parser_1_init(sb, mask); +} + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.h +#define dr_ste_set_flex_parser_field(tag, fname, caps, spec) do { \ + u8 parser_id = (caps)->flex_parser_id_##fname; \ + u8 *parser_ptr = dr_ste_calc_flex_parser_offset(tag, parser_id); \ + *(__be32 *)parser_ptr = cpu_to_be32((spec)->fname);\ + (spec)->fname = 0;\ +} while (0) + + void dr_ste_ctx_builder(tnl_gtpu); + void dr_ste_ctx_builder(tnl_gtpu_flex_parser_0); + void dr_ste_ctx_builder(tnl_gtpu_flex_parser_1); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v0.c +static int dr_ste_v0_build_flex_parser_tnl_gtpu_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + struct mlx5dr_match_misc3 *misc3 = &value->misc3; + + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, + gtpu_msg_flags, misc3, + gtpu_msg_flags); + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, + gtpu_msg_type, misc3, + gtpu_msg_type); + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, + gtpu_teid, misc3, + gtpu_teid); + + return 0; +} + +static void dr_ste_v0_build_flex_parser_tnl_gtpu_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v0_build_flex_parser_tnl_gtpu_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v0_lu_type_flex_parser_tnl_header; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_flex_parser_tnl_gtpu_tag; +} + +static int +dr_ste_v0_build_tnl_gtpu_flex_parser_0_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_0, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_teid)) + dr_ste_set_flex_parser_field(tag, gtpu_teid, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_dw_2)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_2, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_first_ext_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_first_ext_dw_0, sb->caps, &value->misc3); + return 0; +} + +static void +dr_ste_v0_build_tnl_gtpu_flex_parser_0_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v0_build_tnl_gtpu_flex_parser_0_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v0_lu_type_flex_parser_0; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_tnl_gtpu_flex_parser_0_tag; +} + +static int +dr_ste_v0_build_tnl_gtpu_flex_parser_1_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_0, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_teid)) + dr_ste_set_flex_parser_field(tag, gtpu_teid, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_dw_2)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_2, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_first_ext_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_first_ext_dw_0, sb->caps, &value->misc3); + return 0; +} + +static void +dr_ste_v0_build_tnl_gtpu_flex_parser_1_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v0_build_tnl_gtpu_flex_parser_1_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v0_lu_type_flex_parser_1; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v0_build_tnl_gtpu_flex_parser_1_tag; +} + + .build_tnl_gtpu_init = &dr_ste_v0_build_flex_parser_tnl_gtpu_init, + .build_tnl_gtpu_flex_parser_0_init = &dr_ste_v0_build_tnl_gtpu_flex_parser_0_init, + .build_tnl_gtpu_flex_parser_1_init = &dr_ste_v0_build_tnl_gtpu_flex_parser_1_init, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +static int dr_ste_v1_build_flex_parser_tnl_gtpu_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + struct mlx5dr_match_misc3 *misc3 = &value->misc3; + + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, gtpu_msg_flags, misc3, gtpu_msg_flags); + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, gtpu_msg_type, misc3, gtpu_msg_type); + dr_ste_set_tag(flex_parser_tnl_gtpu, tag, gtpu_teid, misc3, gtpu_teid); + + return 0; +} + +static void dr_ste_v1_build_flex_parser_tnl_gtpu_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v1_build_flex_parser_tnl_gtpu_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v1_lu_type_flex_parser_tnl_header; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_flex_parser_tnl_gtpu_tag; +} + +static int +dr_ste_v1_build_tnl_gtpu_flex_parser_0_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_0, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_teid)) + dr_ste_set_flex_parser_field(tag, gtpu_teid, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_dw_2)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_2, sb->caps, &value->misc3); + if (dr_is_flex_parser_0_id(sb->caps->flex_parser_id_gtpu_first_ext_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_first_ext_dw_0, sb->caps, &value->misc3); + return 0; +} + +static void +dr_ste_v1_build_tnl_gtpu_flex_parser_0_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v1_build_tnl_gtpu_flex_parser_0_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v1_lu_type_flex_parser_0; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_tnl_gtpu_flex_parser_0_tag; +} + +static int +dr_ste_v1_build_tnl_gtpu_flex_parser_1_tag(struct mlx5dr_match_param *value, + struct mlx5dr_ste_build *sb, + uint8_t *tag) +{ + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_0, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_teid)) + dr_ste_set_flex_parser_field(tag, gtpu_teid, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_dw_2)) + dr_ste_set_flex_parser_field(tag, gtpu_dw_2, sb->caps, &value->misc3); + if (dr_is_flex_parser_1_id(sb->caps->flex_parser_id_gtpu_first_ext_dw_0)) + dr_ste_set_flex_parser_field(tag, gtpu_first_ext_dw_0, sb->caps, &value->misc3); + return 0; +} + +static void +dr_ste_v1_build_tnl_gtpu_flex_parser_1_init(struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask) +{ + dr_ste_v1_build_tnl_gtpu_flex_parser_1_tag(mask, sb, sb->bit_mask); + + sb->lu_type = dr_ste_v1_lu_type_flex_parser_1; + sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask); + sb->ste_build_tag_func = &dr_ste_v1_build_tnl_gtpu_flex_parser_1_tag; +} + + .build_tnl_gtpu_init = &dr_ste_v1_build_flex_parser_tnl_gtpu_init, + .build_tnl_gtpu_flex_parser_0_init = &dr_ste_v1_build_tnl_gtpu_flex_parser_0_init, + .build_tnl_gtpu_flex_parser_1_init = &dr_ste_v1_build_tnl_gtpu_flex_parser_1_init, + diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +static inline bool dr_is_flex_parser_0_id(u8 parser_id) +{ + return parser_id <= dr_ste_max_flex_0_id; +} + +static inline bool dr_is_flex_parser_1_id(u8 parser_id) +{ + return parser_id > dr_ste_max_flex_0_id; +} + +void mlx5dr_ste_build_tnl_gtpu(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + bool inner, bool rx); +void mlx5dr_ste_build_tnl_gtpu_flex_parser_0(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx); +void mlx5dr_ste_build_tnl_gtpu_flex_parser_1(struct mlx5dr_ste_ctx *ste_ctx, + struct mlx5dr_ste_build *sb, + struct mlx5dr_match_param *mask, + struct mlx5dr_cmd_caps *caps, + bool inner, bool rx); - u8 reserved_auto3[0x18]; + u8 gtpu_msg_flags; + u8 gtpu_msg_type; + u32 gtpu_teid; + u32 gtpu_dw_2; + u32 gtpu_first_ext_dw_0; + u32 gtpu_dw_0; + u8 flex_parser_id_gtpu_dw_0; + u8 flex_parser_id_gtpu_teid; + u8 flex_parser_id_gtpu_dw_2; + u8 flex_parser_id_gtpu_first_ext_dw_0; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5_ifc_dr.h +struct mlx5_ifc_ste_flex_parser_tnl_gtpu_bits { + u8 reserved_at_0[0x5]; + u8 gtpu_msg_flags[0x3]; + u8 gtpu_msg_type[0x8]; + u8 reserved_at_10[0x10]; + + u8 gtpu_teid[0x20]; + + u8 reserved_at_40[0x40]; +}; +
|
Networking
|
df9dd15ae118e4c95fba6fe2d870ae23a99c3de2
|
yevgeny kliteynik
|
drivers
|
net
|
core, ethernet, mellanox, mlx5, steering
|
net: ethernet: mtk_eth_soc: implement dynamic interrupt moderation
|
reduces the number of interrupts under load
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
implement dynamic interrupt moderation
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['mtk_eth_soc']
|
['h', 'kconfig', 'c']
| 3
| 124
| 14
|
--- diff --git a/drivers/net/ethernet/mediatek/kconfig b/drivers/net/ethernet/mediatek/kconfig --- a/drivers/net/ethernet/mediatek/kconfig +++ b/drivers/net/ethernet/mediatek/kconfig + select dimlib diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c + struct dim_sample dim_sample = {}; - int done = 0; + int done = 0, bytes = 0; + bytes += pktlen; + eth->rx_packets += done; + eth->rx_bytes += bytes; + dim_update_sample(eth->rx_events, eth->rx_packets, eth->rx_bytes, + &dim_sample); + net_dim(ð->rx_dim, dim_sample); + + struct dim_sample dim_sample = {}; + eth->tx_packets += done[i]; + eth->tx_bytes += bytes[i]; + dim_update_sample(eth->tx_events, eth->tx_packets, eth->tx_bytes, + &dim_sample); + net_dim(ð->tx_dim, dim_sample); + + eth->rx_events++; + eth->tx_events++; + cancel_work_sync(ð->rx_dim.work); + cancel_work_sync(ð->tx_dim.work); + +static void mtk_dim_rx(struct work_struct *work) +{ + struct dim *dim = container_of(work, struct dim, work); + struct mtk_eth *eth = container_of(dim, struct mtk_eth, rx_dim); + struct dim_cq_moder cur_profile; + u32 val, cur; + + cur_profile = net_dim_get_rx_moderation(eth->rx_dim.mode, + dim->profile_ix); + spin_lock_bh(ð->dim_lock); + + val = mtk_r32(eth, mtk_pdma_delay_int); + val &= mtk_pdma_delay_tx_mask; + val |= mtk_pdma_delay_rx_en; + + cur = min_t(u32, div_round_up(cur_profile.usec, 20), mtk_pdma_delay_ptime_mask); + val |= cur << mtk_pdma_delay_rx_ptime_shift; + + cur = min_t(u32, cur_profile.pkts, mtk_pdma_delay_pint_mask); + val |= cur << mtk_pdma_delay_rx_pint_shift; + + mtk_w32(eth, val, mtk_pdma_delay_int); + mtk_w32(eth, val, mtk_qdma_delay_int); + + spin_unlock_bh(ð->dim_lock); + + dim->state = dim_start_measure; +} + +static void mtk_dim_tx(struct work_struct *work) +{ + struct dim *dim = container_of(work, struct dim, work); + struct mtk_eth *eth = container_of(dim, struct mtk_eth, tx_dim); + struct dim_cq_moder cur_profile; + u32 val, cur; + + cur_profile = net_dim_get_tx_moderation(eth->tx_dim.mode, + dim->profile_ix); + spin_lock_bh(ð->dim_lock); + + val = mtk_r32(eth, mtk_pdma_delay_int); + val &= mtk_pdma_delay_rx_mask; + val |= mtk_pdma_delay_tx_en; + + cur = min_t(u32, div_round_up(cur_profile.usec, 20), mtk_pdma_delay_ptime_mask); + val |= cur << mtk_pdma_delay_tx_ptime_shift; + + cur = min_t(u32, cur_profile.pkts, mtk_pdma_delay_pint_mask); + val |= cur << mtk_pdma_delay_tx_pint_shift; + + mtk_w32(eth, val, mtk_pdma_delay_int); + mtk_w32(eth, val, mtk_qdma_delay_int); + + spin_unlock_bh(ð->dim_lock); + + dim->state = dim_start_measure; +} + - /* enable interrupt delay for rx */ - mtk_w32(eth, mtk_pdma_delay_rx_delay, mtk_pdma_delay_int); - - /* enable interrupt delay for rx */ - mtk_w32(eth, mtk_pdma_delay_rx_delay, mtk_pdma_delay_int); + /* set interrupt delays based on current net dim sample */ + mtk_dim_rx(ð->rx_dim.work); + mtk_dim_tx(ð->tx_dim.work); - mtk_w32(eth, 0, mtk_qdma_delay_int); + spin_lock_init(ð->dim_lock); + + eth->rx_dim.mode = dim_cq_period_mode_start_from_eqe; + init_work(ð->rx_dim.work, mtk_dim_rx); + + eth->tx_dim.mode = dim_cq_period_mode_start_from_eqe; + init_work(ð->tx_dim.work, mtk_dim_tx); diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +#include <linux/dim.h> +#define mtk_pdma_delay_rx_mask genmask(15, 0) -#define mtk_pdma_delay_rx_pint 4 -#define mtk_pdma_delay_rx_ptime 4 -#define mtk_pdma_delay_rx_delay \ - (mtk_pdma_delay_rx_en | mtk_pdma_delay_rx_ptime | \ - (mtk_pdma_delay_rx_pint << mtk_pdma_delay_rx_pint_shift)) +#define mtk_pdma_delay_rx_ptime_shift 0 + +#define mtk_pdma_delay_tx_mask genmask(31, 16) +#define mtk_pdma_delay_tx_en bit(31) +#define mtk_pdma_delay_tx_pint_shift 24 +#define mtk_pdma_delay_tx_ptime_shift 16 + +#define mtk_pdma_delay_pint_mask 0x7f +#define mtk_pdma_delay_ptime_mask 0xff +#define mtk_tx_done_dly bit(28) -#define mtk_tx_done_int (mtk_tx_done_int0 | mtk_tx_done_int1 | \ - mtk_tx_done_int2 | mtk_tx_done_int3) +#define mtk_tx_done_int mtk_tx_done_dly + * @dim_lock: make sure that net dim operations are atomic + * @rx_events: net dim rx event counter + * @rx_packets: net dim rx packet counter + * @rx_bytes: net dim rx byte counter + * @rx_dim: net dim rx context + * @tx_events: net dim tx event counter + * @tx_packets: net dim tx packet counter + * @tx_bytes: net dim tx byte counter + * @tx_dim: net dim tx context + spinlock_t dim_lock; + + u32 rx_events; + u32 rx_packets; + u32 rx_bytes; + struct dim rx_dim; + + u32 tx_events; + u32 tx_packets; + u32 tx_bytes; + struct dim tx_dim; +
|
Networking
|
e9229ffd550b2d8c4997c67a501dbc3919fd4e26
|
felix fietkau
|
drivers
|
net
|
ethernet, mediatek
|
netdevsim: add dummy psample implementation
|
allow netdevsim to report "sampled" packets to the psample module by periodically generating packets from a work queue. the behavior can be enabled / disabled (default) and the various meta data attributes can be controlled via debugfs knobs.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add dummy psample implementation
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['netdevsim ']
|
['h', 'kconfig', 'c', 'makefile']
| 5
| 299
| 2
|
--- diff --git a/drivers/net/kconfig b/drivers/net/kconfig --- a/drivers/net/kconfig +++ b/drivers/net/kconfig + depends on psample || psample=n diff --git a/drivers/net/netdevsim/makefile b/drivers/net/netdevsim/makefile --- a/drivers/net/netdevsim/makefile +++ b/drivers/net/netdevsim/makefile + +ifneq ($(config_psample),) +netdevsim-objs += psample.o +endif diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c - err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); + err = nsim_dev_psample_init(nsim_dev); + err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); + if (err) + goto err_psample_exit; + +err_psample_exit: + nsim_dev_psample_exit(nsim_dev); - err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); + err = nsim_dev_psample_init(nsim_dev); + err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); + if (err) + goto err_psample_exit; + +err_psample_exit: + nsim_dev_psample_exit(nsim_dev); + nsim_dev_psample_exit(nsim_dev); diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h +#if is_enabled(config_psample) +int nsim_dev_psample_init(struct nsim_dev *nsim_dev); +void nsim_dev_psample_exit(struct nsim_dev *nsim_dev); +#else +static inline int nsim_dev_psample_init(struct nsim_dev *nsim_dev) +{ + return 0; +} + +static inline void nsim_dev_psample_exit(struct nsim_dev *nsim_dev) +{ +} +#endif + + struct nsim_dev_psample *psample; diff --git a/drivers/net/netdevsim/psample.c b/drivers/net/netdevsim/psample.c --- /dev/null +++ b/drivers/net/netdevsim/psample.c +// spdx-license-identifier: gpl-2.0 +/* copyright (c) 2021 mellanox technologies. all rights reserved */ + +#include <linux/debugfs.h> +#include <linux/err.h> +#include <linux/etherdevice.h> +#include <linux/inet.h> +#include <linux/kernel.h> +#include <linux/random.h> +#include <linux/slab.h> +#include <net/devlink.h> +#include <net/ip.h> +#include <net/psample.h> +#include <uapi/linux/ip.h> +#include <uapi/linux/udp.h> + +#include "netdevsim.h" + +#define nsim_psample_report_interval_ms 100 +#define nsim_psample_invalid_tc 0xffff +#define nsim_psample_l4_data_len 100 + +struct nsim_dev_psample { + struct delayed_work psample_dw; + struct dentry *ddir; + struct psample_group *group; + u32 rate; + u32 group_num; + u32 trunc_size; + int in_ifindex; + int out_ifindex; + u16 out_tc; + u64 out_tc_occ_max; + u64 latency_max; + bool is_active; +}; + +static struct sk_buff *nsim_dev_psample_skb_build(void) +{ + int tot_len, data_len = nsim_psample_l4_data_len; + struct sk_buff *skb; + struct udphdr *udph; + struct ethhdr *eth; + struct iphdr *iph; + + skb = alloc_skb(nlmsg_goodsize, gfp_kernel); + if (!skb) + return null; + tot_len = sizeof(struct iphdr) + sizeof(struct udphdr) + data_len; + + skb_reset_mac_header(skb); + eth = skb_put(skb, sizeof(struct ethhdr)); + eth_random_addr(eth->h_dest); + eth_random_addr(eth->h_source); + eth->h_proto = htons(eth_p_ip); + skb->protocol = htons(eth_p_ip); + + skb_set_network_header(skb, skb->len); + iph = skb_put(skb, sizeof(struct iphdr)); + iph->protocol = ipproto_udp; + iph->saddr = in_aton("192.0.2.1"); + iph->daddr = in_aton("198.51.100.1"); + iph->version = 0x4; + iph->frag_off = 0; + iph->ihl = 0x5; + iph->tot_len = htons(tot_len); + iph->id = 0; + iph->ttl = 100; + iph->check = 0; + iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); + + skb_set_transport_header(skb, skb->len); + udph = skb_put_zero(skb, sizeof(struct udphdr) + data_len); + get_random_bytes(&udph->source, sizeof(u16)); + get_random_bytes(&udph->dest, sizeof(u16)); + udph->len = htons(sizeof(struct udphdr) + data_len); + + return skb; +} + +static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample, + struct psample_metadata *md) +{ + md->trunc_size = psample->trunc_size; + md->in_ifindex = psample->in_ifindex; + md->out_ifindex = psample->out_ifindex; + + if (psample->out_tc != nsim_psample_invalid_tc) { + md->out_tc = psample->out_tc; + md->out_tc_valid = 1; + } + + if (psample->out_tc_occ_max) { + u64 out_tc_occ; + + get_random_bytes(&out_tc_occ, sizeof(u64)); + md->out_tc_occ = out_tc_occ & (psample->out_tc_occ_max - 1); + md->out_tc_occ_valid = 1; + } + + if (psample->latency_max) { + u64 latency; + + get_random_bytes(&latency, sizeof(u64)); + md->latency = latency & (psample->latency_max - 1); + md->latency_valid = 1; + } +} + +static void nsim_dev_psample_report_work(struct work_struct *work) +{ + struct nsim_dev_psample *psample; + struct psample_metadata md = {}; + struct sk_buff *skb; + unsigned long delay; + + psample = container_of(work, struct nsim_dev_psample, psample_dw.work); + + skb = nsim_dev_psample_skb_build(); + if (!skb) + goto out; + + nsim_dev_psample_md_prepare(psample, &md); + psample_sample_packet(psample->group, skb, psample->rate, &md); + consume_skb(skb); + +out: + delay = msecs_to_jiffies(nsim_psample_report_interval_ms); + schedule_delayed_work(&psample->psample_dw, delay); +} + +static int nsim_dev_psample_enable(struct nsim_dev *nsim_dev) +{ + struct nsim_dev_psample *psample = nsim_dev->psample; + struct devlink *devlink; + unsigned long delay; + + if (psample->is_active) + return -ebusy; + + devlink = priv_to_devlink(nsim_dev); + psample->group = psample_group_get(devlink_net(devlink), + psample->group_num); + if (!psample->group) + return -einval; + + delay = msecs_to_jiffies(nsim_psample_report_interval_ms); + schedule_delayed_work(&psample->psample_dw, delay); + + psample->is_active = true; + + return 0; +} + +static int nsim_dev_psample_disable(struct nsim_dev *nsim_dev) +{ + struct nsim_dev_psample *psample = nsim_dev->psample; + + if (!psample->is_active) + return -einval; + + psample->is_active = false; + + cancel_delayed_work_sync(&psample->psample_dw); + psample_group_put(psample->group); + + return 0; +} + +static ssize_t nsim_dev_psample_enable_write(struct file *file, + const char __user *data, + size_t count, loff_t *ppos) +{ + struct nsim_dev *nsim_dev = file->private_data; + bool enable; + int err; + + err = kstrtobool_from_user(data, count, &enable); + if (err) + return err; + + if (enable) + err = nsim_dev_psample_enable(nsim_dev); + else + err = nsim_dev_psample_disable(nsim_dev); + + return err ? err : count; +} + +static const struct file_operations nsim_psample_enable_fops = { + .open = simple_open, + .write = nsim_dev_psample_enable_write, + .llseek = generic_file_llseek, + .owner = this_module, +}; + +int nsim_dev_psample_init(struct nsim_dev *nsim_dev) +{ + struct nsim_dev_psample *psample; + int err; + + psample = kzalloc(sizeof(*psample), gfp_kernel); + if (!psample) + return -enomem; + nsim_dev->psample = psample; + + init_delayed_work(&psample->psample_dw, nsim_dev_psample_report_work); + + psample->ddir = debugfs_create_dir("psample", nsim_dev->ddir); + if (is_err(psample->ddir)) { + err = ptr_err(psample->ddir); + goto err_psample_free; + } + + /* populate sampling parameters with sane defaults. */ + psample->rate = 100; + debugfs_create_u32("rate", 0600, psample->ddir, &psample->rate); + + psample->group_num = 10; + debugfs_create_u32("group_num", 0600, psample->ddir, + &psample->group_num); + + psample->trunc_size = 0; + debugfs_create_u32("trunc_size", 0600, psample->ddir, + &psample->trunc_size); + + psample->in_ifindex = 1; + debugfs_create_u32("in_ifindex", 0600, psample->ddir, + &psample->in_ifindex); + + psample->out_ifindex = 2; + debugfs_create_u32("out_ifindex", 0600, psample->ddir, + &psample->out_ifindex); + + psample->out_tc = 0; + debugfs_create_u16("out_tc", 0600, psample->ddir, &psample->out_tc); + + psample->out_tc_occ_max = 10000; + debugfs_create_u64("out_tc_occ_max", 0600, psample->ddir, + &psample->out_tc_occ_max); + + psample->latency_max = 50; + debugfs_create_u64("latency_max", 0600, psample->ddir, + &psample->latency_max); + + debugfs_create_file("enable", 0200, psample->ddir, nsim_dev, + &nsim_psample_enable_fops); + + return 0; + +err_psample_free: + kfree(nsim_dev->psample); + return err; +} + +void nsim_dev_psample_exit(struct nsim_dev *nsim_dev) +{ + debugfs_remove_recursive(nsim_dev->psample->ddir); + if (nsim_dev->psample->is_active) { + cancel_delayed_work_sync(&nsim_dev->psample->psample_dw); + psample_group_put(nsim_dev->psample->group); + } + kfree(nsim_dev->psample); +}
|
Networking
|
a8700c3dd0a48f379d269ac6ddcf8bd857042771
|
ido schimmel
|
drivers
|
net
|
netdevsim
|
netdevsim: add support for resilient nexthop groups
|
allow resilient nexthop groups to be programmed and account their occupancy according to their number of buckets. the nexthop group itself as well as its buckets are marked with hardware flags (i.e., 'rtnh_f_trap').
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for resilient nexthop groups
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['netdevsim ']
|
['c']
| 1
| 55
| 0
|
--- diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c + bool fail_res_nexthop_group_replace; + bool fail_nexthop_bucket_replace; + bool is_resilient; + case nh_notifier_info_type_res_table: + occ = info->nh_res_table->num_nh_buckets; + nexthop->is_resilient = true; + break; + int i; + + + if (!nexthop->is_resilient) + return; + + for (i = 0; i < nexthop->occ; i++) + nexthop_bucket_set_hw_flags(net, nexthop->id, i, false, trap); +static int nsim_nexthop_res_table_pre_replace(struct nsim_fib_data *data, + struct nh_notifier_info *info) +{ + if (data->fail_res_nexthop_group_replace) { + nl_set_err_msg_mod(info->extack, "failed to replace a resilient nexthop group"); + return -einval; + } + + return 0; +} + +static int nsim_nexthop_bucket_replace(struct nsim_fib_data *data, + struct nh_notifier_info *info) +{ + if (data->fail_nexthop_bucket_replace) { + nl_set_err_msg_mod(info->extack, "failed to replace nexthop bucket"); + return -einval; + } + + nexthop_bucket_set_hw_flags(info->net, info->id, + info->nh_res_bucket->bucket_index, + false, true); + + return 0; +} + + case nexthop_event_res_table_pre_replace: + err = nsim_nexthop_res_table_pre_replace(data, info); + break; + case nexthop_event_bucket_replace: + err = nsim_nexthop_bucket_replace(data, info); + break; + + data->fail_res_nexthop_group_replace = false; + debugfs_create_bool("fail_res_nexthop_group_replace", 0600, data->ddir, + &data->fail_res_nexthop_group_replace); + + data->fail_nexthop_bucket_replace = false; + debugfs_create_bool("fail_nexthop_bucket_replace", 0600, data->ddir, + &data->fail_nexthop_bucket_replace);
|
Networking
|
d8eaa4facacbb13425d4097bd066e28958a5716f
|
ido schimmel
|
drivers
|
net
|
netdevsim
|
netdevsim: add fec settings support
|
add support for ethtool fec and some ethtool error injection.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add fec settings support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['netdevsim ']
|
['h', 'c']
| 2
| 39
| 0
|
--- diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c --- a/drivers/net/netdevsim/ethtool.c +++ b/drivers/net/netdevsim/ethtool.c +static int +nsim_get_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) +{ + struct netdevsim *ns = netdev_priv(dev); + + if (ns->ethtool.get_err) + return -ns->ethtool.get_err; + memcpy(fecparam, &ns->ethtool.fec, sizeof(ns->ethtool.fec)); + return 0; +} + +static int +nsim_set_fecparam(struct net_device *dev, struct ethtool_fecparam *fecparam) +{ + struct netdevsim *ns = netdev_priv(dev); + u32 fec; + + if (ns->ethtool.set_err) + return -ns->ethtool.set_err; + memcpy(&ns->ethtool.fec, fecparam, sizeof(ns->ethtool.fec)); + fec = fecparam->fec; + if (fec == ethtool_fec_auto) + fec |= ethtool_fec_off; + fec |= ethtool_fec_none; + ns->ethtool.fec.active_fec = 1 << (fls(fec) - 1); + return 0; +} + + .get_fecparam = nsim_get_fecparam, + .set_fecparam = nsim_set_fecparam, + ns->ethtool.fec.fec = ethtool_fec_none; + ns->ethtool.fec.active_fec = ethtool_fec_none; + + debugfs_create_u32("get_err", 0600, ethtool, &ns->ethtool.get_err); + debugfs_create_u32("set_err", 0600, ethtool, &ns->ethtool.set_err); + diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h + u32 get_err; + u32 set_err; + struct ethtool_fecparam fec;
|
Networking
|
0d7f76dc11e6df6b883f625c8343aa8fa1f6874b
|
jakub kicinski
|
drivers
|
net
|
netdevsim
|
nfp: flower: add support for packet-per-second policing
|
allow hardware offload of a policer action attached to a matchall filter which enforces a packets-per-second rate-limit.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for packet-per-second policing
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['nfp', 'flower']
|
['h', 'c']
| 2
| 119
| 46
|
--- diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h --- a/drivers/net/ethernet/netronome/nfp/flower/main.h +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h +#define nfp_fl_feats_qos_pps bit(9) - nfp_fl_feats_vlan_qinq) + nfp_fl_feats_vlan_qinq | \ + nfp_fl_feats_qos_pps) diff --git a/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c b/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c --- a/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c +#define nfp_fl_qos_pps bit(15) +enum nfp_fl_qos_types { + nfp_fl_qos_type_bps, + nfp_fl_qos_type_pps, + nfp_fl_qos_type_max, +}; + - * | flag options | + * | reserved |p| reserved | + * word[0](flag options): + * [15] p(pps) 1 for pps ,0 for bps + * - struct flow_action_entry *action = &flow->rule->action.entries[0]; + struct flow_action_entry *paction = &flow->rule->action.entries[0]; + u32 action_num = flow->rule->action.num_entries; + struct flow_action_entry *action = null; + u32 netdev_port_id, i; - u32 netdev_port_id; + bool pps_support; + u32 bps_num = 0; + u32 pps_num = 0; + netdev_port_id = nfp_repr_get_port_id(netdev); + pps_support = !!(fl_priv->flower_ext_feats & nfp_fl_feats_qos_pps); - if (!flow_offload_has_one_action(&flow->rule->action)) { - nl_set_err_msg_mod(extack, "unsupported offload: qos rate limit offload requires a single action"); - return -eopnotsupp; + if (pps_support) { + if (action_num > 2 || action_num == 0) { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit offload only support action number 1 or 2"); + return -eopnotsupp; + } + } else { + if (!flow_offload_has_one_action(&flow->rule->action)) { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit offload requires a single action"); + return -eopnotsupp; + } - if (action->id != flow_action_police) { - nl_set_err_msg_mod(extack, "unsupported offload: qos rate limit offload requires police action"); - return -eopnotsupp; - } - - if (action->police.rate_pkt_ps) { - nl_set_err_msg_mod(extack, "unsupported offload: qos rate limit offload not support packets per second"); - return -eopnotsupp; + for (i = 0 ; i < action_num; i++) { + action = paction + i; + if (action->id != flow_action_police) { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit offload requires police action"); + return -eopnotsupp; + } + if (action->police.rate_bytes_ps > 0) { + if (bps_num++) { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit offload only support one bps action"); + return -eopnotsupp; + } + } + if (action->police.rate_pkt_ps > 0) { + if (!pps_support) { + nl_set_err_msg_mod(extack, + "unsupported offload: fw does not support pps action"); + return -eopnotsupp; + } + if (pps_num++) { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit offload only support one pps action"); + return -eopnotsupp; + } + } - rate = action->police.rate_bytes_ps; - burst = action->police.burst; - netdev_port_id = nfp_repr_get_port_id(netdev); - - skb = nfp_flower_cmsg_alloc(repr->app, sizeof(struct nfp_police_config), - nfp_flower_cmsg_type_qos_mod, gfp_kernel); - if (!skb) - return -enomem; - - config = nfp_flower_cmsg_get_data(skb); - memset(config, 0, sizeof(struct nfp_police_config)); - config->head.port = cpu_to_be32(netdev_port_id); - config->bkt_tkn_p = cpu_to_be32(burst); - config->bkt_tkn_c = cpu_to_be32(burst); - config->pbs = cpu_to_be32(burst); - config->cbs = cpu_to_be32(burst); - config->pir = cpu_to_be32(rate); - config->cir = cpu_to_be32(rate); - nfp_ctrl_tx(repr->app->ctrl, skb); + for (i = 0 ; i < action_num; i++) { + /* set qos data for this interface */ + action = paction + i; + if (action->police.rate_bytes_ps > 0) { + rate = action->police.rate_bytes_ps; + burst = action->police.burst; + } else if (action->police.rate_pkt_ps > 0) { + rate = action->police.rate_pkt_ps; + burst = action->police.burst_pkt; + } else { + nl_set_err_msg_mod(extack, + "unsupported offload: qos rate limit is not bps or pps"); + continue; + } + if (rate != 0) { + skb = nfp_flower_cmsg_alloc(repr->app, sizeof(struct nfp_police_config), + nfp_flower_cmsg_type_qos_mod, gfp_kernel); + if (!skb) + return -enomem; + + config = nfp_flower_cmsg_get_data(skb); + memset(config, 0, sizeof(struct nfp_police_config)); + if (action->police.rate_pkt_ps > 0) + config->head.flags_opts = cpu_to_be32(nfp_fl_qos_pps); + config->head.port = cpu_to_be32(netdev_port_id); + config->bkt_tkn_p = cpu_to_be32(burst); + config->bkt_tkn_c = cpu_to_be32(burst); + config->pbs = cpu_to_be32(burst); + config->cbs = cpu_to_be32(burst); + config->pir = cpu_to_be32(rate); + config->cir = cpu_to_be32(rate); + nfp_ctrl_tx(repr->app->ctrl, skb); + } + } + u32 netdev_port_id, i; - u32 netdev_port_id; + bool pps_support; + pps_support = !!(fl_priv->flower_ext_feats & nfp_fl_feats_qos_pps); - skb = nfp_flower_cmsg_alloc(repr->app, sizeof(struct nfp_police_config), - nfp_flower_cmsg_type_qos_del, gfp_kernel); - if (!skb) - return -enomem; - - /* clear all qos associate data for this interface */ - - config = nfp_flower_cmsg_get_data(skb); - memset(config, 0, sizeof(struct nfp_police_config)); - config->head.port = cpu_to_be32(netdev_port_id); - nfp_ctrl_tx(repr->app->ctrl, skb); + for (i = 0 ; i < nfp_fl_qos_type_max; i++) { + if (i == nfp_fl_qos_type_pps && !pps_support) + break; + /* 0:bps 1:pps + * clear qos data for this interface. + * there is no need to check if a specific qos_type was + * configured as the firmware handles clearing a qos entry + * safely, even if it wasn't explicitly added. + */ + skb = nfp_flower_cmsg_alloc(repr->app, sizeof(struct nfp_police_config), + nfp_flower_cmsg_type_qos_del, gfp_kernel); + if (!skb) + return -enomem; + + config = nfp_flower_cmsg_get_data(skb); + memset(config, 0, sizeof(struct nfp_police_config)); + if (i == nfp_fl_qos_type_pps) + config->head.flags_opts = cpu_to_be32(nfp_fl_qos_pps); + config->head.port = cpu_to_be32(netdev_port_id); + nfp_ctrl_tx(repr->app->ctrl, skb); + }
|
Networking
|
631a44ed2560672c27a149134a4d8cb963c07779
|
peng zhang
|
drivers
|
net
|
ethernet, flower, netronome, nfp
|
net: ocelot: add pgid_blackhole
|
add a new pgid that is used not to forward frames anywhere. it is used by mrp to make sure that mrp test frames will not reach cpu port.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
extend mrp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['ocelot ']
|
['h', 'c']
| 2
| 6
| 1
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c + + ocelot_write_rix(ocelot, 0, ana_pgid_pgid, pgid_blackhole); + diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h + * pgid_blackhole: used for not forwarding the frames +#define pgid_blackhole 57 - (pgid) < pgid_cpu; \ + (pgid) < pgid_blackhole; \
|
Networking
|
ebb1bb401303ffac0ee994ba8ed9dfd24bb2ac5f
|
horatiu vultur
|
include
|
soc
|
ethernet, mscc
|
net: ocelot: extend mrp
|
this patch extends mrp support for ocelot. it allows to have multiple rings and when the node has the mrc role it forwards mrp test frames in hw. for mrm there is no change.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
extend mrp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['ocelot ']
|
['h', 'c']
| 4
| 160
| 93
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c -#if is_enabled(config_bridge_mrp) - if (skb->protocol == cpu_to_be16(eth_p_mrp) && - cpuq & bit(ocelot_mrp_cpuq)) - skb->offload_fwd_mark = 0; -#endif - diff --git a/drivers/net/ethernet/mscc/ocelot_mrp.c b/drivers/net/ethernet/mscc/ocelot_mrp.c --- a/drivers/net/ethernet/mscc/ocelot_mrp.c +++ b/drivers/net/ethernet/mscc/ocelot_mrp.c - * - * this contains glue logic between the switchdev driver operations and the - * mscc_ocelot_switch_lib. -static int ocelot_mrp_del_vcap(struct ocelot *ocelot, int port) +static const u8 mrp_test_dmac[] = { 0x01, 0x15, 0x4e, 0x00, 0x00, 0x01 }; +static const u8 mrp_control_dmac[] = { 0x01, 0x15, 0x4e, 0x00, 0x00, 0x02 }; + +static int ocelot_mrp_find_partner_port(struct ocelot *ocelot, + struct ocelot_port *p) +{ + int i; + + for (i = 0; i < ocelot->num_phys_ports; ++i) { + struct ocelot_port *ocelot_port = ocelot->ports[i]; + + if (!ocelot_port || p == ocelot_port) + continue; + + if (ocelot_port->mrp_ring_id == p->mrp_ring_id) + return i; + } + + return -1; +} + +static int ocelot_mrp_del_vcap(struct ocelot *ocelot, int id) - filter = ocelot_vcap_block_find_filter_by_id(block_vcap_is2, port, + filter = ocelot_vcap_block_find_filter_by_id(block_vcap_is2, id, +static int ocelot_mrp_redirect_add_vcap(struct ocelot *ocelot, int src_port, + int dst_port) +{ + const u8 mrp_test_mask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + struct ocelot_vcap_filter *filter; + int err; + + filter = kzalloc(sizeof(*filter), gfp_kernel); + if (!filter) + return -enomem; + + filter->key_type = ocelot_vcap_key_etype; + filter->prio = 1; + filter->id.cookie = src_port; + filter->id.tc_offload = false; + filter->block_id = vcap_is2; + filter->type = ocelot_vcap_filter_offload; + filter->ingress_port_mask = bit(src_port); + ether_addr_copy(filter->key.etype.dmac.value, mrp_test_dmac); + ether_addr_copy(filter->key.etype.dmac.mask, mrp_test_mask); + filter->action.mask_mode = ocelot_mask_mode_redirect; + filter->action.port_mask = bit(dst_port); + + err = ocelot_vcap_filter_add(ocelot, filter, null); + if (err) + kfree(filter); + + return err; +} + +static int ocelot_mrp_copy_add_vcap(struct ocelot *ocelot, int port, + int prio, unsigned long cookie) +{ + const u8 mrp_mask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + struct ocelot_vcap_filter *filter; + int err; + + filter = kzalloc(sizeof(*filter), gfp_kernel); + if (!filter) + return -enomem; + + filter->key_type = ocelot_vcap_key_etype; + filter->prio = prio; + filter->id.cookie = cookie; + filter->id.tc_offload = false; + filter->block_id = vcap_is2; + filter->type = ocelot_vcap_filter_offload; + filter->ingress_port_mask = bit(port); + /* here is possible to use control or test dmac because the mask + * doesn't cover the lsb + */ + ether_addr_copy(filter->key.etype.dmac.value, mrp_test_dmac); + ether_addr_copy(filter->key.etype.dmac.mask, mrp_mask); + filter->action.mask_mode = ocelot_mask_mode_permit_deny; + filter->action.port_mask = 0x0; + filter->action.cpu_copy_ena = true; + filter->action.cpu_qu_num = ocelot_mrp_cpuq; + + err = ocelot_vcap_filter_add(ocelot, filter, null); + if (err) + kfree(filter); + + return err; +} + +static void ocelot_mrp_save_mac(struct ocelot *ocelot, + struct ocelot_port *port) +{ + ocelot_mact_learn(ocelot, pgid_blackhole, mrp_test_dmac, + port->pvid_vlan.vid, entrytype_locked); + ocelot_mact_learn(ocelot, pgid_blackhole, mrp_control_dmac, + port->pvid_vlan.vid, entrytype_locked); +} + +static void ocelot_mrp_del_mac(struct ocelot *ocelot, + struct ocelot_port *port) +{ + ocelot_mact_forget(ocelot, mrp_test_dmac, port->pvid_vlan.vid); + ocelot_mact_forget(ocelot, mrp_control_dmac, port->pvid_vlan.vid); +} + - if (ocelot->mrp_ring_id != 0 && - ocelot->mrp_s_port && - ocelot->mrp_p_port) - return -einval; - - if (mrp->p_port == dev) - ocelot->mrp_p_port = dev; - - if (mrp->s_port == dev) - ocelot->mrp_s_port = dev; - - ocelot->mrp_ring_id = mrp->ring_id; + ocelot_port->mrp_ring_id = mrp->ring_id; - struct ocelot_port_private *priv; - struct net_device *dev; + int i; - priv = container_of(ocelot_port, struct ocelot_port_private, port); - dev = priv->dev; - - if (ocelot->mrp_p_port != dev && ocelot->mrp_s_port != dev) + if (ocelot_port->mrp_ring_id != mrp->ring_id) - if (ocelot->mrp_ring_id == 0 && - !ocelot->mrp_s_port && - !ocelot->mrp_p_port) - return -einval; + ocelot_mrp_del_vcap(ocelot, port); + ocelot_mrp_del_vcap(ocelot, port + ocelot->num_phys_ports); - if (ocelot_mrp_del_vcap(ocelot, priv->chip_port)) - return -einval; + ocelot_port->mrp_ring_id = 0; - if (ocelot->mrp_p_port == dev) - ocelot->mrp_p_port = null; + for (i = 0; i < ocelot->num_phys_ports; ++i) { + ocelot_port = ocelot->ports[i]; - if (ocelot->mrp_s_port == dev) - ocelot->mrp_s_port = null; + if (!ocelot_port) + continue; - ocelot->mrp_ring_id = 0; + if (ocelot_port->mrp_ring_id != 0) + goto out; + } + ocelot_mrp_del_mac(ocelot, ocelot_port); +out: - struct ocelot_vcap_filter *filter; - struct ocelot_port_private *priv; - struct net_device *dev; + int dst_port; - priv = container_of(ocelot_port, struct ocelot_port_private, port); - dev = priv->dev; - - if (ocelot->mrp_ring_id != mrp->ring_id) - return -einval; - - if (!mrp->sw_backup) + if (mrp->ring_role != br_mrp_ring_role_mrc && !mrp->sw_backup) - if (ocelot->mrp_p_port != dev && ocelot->mrp_s_port != dev) + if (ocelot_port->mrp_ring_id != mrp->ring_id) - filter = kzalloc(sizeof(*filter), gfp_atomic); - if (!filter) - return -enomem; + ocelot_mrp_save_mac(ocelot, ocelot_port); - filter->key_type = ocelot_vcap_key_etype; - filter->prio = 1; - filter->id.cookie = priv->chip_port; - filter->id.tc_offload = false; - filter->block_id = vcap_is2; - filter->type = ocelot_vcap_filter_offload; - filter->ingress_port_mask = bit(priv->chip_port); - *(__be16 *)filter->key.etype.etype.value = htons(eth_p_mrp); - *(__be16 *)filter->key.etype.etype.mask = htons(0xffff); - filter->action.mask_mode = ocelot_mask_mode_permit_deny; - filter->action.port_mask = 0x0; - filter->action.cpu_copy_ena = true; - filter->action.cpu_qu_num = ocelot_mrp_cpuq; + if (mrp->ring_role != br_mrp_ring_role_mrc) + return ocelot_mrp_copy_add_vcap(ocelot, port, 1, port); - err = ocelot_vcap_filter_add(ocelot, filter, null); + dst_port = ocelot_mrp_find_partner_port(ocelot, ocelot_port); + if (dst_port == -1) + return -einval; + + err = ocelot_mrp_redirect_add_vcap(ocelot, port, dst_port); - kfree(filter); + return err; - return err; + err = ocelot_mrp_copy_add_vcap(ocelot, port, 2, + port + ocelot->num_phys_ports); + if (err) { + ocelot_mrp_del_vcap(ocelot, port); + return err; + } + + return 0; - struct ocelot_port_private *priv; - struct net_device *dev; + int i; - priv = container_of(ocelot_port, struct ocelot_port_private, port); - dev = priv->dev; - - if (ocelot->mrp_ring_id != mrp->ring_id) - return -einval; - - if (!mrp->sw_backup) + if (mrp->ring_role != br_mrp_ring_role_mrc && !mrp->sw_backup) - if (ocelot->mrp_p_port != dev && ocelot->mrp_s_port != dev) + if (ocelot_port->mrp_ring_id != mrp->ring_id) - return ocelot_mrp_del_vcap(ocelot, priv->chip_port); + ocelot_mrp_del_vcap(ocelot, port); + ocelot_mrp_del_vcap(ocelot, port + ocelot->num_phys_ports); + + for (i = 0; i < ocelot->num_phys_ports; ++i) { + ocelot_port = ocelot->ports[i]; + + if (!ocelot_port) + continue; + + if (ocelot_port->mrp_ring_id != 0) + goto out; + } + + ocelot_mrp_del_mac(ocelot, ocelot_port); +out: + return 0; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h + + u16 mrp_ring_id; - -#if is_enabled(config_bridge_mrp) - u16 mrp_ring_id; - struct net_device *mrp_p_port; - struct net_device *mrp_s_port; -#endif diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c -#if is_enabled(config_bridge_mrp) - if (eth_hdr(skb)->h_proto == cpu_to_be16(eth_p_mrp) && - cpuq & bit(ocelot_mrp_cpuq)) - skb->offload_fwd_mark = 0; -#endif -
|
Networking
|
7c588c3e96e9733a2a8a40caefd26c9189416821
|
horatiu vultur
|
include
|
soc
|
ethernet, mscc
|
net: ocelot: remove ocelot_xfh_get_cpuq
|
now when extracting frames from cpu the cpuq is not used anymore so remove it.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
extend mrp
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['ocelot ']
|
['h', 'c']
| 3
| 1
| 9
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c - u64 tod_in_ns, full_ts_in_ns, cpuq; + u64 tod_in_ns, full_ts_in_ns; - ocelot_xfh_get_cpuq(xfh, &cpuq); diff --git a/include/linux/dsa/ocelot.h b/include/linux/dsa/ocelot.h --- a/include/linux/dsa/ocelot.h +++ b/include/linux/dsa/ocelot.h -static inline void ocelot_xfh_get_cpuq(void *extraction, u64 *cpuq) -{ - packing(extraction, cpuq, 28, 20, ocelot_tag_len, unpack, 0); -} - diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c --- a/net/dsa/tag_ocelot.c +++ b/net/dsa/tag_ocelot.c - u64 cpuq; - ocelot_xfh_get_cpuq(extraction, &cpuq);
|
Networking
|
2ed2c5f0391106406ead3a74bfa571575eafe8b6
|
horatiu vultur
|
include
|
linux
|
dsa, ethernet, mscc
|
net: ocelot: support multiple bridges
|
the ocelot switches are a bit odd in that they do not have an stp state to put the ports into. instead, the forwarding configuration is delayed from the typical port_bridge_join into stp_state_set, when the port enters the br_state_forwarding state.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
support multiple bridges
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['ocelot ']
|
['h', 'c']
| 2
| 39
| 40
|
--- diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c - if (ocelot->bridge_mask & bit(src_port)) + if (ocelot->ports[src_port]->bridge) +static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, + struct net_device *bridge) +{ + u32 mask = 0; + int port; + + for (port = 0; port < ocelot->num_phys_ports; port++) { + struct ocelot_port *ocelot_port = ocelot->ports[port]; + + if (!ocelot_port) + continue; + + if (ocelot_port->stp_state == br_state_forwarding && + ocelot_port->bridge == bridge) + mask |= bit(port); + } + + return mask; +} + - } else if (ocelot->bridge_fwd_mask & bit(port)) { + } else if (ocelot_port->bridge) { + struct net_device *bridge = ocelot_port->bridge; - mask = ocelot->bridge_fwd_mask & ~bit(port); + mask = ocelot_get_bridge_fwd_mask(ocelot, bridge); + mask &= ~bit(port); - u32 port_cfg; - - if (!(bit(port) & ocelot->bridge_mask)) - return; + u32 learn_ena = 0; - port_cfg = ocelot_read_gix(ocelot, ana_port_port_cfg, port); + ocelot_port->stp_state = state; - switch (state) { - case br_state_forwarding: - ocelot->bridge_fwd_mask |= bit(port); - fallthrough; - case br_state_learning: - if (ocelot_port->learn_ena) - port_cfg |= ana_port_port_cfg_learn_ena; - break; - - default: - port_cfg &= ~ana_port_port_cfg_learn_ena; - ocelot->bridge_fwd_mask &= ~bit(port); - break; - } + if ((state == br_state_learning || state == br_state_forwarding) && + ocelot_port->learn_ena) + learn_ena = ana_port_port_cfg_learn_ena; - ocelot_write_gix(ocelot, port_cfg, ana_port_port_cfg, port); + ocelot_rmw_gix(ocelot, learn_ena, ana_port_port_cfg_learn_ena, + ana_port_port_cfg, port); - if (!ocelot->bridge_mask) { - ocelot->hw_bridge_dev = bridge; - } else { - if (ocelot->hw_bridge_dev != bridge) - /* this is adding the port to a second bridge, this is - * unsupported */ - return -enodev; - } + struct ocelot_port *ocelot_port = ocelot->ports[port]; - ocelot->bridge_mask |= bit(port); + ocelot_port->bridge = bridge; + struct ocelot_port *ocelot_port = ocelot->ports[port]; - ocelot->bridge_mask &= ~bit(port); - - if (!ocelot->bridge_mask) - ocelot->hw_bridge_dev = null; + ocelot_port->bridge = null; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h + + struct net_device *bridge; + u8 stp_state; - struct net_device *hw_bridge_dev; - u16 bridge_mask; - u16 bridge_fwd_mask; -
|
Networking
|
df291e54ccca0ef357f07a7b89263f7918d6ed7a
|
vladimir oltean
|
include
|
soc
|
ethernet, mscc
|
octeontx2-af: cn10k: mailbox changes for cn10k cpt
|
adds changes to existing cpt mailbox messages to support cn10k cpt block. this patch also adds new register defines for cn10k cpt.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for cn10k cpt block
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 2
| 31
| 1
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +#define pci_devid_otx2_cpt10k_pf 0xa0f2 + +/* length of initial context fetch in 128 byte words */ +#define cpt_ctx_ilen 2 - if (pdev->device == pci_devid_otx2_cpt_pf) { + if (pdev->device == pci_devid_otx2_cpt_pf || + pdev->device == pci_devid_otx2_cpt10k_pf) { + if (!is_rvu_otx2(rvu)) + val |= (cpt_ctx_ilen << 17); + + case cpt_af_ctx_flush_timer: diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +#define cpt_af_ctx_flush_timer (0x48000ull) +#define cpt_af_ctx_err (0x48008ull) +#define cpt_af_ctx_enc_id (0x48010ull) +#define cpt_af_ctx_mis_pc (0x49400ull) +#define cpt_af_ctx_hit_pc (0x49408ull) +#define cpt_af_ctx_aop_pc (0x49410ull) +#define cpt_af_ctx_aop_latency_pc (0x49418ull) +#define cpt_af_ctx_ifetch_pc (0x49420ull) +#define cpt_af_ctx_ifetch_latency_pc (0x49428ull) +#define cpt_af_ctx_ffetch_pc (0x49430ull) +#define cpt_af_ctx_ffetch_latency_pc (0x49438ull) +#define cpt_af_ctx_wback_pc (0x49440ull) +#define cpt_af_ctx_wback_latency_pc (0x49448ull) +#define cpt_af_ctx_psh_pc (0x49450ull) +#define cpt_af_ctx_psh_latency_pc (0x49458ull) +#define cpt_af_rxc_time (0x50010ull) +#define cpt_af_rxc_time_cfg (0x50018ull) +#define cpt_af_rxc_dfrg (0x50020ull) +#define cpt_af_rxc_active_sts (0x50028ull) +#define cpt_af_rxc_zombie_sts (0x50030ull) +#define cpt_af_x2px_link_cfg(a) (0x51000ull | (u64)(a) << 3)
|
Networking
|
e4bbc5c53a8f6b9235d8f1292377705cf7bcf59b
|
srujana challa
|
drivers
|
net
|
af, ethernet, marvell, octeontx2
|
octeontx2-af: cn10k: add mailbox to configure reassembly timeout
|
cn10k cpt coprocessor includes a component named rxc which is responsible for reassembly of inner ip packets. rxc has the feature to evict oldest entries based on age/threshold. this patch adds a new mailbox to configure reassembly age or threshold.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for cn10k cpt block
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 2
| 75
| 7
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +m(cpt_rxc_time_cfg, 0xa06, cpt_rxc_time_cfg, cpt_rxc_time_cfg_req, \ + msg_rsp) \ +/* mailbox message request format to configure reassembly timeout. */ +struct cpt_rxc_time_cfg_req { + struct mbox_msghdr hdr; + int blkaddr; + u32 step; + u16 zombie_thres; + u16 zombie_limit; + u16 active_thres; + u16 active_limit; +}; + diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +#include <linux/bitfield.h> +static int validate_and_get_cpt_blkaddr(int req_blkaddr) +{ + int blkaddr; + + blkaddr = req_blkaddr ? req_blkaddr : blkaddr_cpt0; + if (blkaddr != blkaddr_cpt0 && blkaddr != blkaddr_cpt1) + return -einval; + + return blkaddr; +} + - blkaddr = req->blkaddr ? req->blkaddr : blkaddr_cpt0; - if (blkaddr != blkaddr_cpt0 && blkaddr != blkaddr_cpt1) - return -enodev; + blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr); + if (blkaddr < 0) + return blkaddr; - blkaddr = rvu_get_blkaddr(rvu, blktype_cpt, 0); + blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr); + if (blkaddr < 0) + return blkaddr; - blkaddr = req->blkaddr ? req->blkaddr : blkaddr_cpt0; - if (blkaddr != blkaddr_cpt0 && blkaddr != blkaddr_cpt1) - return -enodev; + blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr); + if (blkaddr < 0) + return blkaddr; +#define rxc_zombie_thres genmask_ull(59, 48) +#define rxc_zombie_limit genmask_ull(43, 32) +#define rxc_active_thres genmask_ull(27, 16) +#define rxc_active_limit genmask_ull(11, 0) +#define rxc_active_count genmask_ull(60, 48) +#define rxc_zombie_count genmask_ull(60, 48) + +static void cpt_rxc_time_cfg(struct rvu *rvu, struct cpt_rxc_time_cfg_req *req, + int blkaddr) +{ + u64 dfrg_reg; + + dfrg_reg = field_prep(rxc_zombie_thres, req->zombie_thres); + dfrg_reg |= field_prep(rxc_zombie_limit, req->zombie_limit); + dfrg_reg |= field_prep(rxc_active_thres, req->active_thres); + dfrg_reg |= field_prep(rxc_active_limit, req->active_limit); + + rvu_write64(rvu, blkaddr, cpt_af_rxc_time_cfg, req->step); + rvu_write64(rvu, blkaddr, cpt_af_rxc_dfrg, dfrg_reg); +} + +int rvu_mbox_handler_cpt_rxc_time_cfg(struct rvu *rvu, + struct cpt_rxc_time_cfg_req *req, + struct msg_rsp *rsp) +{ + int blkaddr; + + blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr); + if (blkaddr < 0) + return blkaddr; + + /* this message is accepted only if sent from cpt pf/vf */ + if (!is_cpt_pf(rvu, req->hdr.pcifunc) && + !is_cpt_vf(rvu, req->hdr.pcifunc)) + return cpt_af_err_access_denied; + + cpt_rxc_time_cfg(rvu, req, blkaddr); + + return 0; +} +
|
Networking
|
ecad2ce8c48fcaa23c6efd07e8d1467319a7bf8a
|
srujana challa
|
drivers
|
net
|
af, ethernet, marvell, octeontx2
|
octeontx2-af: add mailbox for cpt stats
|
adds a new mailbox to get cpt stats, includes performance counters, cpt engines status and rxc status.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for cn10k cpt block
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 2
| 160
| 0
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +m(cpt_stats, 0xa05, cpt_sts, cpt_sts_req, cpt_sts_rsp) \ +/* mailbox message request and response format for cpt stats. */ +struct cpt_sts_req { + struct mbox_msghdr hdr; + u8 blkaddr; +}; + +struct cpt_sts_rsp { + struct mbox_msghdr hdr; + u64 inst_req_pc; + u64 inst_lat_pc; + u64 rd_req_pc; + u64 rd_lat_pc; + u64 rd_uc_pc; + u64 active_cycles_pc; + u64 ctx_mis_pc; + u64 ctx_hit_pc; + u64 ctx_aop_pc; + u64 ctx_aop_lat_pc; + u64 ctx_ifetch_pc; + u64 ctx_ifetch_lat_pc; + u64 ctx_ffetch_pc; + u64 ctx_ffetch_lat_pc; + u64 ctx_wback_pc; + u64 ctx_wback_lat_pc; + u64 ctx_psh_pc; + u64 ctx_psh_lat_pc; + u64 ctx_err; + u64 ctx_enc_id; + u64 ctx_flush_timer; + u64 rxc_time; + u64 rxc_time_cfg; + u64 rxc_active_sts; + u64 rxc_zombie_sts; + u64 busy_sts_ae; + u64 free_sts_ae; + u64 busy_sts_se; + u64 free_sts_se; + u64 busy_sts_ie; + u64 free_sts_ie; + u64 exe_err_info; + u64 cptclk_cnt; + u64 diag; + u64 rxc_dfrg; + u64 x2p_link_cfg0; + u64 x2p_link_cfg1; +}; + diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +#define cpt_get_eng_sts(e_min, e_max, rsp, etype) \ +({ \ + u64 free_sts = 0, busy_sts = 0; \ + typeof(rsp) _rsp = rsp; \ + u32 e, i; \ + \ + for (e = (e_min), i = 0; e < (e_max); e++, i++) { \ + reg = rvu_read64(rvu, blkaddr, cpt_af_exex_sts(e)); \ + if (reg & 0x1) \ + busy_sts |= 1ull << i; \ + \ + if (reg & 0x2) \ + free_sts |= 1ull << i; \ + } \ + (_rsp)->busy_sts_##etype = busy_sts; \ + (_rsp)->free_sts_##etype = free_sts; \ +}) + +static void get_ctx_pc(struct rvu *rvu, struct cpt_sts_rsp *rsp, int blkaddr) +{ + if (is_rvu_otx2(rvu)) + return; + + rsp->ctx_mis_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_mis_pc); + rsp->ctx_hit_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_hit_pc); + rsp->ctx_aop_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_aop_pc); + rsp->ctx_aop_lat_pc = rvu_read64(rvu, blkaddr, + cpt_af_ctx_aop_latency_pc); + rsp->ctx_ifetch_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_ifetch_pc); + rsp->ctx_ifetch_lat_pc = rvu_read64(rvu, blkaddr, + cpt_af_ctx_ifetch_latency_pc); + rsp->ctx_ffetch_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_ffetch_pc); + rsp->ctx_ffetch_lat_pc = rvu_read64(rvu, blkaddr, + cpt_af_ctx_ffetch_latency_pc); + rsp->ctx_wback_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_ffetch_pc); + rsp->ctx_wback_lat_pc = rvu_read64(rvu, blkaddr, + cpt_af_ctx_ffetch_latency_pc); + rsp->ctx_psh_pc = rvu_read64(rvu, blkaddr, cpt_af_ctx_ffetch_pc); + rsp->ctx_psh_lat_pc = rvu_read64(rvu, blkaddr, + cpt_af_ctx_ffetch_latency_pc); + rsp->ctx_err = rvu_read64(rvu, blkaddr, cpt_af_ctx_err); + rsp->ctx_enc_id = rvu_read64(rvu, blkaddr, cpt_af_ctx_enc_id); + rsp->ctx_flush_timer = rvu_read64(rvu, blkaddr, cpt_af_ctx_flush_timer); + + rsp->rxc_time = rvu_read64(rvu, blkaddr, cpt_af_rxc_time); + rsp->rxc_time_cfg = rvu_read64(rvu, blkaddr, cpt_af_rxc_time_cfg); + rsp->rxc_active_sts = rvu_read64(rvu, blkaddr, cpt_af_rxc_active_sts); + rsp->rxc_zombie_sts = rvu_read64(rvu, blkaddr, cpt_af_rxc_zombie_sts); + rsp->rxc_dfrg = rvu_read64(rvu, blkaddr, cpt_af_rxc_dfrg); + rsp->x2p_link_cfg0 = rvu_read64(rvu, blkaddr, cpt_af_x2px_link_cfg(0)); + rsp->x2p_link_cfg1 = rvu_read64(rvu, blkaddr, cpt_af_x2px_link_cfg(1)); +} + +static void get_eng_sts(struct rvu *rvu, struct cpt_sts_rsp *rsp, int blkaddr) +{ + u16 max_ses, max_ies, max_aes; + u32 e_min = 0, e_max = 0; + u64 reg; + + reg = rvu_read64(rvu, blkaddr, cpt_af_constants1); + max_ses = reg & 0xffff; + max_ies = (reg >> 16) & 0xffff; + max_aes = (reg >> 32) & 0xffff; + + /* get ae status */ + e_min = max_ses + max_ies; + e_max = max_ses + max_ies + max_aes; + cpt_get_eng_sts(e_min, e_max, rsp, ae); + /* get se status */ + e_min = 0; + e_max = max_ses; + cpt_get_eng_sts(e_min, e_max, rsp, se); + /* get ie status */ + e_min = max_ses; + e_max = max_ses + max_ies; + cpt_get_eng_sts(e_min, e_max, rsp, ie); +} + +int rvu_mbox_handler_cpt_sts(struct rvu *rvu, struct cpt_sts_req *req, + struct cpt_sts_rsp *rsp) +{ + int blkaddr; + + blkaddr = validate_and_get_cpt_blkaddr(req->blkaddr); + if (blkaddr < 0) + return blkaddr; + + /* this message is accepted only if sent from cpt pf/vf */ + if (!is_cpt_pf(rvu, req->hdr.pcifunc) && + !is_cpt_vf(rvu, req->hdr.pcifunc)) + return cpt_af_err_access_denied; + + get_ctx_pc(rvu, rsp, blkaddr); + + /* get cpt engines status */ + get_eng_sts(rvu, rsp, blkaddr); + + /* read cpt instruction pc registers */ + rsp->inst_req_pc = rvu_read64(rvu, blkaddr, cpt_af_inst_req_pc); + rsp->inst_lat_pc = rvu_read64(rvu, blkaddr, cpt_af_inst_latency_pc); + rsp->rd_req_pc = rvu_read64(rvu, blkaddr, cpt_af_rd_req_pc); + rsp->rd_lat_pc = rvu_read64(rvu, blkaddr, cpt_af_rd_latency_pc); + rsp->rd_uc_pc = rvu_read64(rvu, blkaddr, cpt_af_rd_uc_pc); + rsp->active_cycles_pc = rvu_read64(rvu, blkaddr, + cpt_af_active_cycles_pc); + rsp->exe_err_info = rvu_read64(rvu, blkaddr, cpt_af_exe_err_info); + rsp->cptclk_cnt = rvu_read64(rvu, blkaddr, cpt_af_cptclk_cnt); + rsp->diag = rvu_read64(rvu, blkaddr, cpt_af_diag); + + return 0; +} +
|
Networking
|
2e2ee4cd0ab546859b5b5b2874b973b6caf855b3
|
srujana challa
|
drivers
|
net
|
af, ethernet, marvell, octeontx2
|
octeontx2-pf: add ip tos and ip proto icmp/icmpv6 flow offload support
|
add support for programming the hw mcam match key with ip tos, ip(v6) proto icmp/icmpv6, allowing flow offload rules to be installed using those fields. the npc hw extracts layer type, which will be used as a matching criteria for different ip protocols.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add tc hardware offloads
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 3
| 57
| 4
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/npc.h b/drivers/net/ethernet/marvell/octeontx2/af/npc.h --- a/drivers/net/ethernet/marvell/octeontx2/af/npc.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/npc.h + npc_ipproto_icmp, + npc_ipproto_icmp6, diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c + [npc_ipproto_icmp] = "ip proto icmp", + [npc_ipproto_icmp6] = "ip proto icmp6", + npc_scan_hdr(npc_tos, npc_lid_lc, npc_lt_lc_ip, 1, 1); - /* for ah, check if corresponding layer type is present in the key */ - if (npc_check_field(rvu, blkaddr, npc_ld, intf)) + /* for ah/icmp/icmpv6/, check if corresponding layer type is present in the key */ + if (npc_check_field(rvu, blkaddr, npc_ld, intf)) { + *features |= bit_ull(npc_ipproto_icmp); + *features |= bit_ull(npc_ipproto_icmp6); + } + if (features & bit_ull(npc_ipproto_icmp)) + npc_update_entry(rvu, npc_ld, entry, npc_lt_ld_icmp, + 0, ~0ull, 0, intf); + if (features & bit_ull(npc_ipproto_icmp6)) + npc_update_entry(rvu, npc_ld, entry, npc_lt_ld_icmp6, + 0, ~0ull, 0, intf); + npc_write_flow(npc_tos, tos, pkt->tos, 0, mask->tos, 0); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c + if (ipv4_usr_mask->tos) { + pkt->tos = ipv4_usr_hdr->tos; + pmask->tos = ipv4_usr_mask->tos; + req->features |= bit_ull(npc_tos); + } + if (ipv4_usr_mask->proto) { + switch (ipv4_usr_hdr->proto) { + case ipproto_icmp: + req->features |= bit_ull(npc_ipproto_icmp); + break; + case ipproto_tcp: + req->features |= bit_ull(npc_ipproto_tcp); + break; + case ipproto_udp: + req->features |= bit_ull(npc_ipproto_udp); + break; + case ipproto_sctp: + req->features |= bit_ull(npc_ipproto_sctp); + break; + case ipproto_ah: + req->features |= bit_ull(npc_ipproto_ah); + break; + case ipproto_esp: + req->features |= bit_ull(npc_ipproto_esp); + break; + default: + return -eopnotsupp; + } + } + if (ipv4_l4_mask->tos) { + pkt->tos = ipv4_l4_hdr->tos; + pmask->tos = ipv4_l4_mask->tos; + req->features |= bit_ull(npc_tos); + } + if (ah_esp_mask->tos) { + pkt->tos = ah_esp_hdr->tos; + pmask->tos = ah_esp_mask->tos; + req->features |= bit_ull(npc_tos); + } - if ((ah_esp_mask->spi & ah_esp_hdr->spi) || - (ah_esp_mask->tos & ah_esp_mask->tos)) + if (ah_esp_mask->spi & ah_esp_hdr->spi)
|
Networking
|
2b9cef6679020938666a81f3b6e743cdfcb8b32d
|
naveen mamindlapalli
|
drivers
|
net
|
af, ethernet, marvell, nic, octeontx2
|
octeontx2-pf: add tc flower hardware offload on ingress traffic
|
this patch adds support for tc flower hardware offload on ingress traffic. since the tc-flower filter rules use the same set of mcam rules as the n-tuple filters, the n-tuple filters and tc flower rules are mutually exclusive. when one of the feature is enabled using ethtool, the other feature is disabled in the driver. by default the driver enables n-tuple filters during initialization.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add tc hardware offloads
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c', 'makefile']
| 6
| 551
| 2
|
-> ethernet: dst_mac -> l2 proto: all protocols -> vlan (802.1q): vlan_id/vlan_prio -> ipv4: dst_ip/src_ip/ip_proto{tcp|udp|sctp|icmp}/ip_tos -> ipv6: ip_proto{icmpv6} -> l4(tcp/udp/sctp): dst_port/src_port -> drop -> accept -> redirect -> vlan pop --- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c - seq_printf(s, "%d ", ntohs(rule->packet.vlan_tci)); + seq_printf(s, "0x%x ", ntohs(rule->packet.vlan_tci)); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/makefile b/drivers/net/ethernet/marvell/octeontx2/nic/makefile --- a/drivers/net/ethernet/marvell/octeontx2/nic/makefile +++ b/drivers/net/ethernet/marvell/octeontx2/nic/makefile - otx2_ptp.o otx2_flows.o cn10k.o + otx2_ptp.o otx2_flows.o otx2_tc.o cn10k.o diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +#include <net/pkt_cls.h> +#define otx2_max_tc_flows otx2_max_ntuple_flows + u32 tc_flower_offset; + u32 tc_max_flows; +struct otx2_tc_info { + /* hash table to store tc offloaded flows */ + struct rhashtable flow_table; + struct rhashtable_params flow_ht_params; + declare_bitmap(tc_entries_bitmap, otx2_max_tc_flows); + unsigned long num_entries; +}; + +#define otx2_flag_tc_flower_support bit_ull(11) + struct otx2_tc_info tc_info; +/* tc support */ +int otx2_init_tc(struct otx2_nic *nic); +void otx2_shutdown_tc(struct otx2_nic *nic); +int otx2_setup_tc(struct net_device *netdev, enum tc_setup_type type, + void *type_data); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c + flow_cfg->tc_max_flows = flow_cfg->ntuple_max_flows; + pfvf->flags |= otx2_flag_tc_flower_support; + flow_cfg->tc_flower_offset = flow_cfg->ntuple_offset; + pfvf->flags |= otx2_flag_tc_flower_support; + pf->flow_cfg->tc_max_flows = pf->flow_cfg->ntuple_max_flows; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +static netdev_features_t otx2_fix_features(struct net_device *dev, + netdev_features_t features) +{ + /* check if n-tuple filters are on */ + if ((features & netif_f_hw_tc) && (dev->features & netif_f_ntuple)) { + netdev_info(dev, "disabling n-tuple filters "); + features &= ~netif_f_ntuple; + } + + /* check if tc hw offload is on */ + if ((features & netif_f_ntuple) && (dev->features & netif_f_hw_tc)) { + netdev_info(dev, "disabling tc hardware offload "); + features &= ~netif_f_hw_tc; + } + + return features; +} + + if ((netdev->features & netif_f_hw_tc) > (features & netif_f_hw_tc) && + pf->tc_info.num_entries) { + netdev_err(netdev, "can't disable tc hardware offload while flows are active "); + return -ebusy; + } + + .ndo_fix_features = otx2_fix_features, + .ndo_setup_tc = otx2_setup_tc, + /* hw supports tc offload but mutually exclusive with n-tuple filters */ + if (pf->flags & otx2_flag_tc_flower_support) + netdev->hw_features |= netif_f_hw_tc; + + err = otx2_init_tc(pf); + if (err) + goto err_mcam_flow_del; + +err_mcam_flow_del: + otx2_mcam_flow_del(pf); + otx2_shutdown_tc(pf); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c --- /dev/null +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +// spdx-license-identifier: gpl-2.0 +/* marvell octeontx2 rvu physcial function ethernet driver + * + * copyright (c) 2021 marvell. + */ +#include <linux/netdevice.h> +#include <linux/etherdevice.h> +#include <linux/inetdevice.h> +#include <linux/rhashtable.h> +#include <net/flow_dissector.h> +#include <net/pkt_cls.h> +#include <net/tc_act/tc_gact.h> +#include <net/tc_act/tc_mirred.h> +#include <net/tc_act/tc_vlan.h> +#include <net/ipv6.h> + +#include "otx2_common.h" + +struct otx2_tc_flow { + struct rhash_head node; + unsigned long cookie; + u16 entry; + unsigned int bitpos; + struct rcu_head rcu; +}; + +static int otx2_tc_parse_actions(struct otx2_nic *nic, + struct flow_action *flow_action, + struct npc_install_flow_req *req) +{ + struct flow_action_entry *act; + struct net_device *target; + struct otx2_nic *priv; + int i; + + if (!flow_action_has_entries(flow_action)) { + netdev_info(nic->netdev, "no tc actions specified"); + return -einval; + } + + flow_action_for_each(i, act, flow_action) { + switch (act->id) { + case flow_action_drop: + req->op = nix_rx_actionop_drop; + return 0; + case flow_action_accept: + req->op = nix_rx_action_default; + return 0; + case flow_action_redirect_ingress: + target = act->dev; + priv = netdev_priv(target); + /* npc_install_flow_req doesn't support passing a target pcifunc */ + if (rvu_get_pf(nic->pcifunc) != rvu_get_pf(priv->pcifunc)) { + netdev_info(nic->netdev, + "can't redirect to other pf/vf "); + return -eopnotsupp; + } + req->vf = priv->pcifunc & rvu_pfvf_func_mask; + req->op = nix_rx_action_default; + return 0; + case flow_action_vlan_pop: + req->vtag0_valid = true; + /* use rx_vtag_type7 which is initialized to strip vlan tag */ + req->vtag0_type = nix_af_lfx_rx_vtag_type7; + break; + default: + return -eopnotsupp; + } + } + + return 0; +} + +static int otx2_tc_prepare_flow(struct otx2_nic *nic, + struct flow_cls_offload *f, + struct npc_install_flow_req *req) +{ + struct flow_msg *flow_spec = &req->packet; + struct flow_msg *flow_mask = &req->mask; + struct flow_dissector *dissector; + struct flow_rule *rule; + u8 ip_proto = 0; + + rule = flow_cls_offload_flow_rule(f); + dissector = rule->match.dissector; + + if ((dissector->used_keys & + ~(bit(flow_dissector_key_control) | + bit(flow_dissector_key_basic) | + bit(flow_dissector_key_eth_addrs) | + bit(flow_dissector_key_vlan) | + bit(flow_dissector_key_ipv4_addrs) | + bit(flow_dissector_key_ipv6_addrs) | + bit(flow_dissector_key_ports) | + bit(flow_dissector_key_ip)))) { + netdev_info(nic->netdev, "unsupported flow used key 0x%x", + dissector->used_keys); + return -eopnotsupp; + } + + if (flow_rule_match_key(rule, flow_dissector_key_basic)) { + struct flow_match_basic match; + + flow_rule_match_basic(rule, &match); + + /* all ethertypes can be matched, no hw limitation */ + flow_spec->etype = match.key->n_proto; + flow_mask->etype = match.mask->n_proto; + req->features |= bit_ull(npc_etype); + + if (match.mask->ip_proto && + (match.key->ip_proto != ipproto_tcp && + match.key->ip_proto != ipproto_udp && + match.key->ip_proto != ipproto_sctp && + match.key->ip_proto != ipproto_icmp && + match.key->ip_proto != ipproto_icmpv6)) { + netdev_info(nic->netdev, + "ip_proto=0x%x not supported ", + match.key->ip_proto); + return -eopnotsupp; + } + if (match.mask->ip_proto) + ip_proto = match.key->ip_proto; + + if (ip_proto == ipproto_udp) + req->features |= bit_ull(npc_ipproto_udp); + else if (ip_proto == ipproto_tcp) + req->features |= bit_ull(npc_ipproto_tcp); + else if (ip_proto == ipproto_sctp) + req->features |= bit_ull(npc_ipproto_sctp); + else if (ip_proto == ipproto_icmp) + req->features |= bit_ull(npc_ipproto_icmp); + else if (ip_proto == ipproto_icmpv6) + req->features |= bit_ull(npc_ipproto_icmp6); + } + + if (flow_rule_match_key(rule, flow_dissector_key_eth_addrs)) { + struct flow_match_eth_addrs match; + + flow_rule_match_eth_addrs(rule, &match); + if (!is_zero_ether_addr(match.mask->src)) { + netdev_err(nic->netdev, "src mac match not supported "); + return -eopnotsupp; + } + + if (!is_zero_ether_addr(match.mask->dst)) { + ether_addr_copy(flow_spec->dmac, (u8 *)&match.key->dst); + ether_addr_copy(flow_mask->dmac, + (u8 *)&match.mask->dst); + req->features |= bit_ull(npc_dmac); + } + } + + if (flow_rule_match_key(rule, flow_dissector_key_ip)) { + struct flow_match_ip match; + + flow_rule_match_ip(rule, &match); + if ((ntohs(flow_spec->etype) != eth_p_ip) && + match.mask->tos) { + netdev_err(nic->netdev, "tos not supported "); + return -eopnotsupp; + } + if (match.mask->ttl) { + netdev_err(nic->netdev, "ttl not supported "); + return -eopnotsupp; + } + flow_spec->tos = match.key->tos; + flow_mask->tos = match.mask->tos; + req->features |= bit_ull(npc_tos); + } + + if (flow_rule_match_key(rule, flow_dissector_key_vlan)) { + struct flow_match_vlan match; + u16 vlan_tci, vlan_tci_mask; + + flow_rule_match_vlan(rule, &match); + + if (ntohs(match.key->vlan_tpid) != eth_p_8021q) { + netdev_err(nic->netdev, "vlan tpid 0x%x not supported ", + ntohs(match.key->vlan_tpid)); + return -eopnotsupp; + } + + if (match.mask->vlan_id || + match.mask->vlan_dei || + match.mask->vlan_priority) { + vlan_tci = match.key->vlan_id | + match.key->vlan_dei << 12 | + match.key->vlan_priority << 13; + + vlan_tci_mask = match.mask->vlan_id | + match.key->vlan_dei << 12 | + match.key->vlan_priority << 13; + + flow_spec->vlan_tci = htons(vlan_tci); + flow_mask->vlan_tci = htons(vlan_tci_mask); + req->features |= bit_ull(npc_outer_vid); + } + } + + if (flow_rule_match_key(rule, flow_dissector_key_ipv4_addrs)) { + struct flow_match_ipv4_addrs match; + + flow_rule_match_ipv4_addrs(rule, &match); + + flow_spec->ip4dst = match.key->dst; + flow_mask->ip4dst = match.mask->dst; + req->features |= bit_ull(npc_dip_ipv4); + + flow_spec->ip4src = match.key->src; + flow_mask->ip4src = match.mask->src; + req->features |= bit_ull(npc_sip_ipv4); + } else if (flow_rule_match_key(rule, flow_dissector_key_ipv6_addrs)) { + struct flow_match_ipv6_addrs match; + + flow_rule_match_ipv6_addrs(rule, &match); + + if (ipv6_addr_loopback(&match.key->dst) || + ipv6_addr_loopback(&match.key->src)) { + netdev_err(nic->netdev, + "flow matching on ipv6 loopback addr is not supported "); + return -eopnotsupp; + } + + if (!ipv6_addr_any(&match.mask->dst)) { + memcpy(&flow_spec->ip6dst, + (struct in6_addr *)&match.key->dst, + sizeof(flow_spec->ip6dst)); + memcpy(&flow_mask->ip6dst, + (struct in6_addr *)&match.mask->dst, + sizeof(flow_spec->ip6dst)); + req->features |= bit_ull(npc_dip_ipv6); + } + + if (!ipv6_addr_any(&match.mask->src)) { + memcpy(&flow_spec->ip6src, + (struct in6_addr *)&match.key->src, + sizeof(flow_spec->ip6src)); + memcpy(&flow_mask->ip6src, + (struct in6_addr *)&match.mask->src, + sizeof(flow_spec->ip6src)); + req->features |= bit_ull(npc_sip_ipv6); + } + } + + if (flow_rule_match_key(rule, flow_dissector_key_ports)) { + struct flow_match_ports match; + + flow_rule_match_ports(rule, &match); + + flow_spec->dport = match.key->dst; + flow_mask->dport = match.mask->dst; + if (ip_proto == ipproto_udp) + req->features |= bit_ull(npc_dport_udp); + else if (ip_proto == ipproto_tcp) + req->features |= bit_ull(npc_dport_tcp); + else if (ip_proto == ipproto_sctp) + req->features |= bit_ull(npc_dport_sctp); + + flow_spec->sport = match.key->src; + flow_mask->sport = match.mask->src; + if (ip_proto == ipproto_udp) + req->features |= bit_ull(npc_sport_udp); + else if (ip_proto == ipproto_tcp) + req->features |= bit_ull(npc_sport_tcp); + else if (ip_proto == ipproto_sctp) + req->features |= bit_ull(npc_sport_sctp); + } + + return otx2_tc_parse_actions(nic, &rule->action, req); +} + +static int otx2_del_mcam_flow_entry(struct otx2_nic *nic, u16 entry) +{ + struct npc_delete_flow_req *req; + int err; + + mutex_lock(&nic->mbox.lock); + req = otx2_mbox_alloc_msg_npc_delete_flow(&nic->mbox); + if (!req) { + mutex_unlock(&nic->mbox.lock); + return -enomem; + } + + req->entry = entry; + + /* send message to af */ + err = otx2_sync_mbox_msg(&nic->mbox); + if (err) { + netdev_err(nic->netdev, "failed to delete mcam flow entry %d ", + entry); + mutex_unlock(&nic->mbox.lock); + return -efault; + } + mutex_unlock(&nic->mbox.lock); + + return 0; +} + +static int otx2_tc_del_flow(struct otx2_nic *nic, + struct flow_cls_offload *tc_flow_cmd) +{ + struct otx2_tc_info *tc_info = &nic->tc_info; + struct otx2_tc_flow *flow_node; + + flow_node = rhashtable_lookup_fast(&tc_info->flow_table, + &tc_flow_cmd->cookie, + tc_info->flow_ht_params); + if (!flow_node) { + netdev_err(nic->netdev, "tc flow not found for cookie 0x%lx ", + tc_flow_cmd->cookie); + return -einval; + } + + otx2_del_mcam_flow_entry(nic, flow_node->entry); + + warn_on(rhashtable_remove_fast(&nic->tc_info.flow_table, + &flow_node->node, + nic->tc_info.flow_ht_params)); + kfree_rcu(flow_node, rcu); + + clear_bit(flow_node->bitpos, tc_info->tc_entries_bitmap); + tc_info->num_entries--; + + return 0; +} + +static int otx2_tc_add_flow(struct otx2_nic *nic, + struct flow_cls_offload *tc_flow_cmd) +{ + struct otx2_tc_info *tc_info = &nic->tc_info; + struct otx2_tc_flow *new_node, *old_node; + struct npc_install_flow_req *req; + int rc; + + if (!(nic->flags & otx2_flag_tc_flower_support)) + return -enomem; + + /* allocate memory for the new flow and it's node */ + new_node = kzalloc(sizeof(*new_node), gfp_kernel); + if (!new_node) + return -enomem; + new_node->cookie = tc_flow_cmd->cookie; + + mutex_lock(&nic->mbox.lock); + req = otx2_mbox_alloc_msg_npc_install_flow(&nic->mbox); + if (!req) { + mutex_unlock(&nic->mbox.lock); + return -enomem; + } + + rc = otx2_tc_prepare_flow(nic, tc_flow_cmd, req); + if (rc) { + otx2_mbox_reset(&nic->mbox.mbox, 0); + mutex_unlock(&nic->mbox.lock); + return rc; + } + + /* if a flow exists with the same cookie, delete it */ + old_node = rhashtable_lookup_fast(&tc_info->flow_table, + &tc_flow_cmd->cookie, + tc_info->flow_ht_params); + if (old_node) + otx2_tc_del_flow(nic, tc_flow_cmd); + + if (bitmap_full(tc_info->tc_entries_bitmap, nic->flow_cfg->tc_max_flows)) { + netdev_err(nic->netdev, "not enough mcam space to add the flow "); + otx2_mbox_reset(&nic->mbox.mbox, 0); + mutex_unlock(&nic->mbox.lock); + return -enomem; + } + + new_node->bitpos = find_first_zero_bit(tc_info->tc_entries_bitmap, + nic->flow_cfg->tc_max_flows); + req->channel = nic->hw.rx_chan_base; + req->entry = nic->flow_cfg->entry[nic->flow_cfg->tc_flower_offset + + nic->flow_cfg->tc_max_flows - new_node->bitpos]; + req->intf = nix_intf_rx; + req->set_cntr = 1; + new_node->entry = req->entry; + + /* send message to af */ + rc = otx2_sync_mbox_msg(&nic->mbox); + if (rc) { + netdev_err(nic->netdev, "failed to install mcam flow entry "); + mutex_unlock(&nic->mbox.lock); + goto out; + } + mutex_unlock(&nic->mbox.lock); + + /* add new flow to flow-table */ + rc = rhashtable_insert_fast(&nic->tc_info.flow_table, &new_node->node, + nic->tc_info.flow_ht_params); + if (rc) { + otx2_del_mcam_flow_entry(nic, req->entry); + kfree_rcu(new_node, rcu); + goto out; + } + + set_bit(new_node->bitpos, tc_info->tc_entries_bitmap); + tc_info->num_entries++; +out: + return rc; +} + +static int otx2_setup_tc_cls_flower(struct otx2_nic *nic, + struct flow_cls_offload *cls_flower) +{ + switch (cls_flower->command) { + case flow_cls_replace: + return otx2_tc_add_flow(nic, cls_flower); + case flow_cls_destroy: + return otx2_tc_del_flow(nic, cls_flower); + case flow_cls_stats: + return -eopnotsupp; + default: + return -eopnotsupp; + } +} + +static int otx2_setup_tc_block_ingress_cb(enum tc_setup_type type, + void *type_data, void *cb_priv) +{ + struct otx2_nic *nic = cb_priv; + + if (!tc_cls_can_offload_and_chain0(nic->netdev, type_data)) + return -eopnotsupp; + + switch (type) { + case tc_setup_clsflower: + return otx2_setup_tc_cls_flower(nic, type_data); + default: + break; + } + + return -eopnotsupp; +} + +static list_head(otx2_block_cb_list); + +static int otx2_setup_tc_block(struct net_device *netdev, + struct flow_block_offload *f) +{ + struct otx2_nic *nic = netdev_priv(netdev); + + if (f->block_shared) + return -eopnotsupp; + + if (f->binder_type != flow_block_binder_type_clsact_ingress) + return -eopnotsupp; + + return flow_block_cb_setup_simple(f, &otx2_block_cb_list, + otx2_setup_tc_block_ingress_cb, + nic, nic, true); +} + +int otx2_setup_tc(struct net_device *netdev, enum tc_setup_type type, + void *type_data) +{ + switch (type) { + case tc_setup_block: + return otx2_setup_tc_block(netdev, type_data); + default: + return -eopnotsupp; + } +} + +static const struct rhashtable_params tc_flow_ht_params = { + .head_offset = offsetof(struct otx2_tc_flow, node), + .key_offset = offsetof(struct otx2_tc_flow, cookie), + .key_len = sizeof(((struct otx2_tc_flow *)0)->cookie), + .automatic_shrinking = true, +}; + +int otx2_init_tc(struct otx2_nic *nic) +{ + struct otx2_tc_info *tc = &nic->tc_info; + + tc->flow_ht_params = tc_flow_ht_params; + return rhashtable_init(&tc->flow_table, &tc->flow_ht_params); +} + +void otx2_shutdown_tc(struct otx2_nic *nic) +{ + struct otx2_tc_info *tc = &nic->tc_info; + + rhashtable_destroy(&tc->flow_table); +}
|
Networking
|
1d4d9e42c2406bc7599f5a5b7a49b71dced34b1e
|
naveen mamindlapalli
|
drivers
|
net
|
af, ethernet, marvell, nic, octeontx2
|
octeontx2-pf: add tc flower stats handler for hw offloads
|
add support to get the stats for tc flower flows that are offloaded to hardware. to support this feature, added a new af mbox handler which returns the mcam entry stats for a flow that has hardware stat counter enabled.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add tc hardware offloads
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 3
| 122
| 1
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +m(npc_mcam_get_stats, 0x6012, npc_mcam_entry_stats, \ + npc_mcam_get_stats_req, \ + npc_mcam_get_stats_rsp) \ +struct npc_mcam_get_stats_req { + struct mbox_msghdr hdr; + u16 entry; /* mcam entry */ +}; + +struct npc_mcam_get_stats_rsp { + struct mbox_msghdr hdr; + u64 stat; /* counter stats */ + u8 stat_ena; /* enabled */ +}; + diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c + +int rvu_mbox_handler_npc_mcam_entry_stats(struct rvu *rvu, + struct npc_mcam_get_stats_req *req, + struct npc_mcam_get_stats_rsp *rsp) +{ + struct npc_mcam *mcam = &rvu->hw->mcam; + u16 index, cntr; + int blkaddr; + u64 regval; + u32 bank; + + blkaddr = rvu_get_blkaddr(rvu, blktype_npc, 0); + if (blkaddr < 0) + return npc_mcam_invalid_req; + + mutex_lock(&mcam->lock); + + index = req->entry & (mcam->banksize - 1); + bank = npc_get_bank(mcam, req->entry); + + /* read mcam entry stat_act register */ + regval = rvu_read64(rvu, blkaddr, npc_af_mcamex_bankx_stat_act(index, bank)); + + if (!(regval & bit_ull(9))) { + rsp->stat_ena = 0; + mutex_unlock(&mcam->lock); + return 0; + } + + cntr = regval & 0x1ff; + + rsp->stat_ena = 1; + rsp->stat = rvu_read64(rvu, blkaddr, npc_af_match_statx(cntr)); + rsp->stat &= bit_ull(48) - 1; + + mutex_unlock(&mcam->lock); + + return 0; +} diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +struct otx2_tc_flow_stats { + u64 bytes; + u64 pkts; + u64 used; +}; + + struct otx2_tc_flow_stats stats; + spinlock_t lock; /* lock for stats */ +static int otx2_tc_get_flow_stats(struct otx2_nic *nic, + struct flow_cls_offload *tc_flow_cmd) +{ + struct otx2_tc_info *tc_info = &nic->tc_info; + struct npc_mcam_get_stats_req *req; + struct npc_mcam_get_stats_rsp *rsp; + struct otx2_tc_flow_stats *stats; + struct otx2_tc_flow *flow_node; + int err; + + flow_node = rhashtable_lookup_fast(&tc_info->flow_table, + &tc_flow_cmd->cookie, + tc_info->flow_ht_params); + if (!flow_node) { + netdev_info(nic->netdev, "tc flow not found for cookie %lx", + tc_flow_cmd->cookie); + return -einval; + } + + mutex_lock(&nic->mbox.lock); + + req = otx2_mbox_alloc_msg_npc_mcam_entry_stats(&nic->mbox); + if (!req) { + mutex_unlock(&nic->mbox.lock); + return -enomem; + } + + req->entry = flow_node->entry; + + err = otx2_sync_mbox_msg(&nic->mbox); + if (err) { + netdev_err(nic->netdev, "failed to get stats for mcam flow entry %d ", + req->entry); + mutex_unlock(&nic->mbox.lock); + return -efault; + } + + rsp = (struct npc_mcam_get_stats_rsp *)otx2_mbox_get_rsp + (&nic->mbox.mbox, 0, &req->hdr); + if (is_err(rsp)) { + mutex_unlock(&nic->mbox.lock); + return ptr_err(rsp); + } + + mutex_unlock(&nic->mbox.lock); + + if (!rsp->stat_ena) + return -einval; + + stats = &flow_node->stats; + + spin_lock(&flow_node->lock); + flow_stats_update(&tc_flow_cmd->stats, 0x0, rsp->stat - stats->pkts, 0x0, 0x0, + flow_action_hw_stats_immediate); + stats->pkts = rsp->stat; + spin_unlock(&flow_node->lock); + + return 0; +} + - return -eopnotsupp; + return otx2_tc_get_flow_stats(nic, cls_flower);
|
Networking
|
d8ce30e0cf76afe2dd1acfd3f64f66a8afdfa539
|
naveen mamindlapalli
|
drivers
|
net
|
af, ethernet, marvell, nic, octeontx2
|
octeontx2-pf: tc_matchall egress ratelimiting offload
|
add tc_matchall egress ratelimiting offload support with police action for entire traffic going out of the interface.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add tc hardware offloads
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['octeontx2-af ']
|
['h', 'c']
| 3
| 236
| 4
|
--- diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +#define otx2_flag_tc_matchall_egress_enabled bit_ull(12) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +#define nix_af_tl4x_pir(a) (0x1230 | (a) << 16) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +#include <linux/bitfield.h> +/* egress rate limiting definitions */ +#define max_burst_exponent 0x0full +#define max_burst_mantissa 0xffull +#define max_burst_size 130816ull +#define max_rate_divider_exponent 12ull +#define max_rate_exponent 0x0full +#define max_rate_mantissa 0xffull + +/* bitfields in nix_tlx_pir register */ +#define tlx_rate_mantissa genmask_ull(8, 1) +#define tlx_rate_exponent genmask_ull(12, 9) +#define tlx_rate_divider_exponent genmask_ull(16, 13) +#define tlx_burst_mantissa genmask_ull(36, 29) +#define tlx_burst_exponent genmask_ull(40, 37) + +static void otx2_get_egress_burst_cfg(u32 burst, u32 *burst_exp, + u32 *burst_mantissa) +{ + unsigned int tmp; + + /* burst is calculated as + * ((256 + burst_mantissa) << (1 + burst_exponent)) / 256 + * max supported burst size is 130,816 bytes. + */ + burst = min_t(u32, burst, max_burst_size); + if (burst) { + *burst_exp = ilog2(burst) ? ilog2(burst) - 1 : 0; + tmp = burst - rounddown_pow_of_two(burst); + if (burst < max_burst_mantissa) + *burst_mantissa = tmp * 2; + else + *burst_mantissa = tmp / (1ull << (*burst_exp - 7)); + } else { + *burst_exp = max_burst_exponent; + *burst_mantissa = max_burst_mantissa; + } +} + +static void otx2_get_egress_rate_cfg(u32 maxrate, u32 *exp, + u32 *mantissa, u32 *div_exp) +{ + unsigned int tmp; + + /* rate calculation by hardware + * + * pir_add = ((256 + mantissa) << exp) / 256 + * rate = (2 * pir_add) / ( 1 << div_exp) + * the resultant rate is in mbps. + */ + + /* 2mbps to 100gbps can be expressed with div_exp = 0. + * setting this to '0' will ease the calculation of + * exponent and mantissa. + */ + *div_exp = 0; + + if (maxrate) { + *exp = ilog2(maxrate) ? ilog2(maxrate) - 1 : 0; + tmp = maxrate - rounddown_pow_of_two(maxrate); + if (maxrate < max_rate_mantissa) + *mantissa = tmp * 2; + else + *mantissa = tmp / (1ull << (*exp - 7)); + } else { + /* instead of disabling rate limiting, set all values to max */ + *exp = max_rate_exponent; + *mantissa = max_rate_mantissa; + } +} + +static int otx2_set_matchall_egress_rate(struct otx2_nic *nic, u32 burst, u32 maxrate) +{ + struct otx2_hw *hw = &nic->hw; + struct nix_txschq_config *req; + u32 burst_exp, burst_mantissa; + u32 exp, mantissa, div_exp; + int txschq, err; + + /* all sqs share the same tl4, so pick the first scheduler */ + txschq = hw->txschq_list[nix_txsch_lvl_tl4][0]; + + /* get exponent and mantissa values from the desired rate */ + otx2_get_egress_burst_cfg(burst, &burst_exp, &burst_mantissa); + otx2_get_egress_rate_cfg(maxrate, &exp, &mantissa, &div_exp); + + mutex_lock(&nic->mbox.lock); + req = otx2_mbox_alloc_msg_nix_txschq_cfg(&nic->mbox); + if (!req) { + mutex_unlock(&nic->mbox.lock); + return -enomem; + } + + req->lvl = nix_txsch_lvl_tl4; + req->num_regs = 1; + req->reg[0] = nix_af_tl4x_pir(txschq); + req->regval[0] = field_prep(tlx_burst_exponent, burst_exp) | + field_prep(tlx_burst_mantissa, burst_mantissa) | + field_prep(tlx_rate_divider_exponent, div_exp) | + field_prep(tlx_rate_exponent, exp) | + field_prep(tlx_rate_mantissa, mantissa) | bit_ull(0); + + err = otx2_sync_mbox_msg(&nic->mbox); + mutex_unlock(&nic->mbox.lock); + return err; +} + +static int otx2_tc_validate_flow(struct otx2_nic *nic, + struct flow_action *actions, + struct netlink_ext_ack *extack) +{ + if (nic->flags & otx2_flag_intf_down) { + nl_set_err_msg_mod(extack, "interface not initialized"); + return -einval; + } + + if (!flow_action_has_entries(actions)) { + nl_set_err_msg_mod(extack, "matchall offload called with no action"); + return -einval; + } + + if (!flow_offload_has_one_action(actions)) { + nl_set_err_msg_mod(extack, + "egress matchall offload supports only 1 policing action"); + return -einval; + } + return 0; +} + +static int otx2_tc_egress_matchall_install(struct otx2_nic *nic, + struct tc_cls_matchall_offload *cls) +{ + struct netlink_ext_ack *extack = cls->common.extack; + struct flow_action *actions = &cls->rule->action; + struct flow_action_entry *entry; + u32 rate; + int err; + + err = otx2_tc_validate_flow(nic, actions, extack); + if (err) + return err; + + if (nic->flags & otx2_flag_tc_matchall_egress_enabled) { + nl_set_err_msg_mod(extack, + "only one egress matchall ratelimitter can be offloaded"); + return -enomem; + } + + entry = &cls->rule->action.entries[0]; + switch (entry->id) { + case flow_action_police: + if (entry->police.rate_pkt_ps) { + nl_set_err_msg_mod(extack, "qos offload not support packets per second"); + return -eopnotsupp; + } + /* convert bytes per second to mbps */ + rate = entry->police.rate_bytes_ps * 8; + rate = max_t(u32, rate / 1000000, 1); + err = otx2_set_matchall_egress_rate(nic, entry->police.burst, rate); + if (err) + return err; + nic->flags |= otx2_flag_tc_matchall_egress_enabled; + break; + default: + nl_set_err_msg_mod(extack, + "only police action is supported with egress matchall offload"); + return -eopnotsupp; + } + + return 0; +} + +static int otx2_tc_egress_matchall_delete(struct otx2_nic *nic, + struct tc_cls_matchall_offload *cls) +{ + struct netlink_ext_ack *extack = cls->common.extack; + int err; + + if (nic->flags & otx2_flag_intf_down) { + nl_set_err_msg_mod(extack, "interface not initialized"); + return -einval; + } + + err = otx2_set_matchall_egress_rate(nic, 0, 0); + nic->flags &= ~otx2_flag_tc_matchall_egress_enabled; + return err; +} + +static int otx2_setup_tc_egress_matchall(struct otx2_nic *nic, + struct tc_cls_matchall_offload *cls_matchall) +{ + switch (cls_matchall->command) { + case tc_clsmatchall_replace: + return otx2_tc_egress_matchall_install(nic, cls_matchall); + case tc_clsmatchall_destroy: + return otx2_tc_egress_matchall_delete(nic, cls_matchall); + case tc_clsmatchall_stats: + default: + break; + } + + return -eopnotsupp; +} + +static int otx2_setup_tc_block_egress_cb(enum tc_setup_type type, + void *type_data, void *cb_priv) +{ + struct otx2_nic *nic = cb_priv; + + if (!tc_cls_can_offload_and_chain0(nic->netdev, type_data)) + return -eopnotsupp; + + switch (type) { + case tc_setup_clsmatchall: + return otx2_setup_tc_egress_matchall(nic, type_data); + default: + break; + } + + return -eopnotsupp; +} + + flow_setup_cb_t *cb; + bool ingress; - if (f->binder_type != flow_block_binder_type_clsact_ingress) + if (f->binder_type == flow_block_binder_type_clsact_ingress) { + cb = otx2_setup_tc_block_ingress_cb; + ingress = true; + } else if (f->binder_type == flow_block_binder_type_clsact_egress) { + cb = otx2_setup_tc_block_egress_cb; + ingress = false; + } else { + } - return flow_block_cb_setup_simple(f, &otx2_block_cb_list, - otx2_setup_tc_block_ingress_cb, - nic, nic, true); + return flow_block_cb_setup_simple(f, &otx2_block_cb_list, cb, + nic, nic, ingress);
|
Networking
|
e638a83f167ee9c4abd3faa3be460afe5a688490
|
sunil goutham
|
drivers
|
net
|
ethernet, marvell, nic, octeontx2
|
net: pcs: add c37 sgmii an support for intel mgbe controller
|
xpcs ip supports c37 sgmii an process and it is used in intel multi-gbe controller as mac-side sgmii.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add c37 sgmii an support for intel mgbe controller
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['pcs']
|
['h', 'c']
| 2
| 167
| 1
|
--- diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c +#define synopsys_xpcs_sgmii_id 0x7996ced0 +/* clause 37 defines */ +/* vr mii mmd registers offsets */ +#define dw_vr_mii_dig_ctrl1 0x8000 +#define dw_vr_mii_an_ctrl 0x8001 +#define dw_vr_mii_an_intr_sts 0x8002 + +/* vr_mii_dig_ctrl1 */ +#define dw_vr_mii_dig_ctrl1_mac_auto_sw bit(9) + +/* vr_mii_an_ctrl */ +#define dw_vr_mii_an_ctrl_tx_config_shift 3 +#define dw_vr_mii_tx_config_mask bit(3) +#define dw_vr_mii_tx_config_phy_side_sgmii 0x1 +#define dw_vr_mii_tx_config_mac_side_sgmii 0x0 +#define dw_vr_mii_an_ctrl_pcs_mode_shift 1 +#define dw_vr_mii_pcs_mode_mask genmask(2, 1) +#define dw_vr_mii_pcs_mode_c37_1000basex 0x0 +#define dw_vr_mii_pcs_mode_c37_sgmii 0x2 + +/* vr_mii_an_intr_sts */ +#define dw_vr_mii_an_sts_c37_ansgm_fd bit(1) +#define dw_vr_mii_an_sts_c37_ansgm_sp_shift 2 +#define dw_vr_mii_an_sts_c37_ansgm_sp genmask(3, 2) +#define dw_vr_mii_c37_ansgm_sp_10 0x0 +#define dw_vr_mii_c37_ansgm_sp_100 0x1 +#define dw_vr_mii_c37_ansgm_sp_1000 0x2 +#define dw_vr_mii_c37_ansgm_sp_lnksts bit(4) + +static const int xpcs_sgmii_features[] = { + ethtool_link_mode_10baset_half_bit, + ethtool_link_mode_10baset_full_bit, + ethtool_link_mode_100baset_half_bit, + ethtool_link_mode_100baset_full_bit, + ethtool_link_mode_1000baset_half_bit, + ethtool_link_mode_1000baset_full_bit, + __ethtool_link_mode_mask_nbits, +}; + +static const phy_interface_t xpcs_sgmii_interfaces[] = { + phy_interface_mode_sgmii, + phy_interface_mode_max, +}; + + }, { + .id = synopsys_xpcs_sgmii_id, + .mask = synopsys_xpcs_mask, + .supported = xpcs_sgmii_features, + .interface = xpcs_sgmii_interfaces, + .an_mode = dw_an_c37_sgmii, + case dw_an_c37_sgmii: + dev = mdio_mmd_vend2; + break; +static int xpcs_config_aneg_c37_sgmii(struct mdio_xpcs_args *xpcs) +{ + int ret; + + /* for an for c37 sgmii mode, the settings are :- + * 1) vr_mii_an_ctrl bit(2:1)[pcs_mode] = 10b (sgmii an) + * 2) vr_mii_an_ctrl bit(3) [tx_config] = 0b (mac side sgmii) + * dw xpcs used with dw eqos mac is always mac side sgmii. + * 3) vr_mii_dig_ctrl1 bit(9) [mac_auto_sw] = 1b (automatic + * speed/duplex mode change by hw after sgmii an complete) + * + * note: since it is mac side sgmii, there is no need to set + * sr_mii_an_adv. mac side sgmii receives an tx config from + * phy about the link state change after c28 an is completed + * between phy and link partner. there is also no need to + * trigger an restart for mac-side sgmii. + */ + ret = xpcs_read(xpcs, mdio_mmd_vend2, dw_vr_mii_an_ctrl); + if (ret < 0) + return ret; + + ret &= ~(dw_vr_mii_pcs_mode_mask | dw_vr_mii_tx_config_mask); + ret |= (dw_vr_mii_pcs_mode_c37_sgmii << + dw_vr_mii_an_ctrl_pcs_mode_shift & + dw_vr_mii_pcs_mode_mask); + ret |= (dw_vr_mii_tx_config_mac_side_sgmii << + dw_vr_mii_an_ctrl_tx_config_shift & + dw_vr_mii_tx_config_mask); + ret = xpcs_write(xpcs, mdio_mmd_vend2, dw_vr_mii_an_ctrl, ret); + if (ret < 0) + return ret; + + ret = xpcs_read(xpcs, mdio_mmd_vend2, dw_vr_mii_dig_ctrl1); + if (ret < 0) + return ret; + + ret |= dw_vr_mii_dig_ctrl1_mac_auto_sw; + + return xpcs_write(xpcs, mdio_mmd_vend2, dw_vr_mii_dig_ctrl1, ret); +} + + case dw_an_c37_sgmii: + ret = xpcs_config_aneg_c37_sgmii(xpcs); + if (ret) + return ret; + break; +static int xpcs_get_state_c37_sgmii(struct mdio_xpcs_args *xpcs, + struct phylink_link_state *state) +{ + int ret; + + /* reset link_state */ + state->link = false; + state->speed = speed_unknown; + state->duplex = duplex_unknown; + state->pause = 0; + + /* for c37 sgmii mode, we check dw_vr_mii_an_intr_sts for link + * status, speed and duplex. + */ + ret = xpcs_read(xpcs, mdio_mmd_vend2, dw_vr_mii_an_intr_sts); + if (ret < 0) + return false; + + if (ret & dw_vr_mii_c37_ansgm_sp_lnksts) { + int speed_value; + + state->link = true; + + speed_value = (ret & dw_vr_mii_an_sts_c37_ansgm_sp) >> + dw_vr_mii_an_sts_c37_ansgm_sp_shift; + if (speed_value == dw_vr_mii_c37_ansgm_sp_1000) + state->speed = speed_1000; + else if (speed_value == dw_vr_mii_c37_ansgm_sp_100) + state->speed = speed_100; + else + state->speed = speed_10; + + if (ret & dw_vr_mii_an_sts_c37_ansgm_fd) + state->duplex = duplex_full; + else + state->duplex = duplex_half; + } + + return 0; +} + + case dw_an_c37_sgmii: + ret = xpcs_get_state_c37_sgmii(xpcs, state); + if (ret) + return ret; + break; + /* first, search c73 pcs using pcs mmd */ - return id | ret; + /* if device ids are not all zeros, we found c73 an-type device */ + if (id | ret) + return id | ret; + + /* next, search c37 pcs using vendor-specific mii mmd */ + ret = xpcs_read(xpcs, mdio_mmd_vend2, mii_physid1); + if (ret < 0) + return 0xffffffff; + + id = ret << 16; + + ret = xpcs_read(xpcs, mdio_mmd_vend2, mii_physid2); + if (ret < 0) + return 0xffffffff; + + /* if device ids are not all zeros, we found c37 an-type device */ + if (id | ret) + return id | ret; + + return 0xffffffff; diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h +#define dw_an_c37_sgmii 2
|
Networking
|
b97b5331b8ab7f60fb880e0c31c9b09b73d2fa4e
|
ong boon leong
|
drivers
|
net
|
pcs
|
net: phy: add marvell 88x2222 transceiver support
|
add basic support for the marvell 88x2222 multi-speed ethernet transceiver.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add marvell 88x2222 transceiver support
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ']
|
['h', 'kconfig', 'c', 'makefile']
| 4
| 527
| 0
|
--- diff --git a/drivers/net/phy/kconfig b/drivers/net/phy/kconfig --- a/drivers/net/phy/kconfig +++ b/drivers/net/phy/kconfig +config marvell_88x2222_phy + tristate "marvell 88x2222 phy" + help + support for the marvell 88x2222 dual-port multi-speed ethernet + transceiver. + diff --git a/drivers/net/phy/makefile b/drivers/net/phy/makefile --- a/drivers/net/phy/makefile +++ b/drivers/net/phy/makefile +obj-$(config_marvell_88x2222_phy) += marvell-88x2222.o diff --git a/drivers/net/phy/marvell-88x2222.c b/drivers/net/phy/marvell-88x2222.c --- /dev/null +++ b/drivers/net/phy/marvell-88x2222.c +// spdx-license-identifier: gpl-2.0+ +/* + * marvell 88x2222 dual-port multi-speed ethernet transceiver. + * + * supports: + * xaui on the host side. + * 1000base-x or 10gbase-r on the line side. + * sgmii over 1000base-x. + */ +#include <linux/module.h> +#include <linux/phy.h> +#include <linux/gpio.h> +#include <linux/delay.h> +#include <linux/mdio.h> +#include <linux/marvell_phy.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> +#include <linux/sfp.h> +#include <linux/netdevice.h> + +/* port pcs configuration */ +#define mv_pcs_config 0xf002 +#define mv_pcs_host_xaui 0x73 +#define mv_pcs_line_10gbr (0x71 << 8) +#define mv_pcs_line_1gbx_an (0x7b << 8) +#define mv_pcs_line_sgmii_an (0x7f << 8) + +/* port reset and power down */ +#define mv_port_rst 0xf003 +#define mv_line_rst_sw bit(15) +#define mv_host_rst_sw bit(7) +#define mv_port_rst_sw (mv_line_rst_sw | mv_host_rst_sw) + +/* 1000base-x/sgmii control register */ +#define mv_1gbx_ctrl (0x2000 + mii_bmcr) + +/* 1000base-x/sgmii status register */ +#define mv_1gbx_stat (0x2000 + mii_bmsr) + +/* 1000base-x auto-negotiation advertisement register */ +#define mv_1gbx_advertise (0x2000 + mii_advertise) + +/* 1000base-x phy specific status register */ +#define mv_1gbx_phy_stat 0xa003 +#define mv_1gbx_phy_stat_an_resolved bit(11) +#define mv_1gbx_phy_stat_duplex bit(13) +#define mv_1gbx_phy_stat_speed100 bit(14) +#define mv_1gbx_phy_stat_speed1000 bit(15) + +struct mv2222_data { + phy_interface_t line_interface; + __ethtool_declare_link_mode_mask(supported); +}; + +/* sfi pma transmit enable */ +static int mv2222_tx_enable(struct phy_device *phydev) +{ + return phy_clear_bits_mmd(phydev, mdio_mmd_pmapmd, mdio_pma_txdis, + mdio_pmd_txdis_global); +} + +/* sfi pma transmit disable */ +static int mv2222_tx_disable(struct phy_device *phydev) +{ + return phy_set_bits_mmd(phydev, mdio_mmd_pmapmd, mdio_pma_txdis, + mdio_pmd_txdis_global); +} + +static int mv2222_soft_reset(struct phy_device *phydev) +{ + int val, ret; + + ret = phy_write_mmd(phydev, mdio_mmd_vend2, mv_port_rst, + mv_port_rst_sw); + if (ret < 0) + return ret; + + return phy_read_mmd_poll_timeout(phydev, mdio_mmd_vend2, mv_port_rst, + val, !(val & mv_port_rst_sw), + 5000, 1000000, true); +} + +/* returns negative on error, 0 if link is down, 1 if link is up */ +static int mv2222_read_status_10g(struct phy_device *phydev) +{ + int val, link = 0; + + val = phy_read_mmd(phydev, mdio_mmd_pcs, mdio_stat1); + if (val < 0) + return val; + + if (val & mdio_stat1_lstatus) { + link = 1; + + /* 10gbase-r do not support auto-negotiation */ + phydev->autoneg = autoneg_disable; + phydev->speed = speed_10000; + phydev->duplex = duplex_full; + } + + return link; +} + +/* returns negative on error, 0 if link is down, 1 if link is up */ +static int mv2222_read_status_1g(struct phy_device *phydev) +{ + int val, link = 0; + + val = phy_read_mmd(phydev, mdio_mmd_pcs, mv_1gbx_stat); + if (val < 0) + return val; + + if (!(val & bmsr_lstatus) || + (phydev->autoneg == autoneg_enable && + !(val & bmsr_anegcomplete))) + return 0; + + link = 1; + + val = phy_read_mmd(phydev, mdio_mmd_pcs, mv_1gbx_phy_stat); + if (val < 0) + return val; + + if (val & mv_1gbx_phy_stat_an_resolved) { + if (val & mv_1gbx_phy_stat_duplex) + phydev->duplex = duplex_full; + else + phydev->duplex = duplex_half; + + if (val & mv_1gbx_phy_stat_speed1000) + phydev->speed = speed_1000; + else if (val & mv_1gbx_phy_stat_speed100) + phydev->speed = speed_100; + else + phydev->speed = speed_10; + } + + return link; +} + +static int mv2222_read_status(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + int link; + + phydev->link = 0; + phydev->speed = speed_unknown; + phydev->duplex = duplex_unknown; + + if (priv->line_interface == phy_interface_mode_10gbaser) + link = mv2222_read_status_10g(phydev); + else + link = mv2222_read_status_1g(phydev); + + if (link < 0) + return link; + + phydev->link = link; + + return 0; +} + +static int mv2222_disable_aneg(struct phy_device *phydev) +{ + int ret = phy_clear_bits_mmd(phydev, mdio_mmd_pcs, mv_1gbx_ctrl, + bmcr_anenable | bmcr_anrestart); + if (ret < 0) + return ret; + + return mv2222_soft_reset(phydev); +} + +static int mv2222_enable_aneg(struct phy_device *phydev) +{ + int ret = phy_set_bits_mmd(phydev, mdio_mmd_pcs, mv_1gbx_ctrl, + bmcr_anenable | bmcr_reset); + if (ret < 0) + return ret; + + return mv2222_soft_reset(phydev); +} + +static int mv2222_set_sgmii_speed(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + + switch (phydev->speed) { + default: + case speed_1000: + if ((linkmode_test_bit(ethtool_link_mode_1000baset_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_1000baset_half_bit, + priv->supported))) + return phy_modify_mmd(phydev, mdio_mmd_pcs, + mv_1gbx_ctrl, + bmcr_speed1000 | bmcr_speed100, + bmcr_speed1000); + + fallthrough; + case speed_100: + if ((linkmode_test_bit(ethtool_link_mode_100baset_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_100baset_half_bit, + priv->supported))) + return phy_modify_mmd(phydev, mdio_mmd_pcs, + mv_1gbx_ctrl, + bmcr_speed1000 | bmcr_speed100, + bmcr_speed100); + fallthrough; + case speed_10: + if ((linkmode_test_bit(ethtool_link_mode_10baset_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10baset_half_bit, + priv->supported))) + return phy_modify_mmd(phydev, mdio_mmd_pcs, + mv_1gbx_ctrl, + bmcr_speed1000 | bmcr_speed100, + bmcr_speed10); + + return -einval; + } +} + +static bool mv2222_is_10g_capable(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + + return (linkmode_test_bit(ethtool_link_mode_10000baset_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10000basecr_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10000basesr_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10000baselr_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10000baselrm_full_bit, + priv->supported) || + linkmode_test_bit(ethtool_link_mode_10000baseer_full_bit, + priv->supported)); +} + +static bool mv2222_is_1gbx_capable(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + + return linkmode_test_bit(ethtool_link_mode_1000basex_full_bit, + priv->supported); +} + +static int mv2222_config_line(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + + switch (priv->line_interface) { + case phy_interface_mode_10gbaser: + return phy_write_mmd(phydev, mdio_mmd_vend2, mv_pcs_config, + mv_pcs_host_xaui | mv_pcs_line_10gbr); + case phy_interface_mode_1000basex: + return phy_write_mmd(phydev, mdio_mmd_vend2, mv_pcs_config, + mv_pcs_host_xaui | mv_pcs_line_1gbx_an); + case phy_interface_mode_sgmii: + return phy_write_mmd(phydev, mdio_mmd_vend2, mv_pcs_config, + mv_pcs_host_xaui | mv_pcs_line_sgmii_an); + default: + return -einval; + } +} + +static int mv2222_setup_forced(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + bool changed = false; + int ret; + + switch (priv->line_interface) { + case phy_interface_mode_10gbaser: + if (phydev->speed == speed_1000 && + mv2222_is_1gbx_capable(phydev)) { + priv->line_interface = phy_interface_mode_1000basex; + changed = true; + } + + break; + case phy_interface_mode_1000basex: + if (phydev->speed == speed_10000 && + mv2222_is_10g_capable(phydev)) { + priv->line_interface = phy_interface_mode_10gbaser; + changed = true; + } + + break; + case phy_interface_mode_sgmii: + ret = mv2222_set_sgmii_speed(phydev); + if (ret < 0) + return ret; + + break; + default: + return -einval; + } + + if (changed) { + ret = mv2222_config_line(phydev); + if (ret < 0) + return ret; + } + + return mv2222_disable_aneg(phydev); +} + +static int mv2222_config_aneg(struct phy_device *phydev) +{ + struct mv2222_data *priv = phydev->priv; + int ret, adv; + + /* sfp is not present, do nothing */ + if (priv->line_interface == phy_interface_mode_na) + return 0; + + if (phydev->autoneg == autoneg_disable || + phydev->speed == speed_10000) + return mv2222_setup_forced(phydev); + + if (priv->line_interface == phy_interface_mode_10gbaser && + mv2222_is_1gbx_capable(phydev)) { + priv->line_interface = phy_interface_mode_1000basex; + ret = mv2222_config_line(phydev); + if (ret < 0) + return ret; + } + + adv = linkmode_adv_to_mii_adv_x(priv->supported, + ethtool_link_mode_1000basex_full_bit); + + ret = phy_modify_mmd(phydev, mdio_mmd_pcs, mv_1gbx_advertise, + advertise_1000xfull | + advertise_1000xpause | advertise_1000xpse_asym, + adv); + if (ret < 0) + return ret; + + return mv2222_enable_aneg(phydev); +} + +static int mv2222_aneg_done(struct phy_device *phydev) +{ + int ret; + + if (mv2222_is_10g_capable(phydev)) { + ret = phy_read_mmd(phydev, mdio_mmd_pcs, mdio_stat1); + if (ret < 0) + return ret; + + if (ret & mdio_stat1_lstatus) + return 1; + } + + ret = phy_read_mmd(phydev, mdio_mmd_pcs, mv_1gbx_stat); + if (ret < 0) + return ret; + + return (ret & bmsr_anegcomplete); +} + +static int mv2222_resume(struct phy_device *phydev) +{ + return mv2222_tx_enable(phydev); +} + +static int mv2222_suspend(struct phy_device *phydev) +{ + return mv2222_tx_disable(phydev); +} + +static int mv2222_get_features(struct phy_device *phydev) +{ + /* all supported linkmodes are set at probe */ + + return 0; +} + +static int mv2222_config_init(struct phy_device *phydev) +{ + if (phydev->interface != phy_interface_mode_xaui) + return -einval; + + phydev->autoneg = autoneg_disable; + + return 0; +} + +static int mv2222_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) +{ + struct phy_device *phydev = upstream; + phy_interface_t sfp_interface; + struct mv2222_data *priv; + struct device *dev; + int ret; + + __ethtool_declare_link_mode_mask(sfp_supported) = { 0, }; + + priv = (struct mv2222_data *)phydev->priv; + dev = &phydev->mdio.dev; + + sfp_parse_support(phydev->sfp_bus, id, sfp_supported); + sfp_interface = sfp_select_interface(phydev->sfp_bus, sfp_supported); + + dev_info(dev, "%s sfp module inserted ", phy_modes(sfp_interface)); + + if (sfp_interface != phy_interface_mode_10gbaser && + sfp_interface != phy_interface_mode_1000basex && + sfp_interface != phy_interface_mode_sgmii) { + dev_err(dev, "incompatible sfp module inserted "); + + return -einval; + } + + priv->line_interface = sfp_interface; + linkmode_and(priv->supported, phydev->supported, sfp_supported); + + ret = mv2222_config_line(phydev); + if (ret < 0) + return ret; + + if (mutex_trylock(&phydev->lock)) { + if (priv->line_interface == phy_interface_mode_10gbaser) + ret = mv2222_setup_forced(phydev); + else + ret = mv2222_config_aneg(phydev); + + mutex_unlock(&phydev->lock); + } + + return ret; +} + +static void mv2222_sfp_remove(void *upstream) +{ + struct phy_device *phydev = upstream; + struct mv2222_data *priv; + + priv = (struct mv2222_data *)phydev->priv; + + priv->line_interface = phy_interface_mode_na; + linkmode_zero(priv->supported); +} + +static const struct sfp_upstream_ops sfp_phy_ops = { + .module_insert = mv2222_sfp_insert, + .module_remove = mv2222_sfp_remove, + .attach = phy_sfp_attach, + .detach = phy_sfp_detach, +}; + +static int mv2222_probe(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct mv2222_data *priv = null; + + __ethtool_declare_link_mode_mask(supported) = { 0, }; + + linkmode_set_bit(ethtool_link_mode_autoneg_bit, supported); + linkmode_set_bit(ethtool_link_mode_pause_bit, supported); + linkmode_set_bit(ethtool_link_mode_asym_pause_bit, supported); + linkmode_set_bit(ethtool_link_mode_fibre_bit, supported); + linkmode_set_bit(ethtool_link_mode_tp_bit, supported); + linkmode_set_bit(ethtool_link_mode_10baset_half_bit, supported); + linkmode_set_bit(ethtool_link_mode_10baset_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_100baset_half_bit, supported); + linkmode_set_bit(ethtool_link_mode_100baset_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_1000baset_half_bit, supported); + linkmode_set_bit(ethtool_link_mode_1000baset_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_1000basex_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000baset_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000basecr_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000basesr_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000baselr_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000baselrm_full_bit, supported); + linkmode_set_bit(ethtool_link_mode_10000baseer_full_bit, supported); + + linkmode_copy(phydev->supported, supported); + + priv = devm_kzalloc(dev, sizeof(*priv), gfp_kernel); + if (!priv) + return -enomem; + + priv->line_interface = phy_interface_mode_na; + phydev->priv = priv; + + return phy_sfp_probe(phydev, &sfp_phy_ops); +} + +static struct phy_driver mv2222_drivers[] = { + { + .phy_id = marvell_phy_id_88x2222, + .phy_id_mask = marvell_phy_id_mask, + .name = "marvell 88x2222", + .get_features = mv2222_get_features, + .soft_reset = mv2222_soft_reset, + .config_init = mv2222_config_init, + .config_aneg = mv2222_config_aneg, + .aneg_done = mv2222_aneg_done, + .probe = mv2222_probe, + .suspend = mv2222_suspend, + .resume = mv2222_resume, + .read_status = mv2222_read_status, + }, +}; +module_phy_driver(mv2222_drivers); + +static struct mdio_device_id __maybe_unused mv2222_tbl[] = { + { marvell_phy_id_88x2222, marvell_phy_id_mask }, + { } +}; +module_device_table(mdio, mv2222_tbl); + +module_description("marvell 88x2222 ethernet transceiver driver"); +module_license("gpl"); diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h +#define marvell_phy_id_88x2222 0x01410f10
|
Networking
|
6e3bac3eba448a438840ab8152cb8bbfcb8787b8
|
ivan bornyakov
|
include
|
linux
|
phy
|
net: phy: broadcom: add statistics for all gigabit phys
|
all gigabit phys use the same register layout as far as fetching statistics goes. fast ethernet phys do not all support statistics, and the bcm54616s would require some switching between the coper and fiber modes to fetch the appropriate statistics which is not supported yet.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add statistics for all gigabit phys
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ', 'broadcom']
|
['c']
| 1
| 66
| 10
|
--- diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c -struct bcm53xx_phy_priv { +struct bcm54xx_phy_priv { -static int bcm53xx_phy_probe(struct phy_device *phydev) +static int bcm54xx_phy_probe(struct phy_device *phydev) - struct bcm53xx_phy_priv *priv; + struct bcm54xx_phy_priv *priv; -static void bcm53xx_phy_get_stats(struct phy_device *phydev, - struct ethtool_stats *stats, u64 *data) +static void bcm54xx_get_stats(struct phy_device *phydev, + struct ethtool_stats *stats, u64 *data) - struct bcm53xx_phy_priv *priv = phydev->priv; + struct bcm54xx_phy_priv *priv = phydev->priv; + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, - .get_stats = bcm53xx_phy_get_stats, - .probe = bcm53xx_phy_probe, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, - .get_stats = bcm53xx_phy_get_stats, - .probe = bcm53xx_phy_probe, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm54xx_get_stats, + .probe = bcm54xx_phy_probe,
|
Networking
|
5a32fcdb1e686e90a2c5f2d095fb79aa2fb3f176
|
florian fainelli andrew lunn andrew lunn ch
|
drivers
|
net
|
phy
|
net: phy: add genphy_c45_loopback
|
add generic code to enable c45 phy loopback into the common phy-c45.c file. this will allow c45 phy drivers aceess this by setting .set_loopback.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for clause-45 phy loopback
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ']
|
['h', 'c']
| 2
| 9
| 0
|
--- diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c +int genphy_c45_loopback(struct phy_device *phydev, bool enable) +{ + return phy_modify_mmd(phydev, mdio_mmd_pcs, mdio_ctrl1, + mdio_pcs_ctrl1_loopback, + enable ? mdio_pcs_ctrl1_loopback : 0); +} +export_symbol_gpl(genphy_c45_loopback); + diff --git a/include/linux/phy.h b/include/linux/phy.h --- a/include/linux/phy.h +++ b/include/linux/phy.h +int genphy_c45_loopback(struct phy_device *phydev, bool enable);
|
Networking
|
0ef25ed104ac17fa0586fbb076f24a5e8940b966
|
wong vee khee heiner kallweit hkallweit gmail com heiner kallweit hkallweit gmail com andrew lunn andrew lunn ch
|
include
|
linux
|
phy
|
net: phy: marvell10g: add phy loopback support
|
add support for phy loopback for marvell 88x2110 and marvell 88x3310.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for clause-45 phy loopback
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ']
|
['c']
| 1
| 2
| 0
|
--- diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c + .set_loopback = genphy_c45_loopback, + .set_loopback = genphy_c45_loopback,
|
Networking
|
d137c70d0e7a3db91ed0c674acb561c115911100
|
wong vee khee
|
drivers
|
net
|
phy
|
net: phy: marvell10g: allow 5gbase-r and usxgmii
|
these modes are also supported by these phys.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
allow 5gbase-r and usxgmii
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ', 'marvell10g']
|
['c']
| 1
| 7
| 1
|
--- diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c + phydev->interface != phy_interface_mode_5gbaser && - phydev->interface != phy_interface_mode_10gbaser) + phydev->interface != phy_interface_mode_10gbaser && + phydev->interface != phy_interface_mode_usxgmii) + phydev->interface == phy_interface_mode_5gbaser || + case speed_5000: + phydev->interface = phy_interface_mode_5gbaser; + break;
|
Networking
|
0d3755428d6990637cf6dc45f007980a1dce28d1
|
marek beh n andrew lunn andrew lunn ch
|
drivers
|
net
|
phy
|
net: phy: marvell10g: support all rate matching modes
|
add support for all rate matching modes for 88x3310 (currently only 10gbase-r is supported, but xaui and rxaui can also be used).
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
support all rate matching modes
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ', 'marvell10g']
|
['c']
| 1
| 92
| 11
|
--- diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c +struct mv3310_chip { + int (*get_mactype)(struct phy_device *phydev); + int (*init_interface)(struct phy_device *phydev, int mactype); +}; + + phy_interface_t const_interface; +static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev) +{ + return phydev->drv->driver_data; +} + -static int mv3310_config_init(struct phy_device *phydev) +static int mv2110_get_mactype(struct phy_device *phydev) +{ + int mactype; + + mactype = phy_read_mmd(phydev, mdio_mmd_pmapmd, mv_pma_21x0_port_ctrl); + if (mactype < 0) + return mactype; + + return mactype & mv_pma_21x0_port_ctrl_mactype_mask; +} + +static int mv3310_get_mactype(struct phy_device *phydev) +{ + int mactype; + + mactype = phy_read_mmd(phydev, mdio_mmd_vend2, mv_v2_port_ctrl); + if (mactype < 0) + return mactype; + + return mactype & mv_v2_33x0_port_ctrl_mactype_mask; +} + +static int mv2110_init_interface(struct phy_device *phydev, int mactype) - int err; - int val; + + priv->rate_match = false; + + if (mactype == mv_pma_21x0_port_ctrl_mactype_10gbaser_rate_match) { + priv->rate_match = true; + priv->const_interface = phy_interface_mode_10gbaser; + } + + return 0; +} + +static int mv3310_init_interface(struct phy_device *phydev, int mactype) +{ + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + + priv->rate_match = false; + + if (mactype == mv_v2_33x0_port_ctrl_mactype_10gbaser_rate_match || + mactype == mv_v2_33x0_port_ctrl_mactype_rxaui_rate_match || + mactype == mv_v2_3310_port_ctrl_mactype_xaui_rate_match) + priv->rate_match = true; + + if (mactype == mv_v2_33x0_port_ctrl_mactype_10gbaser_rate_match) + priv->const_interface = phy_interface_mode_10gbaser; + else if (mactype == mv_v2_33x0_port_ctrl_mactype_rxaui_rate_match) + priv->const_interface = phy_interface_mode_rxaui; + else if (mactype == mv_v2_3310_port_ctrl_mactype_xaui_rate_match) + priv->const_interface = phy_interface_mode_xaui; + + return 0; +} + +static int mv3310_config_init(struct phy_device *phydev) +{ + const struct mv3310_chip *chip = to_mv3310_chip(phydev); + int err, mactype; - val = phy_read_mmd(phydev, mdio_mmd_vend2, mv_v2_port_ctrl); - if (val < 0) - return val; - priv->rate_match = ((val & mv_v2_33x0_port_ctrl_mactype_mask) == - mv_v2_33x0_port_ctrl_mactype_10gbaser_rate_match); + mactype = chip->get_mactype(phydev); + if (mactype < 0) + return mactype; + + err = chip->init_interface(phydev, mactype); + if (err) + return err; - /* in "xfi with rate matching" mode the phy interface is fixed at - * 10gb. the phy adapts the rate to actual wire speed with help of + /* in all of the "* with rate matching" modes the phy interface is fixed + * at 10gb. the phy adapts the rate to actual wire speed with help of - phydev->interface = phy_interface_mode_10gbaser; + phydev->interface = priv->const_interface; +static const struct mv3310_chip mv3310_type = { + .get_mactype = mv3310_get_mactype, + .init_interface = mv3310_init_interface, +}; + +static const struct mv3310_chip mv2110_type = { + .get_mactype = mv2110_get_mactype, + .init_interface = mv2110_init_interface, +}; + + .driver_data = &mv3310_type, + .driver_data = &mv2110_type,
|
Networking
|
97bbe3bd6922e7ccf8ecd308640a7da55ae3c2f9
|
marek beh n
|
drivers
|
net
|
phy
|
net: phy: marvell: add downshift support for m88e1240
|
add downshift support for 88e1240, it uses the same downshift configuration registers as 88e1011.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add downshift support for
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ', 'marvell']
|
['c']
| 1
| 2
| 0
|
--- diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c + .get_tunable = m88e1011_get_tunable, + .set_tunable = m88e1011_set_tunable,
|
Networking
|
65ad85f63b15af6995473724ab8562772db22753
|
maxim kochetkov
|
drivers
|
net
|
phy
|
net: phy: marvell: add support for amethyst internal phy
|
add support for amethyst internal phy.
|
this release includes the landlock security module, which aims to make easier to sandbox applications; support for the clang control flow integrity, which aims to abort the program upon detecting certain forms of undefined behavior; support for randomising the stack address offset in each syscall; support for concurrent tbl flushing; preparatory apple m1 support; support for incoming amd and intel graphics chips; bpf support for calling kernel functions directly; a virtio sound driver for improved sound experience on virtualized guests; io_uring support for multi shot mode and a misc cgroup for miscellaneous resources. as always, there are many other features, new drivers, improvements and fixes.
|
add support for amethyst internal phy
|
['core (various)', 'file systems', 'memory management', 'block layer', 'tracing, perf and bpf', 'virtualization', 'security', 'networking', 'architectures arm x86 mips powerpc riscv s390 ia64 xtensa']
|
['graphics', 'power management', 'storage', 'drivers in the staging area', 'networking', 'audio', 'tablets, touch screens, keyboards, mouses', 'tv tuners, webcams, video capturers', 'universal serial bus', 'serial peripheral interface (spi)', 'watchdog', 'serial', 'cpu frequency scaling', 'voltage, current regulators, power capping, power supply', 'real time clock (rtc)', 'pin controllers (pinctrl)', 'multi media card (mmc)', 'memory technology devices (mtd)', 'industrial i/o (iio)', 'multi function devices (mfd)', 'pulse-width modulation (pwm)', 'inter-integrated circuit (i2c + i3c)', 'hardware monitoring (hwmon)', 'general purpose i/o (gpio)', 'leds', 'dma engines', 'cryptography hardware acceleration', 'pci', 'remote processors', 'clock', 'phy ("physical layer" framework)', 'various']
|
['phy ', 'marvell']
|
['h', 'c']
| 2
| 115
| 3
|
--- diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c +#define mii_88e6393_misc_test_samples_2048 (0x0 << 11) +#define mii_88e6393_misc_test_samples_4096 (0x1 << 11) +#define mii_88e6393_misc_test_samples_8192 (0x2 << 11) +#define mii_88e6393_misc_test_samples_16384 (0x3 << 11) +#define mii_88e6393_misc_test_samples_mask (0x3 << 11) +#define mii_88e6393_misc_test_rate_2_3ms (0x5 << 8) +#define mii_88e6393_misc_test_rate_6_4ms (0x6 << 8) +#define mii_88e6393_misc_test_rate_11_9ms (0x7 << 8) +#define mii_88e6393_misc_test_rate_mask (0x7 << 8) -#define mii_88e6390_temp_sensor_mask 0xff -#define mii_88e6390_temp_sensor_samples 10 +#define mii_88e6393_temp_sensor_threshold_mask 0xff00 +#define mii_88e6393_temp_sensor_threshold_shift 8 +#define mii_88e6390_temp_sensor_mask 0xff +#define mii_88e6390_temp_sensor_samples 10 + int (*config)(struct phy_device *phydev); +static int m88e6393_get_temp(struct phy_device *phydev, long *temp) +{ + int err; + + err = m88e1510_get_temp(phydev, temp); + + /* 88e1510 measures t + 25, while the phy on 88e6393x switch + * t + 75, so we have to subtract another 50 + */ + *temp -= 50000; + + return err; +} + +static int m88e6393_get_temp_critical(struct phy_device *phydev, long *temp) +{ + int ret; + + *temp = 0; + + ret = phy_read_paged(phydev, mii_marvell_misc_test_page, + mii_88e6390_temp_sensor); + if (ret < 0) + return ret; + + *temp = (((ret & mii_88e6393_temp_sensor_threshold_mask) >> + mii_88e6393_temp_sensor_threshold_shift) - 75) * 1000; + + return 0; +} + +static int m88e6393_set_temp_critical(struct phy_device *phydev, long temp) +{ + temp = (temp / 1000) + 75; + + return phy_modify_paged(phydev, mii_marvell_misc_test_page, + mii_88e6390_temp_sensor, + mii_88e6393_temp_sensor_threshold_mask, + temp << mii_88e6393_temp_sensor_threshold_shift); +} + +static int m88e6393_hwmon_config(struct phy_device *phydev) +{ + int err; + + err = m88e6393_set_temp_critical(phydev, 100000); + if (err) + return err; + + return phy_modify_paged(phydev, mii_marvell_misc_test_page, + mii_88e6390_misc_test, + mii_88e6390_misc_test_temp_sensor_mask | + mii_88e6393_misc_test_samples_mask | + mii_88e6393_misc_test_rate_mask, + mii_88e6390_misc_test_temp_sensor_enable | + mii_88e6393_misc_test_samples_2048 | + mii_88e6393_misc_test_rate_2_3ms); +} + + if (is_err(priv->hwmon_dev)) + return ptr_err(priv->hwmon_dev); - return ptr_err_or_zero(priv->hwmon_dev); + if (ops->config) + err = ops->config(phydev); + + return err; +static const struct marvell_hwmon_ops m88e6393_hwmon_ops = { + .config = m88e6393_hwmon_config, + .get_temp = m88e6393_get_temp, + .get_temp_critical = m88e6393_get_temp_critical, + .set_temp_critical = m88e6393_set_temp_critical, + .get_temp_alarm = m88e1510_get_temp_alarm, +}; + + { + .phy_id = marvell_phy_id_88e6393_family, + .phy_id_mask = marvell_phy_id_mask, + .name = "marvell 88e6393 family", + .driver_data = def_marvell_hwmon_ops(m88e6393_hwmon_ops), + /* phy_gbit_features */ + .flags = phy_poll_cable_test, + .probe = marvell_probe, + .config_init = marvell_config_init, + .config_aneg = m88e1510_config_aneg, + .read_status = marvell_read_status, + .config_intr = marvell_config_intr, + .handle_interrupt = marvell_handle_interrupt, + .resume = genphy_resume, + .suspend = genphy_suspend, + .read_page = marvell_read_page, + .write_page = marvell_write_page, + .get_sset_count = marvell_get_sset_count, + .get_strings = marvell_get_strings, + .get_stats = marvell_get_stats, + .get_tunable = m88e1540_get_tunable, + .set_tunable = m88e1540_set_tunable, + .cable_test_start = marvell_vct7_cable_test_start, + .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, + .cable_test_get_status = marvell_vct7_cable_test_get_status, + }, + { marvell_phy_id_88e6393_family, marvell_phy_id_mask }, diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h +#define marvell_phy_id_88e6393_family 0x002b0b9b
|
Networking
|
a978f7c479ea68d68a6267a37cbd44362bdd9811
|
marek beh n
|
include
|
linux
|
phy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.