* RE: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for create_flow
From: Ruhl, Michael J @ 2018-05-31 14:42 UTC (permalink / raw)
To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Or Gerlitz, Raed Salem, Yishai Hadas, Saeed Mahameed,
linux-netdev
In-Reply-To: <20180531134341.18441-9-leon@kernel.org>
>-----Original Message-----
>From: Leon Romanovsky [mailto:leon@kernel.org]
>Sent: Thursday, May 31, 2018 9:44 AM
>To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
><jgg@mellanox.com>
>Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>rdma@vger.kernel.org>; Boris Pismenny <borisp@mellanox.com>; Matan
>Barak <matanb@mellanox.com>; Ruhl, Michael J <michael.j.ruhl@intel.com>;
>Or Gerlitz <ogerlitz@mellanox.com>; Raed Salem <raeds@mellanox.com>;
>Yishai Hadas <yishaih@mellanox.com>; Saeed Mahameed
><saeedm@mellanox.com>; linux-netdev <netdev@vger.kernel.org>
>Subject: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for
>create_flow
>
>From: Matan Barak <matanb@mellanox.com>
>
>This is required when user-space drivers need to pass extra information
>regarding how to handle this flow steering specification.
>
>Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>Signed-off-by: Matan Barak <matanb@mellanox.com>
>Signed-off-by: Boris Pismenny <borisp@mellanox.com>
>Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>---
> drivers/infiniband/core/uverbs_cmd.c | 7 ++++++-
> drivers/infiniband/core/verbs.c | 2 +-
> drivers/infiniband/hw/mlx4/main.c | 6 +++++-
> drivers/infiniband/hw/mlx5/main.c | 7 ++++++-
> include/rdma/ib_verbs.h | 3 ++-
> 5 files changed, 20 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/infiniband/core/uverbs_cmd.c
>b/drivers/infiniband/core/uverbs_cmd.c
>index e74262ee104c..ddb9d79691be 100644
>--- a/drivers/infiniband/core/uverbs_cmd.c
>+++ b/drivers/infiniband/core/uverbs_cmd.c
>@@ -3542,11 +3542,16 @@ int ib_uverbs_ex_create_flow(struct
>ib_uverbs_file *file,
> err = -EINVAL;
> goto err_free;
> }
>- flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
>+
>+ flow_id = qp->device->create_flow(qp, flow_attr,
>+ IB_FLOW_DOMAIN_USER, uhw);
>+
If the create_flow() callback is not defined, won't this cause a problem?
ib_flow_create() checks for the NULL.
Mike
> if (IS_ERR(flow_id)) {
> err = PTR_ERR(flow_id);
> goto err_free;
> }
>+ atomic_inc(&qp->usecnt);
>+ flow_id->qp = qp;
> flow_id->uobject = uobj;
> uobj->object = flow_id;
> uflow = container_of(uobj, typeof(*uflow), uobject);
>diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
>index 6ddfb1fade79..0b56828c1319 100644
>--- a/drivers/infiniband/core/verbs.c
>+++ b/drivers/infiniband/core/verbs.c
>@@ -1983,7 +1983,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
> if (!qp->device->create_flow)
> return ERR_PTR(-EOPNOTSUPP);
>
>- flow_id = qp->device->create_flow(qp, flow_attr, domain);
>+ flow_id = qp->device->create_flow(qp, flow_attr, domain, NULL);
> if (!IS_ERR(flow_id)) {
> atomic_inc(&qp->usecnt);
> flow_id->qp = qp;
>diff --git a/drivers/infiniband/hw/mlx4/main.c
>b/drivers/infiniband/hw/mlx4/main.c
>index bf12394c13c1..6fe5d5d1d1d9 100644
>--- a/drivers/infiniband/hw/mlx4/main.c
>+++ b/drivers/infiniband/hw/mlx4/main.c
>@@ -1848,7 +1848,7 @@ static int mlx4_ib_add_dont_trap_rule(struct
>mlx4_dev *dev,
>
> static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
> struct ib_flow_attr *flow_attr,
>- int domain)
>+ int domain, struct ib_udata *udata)
> {
> int err = 0, i = 0, j = 0;
> struct mlx4_ib_flow *mflow;
>@@ -1866,6 +1866,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct
>ib_qp *qp,
> (flow_attr->type != IB_FLOW_ATTR_NORMAL))
> return ERR_PTR(-EOPNOTSUPP);
>
>+ if (udata &&
>+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>+ return ERR_PTR(-EOPNOTSUPP);
>+
> memset(type, 0, sizeof(type));
>
> mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
>diff --git a/drivers/infiniband/hw/mlx5/main.c
>b/drivers/infiniband/hw/mlx5/main.c
>index 92879d2d3026..fb31a719ee25 100644
>--- a/drivers/infiniband/hw/mlx5/main.c
>+++ b/drivers/infiniband/hw/mlx5/main.c
>@@ -3371,7 +3371,8 @@ static struct mlx5_ib_flow_handler
>*create_sniffer_rule(struct mlx5_ib_dev *dev,
>
> static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
> struct ib_flow_attr *flow_attr,
>- int domain)
>+ int domain,
>+ struct ib_udata *udata)
> {
> struct mlx5_ib_dev *dev = to_mdev(qp->device);
> struct mlx5_ib_qp *mqp = to_mqp(qp);
>@@ -3383,6 +3384,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct
>ib_qp *qp,
> int err;
> int underlay_qpn;
>
>+ if (udata &&
>+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>+ return ERR_PTR(-EOPNOTSUPP);
>+
> if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
> return ERR_PTR(-ENOMEM);
>
>diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>index ba49e874c841..84f412f7b8f3 100644
>--- a/include/rdma/ib_verbs.h
>+++ b/include/rdma/ib_verbs.h
>@@ -2459,7 +2459,8 @@ struct ib_device {
> struct ib_flow * (*create_flow)(struct ib_qp *qp,
> struct ib_flow_attr
> *flow_attr,
>- int domain);
>+ int domain,
>+ struct ib_udata *udata);
> int (*destroy_flow)(struct ib_flow *flow_id);
> int (*check_mr_status)(struct ib_mr *mr, u32
>check_mask,
> struct ib_mr_status
>*mr_status);
>--
>2.14.3
^ permalink raw reply
* Re: [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Nicolas Dichtel @ 2018-05-31 14:31 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20180531142848.377-1-nicolas.dichtel@6wind.com>
Oops, I use an old email for Stephen, sorry.
Regards,
Nicolas
Le 31/05/2018 à 16:28, Nicolas Dichtel a écrit :
> Parse and display those attributes.
> Example:
> ip l a type dummy
> ip netns add foo
> ip monitor link&
> ip l s dummy1 netns foo
> Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
> link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> ip/ipaddress.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 00da14c6f97c..c7c7e7df4e81 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
> }
> }
>
> + if (tb[IFLA_NEW_NETNSID]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
> +
> + print_int(PRINT_FP, NULL, " new-nsid %d", id);
> + }
> + if (tb[IFLA_NEW_IFINDEX]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
> +
> + print_int(PRINT_FP, NULL, " new-ifindex %d", id);
> + }
> +
> if (tb[IFLA_PROTO_DOWN]) {
> if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
> print_bool(PRINT_ANY,
>
^ permalink raw reply
* [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Nicolas Dichtel @ 2018-05-31 14:28 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
Parse and display those attributes.
Example:
ip l a type dummy
ip netns add foo
ip monitor link&
ip l s dummy1 netns foo
Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/ipaddress.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 00da14c6f97c..c7c7e7df4e81 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
}
}
+ if (tb[IFLA_NEW_NETNSID]) {
+ int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
+
+ print_int(PRINT_FP, NULL, " new-nsid %d", id);
+ }
+ if (tb[IFLA_NEW_IFINDEX]) {
+ int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
+
+ print_int(PRINT_FP, NULL, " new-ifindex %d", id);
+ }
+
if (tb[IFLA_PROTO_DOWN]) {
if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
print_bool(PRINT_ANY,
--
2.15.1
^ permalink raw reply related
* [PATCH] net: virtio: simplify the virtnet_find_vqs
From: Tonghao Zhang @ 2018-05-31 14:16 UTC (permalink / raw)
To: netdev; +Cc: Tonghao Zhang
Use the common free functions while return successfully.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/virtio_net.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8f08a3e..0eee6d6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2609,12 +2609,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
vi->sq[i].vq = vqs[txq2vq(i)];
}
- kfree(names);
- kfree(callbacks);
- kfree(vqs);
- kfree(ctx);
+ /* run here: ret == 0. */
- return 0;
err_find:
kfree(ctx);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2] net: dsa: b53: Add BCM5389 support
From: Florian Fainelli @ 2018-05-31 14:14 UTC (permalink / raw)
To: Damien Thébault, vivien.didelot@savoirfairelinux.com,
andrew@lunn.ch
Cc: davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <1ce940f7dc9c2d57c53e93341629e1981755689a.camel@vitec.com>
On 05/31/2018 12:04 AM, Damien Thébault wrote:
> This patch adds support for the BCM5389 switch connected through MDIO.
>
> Signed-off-by: Damien Thébault <damien.thebault@vitec.com>
Looks great, thanks Damien.
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: mv88e6xxx: Be explicit about DT or pdata
From: Florian Fainelli @ 2018-05-31 14:12 UTC (permalink / raw)
To: Andrew Lunn, David Miller; +Cc: Vivien Didelot, dan.carpenter, netdev
In-Reply-To: <1527718542-22658-1-git-send-email-andrew@lunn.ch>
On 05/30/2018 03:15 PM, Andrew Lunn wrote:
> Make it explicit that either device tree is used or platform data. If
> neither is available, abort the probe.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 877b7cb0b6f2 ("net: dsa: mv88e6xxx: Add minimal platform_data support")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* pull-request: wireless-drivers-next 2018-05-31
From: Kalle Valo @ 2018-05-31 14:10 UTC (permalink / raw)
To: David Miller; +Cc: linux-wireless, netdev, linux-kernel
Hi Dave,
here's a pull request to net-next tree for 4.18. More info below and
please let me know if there are any problems.
Kalle
The following changes since commit e3bb946cd922b773fdc03252aefbf2472d1d530c:
Merge branch 'TI-Ethernet-driver-warnings-fixes' (2018-05-21 16:17:11 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git tags/wireless-drivers-next-for-davem-2018-05-31
for you to fetch changes up to 76606886c9f433bb46ed9c8910cabce780b23f36:
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2018-05-30 22:24:44 +0300)
----------------------------------------------------------------
wireless-drivers-next patches for 4.18
Hopefully the last pull request to 4.18 before the merge window.
Nothing major here, we have smaller new features and of course a lots
of fixes.
Major changes:
ath10k
* add memory dump support for QCA9888 and QCA99X0
* add support to configure channel dwell time
* support new DFS host confirmation feature in the firmware
ath
* update various regulatory mappings
wcn36xx
* various fixes to improve reliability
* add Factory Test Mode support
brmfmac
* add debugfs file for reading firmware capabilities
mwifiex
* support sysfs initiated device coredump
----------------------------------------------------------------
Ahmad Masri (1):
wil6210: align to latest auto generated wmi.h
Alexei Avshalom Lazar (2):
wil6210: disable tracing config option
wil6210: Initialize reply struct of the WMI commands
Andrey Shevchenko (3):
qtnfmac: remove unused function declarations
qtnfmac: fix bg_scan_period parameter processing
qtnfmac: cancel scan on disconnect
Anilkumar Kolli (1):
ath10k: add memory dump support for QCA9888 and QCA99X0
Arend Van Spriel (3):
brcmfmac: move ALLFFMAC variable in flowring module
brcmfmac: add support for sysfs initiated coredump
mwifiex: support sysfs initiated device coredump
Aviya Erenfeld (1):
iwlmvm: tdls: Check TDLS channel switch support
Colin Ian King (3):
ath10k: fix spelling mistake: "servive" -> "service"
rsi: fix spelling mistake "Uknown" -> "Unknown"
iwlwifi: mvm: remove division by size of sizeof(struct ieee80211_wmm_rule)
Daniel Mack (10):
wcn36xx: fix buffer commit logic on TX path
wcn36xx: set DMA mask explicitly
wcn36xx: don't disable RX IRQ from handler
wcn36xx: clear all masks in RX interrupt
wcn36xx: only handle packets when ED or DONE bit is set
wcn36xx: consider CTRL_EOP bit when looking for valid descriptors
wcn36xx: set PREASSOC and IDLE stated when BSS info changes
wcn36xx: drain pending indicator messages on shutdown
wcn36xx: simplify wcn36xx_smd_open()
wcn36xx: improve debug and error messages for SMD
Dedy Lansky (3):
wil6210: move WMI functionality out of wil_cfg80211_mgmt_tx
wil6210: remove unused rx_reorder members
wil6210: rate limit wil_rx_refill error
Dmitry Lebed (2):
qtnfmac: improve control path timeout handling
qtnfmac: fix firmware command error path
Emmanuel Grumbach (2):
iwlwifi: mvm: fix TSO with highly fragmented SKBs
iwlwifi: mvm: honor the max_amsdu_subframes limit
Erel Geron (1):
iwlwifi: fix non_shared_ant for 9000 devices
Erik Stromdahl (1):
ath10k: fix return value check in wake_tx_q op
Eyal Ilsar (1):
wcn36xx: Add support for Factory Test Mode (FTM)
Eyal Reizer (1):
wlcore: sdio: check for valid platform device data before suspend
Fabio Estevam (1):
ath10k: snoc: Remove owner assignment from platform_driver
Felix Fietkau (7):
mt76: fix sending encrypted broadcast packets for secondary interfaces
mt76: discard early received packets if not running yet
mt76: only stop tx queues on offchannel, not during the entire scan
mt76: prevent tx scheduling during channel change
mt76: move ieee80211_hw allocation to common core
mt76: wait for pending tx to complete before switching channel
mt76: use udelay instead of usleep_range in mt76x2_mac_stop
Franky Lin (3):
brcmfmac: validate user provided data for memdump before copying
brcmfmac: trigger memory dump upon firmware halt signal
brcmfmac: trigger memory dump on SDIO firmware halt message
Ganapathi Bhat (3):
mwifiex: avoid exporting mwifiex_send_cmd
mwifiex: handle race during mwifiex_usb_disconnect
mwifiex: skip sending GT_REKEY_OFFLOAD_CFG if firmware has no support
Golan Ben Ami (1):
iwlwifi: add csr configuration for 6300 devices
Govind Singh (1):
ath10k: replace bit shifts with the BIT() macro for rx desc bits
Gregory Greenman (1):
iwlwifi: mvm: open BA session only when sta is authorized
Gustavo A. R. Silva (2):
mwifiex: mark expected switch fall-throughs
rtlwifi: remove duplicate code
Igor Mitsyanko (1):
qtnfmac: decode error codes from firmware replies
Johannes Berg (1):
iwlwifi: mvm: fix race in queue notification wait
Kalle Valo (3):
Merge ath-next from git://git.kernel.org/.../kvalo/ath.git
Merge tag 'iwlwifi-next-for-kalle-2018-05-30' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
Merge ath-next from git://git.kernel.org/.../kvalo/ath.git
Kenneth Lu (1):
ath10k: remove variables which set but not used
Lior David (2):
wil6210: fix call to wil6210_disconnect during unload
wil6210: change reply_size arg to u16 in wmi_call
Lorenzo Bianconi (1):
mt76x2: apply coverage class on slot time too
Luc Van Oostenryck (1):
ath6kl: fix ath6kl_data_tx()'s return type
Marcus Folkesson (1):
ath10k: hw: make consistent usage of ATH10K_FW_DIR in paths
Niklas Cassel (1):
ath10k: sdio: jump to correct label in error handling path
Ping-Ke Shih (13):
rtlwifi: remove CONNECTION_MONITOR flag
rtlwifi: remove duplicate rx_packet_type definition
rtlwifi: rename register-based C2H command IDs to V0
rtlwifi: remove duplicate C2H definition
rtlwifi: remove unused fw C2H command ID
rtlwifi: remove dummy hal_op rx_command_packet from rtl8188ee and rtl8723ae
rtlwifi: Add hal_op c2h_ra_report_handler for special process
rtlwifi: remove duplicate C2H handler
rtlwifi: remove hal_op rx_command_packet
rtlwifi: remove hal_op c2h_content_parsing
rtlwifi: use sk_buff to queue C2H commands
rtlwifi: access skb->data to get C2H data by macro
rtlwifi: fix btmpinfo timeout while processing C2H_BT_INFO
Pradeep Kumar Chitrapu (1):
ath10k: add support to configure channel dwell time
Rafał Miłecki (1):
brcmfmac: add debugfs entry for reading firmware capabilities
Sanjay Konduri (2):
rsi: add fix for crash during assertions
rsi: add fix for corruption of auto rate table
Sara Sharon (1):
iwlwifi: mvm: drop UNKNOWN security type frames
Sergey Matyukevich (3):
qtnfmac: simplify notation
qtnfmac: cleanup wdev structure between its uses
qtnfmac: fix invalid STA state on EAPOL failure
Shaul Triebitz (1):
iwlwifi: pcie: fix race in Rx buffer allocator
Sriram R (2):
ath: add support to get the detected radar specifications
ath10k: DFS Host Confirmation
Sven Eckelmann (35):
ath: Add regulatory mapping for Bahamas
ath: Add regulatory mapping for Bermuda
ath: Add regulatory mapping for Kenya
ath: Add regulatory mapping for Mauritius
ath: Add regulatory mapping for Montenegro
ath: Add regulatory mapping for Nicaragua
ath: Add regulatory mapping for Paraguya
ath: Add regulatory mapping for Serbia
ath: Add regulatory mapping for Tanzania
ath: Add regulatory mapping for Uganda
ath: Add regulatory mapping for APL2_FCCA
ath: Add regulatory mapping for APL13_WORLD
ath: Add regulatory mapping for ETSI8_WORLD
ath: Add regulatory mapping for ETSI9_WORLD
ath: Add regulatory mapping for FCC3_ETSIC
ath: Map Albania to ETSI1_WORLD
ath: Map Algeria to APL13_WORLD
ath: Map Australia to FCC3_WORLD
ath: Map Bangladesh to APL1_WORLD
ath: Map Brunei Darussalam to APL6_WORLD
ath: Map Bulgaria to ETSI1_WORLD
ath: Map Colombia to FCC1_FCCA
ath: Map Czech to ETSI1_WORLD
ath: Map Honduras to FCC3_WORLD
ath: Map Isreal to ETSI3_WORLD
ath: Map Macedonia to ETSI1_WORLD
ath: Map Malasia to FCC1_WORLD
ath: Map New Zealand to FCC3_ETSIC
ath: Map Peru to APL1_WORLD
ath: Map Philippines to FCC3_WORLD
ath: Map Romania to ETSI1_WORLD
ath: Map Russia to ETSI8_WORLD
ath: Map Singapore to FCC3_WORLD
ath: Map Ukraine to ETSI9_WORLD
ath: Map Zimbabwe to ETSI1_WORLD
Tamizh Chelvam (1):
ath10k: fix kernel panic while reading tpc_stats
Tony Lindgren (1):
wlcore: sdio: Fix flakey SDIO runtime PM handling
Tzu-En Huang (1):
rtlwifi: support accurate nullfunc frame tx ack report
Venkateswara Naralasetty (1):
ath10k: fix information leak in debugfs
Xinming Hu (3):
mwifiex: correct histogram data with appropriate index
mwifiex: increase log level for internal scan fail result
mwifiex: reserve passive scan time for radar channel
Yu Wang (1):
ath10k: add quiet mode support for QCA6174/QCA9377
YueHaibing (2):
ath10k: remove useless test before clk_disable_unprepare
atmel: Add missing call to pci_disable_device()
drivers/net/wireless/ath/ath10k/ahb.c | 9 +-
drivers/net/wireless/ath/ath10k/core.h | 22 ++
drivers/net/wireless/ath/ath10k/coredump.c | 98 ++++++
drivers/net/wireless/ath/ath10k/debug.c | 28 +-
drivers/net/wireless/ath/ath10k/debugfs_sta.c | 30 +-
drivers/net/wireless/ath/ath10k/hw.h | 4 +-
drivers/net/wireless/ath/ath10k/mac.c | 37 +-
drivers/net/wireless/ath/ath10k/rx_desc.h | 136 ++++----
drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
drivers/net/wireless/ath/ath10k/snoc.c | 1 -
drivers/net/wireless/ath/ath10k/wmi-ops.h | 32 ++
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 33 +-
drivers/net/wireless/ath/ath10k/wmi-tlv.h | 16 +
drivers/net/wireless/ath/ath10k/wmi.c | 206 +++++++++--
drivers/net/wireless/ath/ath10k/wmi.h | 34 +-
drivers/net/wireless/ath/ath6kl/core.h | 2 +-
drivers/net/wireless/ath/ath6kl/txrx.c | 2 +-
drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
drivers/net/wireless/ath/dfs_pattern_detector.c | 5 +-
drivers/net/wireless/ath/dfs_pattern_detector.h | 3 +-
drivers/net/wireless/ath/dfs_pri_detector.h | 3 +-
drivers/net/wireless/ath/regd.h | 7 +
drivers/net/wireless/ath/regd_common.h | 60 ++--
drivers/net/wireless/ath/wcn36xx/Makefile | 2 +
drivers/net/wireless/ath/wcn36xx/dxe.c | 176 ++++++----
drivers/net/wireless/ath/wcn36xx/hal.h | 16 +
drivers/net/wireless/ath/wcn36xx/main.c | 13 +
drivers/net/wireless/ath/wcn36xx/smd.c | 113 +++++-
drivers/net/wireless/ath/wcn36xx/smd.h | 4 +
drivers/net/wireless/ath/wcn36xx/testmode.c | 149 ++++++++
drivers/net/wireless/ath/wcn36xx/testmode.h | 46 +++
drivers/net/wireless/ath/wcn36xx/testmode_i.h | 29 ++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 +
drivers/net/wireless/ath/wil6210/Kconfig | 2 +-
drivers/net/wireless/ath/wil6210/cfg80211.c | 61 +---
drivers/net/wireless/ath/wil6210/debugfs.c | 5 +-
drivers/net/wireless/ath/wil6210/main.c | 2 +
drivers/net/wireless/ath/wil6210/netdev.c | 8 +-
drivers/net/wireless/ath/wil6210/rx_reorder.c | 7 +-
drivers/net/wireless/ath/wil6210/txrx.c | 12 +-
drivers/net/wireless/ath/wil6210/wil6210.h | 13 +-
drivers/net/wireless/ath/wil6210/wmi.c | 152 +++++---
drivers/net/wireless/ath/wil6210/wmi.h | 387 +++++++++++++++++++--
drivers/net/wireless/atmel/atmel_pci.c | 4 +-
.../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
.../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 +
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 -
.../wireless/broadcom/brcm80211/brcmfmac/common.h | 2 -
.../wireless/broadcom/brcm80211/brcmfmac/core.c | 8 +
.../wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++
.../broadcom/brcm80211/brcmfmac/flowring.c | 2 +
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +-
drivers/net/wireless/intel/iwlwifi/cfg/6000.c | 1 +
drivers/net/wireless/intel/iwlwifi/cfg/9000.c | 2 +-
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h | 1 +
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 3 +-
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 38 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs.h | 7 +-
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 36 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 10 +-
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 16 +-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 16 +-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 3 +
drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 +
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 24 +-
drivers/net/wireless/marvell/mwifiex/debugfs.c | 31 +-
drivers/net/wireless/marvell/mwifiex/fw.h | 1 +
drivers/net/wireless/marvell/mwifiex/main.h | 1 +
drivers/net/wireless/marvell/mwifiex/pcie.c | 18 +-
drivers/net/wireless/marvell/mwifiex/scan.c | 10 +-
drivers/net/wireless/marvell/mwifiex/sdio.c | 12 +
drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 +
drivers/net/wireless/marvell/mwifiex/usb.c | 15 +
drivers/net/wireless/marvell/mwifiex/util.c | 15 +-
drivers/net/wireless/mediatek/mt76/dma.c | 4 +
drivers/net/wireless/mediatek/mt76/mac80211.c | 43 ++-
drivers/net/wireless/mediatek/mt76/mt76.h | 5 +
drivers/net/wireless/mediatek/mt76/mt76x2.h | 3 +
drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 22 +-
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 3 +
drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 15 +-
drivers/net/wireless/mediatek/mt76/tx.c | 4 +-
drivers/net/wireless/quantenna/qtnfmac/bus.h | 3 +-
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 56 +--
drivers/net/wireless/quantenna/qtnfmac/commands.c | 35 +-
drivers/net/wireless/quantenna/qtnfmac/commands.h | 5 -
drivers/net/wireless/quantenna/qtnfmac/core.c | 3 +-
drivers/net/wireless/quantenna/qtnfmac/core.h | 2 -
drivers/net/wireless/quantenna/qtnfmac/event.c | 8 +-
.../net/wireless/quantenna/qtnfmac/pearl/pcie.c | 15 +-
drivers/net/wireless/quantenna/qtnfmac/qlink.h | 2 +
drivers/net/wireless/quantenna/qtnfmac/trans.c | 4 +-
drivers/net/wireless/realtek/rtlwifi/base.c | 208 ++++++++---
drivers/net/wireless/realtek/rtlwifi/base.h | 7 +-
.../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 23 +-
drivers/net/wireless/realtek/rtlwifi/pci.c | 18 +-
.../net/wireless/realtek/rtlwifi/rtl8188ee/def.h | 32 --
.../net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.c | 7 -
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | 4 -
.../net/wireless/realtek/rtlwifi/rtl8192ce/def.h | 25 --
.../net/wireless/realtek/rtlwifi/rtl8192ee/def.h | 8 -
.../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 78 +----
.../net/wireless/realtek/rtlwifi/rtl8192ee/fw.h | 16 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/sw.c | 3 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 29 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/def.h | 25 --
.../wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c | 6 +-
.../wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h | 20 +-
.../net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 1 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/trx.c | 7 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8723be/def.h | 8 -
.../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 69 ----
.../net/wireless/realtek/rtlwifi/rtl8723be/fw.h | 13 -
.../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 30 +-
.../net/wireless/realtek/rtlwifi/rtl8723be/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8821ae/def.h | 33 --
.../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 69 +---
.../net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 21 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 3 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | 31 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 3 -
drivers/net/wireless/realtek/rtlwifi/wifi.h | 56 ++-
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 3 +-
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 1 +
drivers/net/wireless/ti/wlcore/sdio.c | 21 +-
133 files changed, 2282 insertions(+), 1157 deletions(-)
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode_i.h
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v4 net-next 00/19] inet: frags: bring rhashtables to IP defrag
From: Eric Dumazet @ 2018-05-31 14:05 UTC (permalink / raw)
To: moshe
Cc: Tariq Toukan, Eric Dumazet, aring, David Miller, netdev,
Florian Westphal, Herbert Xu, Thomas Graf, Jesper Dangaard Brouer,
Alexander Aring, Stefan Schmidt, Kirill Tkhai, Eran Ben Elisha
In-Reply-To: <0bb2faec-ba8d-51d7-0c1a-12520b9168e8@mellanox.com>
On Thu, May 31, 2018 at 8:18 AM Moshe Shemesh <moshe@mellanox.com> wrote:
>
>
>
> I do see big improvement after changing the 3 parameters as Eric suggested:
> /proc/sys/net/ipv6/ip6frag_time set to 2
> /proc/sys/net/ipv6/ip6frag_low_thresh set to 104857600
> /proc/sys/net/ipv6/ip6frag_high_thresh set to 78643200
>
>
> [root@reg-l-vrt-67100-104 linux-stable]# netperf -H
> fe80::7efe:90ff:fed5:bb48%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::7efe:90ff:fed5:bb48%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 156387 0 8194.60
> 212992 10.00 76901 4029.57
>
> #kernel
> Ip6InReceives 7107999 0.0
> Ip6InDelivers 114126 0.0
> Ip6OutRequests 47 0.0
> Ip6ReasmTimeout 5115 0.0
> Ip6ReasmReqds 7107987 0.0
> Ip6ReasmOKs 114114 0.0
> Ip6ReasmFails 1714146 0.0
> ...
> Udp6InDatagrams 112486 0.0
> Udp6InErrors 1629 0.0
> Udp6RcvbufErrors 1629 0.0
> ...
>
> While before these parameters settings I got:
> [root@reg-l-vrt-67100-104 ~]# netperf -H
> fe80::e61d:2dff:feca:c7c3%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::e61d:2dff:feca:c7c3%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 145419 0 7620.35
> 212992 10.00 285 14.93
>
> #kernel
> Ip6InReceives 6665965 0.0
> Ip6InDelivers 300 0.0
> Ip6OutRequests 9 0.0
> Ip6ReasmReqds 6665950 0.0
> Ip6ReasmOKs 285 0.0
> Ip6ReasmFails 6650890 0.0
> ...
> Udp6InDatagrams 286 0.0
>
>
> however, before the patchset, I got much better results:
> [root@reg-l-vrt-67100-104 linux-stable]# netperf -H
> fe80::7efe:90ff:fed5:bb48%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::7efe:90ff:fed5:bb48%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 158935 0 8328.32
> 212992 10.00 144652 7579.88
>
>
> #kernel
> Ip6InReceives 7088903 0.0
> Ip6InDelivers 154117 0.0
> Ip6OutRequests 9 0.0
> Ip6ReasmReqds 7088889 0.0
> Ip6ReasmOKs 154103 0.0
> ...
> Udp6InDatagrams 144653 0.0
> Udp6InErrors 9451 0.0
> Udp6RcvbufErrors 9451 0.0
>
>
Hi Moshe
Your environment seems to be very lossy.
Frags and packets losses do not mix well, there is nothing really
magic we can do with that,
unless we can reserve GB of memory for frags.
Which is exactly was the reason for my patches in the first place.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: mv88e6xxx: Be explicit about DT or pdata
From: Vivien Didelot @ 2018-05-31 13:51 UTC (permalink / raw)
To: Andrew Lunn, David Miller
Cc: Florian Fainelli, dan.carpenter, netdev, Andrew Lunn
In-Reply-To: <1527718542-22658-1-git-send-email-andrew@lunn.ch>
Andrew Lunn <andrew@lunn.ch> writes:
> Make it explicit that either device tree is used or platform data. If
> neither is available, abort the probe.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 877b7cb0b6f2 ("net: dsa: mv88e6xxx: Add minimal platform_data support")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
^ permalink raw reply
* [PATCH mlx5-next v3 12/14] IB/mlx5: Add flow counters binding support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
Associates a counters with a flow when IB_FLOW_SPEC_ACTION_COUNT
is part of the flow specifications.
The counters user space placements of location and description
(index, description) pairs are passed as private data of the
counters flow specification.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/main.c | 223 ++++++++++++++++++++++++++++++++---
drivers/infiniband/hw/mlx5/mlx5_ib.h | 15 +++
include/linux/mlx5/fs.h | 1 +
include/uapi/rdma/mlx5-abi.h | 24 ++++
4 files changed, 249 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 4d0f53566854..6a5600db897e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -2480,7 +2480,7 @@ static int check_mpls_supp_fields(u32 field_support, const __be32 *set_mask)
#define LAST_TUNNEL_FIELD tunnel_id
#define LAST_FLOW_TAG_FIELD tag_id
#define LAST_DROP_FIELD size
-#define LAST_DROP_FIELD size
+#define LAST_COUNTERS_FIELD counters
/* Field is the last supported field */
#define FIELDS_NOT_SUPPORTED(filter, field)\
@@ -2844,6 +2844,18 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c,
if (ret)
return ret;
break;
+ case IB_FLOW_SPEC_ACTION_COUNT:
+ if (FIELDS_NOT_SUPPORTED(ib_spec->flow_count,
+ LAST_COUNTERS_FIELD))
+ return -EOPNOTSUPP;
+
+ /* for now support only one counters spec per flow */
+ if (action->action & MLX5_FLOW_CONTEXT_ACTION_COUNT)
+ return -EINVAL;
+
+ action->counters = ib_spec->flow_count.counters;
+ action->action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
+ break;
default:
return -EINVAL;
}
@@ -2991,6 +3003,17 @@ static void put_flow_table(struct mlx5_ib_dev *dev,
}
}
+static void counters_clear_description(struct ib_counters *counters)
+{
+ struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
+
+ mutex_lock(&mcounters->mcntrs_mutex);
+ kfree(mcounters->counters_data);
+ mcounters->counters_data = NULL;
+ mcounters->cntrs_max_index = 0;
+ mutex_unlock(&mcounters->mcntrs_mutex);
+}
+
static int mlx5_ib_destroy_flow(struct ib_flow *flow_id)
{
struct mlx5_ib_dev *dev = to_mdev(flow_id->qp->device);
@@ -3010,8 +3033,11 @@ static int mlx5_ib_destroy_flow(struct ib_flow *flow_id)
mlx5_del_flow_rules(handler->rule);
put_flow_table(dev, handler->prio, true);
- mutex_unlock(&dev->flow_db->lock);
+ if (handler->ibcounters &&
+ atomic_read(&handler->ibcounters->usecnt) == 1)
+ counters_clear_description(handler->ibcounters);
+ mutex_unlock(&dev->flow_db->lock);
kfree(handler);
return 0;
@@ -3131,22 +3157,128 @@ static void set_underlay_qp(struct mlx5_ib_dev *dev,
}
}
+static int counters_set_description(struct ib_counters *counters,
+ enum mlx5_ib_counters_type counters_type,
+ struct mlx5_ib_flow_counters_desc *desc_data,
+ u32 ncounters)
+{
+ struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
+ u32 cntrs_max_index = 0;
+ int i;
+
+ if (counters_type != MLX5_IB_COUNTERS_FLOW)
+ return -EINVAL;
+
+ /* init the fields for the object */
+ mcounters->type = counters_type;
+ mcounters->ncounters = ncounters;
+ /* each counter entry have both description and index pair */
+ for (i = 0; i < ncounters; i++) {
+ if (desc_data[i].description > IB_COUNTER_BYTES)
+ return -EINVAL;
+
+ if (cntrs_max_index <= desc_data[i].index)
+ cntrs_max_index = desc_data[i].index + 1;
+ }
+
+ mutex_lock(&mcounters->mcntrs_mutex);
+ mcounters->counters_data = desc_data;
+ mcounters->cntrs_max_index = cntrs_max_index;
+ mutex_unlock(&mcounters->mcntrs_mutex);
+
+ return 0;
+}
+
+#define MAX_COUNTERS_NUM (USHRT_MAX / (sizeof(u32) * 2))
+static int flow_counters_set_data(struct ib_counters *ibcounters,
+ struct mlx5_ib_create_flow *ucmd)
+{
+ struct mlx5_ib_mcounters *mcounters = to_mcounters(ibcounters);
+ struct mlx5_ib_flow_counters_data *cntrs_data = NULL;
+ struct mlx5_ib_flow_counters_desc *desc_data = NULL;
+ bool hw_hndl = false;
+ int ret = 0;
+
+ if (ucmd && ucmd->ncounters_data != 0) {
+ cntrs_data = ucmd->data;
+ if (cntrs_data->ncounters > MAX_COUNTERS_NUM)
+ return -EINVAL;
+
+ desc_data = kcalloc(cntrs_data->ncounters,
+ sizeof(*desc_data),
+ GFP_KERNEL);
+ if (!desc_data)
+ return -ENOMEM;
+
+ if (copy_from_user(desc_data,
+ u64_to_user_ptr(cntrs_data->counters_data),
+ sizeof(*desc_data) * cntrs_data->ncounters)) {
+ ret = -EFAULT;
+ goto free;
+ }
+ }
+
+ if (!mcounters->hw_cntrs_hndl) {
+ mcounters->hw_cntrs_hndl = mlx5_fc_create(
+ to_mdev(ibcounters->device)->mdev, false);
+ if (!mcounters->hw_cntrs_hndl) {
+ ret = -ENOMEM;
+ goto free;
+ }
+ hw_hndl = true;
+ }
+
+ if (desc_data) {
+ /* counters already bound to at least one flow */
+ if (mcounters->cntrs_max_index) {
+ ret = -EINVAL;
+ goto free_hndl;
+ }
+
+ ret = counters_set_description(ibcounters,
+ MLX5_IB_COUNTERS_FLOW,
+ desc_data,
+ cntrs_data->ncounters);
+ if (ret)
+ goto free_hndl;
+
+ } else if (!mcounters->cntrs_max_index) {
+ /* counters not bound yet, must have udata passed */
+ ret = -EINVAL;
+ goto free_hndl;
+ }
+
+ return 0;
+
+free_hndl:
+ if (hw_hndl) {
+ mlx5_fc_destroy(to_mdev(ibcounters->device)->mdev,
+ mcounters->hw_cntrs_hndl);
+ mcounters->hw_cntrs_hndl = NULL;
+ }
+free:
+ kfree(desc_data);
+ return ret;
+}
+
static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
struct mlx5_ib_flow_prio *ft_prio,
const struct ib_flow_attr *flow_attr,
struct mlx5_flow_destination *dst,
- u32 underlay_qpn)
+ u32 underlay_qpn,
+ struct mlx5_ib_create_flow *ucmd)
{
struct mlx5_flow_table *ft = ft_prio->flow_table;
struct mlx5_ib_flow_handler *handler;
struct mlx5_flow_act flow_act = {.flow_tag = MLX5_FS_DEFAULT_FLOW_TAG};
struct mlx5_flow_spec *spec;
- struct mlx5_flow_destination *rule_dst = dst;
+ struct mlx5_flow_destination dest_arr[2] = {};
+ struct mlx5_flow_destination *rule_dst = dest_arr;
const void *ib_flow = (const void *)flow_attr + sizeof(*flow_attr);
unsigned int spec_index;
u32 prev_type = 0;
int err = 0;
- int dest_num = 1;
+ int dest_num = 0;
bool is_egress = flow_attr->flags & IB_FLOW_ATTR_FLAGS_EGRESS;
if (!is_valid_attr(dev->mdev, flow_attr))
@@ -3160,6 +3292,10 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
}
INIT_LIST_HEAD(&handler->list);
+ if (dst) {
+ memcpy(&dest_arr[0], dst, sizeof(*dst));
+ dest_num++;
+ }
for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) {
err = parse_flow_attr(dev->mdev, spec->match_criteria,
@@ -3196,15 +3332,30 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
goto free;
}
+ if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) {
+ err = flow_counters_set_data(flow_act.counters, ucmd);
+ if (err)
+ goto free;
+
+ handler->ibcounters = flow_act.counters;
+ dest_arr[dest_num].type =
+ MLX5_FLOW_DESTINATION_TYPE_COUNTER;
+ dest_arr[dest_num].counter =
+ to_mcounters(flow_act.counters)->hw_cntrs_hndl;
+ dest_num++;
+ }
+
if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP) {
- rule_dst = NULL;
- dest_num = 0;
+ if (!(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT)) {
+ rule_dst = NULL;
+ dest_num = 0;
+ }
} else {
if (is_egress)
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_ALLOW;
else
flow_act.action |=
- dst ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST :
+ dest_num ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST :
MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO;
}
@@ -3230,8 +3381,12 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev,
ft_prio->flow_table = ft;
free:
- if (err)
+ if (err && handler) {
+ if (handler->ibcounters &&
+ atomic_read(&handler->ibcounters->usecnt) == 1)
+ counters_clear_description(handler->ibcounters);
kfree(handler);
+ }
kvfree(spec);
return err ? ERR_PTR(err) : handler;
}
@@ -3241,7 +3396,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
const struct ib_flow_attr *flow_attr,
struct mlx5_flow_destination *dst)
{
- return _create_flow_rule(dev, ft_prio, flow_attr, dst, 0);
+ return _create_flow_rule(dev, ft_prio, flow_attr, dst, 0, NULL);
}
static struct mlx5_ib_flow_handler *create_dont_trap_rule(struct mlx5_ib_dev *dev,
@@ -3381,12 +3536,43 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
struct mlx5_ib_flow_prio *ft_prio_tx = NULL;
struct mlx5_ib_flow_prio *ft_prio;
bool is_egress = flow_attr->flags & IB_FLOW_ATTR_FLAGS_EGRESS;
+ struct mlx5_ib_create_flow *ucmd = NULL, ucmd_hdr;
+ size_t min_ucmd_sz, required_ucmd_sz;
int err;
int underlay_qpn;
- if (udata &&
- udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
- return ERR_PTR(-EOPNOTSUPP);
+ if (udata && udata->inlen) {
+ min_ucmd_sz = offsetof(typeof(ucmd_hdr), reserved) +
+ sizeof(ucmd_hdr.reserved);
+ if (udata->inlen < min_ucmd_sz)
+ return ERR_PTR(-EOPNOTSUPP);
+
+ err = ib_copy_from_udata(&ucmd_hdr, udata, min_ucmd_sz);
+ if (err)
+ return ERR_PTR(err);
+
+ /* currently supports only one counters data */
+ if (ucmd_hdr.ncounters_data > 1)
+ return ERR_PTR(-EINVAL);
+
+ required_ucmd_sz = min_ucmd_sz +
+ sizeof(struct mlx5_ib_flow_counters_data) *
+ ucmd_hdr.ncounters_data;
+ if (udata->inlen > required_ucmd_sz &&
+ !ib_is_udata_cleared(udata, required_ucmd_sz,
+ udata->inlen - required_ucmd_sz))
+ return ERR_PTR(-EOPNOTSUPP);
+
+ ucmd = kzalloc(required_ucmd_sz, GFP_KERNEL);
+ if (!ucmd)
+ return ERR_PTR(-ENOMEM);
+
+ err = ib_copy_from_udata(ucmd, udata, required_ucmd_sz);
+ if (err) {
+ kfree(ucmd);
+ return ERR_PTR(err);
+ }
+ }
if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
return ERR_PTR(-ENOMEM);
@@ -3441,7 +3627,7 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
underlay_qpn = (mqp->flags & MLX5_IB_QP_UNDERLAY) ?
mqp->underlay_qpn : 0;
handler = _create_flow_rule(dev, ft_prio, flow_attr,
- dst, underlay_qpn);
+ dst, underlay_qpn, ucmd);
}
} else if (flow_attr->type == IB_FLOW_ATTR_ALL_DEFAULT ||
flow_attr->type == IB_FLOW_ATTR_MC_DEFAULT) {
@@ -3462,6 +3648,7 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
mutex_unlock(&dev->flow_db->lock);
kfree(dst);
+ kfree(ucmd);
return &handler->ibflow;
@@ -3472,6 +3659,7 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
unlock:
mutex_unlock(&dev->flow_db->lock);
kfree(dst);
+ kfree(ucmd);
kfree(handler);
return ERR_PTR(err);
}
@@ -5136,6 +5324,11 @@ static int mlx5_ib_destroy_counters(struct ib_counters *counters)
{
struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
+ counters_clear_description(counters);
+ if (mcounters->hw_cntrs_hndl)
+ mlx5_fc_destroy(to_mdev(counters->device)->mdev,
+ mcounters->hw_cntrs_hndl);
+
kfree(mcounters);
return 0;
@@ -5150,6 +5343,8 @@ static struct ib_counters *mlx5_ib_create_counters(struct ib_device *device,
if (!mcounters)
return ERR_PTR(-ENOMEM);
+ mutex_init(&mcounters->mcntrs_mutex);
+
return &mcounters->ibcntrs;
}
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index fd27ec1aed08..155bca627222 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -175,6 +175,7 @@ struct mlx5_ib_flow_handler {
struct ib_flow ibflow;
struct mlx5_ib_flow_prio *prio;
struct mlx5_flow_handle *rule;
+ struct ib_counters *ibcounters;
};
struct mlx5_ib_flow_db {
@@ -813,8 +814,22 @@ struct mlx5_memic {
DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES);
};
+enum mlx5_ib_counters_type {
+ MLX5_IB_COUNTERS_FLOW,
+};
+
struct mlx5_ib_mcounters {
struct ib_counters ibcntrs;
+ enum mlx5_ib_counters_type type;
+ void *hw_cntrs_hndl;
+ /* max index set as part of create_flow */
+ u32 cntrs_max_index;
+ /* number of counters data entries (<description,index> pair) */
+ u32 ncounters;
+ /* counters data array for descriptions and indexes */
+ struct mlx5_ib_flow_counters_desc *counters_data;
+ /* protects access to mcounters internal data */
+ struct mutex mcntrs_mutex;
};
static inline struct mlx5_ib_mcounters *
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 3b4c3298061c..757b4a30281e 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -160,6 +160,7 @@ struct mlx5_flow_act {
u32 modify_id;
uintptr_t esp_id;
struct mlx5_fs_vlan vlan;
+ struct ib_counters *counters;
};
#define MLX5_DECLARE_FLOW_ACT(name) \
diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h
index 729b18f8c046..8daec1fa49cf 100644
--- a/include/uapi/rdma/mlx5-abi.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -36,6 +36,7 @@
#include <linux/types.h>
#include <linux/if_ether.h> /* For ETH_ALEN. */
+#include <rdma/ib_user_ioctl_verbs.h>
enum {
MLX5_QP_FLAG_SIGNATURE = 1 << 0,
@@ -443,4 +444,27 @@ enum {
enum {
MLX5_IB_CLOCK_INFO_V1 = 0,
};
+
+struct mlx5_ib_flow_counters_desc {
+ __u32 description;
+ __u32 index;
+};
+
+struct mlx5_ib_flow_counters_data {
+ RDMA_UAPI_PTR(struct mlx5_ib_flow_counters_desc *, counters_data);
+ __u32 ncounters;
+ __u32 reserved;
+};
+
+struct mlx5_ib_create_flow {
+ __u32 ncounters_data;
+ __u32 reserved;
+ /*
+ * Following are counters data based on ncounters_data, each
+ * entry in the data[] should match a corresponding counter object
+ * that was pointed by a counters spec upon the flow creation
+ */
+ struct mlx5_ib_flow_counters_data data[];
+};
+
#endif /* MLX5_ABI_USER_H */
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 14/14] IB/mlx5: Add counters read support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
This patch implements the uverbs counters read API, it will use the
specific read counters function to the given type to accomplish its
task.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/main.c | 43 +++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e7c90c151165..d0c94c2b49de 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5335,6 +5335,48 @@ static void depopulate_specs_root(struct mlx5_ib_dev *dev)
uverbs_free_spec_tree(dev->ib_dev.specs_root);
}
+static int mlx5_ib_read_counters(struct ib_counters *counters,
+ struct ib_counters_read_attr *read_attr,
+ struct uverbs_attr_bundle *attrs)
+{
+ struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
+ struct mlx5_read_counters_attr mread_attr = {};
+ struct mlx5_ib_flow_counters_desc *desc;
+ int ret, i;
+
+ mutex_lock(&mcounters->mcntrs_mutex);
+ if (mcounters->cntrs_max_index > read_attr->ncounters) {
+ ret = -EINVAL;
+ goto err_bound;
+ }
+
+ mread_attr.out = kcalloc(mcounters->counters_num, sizeof(u64),
+ GFP_KERNEL);
+ if (!mread_attr.out) {
+ ret = -ENOMEM;
+ goto err_bound;
+ }
+
+ mread_attr.hw_cntrs_hndl = mcounters->hw_cntrs_hndl;
+ mread_attr.flags = read_attr->flags;
+ ret = mcounters->read_counters(counters->device, &mread_attr);
+ if (ret)
+ goto err_read;
+
+ /* do the pass over the counters data array to assign according to the
+ * descriptions and indexing pairs
+ */
+ desc = mcounters->counters_data;
+ for (i = 0; i < mcounters->ncounters; i++)
+ read_attr->counters_buff[desc[i].index] += mread_attr.out[desc[i].description];
+
+err_read:
+ kfree(mread_attr.out);
+err_bound:
+ mutex_unlock(&mcounters->mcntrs_mutex);
+ return ret;
+}
+
static int mlx5_ib_destroy_counters(struct ib_counters *counters)
{
struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
@@ -5608,6 +5650,7 @@ int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
dev->ib_dev.driver_id = RDMA_DRIVER_MLX5;
dev->ib_dev.create_counters = mlx5_ib_create_counters;
dev->ib_dev.destroy_counters = mlx5_ib_destroy_counters;
+ dev->ib_dev.read_counters = mlx5_ib_read_counters;
err = init_node_data(dev);
if (err)
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 13/14] IB/mlx5: Add flow counters read support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
Implements the flow counters read wrapper.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/main.c | 15 +++++++++++++++
drivers/infiniband/hw/mlx5/mlx5_ib.h | 13 ++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 6a5600db897e..e7c90c151165 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3157,6 +3157,19 @@ static void set_underlay_qp(struct mlx5_ib_dev *dev,
}
}
+static int read_flow_counters(struct ib_device *ibdev,
+ struct mlx5_read_counters_attr *read_attr)
+{
+ struct mlx5_fc *fc = read_attr->hw_cntrs_hndl;
+ struct mlx5_ib_dev *dev = to_mdev(ibdev);
+
+ return mlx5_fc_query(dev->mdev, fc,
+ &read_attr->out[IB_COUNTER_PACKETS],
+ &read_attr->out[IB_COUNTER_BYTES]);
+}
+
+/* flow counters currently expose two counters packets and bytes */
+#define FLOW_COUNTERS_NUM 2
static int counters_set_description(struct ib_counters *counters,
enum mlx5_ib_counters_type counters_type,
struct mlx5_ib_flow_counters_desc *desc_data,
@@ -3171,6 +3184,8 @@ static int counters_set_description(struct ib_counters *counters,
/* init the fields for the object */
mcounters->type = counters_type;
+ mcounters->read_counters = read_flow_counters;
+ mcounters->counters_num = FLOW_COUNTERS_NUM;
mcounters->ncounters = ncounters;
/* each counter entry have both description and index pair */
for (i = 0; i < ncounters; i++) {
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 155bca627222..d89c8fe626f6 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -814,6 +814,12 @@ struct mlx5_memic {
DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES);
};
+struct mlx5_read_counters_attr {
+ struct mlx5_fc *hw_cntrs_hndl;
+ u64 *out;
+ u32 flags;
+};
+
enum mlx5_ib_counters_type {
MLX5_IB_COUNTERS_FLOW,
};
@@ -821,7 +827,12 @@ enum mlx5_ib_counters_type {
struct mlx5_ib_mcounters {
struct ib_counters ibcntrs;
enum mlx5_ib_counters_type type;
- void *hw_cntrs_hndl;
+ /* number of counters supported for this counters type */
+ u32 counters_num;
+ struct mlx5_fc *hw_cntrs_hndl;
+ /* read function for this counters type */
+ int (*read_counters)(struct ib_device *ibdev,
+ struct mlx5_read_counters_attr *read_attr);
/* max index set as part of create_flow */
u32 cntrs_max_index;
/* number of counters data entries (<description,index> pair) */
--
2.14.3
^ permalink raw reply related
* [PATCH mlx5-next v3 03/14] net/mlx5: Export flow counter related API
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
Exports counters API to be used in both IB and EN.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 2 --
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c | 3 +++
include/linux/mlx5/fs.h | 3 +++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index d589dbbc72a7..32070e5d993d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -233,8 +233,6 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
unsigned long delay);
void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
unsigned long interval);
-int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
- u64 *packets, u64 *bytes);
int mlx5_init_fs(struct mlx5_core_dev *dev);
void mlx5_cleanup_fs(struct mlx5_core_dev *dev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index f5cb3fa5d8cf..58af6be13dfa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -243,6 +243,7 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging)
return ERR_PTR(err);
}
+EXPORT_SYMBOL(mlx5_fc_create);
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
{
@@ -260,6 +261,7 @@ void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter)
mlx5_cmd_fc_free(dev, counter->id);
kfree(counter);
}
+EXPORT_SYMBOL(mlx5_fc_destroy);
int mlx5_init_fc_stats(struct mlx5_core_dev *dev)
{
@@ -317,6 +319,7 @@ int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
{
return mlx5_cmd_fc_query(dev, counter->id, packets, bytes);
}
+EXPORT_SYMBOL(mlx5_fc_query);
void mlx5_fc_query_cached(struct mlx5_fc *counter,
u64 *bytes, u64 *packets, u64 *lastuse)
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 9f4d32e41c06..3b4c3298061c 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -186,6 +186,9 @@ struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
void mlx5_fc_query_cached(struct mlx5_fc *counter,
u64 *bytes, u64 *packets, u64 *lastuse);
+int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
+ u64 *packets, u64 *bytes);
+
int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 11/14] IB/mlx5: Add counters create and destroy support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
This patch implements the device counters create and destroy APIs
and introducing some internal management structures.
Downstream patches in this series will add the functionality to
support flow counters binding and reading.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/main.c | 23 +++++++++++++++++++++++
drivers/infiniband/hw/mlx5/mlx5_ib.h | 10 ++++++++++
2 files changed, 33 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index fb31a719ee25..4d0f53566854 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5132,6 +5132,27 @@ static void depopulate_specs_root(struct mlx5_ib_dev *dev)
uverbs_free_spec_tree(dev->ib_dev.specs_root);
}
+static int mlx5_ib_destroy_counters(struct ib_counters *counters)
+{
+ struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
+
+ kfree(mcounters);
+
+ return 0;
+}
+
+static struct ib_counters *mlx5_ib_create_counters(struct ib_device *device,
+ struct uverbs_attr_bundle *attrs)
+{
+ struct mlx5_ib_mcounters *mcounters;
+
+ mcounters = kzalloc(sizeof(*mcounters), GFP_KERNEL);
+ if (!mcounters)
+ return ERR_PTR(-ENOMEM);
+
+ return &mcounters->ibcntrs;
+}
+
void mlx5_ib_stage_init_cleanup(struct mlx5_ib_dev *dev)
{
mlx5_ib_cleanup_multiport_master(dev);
@@ -5375,6 +5396,8 @@ int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
dev->ib_dev.destroy_flow_action = mlx5_ib_destroy_flow_action;
dev->ib_dev.modify_flow_action_esp = mlx5_ib_modify_flow_action_esp;
dev->ib_dev.driver_id = RDMA_DRIVER_MLX5;
+ dev->ib_dev.create_counters = mlx5_ib_create_counters;
+ dev->ib_dev.destroy_counters = mlx5_ib_destroy_counters;
err = init_node_data(dev);
if (err)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 49a1aa0ff429..fd27ec1aed08 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -813,6 +813,16 @@ struct mlx5_memic {
DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES);
};
+struct mlx5_ib_mcounters {
+ struct ib_counters ibcntrs;
+};
+
+static inline struct mlx5_ib_mcounters *
+to_mcounters(struct ib_counters *ibcntrs)
+{
+ return container_of(ibcntrs, struct mlx5_ib_mcounters, ibcntrs);
+}
+
struct mlx5_ib_dev {
struct ib_device ib_dev;
struct mlx5_core_dev *mdev;
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 10/14] IB/uverbs: Add support for flow counters
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
The struct ib_uverbs_flow_spec_action_count associates
a counters object with the flow.
Post this association the flow counters can be read via
the counters object.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/uverbs.h | 1 +
drivers/infiniband/core/uverbs_cmd.c | 81 +++++++++++++++++++++++++++++++-----
include/uapi/rdma/ib_user_verbs.h | 13 ++++++
3 files changed, 84 insertions(+), 11 deletions(-)
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 5b2461fa634d..c0d40fc3a53a 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -263,6 +263,7 @@ struct ib_uverbs_flow_spec {
struct ib_uverbs_flow_spec_action_tag flow_tag;
struct ib_uverbs_flow_spec_action_drop drop;
struct ib_uverbs_flow_spec_action_handle action;
+ struct ib_uverbs_flow_spec_action_count flow_count;
};
};
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index ddb9d79691be..3179a95c6f5e 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -2748,43 +2748,82 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
struct ib_uflow_resources {
size_t max;
size_t num;
- struct ib_flow_action *collection[0];
+ size_t collection_num;
+ size_t counters_num;
+ struct ib_counters **counters;
+ struct ib_flow_action **collection;
};
static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
{
struct ib_uflow_resources *resources;
- resources =
- kmalloc(sizeof(*resources) +
- num_specs * sizeof(*resources->collection), GFP_KERNEL);
+ resources = kzalloc(sizeof(*resources), GFP_KERNEL);
if (!resources)
- return NULL;
+ goto err_res;
+
+ resources->counters =
+ kcalloc(num_specs, sizeof(*resources->counters), GFP_KERNEL);
+
+ if (!resources->counters)
+ goto err_cnt;
+
+ resources->collection =
+ kcalloc(num_specs, sizeof(*resources->collection), GFP_KERNEL);
+
+ if (!resources->collection)
+ goto err_collection;
- resources->num = 0;
resources->max = num_specs;
return resources;
+
+err_collection:
+ kfree(resources->counters);
+err_cnt:
+ kfree(resources);
+err_res:
+ return NULL;
}
void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res)
{
unsigned int i;
- for (i = 0; i < uflow_res->num; i++)
+ for (i = 0; i < uflow_res->collection_num; i++)
atomic_dec(&uflow_res->collection[i]->usecnt);
+ for (i = 0; i < uflow_res->counters_num; i++)
+ atomic_dec(&uflow_res->counters[i]->usecnt);
+
+ kfree(uflow_res->collection);
+ kfree(uflow_res->counters);
kfree(uflow_res);
}
static void flow_resources_add(struct ib_uflow_resources *uflow_res,
- struct ib_flow_action *action)
+ enum ib_flow_spec_type type,
+ void *ibobj)
{
WARN_ON(uflow_res->num >= uflow_res->max);
- atomic_inc(&action->usecnt);
- uflow_res->collection[uflow_res->num++] = action;
+ switch (type) {
+ case IB_FLOW_SPEC_ACTION_HANDLE:
+ atomic_inc(&((struct ib_flow_action *)ibobj)->usecnt);
+ uflow_res->collection[uflow_res->collection_num++] =
+ (struct ib_flow_action *)ibobj;
+ break;
+ case IB_FLOW_SPEC_ACTION_COUNT:
+ atomic_inc(&((struct ib_counters *)ibobj)->usecnt);
+ uflow_res->counters[uflow_res->counters_num++] =
+ (struct ib_counters *)ibobj;
+ break;
+ default:
+ WARN_ON(1);
+ }
+
+ uflow_res->num++;
}
static int kern_spec_to_ib_spec_action(struct ib_ucontext *ucontext,
@@ -2821,9 +2860,29 @@ static int kern_spec_to_ib_spec_action(struct ib_ucontext *ucontext,
return -EINVAL;
ib_spec->action.size =
sizeof(struct ib_flow_spec_action_handle);
- flow_resources_add(uflow_res, ib_spec->action.act);
+ flow_resources_add(uflow_res,
+ IB_FLOW_SPEC_ACTION_HANDLE,
+ ib_spec->action.act);
uobj_put_obj_read(ib_spec->action.act);
break;
+ case IB_FLOW_SPEC_ACTION_COUNT:
+ if (kern_spec->flow_count.size !=
+ sizeof(struct ib_uverbs_flow_spec_action_count))
+ return -EINVAL;
+ ib_spec->flow_count.counters =
+ uobj_get_obj_read(counters,
+ UVERBS_OBJECT_COUNTERS,
+ kern_spec->flow_count.handle,
+ ucontext);
+ if (!ib_spec->flow_count.counters)
+ return -EINVAL;
+ ib_spec->flow_count.size =
+ sizeof(struct ib_flow_spec_action_count);
+ flow_resources_add(uflow_res,
+ IB_FLOW_SPEC_ACTION_COUNT,
+ ib_spec->flow_count.counters);
+ uobj_put_obj_read(ib_spec->flow_count.counters);
+ break;
default:
return -EINVAL;
}
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 409507f83b91..4f9991de8e3a 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -998,6 +998,19 @@ struct ib_uverbs_flow_spec_action_handle {
__u32 reserved1;
};
+struct ib_uverbs_flow_spec_action_count {
+ union {
+ struct ib_uverbs_flow_spec_hdr hdr;
+ struct {
+ __u32 type;
+ __u16 size;
+ __u16 reserved;
+ };
+ };
+ __u32 handle;
+ __u32 reserved1;
+};
+
struct ib_uverbs_flow_tunnel_filter {
__be32 tunnel_id;
};
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 09/14] IB/core: Add support for flow counters
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
A counters object could be attached to flow on creation
by providing the counter specification action.
General counters description which count packets and bytes are
introduced, downstream patches from this series will use them
as part of flow counters binding.
In addition, increase number of flow specifications supported
layers to 10 upon adding count specification and for the
previously added drop specification.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/rdma/ib_verbs.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 84f412f7b8f3..2cc04abb6df8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1859,9 +1859,10 @@ enum ib_flow_spec_type {
IB_FLOW_SPEC_ACTION_TAG = 0x1000,
IB_FLOW_SPEC_ACTION_DROP = 0x1001,
IB_FLOW_SPEC_ACTION_HANDLE = 0x1002,
+ IB_FLOW_SPEC_ACTION_COUNT = 0x1003,
};
#define IB_FLOW_SPEC_LAYER_MASK 0xF0
-#define IB_FLOW_SPEC_SUPPORT_LAYERS 8
+#define IB_FLOW_SPEC_SUPPORT_LAYERS 10
/* Flow steering rule priority is set according to it's domain.
* Lower domain value means higher priority.
@@ -2041,6 +2042,17 @@ struct ib_flow_spec_action_handle {
struct ib_flow_action *act;
};
+enum ib_counters_description {
+ IB_COUNTER_PACKETS,
+ IB_COUNTER_BYTES,
+};
+
+struct ib_flow_spec_action_count {
+ enum ib_flow_spec_type type;
+ u16 size;
+ struct ib_counters *counters;
+};
+
union ib_flow_spec {
struct {
u32 type;
@@ -2058,6 +2070,7 @@ union ib_flow_spec {
struct ib_flow_spec_action_tag flow_tag;
struct ib_flow_spec_action_drop drop;
struct ib_flow_spec_action_handle action;
+ struct ib_flow_spec_action_count flow_count;
};
struct ib_flow_attr {
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for create_flow
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Matan Barak <matanb@mellanox.com>
This is required when user-space drivers need to pass extra information
regarding how to handle this flow steering specification.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/uverbs_cmd.c | 7 ++++++-
drivers/infiniband/core/verbs.c | 2 +-
drivers/infiniband/hw/mlx4/main.c | 6 +++++-
drivers/infiniband/hw/mlx5/main.c | 7 ++++++-
include/rdma/ib_verbs.h | 3 ++-
5 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index e74262ee104c..ddb9d79691be 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3542,11 +3542,16 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
err = -EINVAL;
goto err_free;
}
- flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
+
+ flow_id = qp->device->create_flow(qp, flow_attr,
+ IB_FLOW_DOMAIN_USER, uhw);
+
if (IS_ERR(flow_id)) {
err = PTR_ERR(flow_id);
goto err_free;
}
+ atomic_inc(&qp->usecnt);
+ flow_id->qp = qp;
flow_id->uobject = uobj;
uobj->object = flow_id;
uflow = container_of(uobj, typeof(*uflow), uobject);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 6ddfb1fade79..0b56828c1319 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1983,7 +1983,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
if (!qp->device->create_flow)
return ERR_PTR(-EOPNOTSUPP);
- flow_id = qp->device->create_flow(qp, flow_attr, domain);
+ flow_id = qp->device->create_flow(qp, flow_attr, domain, NULL);
if (!IS_ERR(flow_id)) {
atomic_inc(&qp->usecnt);
flow_id->qp = qp;
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index bf12394c13c1..6fe5d5d1d1d9 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1848,7 +1848,7 @@ static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
struct ib_flow_attr *flow_attr,
- int domain)
+ int domain, struct ib_udata *udata)
{
int err = 0, i = 0, j = 0;
struct mlx4_ib_flow *mflow;
@@ -1866,6 +1866,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
(flow_attr->type != IB_FLOW_ATTR_NORMAL))
return ERR_PTR(-EOPNOTSUPP);
+ if (udata &&
+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
+ return ERR_PTR(-EOPNOTSUPP);
+
memset(type, 0, sizeof(type));
mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 92879d2d3026..fb31a719ee25 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -3371,7 +3371,8 @@ static struct mlx5_ib_flow_handler *create_sniffer_rule(struct mlx5_ib_dev *dev,
static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
struct ib_flow_attr *flow_attr,
- int domain)
+ int domain,
+ struct ib_udata *udata)
{
struct mlx5_ib_dev *dev = to_mdev(qp->device);
struct mlx5_ib_qp *mqp = to_mqp(qp);
@@ -3383,6 +3384,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
int err;
int underlay_qpn;
+ if (udata &&
+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
+ return ERR_PTR(-EOPNOTSUPP);
+
if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
return ERR_PTR(-ENOMEM);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ba49e874c841..84f412f7b8f3 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2459,7 +2459,8 @@ struct ib_device {
struct ib_flow * (*create_flow)(struct ib_qp *qp,
struct ib_flow_attr
*flow_attr,
- int domain);
+ int domain,
+ struct ib_udata *udata);
int (*destroy_flow)(struct ib_flow *flow_id);
int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
struct ib_mr_status *mr_status);
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 07/14] IB/uverbs: Add read counters support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
This patch exposes the read counters verb to user space
applications.
By that verb the user can read the hardware counters which
are associated with the counters object.
The application needs to provide a sufficient memory to
hold the statistics.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
.../infiniband/core/uverbs_std_types_counters.c | 59 +++++++++++++++++++++-
include/uapi/rdma/ib_user_ioctl_cmds.h | 7 +++
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/uverbs_std_types_counters.c b/drivers/infiniband/core/uverbs_std_types_counters.c
index a5bc50ceee13..b35fcd3718c8 100644
--- a/drivers/infiniband/core/uverbs_std_types_counters.c
+++ b/drivers/infiniband/core/uverbs_std_types_counters.c
@@ -80,6 +80,49 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(struct ib_device *ib_de
return ret;
}
+static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(struct ib_device *ib_dev,
+ struct ib_uverbs_file *file,
+ struct uverbs_attr_bundle *attrs)
+{
+ struct ib_counters_read_attr read_attr = {};
+ const struct uverbs_attr *uattr;
+ struct ib_counters *counters =
+ uverbs_attr_get_obj(attrs, UVERBS_ATTR_READ_COUNTERS_HANDLE);
+ int ret;
+
+ if (!ib_dev->read_counters)
+ return -EOPNOTSUPP;
+
+ if (!atomic_read(&counters->usecnt))
+ return -EINVAL;
+
+ ret = uverbs_copy_from(&read_attr.flags, attrs,
+ UVERBS_ATTR_READ_COUNTERS_FLAGS);
+ if (ret)
+ return ret;
+
+ uattr = uverbs_attr_get(attrs, UVERBS_ATTR_READ_COUNTERS_BUFF);
+ read_attr.ncounters = uattr->ptr_attr.len / sizeof(u64);
+ read_attr.counters_buff = kcalloc(read_attr.ncounters,
+ sizeof(u64), GFP_KERNEL);
+ if (!read_attr.counters_buff)
+ return -ENOMEM;
+
+ ret = ib_dev->read_counters(counters,
+ &read_attr,
+ attrs);
+ if (ret)
+ goto err_read;
+
+ ret = uverbs_copy_to(attrs, UVERBS_ATTR_READ_COUNTERS_BUFF,
+ read_attr.counters_buff,
+ read_attr.ncounters * sizeof(u64));
+
+err_read:
+ kfree(read_attr.counters_buff);
+ return ret;
+}
+
static DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_COUNTERS_CREATE,
&UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
UVERBS_OBJECT_COUNTERS,
@@ -93,8 +136,22 @@ static DECLARE_UVERBS_NAMED_METHOD_WITH_HANDLER(UVERBS_METHOD_COUNTERS_DESTROY,
UVERBS_ACCESS_DESTROY,
UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
+#define MAX_COUNTERS_BUFF_SIZE USHRT_MAX
+static DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_COUNTERS_READ,
+ &UVERBS_ATTR_IDR(UVERBS_ATTR_READ_COUNTERS_HANDLE,
+ UVERBS_OBJECT_COUNTERS,
+ UVERBS_ACCESS_READ,
+ UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
+ &UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_READ_COUNTERS_BUFF,
+ UVERBS_ATTR_SIZE(0, MAX_COUNTERS_BUFF_SIZE),
+ UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),
+ &UVERBS_ATTR_PTR_IN(UVERBS_ATTR_READ_COUNTERS_FLAGS,
+ UVERBS_ATTR_TYPE(__u32),
+ UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
+
DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COUNTERS,
&UVERBS_TYPE_ALLOC_IDR(0, uverbs_free_counters),
&UVERBS_METHOD(UVERBS_METHOD_COUNTERS_CREATE),
- &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY));
+ &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY),
+ &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_READ));
diff --git a/include/uapi/rdma/ib_user_ioctl_cmds.h b/include/uapi/rdma/ib_user_ioctl_cmds.h
index c28ce62d2e40..888ac5975a6c 100644
--- a/include/uapi/rdma/ib_user_ioctl_cmds.h
+++ b/include/uapi/rdma/ib_user_ioctl_cmds.h
@@ -140,9 +140,16 @@ enum uverbs_attrs_destroy_counters_cmd_attr_ids {
UVERBS_ATTR_DESTROY_COUNTERS_HANDLE,
};
+enum uverbs_attrs_read_counters_cmd_attr_ids {
+ UVERBS_ATTR_READ_COUNTERS_HANDLE,
+ UVERBS_ATTR_READ_COUNTERS_BUFF,
+ UVERBS_ATTR_READ_COUNTERS_FLAGS,
+};
+
enum uverbs_methods_actions_counters_ops {
UVERBS_METHOD_COUNTERS_CREATE,
UVERBS_METHOD_COUNTERS_DESTROY,
+ UVERBS_METHOD_COUNTERS_READ,
};
#endif
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 06/14] IB/core: Introduce counters read verb
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
The user supplies counters instance and a reference to an output
array of uint64_t.
The driver reads the hardware counters values and writes them to
the output index location in the user supplied array.
All counters values are represented as uint64_t types.
To be able to successfully read the data the counters must be
first bound to an IB object.
Downstream patches will present binding method for
flow counters.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/rdma/ib_verbs.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 90c548437c8a..ba49e874c841 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2219,6 +2219,17 @@ struct ib_counters {
atomic_t usecnt;
};
+enum ib_read_counters_flags {
+ /* prefer read values from driver cache */
+ IB_READ_COUNTERS_ATTR_PREFER_CACHED = 1 << 0,
+};
+
+struct ib_counters_read_attr {
+ u64 *counters_buff;
+ u32 ncounters;
+ u32 flags; /* use enum ib_read_counters_flags */
+};
+
struct uverbs_attr_bundle;
struct ib_device {
@@ -2493,6 +2504,9 @@ struct ib_device {
struct ib_counters * (*create_counters)(struct ib_device *device,
struct uverbs_attr_bundle *attrs);
int (*destroy_counters)(struct ib_counters *counters);
+ int (*read_counters)(struct ib_counters *counters,
+ struct ib_counters_read_attr *counters_read_attr,
+ struct uverbs_attr_bundle *attrs);
/**
* rdma netdev operation
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 05/14] IB/uverbs: Add create/destroy counters support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
User space application which uses counters functionality,
is expected to allocate/release the counters resources by
calling create/destroy verbs and in turn get a unique handle
that can be used to attach the counters to its counted type.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/Makefile | 2 +-
drivers/infiniband/core/uverbs.h | 1 +
drivers/infiniband/core/uverbs_std_types.c | 3 +-
.../infiniband/core/uverbs_std_types_counters.c | 100 +++++++++++++++++++++
include/uapi/rdma/ib_user_ioctl_cmds.h | 14 +++
5 files changed, 118 insertions(+), 2 deletions(-)
create mode 100644 drivers/infiniband/core/uverbs_std_types_counters.c
diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index 8d42373a2d8a..61667705d746 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -37,4 +37,4 @@ ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o \
rdma_core.o uverbs_std_types.o uverbs_ioctl.o \
uverbs_ioctl_merge.o uverbs_std_types_cq.o \
uverbs_std_types_flow_action.o uverbs_std_types_dm.o \
- uverbs_std_types_mr.o
+ uverbs_std_types_mr.o uverbs_std_types_counters.o
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index cfb51618ab7a..5b2461fa634d 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -287,6 +287,7 @@ extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_RWQ_IND_TBL);
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_XRCD);
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_FLOW_ACTION);
extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_DM);
+extern const struct uverbs_object_def UVERBS_OBJECT(UVERBS_OBJECT_COUNTERS);
#define IB_UVERBS_DECLARE_CMD(name) \
ssize_t ib_uverbs_##name(struct ib_uverbs_file *file, \
diff --git a/drivers/infiniband/core/uverbs_std_types.c b/drivers/infiniband/core/uverbs_std_types.c
index 569f48bd821e..b570acbd94af 100644
--- a/drivers/infiniband/core/uverbs_std_types.c
+++ b/drivers/infiniband/core/uverbs_std_types.c
@@ -302,7 +302,8 @@ static DECLARE_UVERBS_OBJECT_TREE(uverbs_default_objects,
&UVERBS_OBJECT(UVERBS_OBJECT_RWQ_IND_TBL),
&UVERBS_OBJECT(UVERBS_OBJECT_XRCD),
&UVERBS_OBJECT(UVERBS_OBJECT_FLOW_ACTION),
- &UVERBS_OBJECT(UVERBS_OBJECT_DM));
+ &UVERBS_OBJECT(UVERBS_OBJECT_DM),
+ &UVERBS_OBJECT(UVERBS_OBJECT_COUNTERS));
const struct uverbs_object_tree_def *uverbs_default_get_objects(void)
{
diff --git a/drivers/infiniband/core/uverbs_std_types_counters.c b/drivers/infiniband/core/uverbs_std_types_counters.c
new file mode 100644
index 000000000000..a5bc50ceee13
--- /dev/null
+++ b/drivers/infiniband/core/uverbs_std_types_counters.c
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "uverbs.h"
+#include <rdma/uverbs_std_types.h>
+
+static int uverbs_free_counters(struct ib_uobject *uobject,
+ enum rdma_remove_reason why)
+{
+ struct ib_counters *counters = uobject->object;
+
+ if (why == RDMA_REMOVE_DESTROY &&
+ atomic_read(&counters->usecnt))
+ return -EBUSY;
+
+ return counters->device->destroy_counters(counters);
+}
+
+static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(struct ib_device *ib_dev,
+ struct ib_uverbs_file *file,
+ struct uverbs_attr_bundle *attrs)
+{
+ struct ib_counters *counters;
+ struct ib_uobject *uobj;
+ int ret;
+
+ /*
+ * This check should be removed once the infrastructure
+ * have the ability to remove methods from parse tree once
+ * such condition is met.
+ */
+ if (!ib_dev->create_counters)
+ return -EOPNOTSUPP;
+
+ uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_COUNTERS_HANDLE);
+ counters = ib_dev->create_counters(ib_dev, attrs);
+ if (IS_ERR(counters)) {
+ ret = PTR_ERR(counters);
+ goto err_create_counters;
+ }
+
+ counters->device = ib_dev;
+ counters->uobject = uobj;
+ uobj->object = counters;
+ atomic_set(&counters->usecnt, 0);
+
+ return 0;
+
+err_create_counters:
+ return ret;
+}
+
+static DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_COUNTERS_CREATE,
+ &UVERBS_ATTR_IDR(UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
+ UVERBS_OBJECT_COUNTERS,
+ UVERBS_ACCESS_NEW,
+ UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
+
+static DECLARE_UVERBS_NAMED_METHOD_WITH_HANDLER(UVERBS_METHOD_COUNTERS_DESTROY,
+ uverbs_destroy_def_handler,
+ &UVERBS_ATTR_IDR(UVERBS_ATTR_DESTROY_COUNTERS_HANDLE,
+ UVERBS_OBJECT_COUNTERS,
+ UVERBS_ACCESS_DESTROY,
+ UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)));
+
+DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COUNTERS,
+ &UVERBS_TYPE_ALLOC_IDR(0, uverbs_free_counters),
+ &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_CREATE),
+ &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY));
+
diff --git a/include/uapi/rdma/ib_user_ioctl_cmds.h b/include/uapi/rdma/ib_user_ioctl_cmds.h
index 83e3890eef20..c28ce62d2e40 100644
--- a/include/uapi/rdma/ib_user_ioctl_cmds.h
+++ b/include/uapi/rdma/ib_user_ioctl_cmds.h
@@ -55,6 +55,7 @@ enum uverbs_default_objects {
UVERBS_OBJECT_WQ,
UVERBS_OBJECT_FLOW_ACTION,
UVERBS_OBJECT_DM,
+ UVERBS_OBJECT_COUNTERS,
};
enum {
@@ -131,4 +132,17 @@ enum uverbs_methods_mr {
UVERBS_METHOD_DM_MR_REG,
};
+enum uverbs_attrs_create_counters_cmd_attr_ids {
+ UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
+};
+
+enum uverbs_attrs_destroy_counters_cmd_attr_ids {
+ UVERBS_ATTR_DESTROY_COUNTERS_HANDLE,
+};
+
+enum uverbs_methods_actions_counters_ops {
+ UVERBS_METHOD_COUNTERS_CREATE,
+ UVERBS_METHOD_COUNTERS_DESTROY,
+};
+
#endif
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 04/14] IB/core: Introduce counters object and its create/destroy
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Raed Salem <raeds@mellanox.com>
A verbs application may need to get statistics and info on various
aspects of a verb object (e.g. Flow, QP, ...), in general case the
application will state which object's counters its interested in
(we refer to this action as attach), bind this new counters object
to the appropriate verb object and on later stage read their values
using the counters object.
This series introduces a general API for counters object that may
accumulate any ib object counters type, bound and read on demand.
Counters instance is allocated on an IB context and belongs to
that context.
Upon successful creation the counters can be bound to a verbs
object so that hardware counter instances can be created and read.
Downstream patches in this series will introduce the attach, bind
and the read functionality.
Counters instance can be de-allocated, upon successful
destruction the related hardware resources are released.
Prior to destroy call the user must first make sure that the counters
is not being used by any IB object, e.g. not attached to any of its
counted type otherwise an EBUSY error is invoked.
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/rdma/ib_verbs.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 406c98d7a09a..90c548437c8a 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2212,6 +2212,13 @@ struct ib_port_pkey_list {
struct list_head pkey_list;
};
+struct ib_counters {
+ struct ib_device *device;
+ struct ib_uobject *uobject;
+ /* num of objects attached */
+ atomic_t usecnt;
+};
+
struct uverbs_attr_bundle;
struct ib_device {
@@ -2483,6 +2490,10 @@ struct ib_device {
struct ib_mr * (*reg_dm_mr)(struct ib_pd *pd, struct ib_dm *dm,
struct ib_dm_mr_attr *attr,
struct uverbs_attr_bundle *attrs);
+ struct ib_counters * (*create_counters)(struct ib_device *device,
+ struct uverbs_attr_bundle *attrs);
+ int (*destroy_counters)(struct ib_counters *counters);
+
/**
* rdma netdev operation
*
--
2.14.3
^ permalink raw reply related
* [PATCH mlx5-next v3 02/14] net/mlx5: Use flow counter pointer as input to the query function
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Or Gerlitz <ogerlitz@mellanox.com>
This allows to un-expose the details of struct mlx5_fc and keep
it internal to the core driver as it used to be.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 15 ++++++---------
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c | 4 ++--
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 9a24314b817a..bb9665b7e8e7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2104,21 +2104,18 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev,
struct mlx5_vport *vport = &esw->vports[vport_idx];
u64 rx_discard_vport_down, tx_discard_vport_down;
u64 bytes = 0;
- u16 idx = 0;
int err = 0;
if (!vport->enabled || esw->mode != SRIOV_LEGACY)
return 0;
- if (vport->egress.drop_counter) {
- idx = vport->egress.drop_counter->id;
- mlx5_fc_query(dev, idx, &stats->rx_dropped, &bytes);
- }
+ if (vport->egress.drop_counter)
+ mlx5_fc_query(dev, vport->egress.drop_counter,
+ &stats->rx_dropped, &bytes);
- if (vport->ingress.drop_counter) {
- idx = vport->ingress.drop_counter->id;
- mlx5_fc_query(dev, idx, &stats->tx_dropped, &bytes);
- }
+ if (vport->ingress.drop_counter)
+ mlx5_fc_query(dev, vport->ingress.drop_counter,
+ &stats->tx_dropped, &bytes);
if (!MLX5_CAP_GEN(dev, receive_discard_vport_down) &&
!MLX5_CAP_GEN(dev, transmit_discard_vport_down))
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index b6da322a8016..d589dbbc72a7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -233,7 +233,7 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,
unsigned long delay);
void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,
unsigned long interval);
-int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,
+int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
u64 *packets, u64 *bytes);
int mlx5_init_fs(struct mlx5_core_dev *dev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index b7ab929d5f8e..f5cb3fa5d8cf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -312,10 +312,10 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
}
}
-int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,
+int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
u64 *packets, u64 *bytes)
{
- return mlx5_cmd_fc_query(dev, id, packets, bytes);
+ return mlx5_cmd_fc_query(dev, counter->id, packets, bytes);
}
void mlx5_fc_query_cached(struct mlx5_fc *counter,
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 01/14] IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
In-Reply-To: <20180531134341.18441-1-leon@kernel.org>
From: Matan Barak <matanb@mellanox.com>
Previously, the user had to dig inside the attribute to get the uobject.
Add a helper function that correctly extract it (and do the required
checks) for him/her.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/uverbs_std_types_cq.c | 23 +++++++++++-----------
.../infiniband/core/uverbs_std_types_flow_action.c | 4 ++--
include/rdma/uverbs_ioctl.h | 11 +++++++++++
3 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/infiniband/core/uverbs_std_types_cq.c b/drivers/infiniband/core/uverbs_std_types_cq.c
index b0dbae9dd0d7..3d293d01afea 100644
--- a/drivers/infiniband/core/uverbs_std_types_cq.c
+++ b/drivers/infiniband/core/uverbs_std_types_cq.c
@@ -65,7 +65,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev,
struct ib_cq_init_attr attr = {};
struct ib_cq *cq;
struct ib_uverbs_completion_event_file *ev_file = NULL;
- const struct uverbs_attr *ev_file_attr;
struct ib_uobject *ev_file_uobj;
if (!(ib_dev->uverbs_cmd_mask & 1ULL << IB_USER_VERBS_CMD_CREATE_CQ))
@@ -87,10 +86,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev,
UVERBS_ATTR_CREATE_CQ_FLAGS)))
return -EFAULT;
- ev_file_attr = uverbs_attr_get(attrs, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL);
- if (!IS_ERR(ev_file_attr)) {
- ev_file_uobj = ev_file_attr->obj_attr.uobject;
-
+ ev_file_uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL);
+ if (!IS_ERR(ev_file_uobj)) {
ev_file = container_of(ev_file_uobj,
struct ib_uverbs_completion_event_file,
uobj_file.uobj);
@@ -102,8 +99,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev,
goto err_event_file;
}
- obj = container_of(uverbs_attr_get(attrs,
- UVERBS_ATTR_CREATE_CQ_HANDLE)->obj_attr.uobject,
+ obj = container_of(uverbs_attr_get_uobject(attrs,
+ UVERBS_ATTR_CREATE_CQ_HANDLE),
typeof(*obj), uobject);
obj->uverbs_file = ucontext->ufile;
obj->comp_events_reported = 0;
@@ -170,13 +167,17 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_DESTROY)(struct ib_device *ib_dev,
struct ib_uverbs_file *file,
struct uverbs_attr_bundle *attrs)
{
- struct ib_uverbs_destroy_cq_resp resp;
struct ib_uobject *uobj =
- uverbs_attr_get(attrs, UVERBS_ATTR_DESTROY_CQ_HANDLE)->obj_attr.uobject;
- struct ib_ucq_object *obj = container_of(uobj, struct ib_ucq_object,
- uobject);
+ uverbs_attr_get_uobject(attrs, UVERBS_ATTR_DESTROY_CQ_HANDLE);
+ struct ib_uverbs_destroy_cq_resp resp;
+ struct ib_ucq_object *obj;
int ret;
+ if (IS_ERR(uobj))
+ return PTR_ERR(uobj);
+
+ obj = container_of(uobj, struct ib_ucq_object, uobject);
+
if (!(ib_dev->uverbs_cmd_mask & 1ULL << IB_USER_VERBS_CMD_DESTROY_CQ))
return -EOPNOTSUPP;
diff --git a/drivers/infiniband/core/uverbs_std_types_flow_action.c b/drivers/infiniband/core/uverbs_std_types_flow_action.c
index b4f016dfa23d..a7be51cf2e42 100644
--- a/drivers/infiniband/core/uverbs_std_types_flow_action.c
+++ b/drivers/infiniband/core/uverbs_std_types_flow_action.c
@@ -320,7 +320,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)(struct ib_device
return ret;
/* No need to check as this attribute is marked as MANDATORY */
- uobj = uverbs_attr_get(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE)->obj_attr.uobject;
+ uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE);
action = ib_dev->create_flow_action_esp(ib_dev, &esp_attr.hdr, attrs);
if (IS_ERR(action))
return PTR_ERR(action);
@@ -350,7 +350,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY)(struct ib_device
if (ret)
return ret;
- uobj = uverbs_attr_get(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE)->obj_attr.uobject;
+ uobj = uverbs_attr_get_uobject(attrs, UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE);
action = uobj->object;
if (action->type != IB_FLOW_ACTION_ESP)
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 095383a4bd1a..bd6bba3a6e04 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -420,6 +420,17 @@ static inline void *uverbs_attr_get_obj(const struct uverbs_attr_bundle *attrs_b
return attr->obj_attr.uobject->object;
}
+static inline struct ib_uobject *uverbs_attr_get_uobject(const struct uverbs_attr_bundle *attrs_bundle,
+ u16 idx)
+{
+ const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx);
+
+ if (IS_ERR(attr))
+ return ERR_CAST(attr);
+
+ return attr->obj_attr.uobject;
+}
+
static inline int uverbs_copy_to(const struct uverbs_attr_bundle *attrs_bundle,
size_t idx, const void *from, size_t size)
{
--
2.14.3
^ permalink raw reply related
* [PATCH rdma-next v3 00/14] Verbs flow counters support
From: Leon Romanovsky @ 2018-05-31 13:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Michael J . Ruhl, Or Gerlitz, Raed Salem, Yishai Hadas,
Saeed Mahameed, linux-netdev
From: Leon Romanovsky <leonro@mellanox.com>
Changelog:
v2->v3:
* Change function mlx5_fc_query signature to hide the details of
internal core driver struct mlx5_fc
* Add commen to data[] field at struct mlx5_ib_flow_counters_data (mlx5-abi.h)
* Use array of struct mlx5_ib_flow_counters_desc to clarify the output
v1->v2:
* Removed conversion from struct mlx5_fc* to void*
* Fixed one place with double space in it
* Balanced release of hardware handler in case of counters allocation failure
* Added Tested-by
* Minimize time spent holding mutex lock
* Fixed deadlock caused by nested lock in error path
* Protect from handler pointer derefence in the error paths
Not changed: mlx5-abi.h
v0->v1:
* Decouple from DevX submission
* Use uverbs_attr_get_obj at counters read method
* Added define for max read buffer size (MAX_COUNTERS_BUFF_SIZE)
* Removed the struct mlx5_ib_flow_counter basic_flow_cnts and
the related structs used, used define instead
* Took Matan's patch from DevX
* uverbs_free_counters removed void* casting
* Added check to bound ncounters value (added define
* Changed user supplied data buffer structure to be array of
struct <desc,index> pair (applied this change to user space also)
Not changed:
* UAPI files
* Addition of uhw to flow
Thanks
----------------------------------------------------------------------
>From Raed:
This series comes to allow user space applications to monitor real time
traffic activity and events of the verbs objects it manages, e.g.:
ibv_qp, ibv_wq, ibv_flow.
This API enables generic counters creation and define mapping
to association with a verbs object, current mlx5 driver using
this API for flow counters.
With this API, an application can monitor the entire life cycle of
object activity, defined here as a static counters attachment.
This API also allows dynamic counters monitoring of measurement points
for a partial period in the verbs object life cycle.
In addition it presents the implementation of the generic counters interface.
This will be achieved by extending flow creation by adding a new flow count
specification type which allows the user to associate a previously created
flow counters using the generic verbs counters interface to the created flow,
once associated the user could read statistics by using the read function of
the generic counters interface.
The API includes:
1. create and destroyed API of a new counters objects
2. read the counters values from HW
Note:
Attaching API to allow application to define the measurement points per objects
is a user space only API and this data is passed to kernel when the counted
object (e.g. flow) is created with the counters object.
Thanks
Matan Barak (2):
IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure
IB/core: Support passing uhw for create_flow
Or Gerlitz (1):
net/mlx5: Use flow counter pointer as input to the query function
Raed Salem (11):
net/mlx5: Export flow counter related API
IB/core: Introduce counters object and its create/destroy
IB/uverbs: Add create/destroy counters support
IB/core: Introduce counters read verb
IB/uverbs: Add read counters support
IB/core: Add support for flow counters
IB/uverbs: Add support for flow counters
IB/mlx5: Add counters create and destroy support
IB/mlx5: Add flow counters binding support
IB/mlx5: Add flow counters read support
IB/mlx5: Add counters read support
drivers/infiniband/core/Makefile | 2 +-
drivers/infiniband/core/uverbs.h | 2 +
drivers/infiniband/core/uverbs_cmd.c | 88 +++++-
drivers/infiniband/core/uverbs_std_types.c | 3 +-
.../infiniband/core/uverbs_std_types_counters.c | 157 +++++++++++
drivers/infiniband/core/uverbs_std_types_cq.c | 23 +-
.../infiniband/core/uverbs_std_types_flow_action.c | 4 +-
drivers/infiniband/core/verbs.c | 2 +-
drivers/infiniband/hw/mlx4/main.c | 6 +-
drivers/infiniband/hw/mlx5/main.c | 305 ++++++++++++++++++++-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 36 +++
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 15 +-
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 2 -
.../net/ethernet/mellanox/mlx5/core/fs_counters.c | 7 +-
include/linux/mlx5/fs.h | 4 +
include/rdma/ib_verbs.h | 43 ++-
include/rdma/uverbs_ioctl.h | 11 +
include/uapi/rdma/ib_user_ioctl_cmds.h | 21 ++
include/uapi/rdma/ib_user_verbs.h | 13 +
include/uapi/rdma/mlx5-abi.h | 24 ++
20 files changed, 712 insertions(+), 56 deletions(-)
create mode 100644 drivers/infiniband/core/uverbs_std_types_counters.c
^ permalink raw reply
* Re: [PATCH net-next v12 2/5] netvsc: refactor notifier/event handling code to use the failover framework
From: Stephen Hemminger @ 2018-05-31 12:58 UTC (permalink / raw)
To: Samudrala, Sridhar
Cc: mst, davem, netdev, virtualization, virtio-dev, jesse.brandeburg,
alexander.h.duyck, kubakici, jasowang, loseweigh, jiri,
aaron.f.brown, anjali.singhai
In-Reply-To: <274f0b84-07f1-5cd5-e256-ce4b71358c14@intel.com>
On Wed, 30 May 2018 20:03:11 -0700
"Samudrala, Sridhar" <sridhar.samudrala@intel.com> wrote:
> On 5/30/2018 7:06 PM, Stephen Hemminger wrote:
> > On Thu, 24 May 2018 09:55:14 -0700
> > Sridhar Samudrala <sridhar.samudrala@intel.com> wrote:
> >
> >> Use the registration/notification framework supported by the generic
> >> failover infrastructure.
> >>
> >> Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
> > Why was this merged? It was never signed off by any of the netvsc maintainers,
> > and there were still issues unresolved.
> >
> > There are also namespaces issues I am fixing and this breaks them.
> > Will start my patch set with a revert for this. Sorry
>
> I would appreciate if you can make the fixes on top of this patch series. I tried hard
> to make sure that netvsc functionality and behavior doesn't change.
>
> It is possible that there could be some bugs introduced, but they can be fixed.
> Looks like Wei already found a bug and submitted a fix for that.
>
Ok, but several of these may clash with what you want for virtio.
Like:
- VF should be moved to namespace of virt device
- VF should be associated based on message from host with serial # not
registration notifier and MAC address.
- control operations should use master device reference rather than
searching based on MAC.
As you can see these are structural changes.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox