* [GIT] Networking
From: David Miller @ 2017-05-04 18:51 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) The wireless rate info fix from Johannes Berg.
2) When a RAW socket is in hdrincl mode, we need to make sure that the
user provided at least a minimally sized ipv4/ipv6 header. Fix from
Alexander Potapenko.
3) We must emit IFLA_PHYS_PORT_NAME netlink attributes using
nla_put_string() so that it is NULL terminated.
4) Fix a bug in TCP fastopen handling, wherein child sockets erroneously
inherit the fastopen_req from the parent, and later can end up
derefencing freed memory or doing a double free. From Eric Dumazet.
5) Don't clear out netdev stats at close time in tg3 driver, from
YueHaibing.
6) Fix refcount leak in xt_CT, from Gao Feng.
7) In nft_set_bitmap() don't leak dummy elements, from Liping Zhang.
8) Fix deadlock due to taking the expectation lock twice, also from
Liping Zhang.
9) Make xt_socket work again with ipv6, from Peter Tirsek.
10) Don't allow IPV6 to be used with IPVS if ipv6.disable=1, from
Paolo Abeni.
11) Make the BPF loader more flexible wrt. changes to the bpf MAP
entry layout. From Jesper Dangaard Brouer.
12) Fix ethtool reported device name in aquantia driver, from Pavel
Belous.
13) Fix build failures due to the compile time size test not working
in netfilter conntrack. From Geert Uytterhoeven.
Please pull, thanks a lot!
The following changes since commit 89c9fea3c8034cdb2fd745f551cde0b507fd6893:
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial (2017-05-02 19:09:35 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
for you to fetch changes up to 842be75c77cb72ee546a2b19da9c285fb3ded660:
cfg80211: make RATE_INFO_BW_20 the default (2017-05-04 13:15:28 -0400)
----------------------------------------------------------------
Alexander Potapenko (1):
ipv4, ipv6: ensure raw socket message is big enough to hold an IP header
Alexei Starovoitov (1):
selftests/bpf: get rid of -D__x86_64__
Colin Ian King (1):
net/sched: remove redundant null check on head
Dan Carpenter (1):
netfilter: x_tables: unlock on error in xt_find_table_lock()
Daniel Borkmann (1):
xdp: use common helper for netlink extended ack reporting
Daniele Palmas (1):
net: usb: qmi_wwan: add Telit ME910 support
Dave Johnson (1):
netfilter: Wrong icmp6 checksum for ICMPV6_TIME_EXCEED in reverse SNATv6 path
David Ahern (1):
net: ipv6: Do not duplicate DAD on link up
David Cai (1):
smsc911x: Adding support for Micochip LAN9250 Ethernet controller
David S. Miller (4):
Merge branch 'sample-bpf-loader-fixes'
Merge git://git.kernel.org/.../pablo/nf
Merge branch 'ibmvnic-Updated-reset-handler-andcode-fixes'
Merge branch 'qed-fixes'
Eric Dumazet (1):
tcp: do not inherit fastopen_req from parent
Gao Feng (1):
netfilter: xt_CT: fix refcnt leak on error path
Geert Uytterhoeven (2):
test_bpf: Use ULL suffix for 64-bit constants
netfilter: conntrack: Force inlining of build check to prevent build failure
Jarno Rajahalme (1):
openvswitch: Delete conntrack entry clashing with an expectation.
Jesper Dangaard Brouer (4):
samples/bpf: adjust rlimit RLIMIT_MEMLOCK for traceex2, tracex3 and tracex4
samples/bpf: make bpf_load.c code compatible with ELF maps section changes
samples/bpf: load_bpf.c make callback fixup more flexible
samples/bpf: export map_data[] for more info on maps
Johannes Berg (1):
cfg80211: make RATE_INFO_BW_20 the default
Linus Lüssing (1):
bridge: ebtables: fix reception of frames DNAT-ed to bridge device/port
Liping Zhang (7):
netfilter: nf_ct_helper: permit cthelpers with different names via nfnetlink
netfilter: nft_set_bitmap: free dummy elements when destroy the set
netfilter: ctnetlink: drop the incorrect cthelper module request
netfilter: ctnetlink: fix deadlock due to acquire _expect_lock twice
netfilter: ctnetlink: make it safer when updating ct->status
netfilter: ctnetlink: acquire ct->lock before operating nf_ct_seqadj
netfilter: nft_dynset: continue to next expr if _OP_ADD succeeded
Michal Schmidt (1):
rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string
Nathan Fontenot (10):
ibmvnic: Move resource initialization to its own routine
ibmvnic: Replace is_closed with state field
ibmvnic: Updated reset handling
ibmvnic: Delete napi's when releasing driver resources
ibmvnic: Whitespace correction in release_rx_pools
ibmvnic: Clean up tx pools when closing
ibmvnic: Wait for any pending scrqs entries at driver close
ibmvnic: Check for driver reset first in ibmvnic_xmit
ibmvnic: Continue skb processing after skb completion error
ibmvnic: Move queue restarting in ibmvnic_tx_complete
Pablo Neira Ayuso (3):
Merge tag 'ipvs-fixes-for-v4.11' of http://git.kernel.org/.../horms/ipvs
netfilter: update MAINTAINERS file
netfilter: nf_tables: check if same extensions are set when adding elements
Paolo Abeni (1):
ipvs: explicitly forbid ipv6 service/dest creation if ipv6 mod is disabled
Pavel Belous (1):
aquantia: Fix driver name reported by ethtool
Peter Tirsek (1):
netfilter: xt_socket: Fix broken IPv6 handling
Thomas Falcon (1):
ibmvnic: Record SKB RX queue during poll
WANG Cong (1):
ipv6: initialize route null entry in addrconf_init()
Yonghong Song (1):
selftests/bpf: add a test case to check verifier pointer arithmetic
YueHaibing (1):
tg3: don't clear stats while tg3_close
Zhu Yanjun (1):
forcedeth: remove unnecessary carrier status check
stephen hemminger (1):
netvsc: make sure napi enabled before vmbus_open
sudarsana.kalluru@cavium.com (3):
qed*: Fix possible overflow for status block id field.
qed: Fix overriding of supported autoneg value.
qede: Fix possible misconfiguration of advertised autoneg value.
MAINTAINERS | 4 +-
drivers/net/ethernet/aquantia/atlantic/aq_cfg.h | 2 +-
drivers/net/ethernet/broadcom/tg3.c | 4 -
drivers/net/ethernet/ibm/ibmvnic.c | 561 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
drivers/net/ethernet/ibm/ibmvnic.h | 31 ++++--
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 +-
drivers/net/ethernet/nvidia/forcedeth.c | 6 +-
drivers/net/ethernet/qlogic/qed/qed_dev.c | 11 ++-
drivers/net/ethernet/qlogic/qed/qed_dev_api.h | 4 +-
drivers/net/ethernet/qlogic/qed/qed_main.c | 8 +-
drivers/net/ethernet/qlogic/qed/qed_mcp.h | 1 +
drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 10 +-
drivers/net/ethernet/smsc/smsc911x.c | 49 +++++----
drivers/net/ethernet/smsc/smsc911x.h | 19 ++++
drivers/net/hyperv/netvsc.c | 8 +-
drivers/net/hyperv/rndis_filter.c | 2 +-
drivers/net/usb/qmi_wwan.c | 1 +
drivers/net/virtio_net.c | 8 +-
include/linux/netlink.h | 19 ++--
include/linux/qed/qed_if.h | 2 +-
include/net/cfg80211.h | 2 +-
include/net/ip6_route.h | 1 +
include/uapi/linux/netfilter/nf_conntrack_common.h | 13 ++-
lib/test_bpf.c | 10 +-
net/bridge/netfilter/ebt_dnat.c | 20 ++++
net/core/rtnetlink.c | 2 +-
net/ipv4/raw.c | 3 +
net/ipv4/tcp_minisocks.c | 1 +
net/ipv6/addrconf.c | 7 +-
net/ipv6/netfilter/nf_nat_l3proto_ipv6.c | 2 +-
net/ipv6/raw.c | 2 +
net/ipv6/route.c | 26 ++---
net/netfilter/ipvs/ip_vs_ctl.c | 22 ++++-
net/netfilter/nf_conntrack_core.c | 2 +-
net/netfilter/nf_conntrack_helper.c | 26 ++++-
net/netfilter/nf_conntrack_netlink.c | 89 +++++++++--------
net/netfilter/nf_tables_api.c | 5 +
net/netfilter/nft_dynset.c | 5 +-
net/netfilter/nft_set_bitmap.c | 5 +
net/netfilter/x_tables.c | 4 +-
net/netfilter/xt_CT.c | 11 ++-
net/netfilter/xt_socket.c | 2 +-
net/openvswitch/conntrack.c | 30 +++++-
net/sched/cls_matchall.c | 3 +-
samples/bpf/bpf_load.c | 229 ++++++++++++++++++++++++++++--------------
samples/bpf/bpf_load.h | 18 +++-
samples/bpf/map_perf_test_user.c | 14 +--
samples/bpf/tracex2_user.c | 7 ++
samples/bpf/tracex3_user.c | 7 ++
samples/bpf/tracex4_user.c | 8 ++
tools/testing/selftests/bpf/Makefile | 6 +-
tools/testing/selftests/bpf/gnu/stubs.h | 1 +
tools/testing/selftests/bpf/test_progs.c | 16 +++
tools/testing/selftests/bpf/test_tcp_estats.c | 258 +++++++++++++++++++++++++++++++++++++++++++++++
54 files changed, 1174 insertions(+), 437 deletions(-)
create mode 100644 tools/testing/selftests/bpf/gnu/stubs.h
create mode 100644 tools/testing/selftests/bpf/test_tcp_estats.c
^ permalink raw reply
* Re: [RFC iproute2 0/8] RDMA tool
From: Leon Romanovsky @ 2017-05-04 18:45 UTC (permalink / raw)
To: Bart Van Assche
Cc: jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ram.amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org,
sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org,
ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
hch-jcswGhMUV9g@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
In-Reply-To: <1493922625.2692.8.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2022 bytes --]
On Thu, May 04, 2017 at 06:30:27PM +0000, Bart Van Assche wrote:
> On Thu, 2017-05-04 at 21:25 +0300, Leon Romanovsky wrote:
> > On Thu, May 04, 2017 at 06:10:54PM +0000, Bart Van Assche wrote:
> > > On Thu, 2017-05-04 at 21:02 +0300, Leon Romanovsky wrote:
> > > > Following our discussion both in mailing list [1] and at the LPC 2016 [2],
> > > > we would like to propose this RDMA tool to be part of iproute2 package
> > > > and finally improve this situation.
> > >
> > > Hello Leon,
> > >
> > > Although I really appreciate your work: can you clarify why you would like to
> > > add *RDMA* functionality to an *IP routing* tool? I haven't found any motivation
> > > for adding RDMA functionality to iproute2 in [1].
> >
> > We are planning to reuse the same infrastructure provided by iproute2,
> > like netlink parsing, access to distributions, same CLI and same standards.
> >
> > Right now, RDMA is already tightened to netdev: iWARP, RoCE, IPoIB, HFI-VNIC.
> > Many drivers (mlx, qed, i40, cxgb) are sharing code between net and
> > RDMA.
> >
> > I do expect that iproute2 will be installed on every machine with any
> > type of connection, including IB and OPA.
> >
> > So I think that it is enough to be part of that suite and don't invent
> > our own for one specific tool.
>
> Hello Leon,
>
> Sorry but to me that sounds like a weak argument for including RDMA functionality
> in iproute2. There is already a library for communication over netlink sockets,
> namely libnl. Is there functionality that is in iproute2 but not in libnl and
> that is needed for the new tool? If so, have you considered to create a new
> library for that functionality?
It is not hard to create new tool, the hardest part is to ensure that it is
part of the distributions. Did you count how many months we are trying to
add rdma-core to debian?
I have enough headache with that and don't want another one.
Do you have situation in mind where you will have RDMA device without
iproute2 installed?
Thanks
>
> Thanks,
>
> Bart.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
From: Pavel Belous @ 2017-05-04 18:41 UTC (permalink / raw)
To: Joe Perches, David Arcari, David S . Miller; +Cc: netdev
In-Reply-To: <1493921851.22125.42.camel@perches.com>
On 04.05.2017 21:17, Joe Perches wrote:
> On Thu, 2017-05-04 at 20:08 +0300, Pavel Belous wrote:
>> I will prepare another patch with Lino and David M. comments.
>
> I'm not submitting this because it'd just cause merge conflicts,
> but
> something you could do one day is remove the AQ_DIMOF macro
> and just use ARRAY_SIZE directly.
> ---
> drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ++--
> drivers/net/ethernet/aquantia/atlantic/aq_utils.h | 2 --
> drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 2 +-
> drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +-
> drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 +-
> 5 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> index cdb02991f249..cffae53414ba 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> @@ -154,7 +154,7 @@ static void aq_nic_service_timer_cb(unsigned long param)
>
> memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
> memset(&stats_tx, 0U, sizeof(struct aq_ring_stats_tx_s));
> - for (i = AQ_DIMOF(self->aq_vec); i--;) {
> + for (i = ARRAY_SIZE(self->aq_vec); i--;) {
> if (self->aq_vec[i])
> aq_vec_add_stats(self->aq_vec[i], &stats_rx, &stats_tx);
> }
> @@ -958,7 +958,7 @@ void aq_nic_free_hot_resources(struct aq_nic_s *self)
> if (!self)
> goto err_exit;
>
> - for (i = AQ_DIMOF(self->aq_vec); i--;) {
> + for (i = ARRAY_SIZE(self->aq_vec); i--;) {
> if (self->aq_vec[i])
> aq_vec_free(self->aq_vec[i]);
> }
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
> index f6012b34abe6..64a8c3c781ff 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
> @@ -14,8 +14,6 @@
>
> #include "aq_common.h"
>
> -#define AQ_DIMOF(_ARY_) ARRAY_SIZE(_ARY_)
> -
> struct aq_obj_s {
> spinlock_t lock; /* spinlock for nic/rings processing */
> atomic_t flags;
> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
> index 4ee15ff06a44..96c3360e7060 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
> @@ -182,7 +182,7 @@ static int hw_atl_a0_hw_rss_set(struct aq_hw_s *self,
> ((i * 3U) & 0xFU));
> }
>
> - for (i = AQ_DIMOF(bitary); i--;) {
> + for (i = ARRAY_SIZE(bitary); i--;) {
> rpf_rss_redir_tbl_wr_data_set(self, bitary[i]);
> rpf_rss_redir_tbl_addr_set(self, i);
> rpf_rss_redir_wr_en_set(self, 1U);
> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
> index 42150708191d..5a19eba31786 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
> @@ -182,7 +182,7 @@ static int hw_atl_b0_hw_rss_set(struct aq_hw_s *self,
> ((i * 3U) & 0xFU));
> }
>
> - for (i = AQ_DIMOF(bitary); i--;) {
> + for (i = ARRAY_SIZE(bitary); i--;) {
> rpf_rss_redir_tbl_wr_data_set(self, bitary[i]);
> rpf_rss_redir_tbl_addr_set(self, i);
> rpf_rss_redir_wr_en_set(self, 1U);
> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> index 8d6d8f5804da..922af5f36d37 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
> @@ -385,7 +385,7 @@ int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
> aq_hw_read_reg(self, 0x00000374U) +
> (40U * 4U),
> mac_addr,
> - AQ_DIMOF(mac_addr));
> + ARRAY_SIZE(mac_addr));
> if (err < 0) {
> mac_addr[0] = 0U;
> mac_addr[1] = 0U;
>
Thank you,
I will do it, little bit later.
Regards,
Pavel
^ permalink raw reply
* Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
From: Pavel Belous @ 2017-05-04 18:37 UTC (permalink / raw)
To: David Arcari, David Miller, LinoSanfilippo; +Cc: netdev
In-Reply-To: <0efef5aa-c73d-ff16-a2ec-e63ad298ffa2@redhat.com>
On 04.05.2017 21:27, David Arcari wrote:
> On 05/04/2017 01:09 PM, Pavel Belous wrote:
>>
>>
>> On 04.05.2017 19:51, David Miller wrote:
>>> From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
>>> Date: Thu, 4 May 2017 18:48:12 +0200
>>>
>>>> Hi Pavel,
>>>>
>>>> On 04.05.2017 18:33, Pavel Belous wrote:
>>>>> From: Pavel Belous <pavel.belous@aquantia.com>
>>>>>
>>>>> This patch fixes the crash that happens when driver tries to collect statistics
>>>>> from already released "aq_vec" object.
>>>>>
>>>>> Fixes: 97bde5c4f909 ("net: ethernet: aquantia: Support for NIC-specific code")
>>>>> Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
>>>>> ---
>>>>> drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++-
>>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>>> b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>>> index cdb0299..3a32573 100644
>>>>> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>>> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>>> @@ -755,7 +755,7 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)
>>>>> count = 0U;
>>>>>
>>>>> for (i = 0U, aq_vec = self->aq_vec[0];
>>>>> - self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) {
>>>>> + aq_vec && self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) {
>>>>> data += count;
>>>>> aq_vec_get_sw_stats(aq_vec, data, &count);
>>>>> }
>>>>> @@ -961,6 +961,7 @@ void aq_nic_free_hot_resources(struct aq_nic_s *self)
>>>>> for (i = AQ_DIMOF(self->aq_vec); i--;) {
>>>>> if (self->aq_vec[i])
>>>>> aq_vec_free(self->aq_vec[i]);
>>>>> + self->aq_vec[i] = NULL;
>>>>> }
>>>>>
>>>>> err_exit:;
>>>>>
>>>>
>>>> if the driver does not support statistics when the interface is down, would
>>>> not it be clearer
>>>> to check if netif_running() in get_stats() instead?
>>>
>>> Yes, much cleaner.
>>>
>>> Much better would be to have a cached software copy so that statistics
>>> can be reported regardless of whether the device is down or not.
>>>
>>
>> Thank you.
>> I will think about how to do it better.
>
> It appears that the adapter is still reporting the cumulative hardware stats
> even while its down. The user is just losing the per queue stats.
>
> Although the loss of the per queue stats is not ideal, this patch still fixes a
> crash.
>
> It might be worthwhile to refactor this patch as a short term solution and then
> subsequently produce a version that contains cached statistics. Assuming that
> is amenable to everyone of course.
>
> -DA
>
Yes, even adapter is in the down state user can still see statistics
from the HW.
For example (adapter is down):
$ ethtool -S enp2s0
NIC statistics:
InPackets: 3237727
InUCast: 3237214
InMCast: 391
InBCast: 122
InErrors: 0
OutPackets: 14157898
OutUCast: 14157089
OutMCast: 304
OutBCast: 505
InUCastOctects: 226714406
OutUCastOctects: 10463156
InMCastOctects: 58046
OutMCastOctects: 44817
InBCastOctects: 12857
OutBCastOctects: 41626
InOctects: 226785309
OutOctects: 10549599
InPacketsDma: 0
OutPacketsDma: 16
InOctetsDma: 0
OutOctetsDma: 2396
InDroppedDma: 0
Queue[0] InPackets: 0
Queue[0] OutPackets: 0
Queue[0] InJumboPackets: 0
Queue[0] InLroPackets: 0
Queue[0] InErrors: 0
Queue[1] InPackets: 0
Queue[1] OutPackets: 0
Queue[1] InJumboPackets: 0
Queue[1] InLroPackets: 0
Queue[1] InErrors: 0
Queue[2] InPackets: 0
Queue[2] OutPackets: 0
Queue[2] InJumboPackets: 0
Queue[2] InLroPackets: 0
Queue[2] InErrors: 0
Queue[3] InPackets: 0
Queue[3] OutPackets: 0
Queue[3] InJumboPackets: 0
Queue[3] InLroPackets: 0
Queue[3] InErrors: 0
Lino, David what do you think?
If you agree I can re-submit the patch (with fixed braces).
Regards,
Pavel
^ permalink raw reply
* Re: Why do we need MSG_SENDPAGE_NOTLAST?
From: Eric Dumazet @ 2017-05-04 18:32 UTC (permalink / raw)
To: Ilya Lesokhin; +Cc: netdev@vger.kernel.org, tls-fpga-sw-dev, Dave Watson
In-Reply-To: <VI1PR0502MB2957F149F915013F6813559FD4EA0@VI1PR0502MB2957.eurprd05.prod.outlook.com>
On Thu, 2017-05-04 at 17:03 +0000, Ilya Lesokhin wrote:
> I don't understand the need for MSG_SENDPAGE_NOTLAST and I'm hoping
> someone can enlighten me.
>
> According to commit 35f9c09 ('tcp: tcp_sendpages() should call
> tcp_push() once'):
> "We need to call tcp_flush() at the end of the last page processed in
> tcp_sendpages(), or else transmits can be deferred and future sends
> stall."
>
> I don't understand why we need to differentiate between the user
> setting MSG_MORE
> and splice indicating that more data is going to be sent.
> if the user passed MSG_MORE and didn't push any extra data, isn't it
> the users fault?
> Do we need it because poorly written applications were broken when
> MSG_MORE was added to tcp_sendpage? Or is there a deeper reason?
>
The answer lies to how splice() is working.
User can issue one splice without MSG_MORE semantic, right ?
Still, we want an implicit MORE behavior for all individual pages, but
the last one.
> The reason I'm asking is that we are working on a kernel TLS
> implementation
> and I would like to know if we can coalesce multiple tls_sendpage
> calls with MSG_MORE into a single
> tls record or whether we must push out the record as soon as
> MSG_SENDPAGE_NOTLAST is cleared?
Make sure you handle partial writes (you want to coalesce 10 pages, but
stack will only take 5 of them)
^ permalink raw reply
* Re: [RFC iproute2 0/8] RDMA tool
From: Bart Van Assche @ 2017-05-04 18:30 UTC (permalink / raw)
To: leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ram.amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org,
sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org,
ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
hch-jcswGhMUV9g@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
In-Reply-To: <20170504182542.GD22833-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
On Thu, 2017-05-04 at 21:25 +0300, Leon Romanovsky wrote:
> On Thu, May 04, 2017 at 06:10:54PM +0000, Bart Van Assche wrote:
> > On Thu, 2017-05-04 at 21:02 +0300, Leon Romanovsky wrote:
> > > Following our discussion both in mailing list [1] and at the LPC 2016 [2],
> > > we would like to propose this RDMA tool to be part of iproute2 package
> > > and finally improve this situation.
> >
> > Hello Leon,
> >
> > Although I really appreciate your work: can you clarify why you would like to
> > add *RDMA* functionality to an *IP routing* tool? I haven't found any motivation
> > for adding RDMA functionality to iproute2 in [1].
>
> We are planning to reuse the same infrastructure provided by iproute2,
> like netlink parsing, access to distributions, same CLI and same standards.
>
> Right now, RDMA is already tightened to netdev: iWARP, RoCE, IPoIB, HFI-VNIC.
> Many drivers (mlx, qed, i40, cxgb) are sharing code between net and
> RDMA.
>
> I do expect that iproute2 will be installed on every machine with any
> type of connection, including IB and OPA.
>
> So I think that it is enough to be part of that suite and don't invent
> our own for one specific tool.
Hello Leon,
Sorry but to me that sounds like a weak argument for including RDMA functionality
in iproute2. There is already a library for communication over netlink sockets,
namely libnl. Is there functionality that is in iproute2 but not in libnl and
that is needed for the new tool? If so, have you considered to create a new
library for that functionality?
Thanks,
Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: Re: [PATCH 2/4] dt-bindings: add binding for RTL8211E Ethernet PHY
From: Florian Fainelli @ 2017-05-04 18:29 UTC (permalink / raw)
To: Icenowy Zheng
Cc: Andrew Lunn, Rob Herring, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng
In-Reply-To: <D714E47B-D6B2-4C9F-B9D7-FB9D170E0ADF-h8G6r0blFSE@public.gmane.org>
On 05/04/2017 11:26 AM, Icenowy Zheng wrote:
>
>
> 于 2017年5月5日 GMT+08:00 上午2:21:29, Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写到:
>> On 05/04/2017 11:10 AM, icenowy-h8G6r0blFSE@public.gmane.org wrote:
>>> 在 2017-04-22 08:22,Florian Fainelli 写道:
>>>> On 04/21/2017 04:24 PM, Icenowy Zheng wrote:
>>>>> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>>>>
>>>>> Some RTL8211E Ethernet PHY have an issue that needs a workaround
>>>>> indicated with device tree.
>>>>>
>>>>> Add the binding for a property that indicates this workaround.
>>>>>
>>>>> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>>>> ---
>>>>> .../devicetree/bindings/net/realtek,rtl8211e.txt | 22
>>>>> ++++++++++++++++++++++
>>>>> 1 file changed, 22 insertions(+)
>>>>> create mode 100644
>>>>> Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>>>
>>>>> diff --git
>>>>> a/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>>> b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>>> new file mode 100644
>>>>> index 000000000000..c1913301bfe8
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>>> @@ -0,0 +1,22 @@
>>>>> +Realtek RTL8211E Ethernet PHY
>>>>> +
>>>>> +One batch of RTL8211E is slight broken, that needs some special
>> (and
>>>>> +full of magic numbers) tweaking in order to make GbE to operate
>>>>> properly.
>>>>> +The only well-known board that used the broken batch is Pine64+.
>>>>> +Configure it through an Ethernet OF device node.
>>>>> +
>>>>> +Optional properties:
>>>>> +
>>>>> +- realtek,disable-rx-delay:
>>>>> + If set, RX delay will be completely disabled (according to
>>>>> Realtek). This
>>>>> + will affect the performance on non-broken boards.
>>>>> + default: do not disable RX delay.
>>>>
>>>> Please don't introduce custom properties to do that, instead correct
>>>> specify the "phy-mode" such that it is e.g: "rgmii-txid" which
>> indicates
>>>> that there should be no RX internal delay, but a TX internal delay
>> added
>>>> by the PHY.
>>>
>>> Checked the document, the meaning of "rgmii-txid" is not correct
>> here.
>>>
>>> This doesn't effect the MAC, and the MAC should still add TX delay.
>>>
>>> The definition of "rgmii-txid" in
>>> Documentation/devicetree/binding/net/ethernet.txt is "RGMII with
>>> internal TX delay provided by the PHY, the MAC should not add an TX
>> delay
>>> in this case". However, this do not indicate that the MAC doesn't add
>> TX
>>> delay; in fact that just totally disabled the PHY to provide the RX
>> delay.
>>> MAC still should to add delay on both TX/RX, which is the semantic of
>>> standard "rgmii".
>>>
>>> So I cannot used "rgmii-txid" here, but should continue to use this
>>> custom property.
>>
>> This is absolutely not a correct understanding. The 'phy-mode' property
>> defines the contract between the MAC and PHY. It is defined from the
>> PHY's perspective of the delay, which means that the MAC has to either
>> also provide an adequate delay (RX or TX) or not (RX or TX). So if you
>> specified 'phy-mode' = "rgmii" this means that the MAC needs to adds
>> the
>> TX and RX delay, so implcitly this means that your MAC operates in
>
> The MAC doesn't lose its responsibility to tweak RX/TX delays with this property set.
No it does not but now there is no contract binding the MAC and the PHY
together was to what an appropriate delay configuration there should be.
This is why using phydev->interface (directly inherited from 'phy-mode')
is important because it binds the PHY and MAC on a contract.
>
> This situation is that, the PHY's RX delay tweaking function is broken. But it doesn't mean that the PHY can take over *all* responsibility to tweak TX, it still needs MAC to tweak TX.
Correct, so what part of my answer was not clear in that sense?
>
>> "rgmii-id", if the property was defined from the perspective of the
>> MAC,
>> which it is not.
>>
>> Both the Ethernet PHY driver and the MAC driver need to take care of
>> adjusting the delays based on the phydev->interface value.
>>
>> The property you are introducing here is absolutely not appropriate
>> because it is entirely redundant with what 'phy-mode' already defines,
>> except the latter also covers a lot more cases.
--
Florian
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
From: David Arcari @ 2017-05-04 18:27 UTC (permalink / raw)
To: Pavel Belous, David Miller, LinoSanfilippo; +Cc: netdev
In-Reply-To: <d20deac6-7010-c0e8-e4d8-7faa591e7306@aquantia.com>
On 05/04/2017 01:09 PM, Pavel Belous wrote:
>
>
> On 04.05.2017 19:51, David Miller wrote:
>> From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
>> Date: Thu, 4 May 2017 18:48:12 +0200
>>
>>> Hi Pavel,
>>>
>>> On 04.05.2017 18:33, Pavel Belous wrote:
>>>> From: Pavel Belous <pavel.belous@aquantia.com>
>>>>
>>>> This patch fixes the crash that happens when driver tries to collect statistics
>>>> from already released "aq_vec" object.
>>>>
>>>> Fixes: 97bde5c4f909 ("net: ethernet: aquantia: Support for NIC-specific code")
>>>> Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
>>>> ---
>>>> drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>> b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>> index cdb0299..3a32573 100644
>>>> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
>>>> @@ -755,7 +755,7 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)
>>>> count = 0U;
>>>>
>>>> for (i = 0U, aq_vec = self->aq_vec[0];
>>>> - self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) {
>>>> + aq_vec && self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) {
>>>> data += count;
>>>> aq_vec_get_sw_stats(aq_vec, data, &count);
>>>> }
>>>> @@ -961,6 +961,7 @@ void aq_nic_free_hot_resources(struct aq_nic_s *self)
>>>> for (i = AQ_DIMOF(self->aq_vec); i--;) {
>>>> if (self->aq_vec[i])
>>>> aq_vec_free(self->aq_vec[i]);
>>>> + self->aq_vec[i] = NULL;
>>>> }
>>>>
>>>> err_exit:;
>>>>
>>>
>>> if the driver does not support statistics when the interface is down, would
>>> not it be clearer
>>> to check if netif_running() in get_stats() instead?
>>
>> Yes, much cleaner.
>>
>> Much better would be to have a cached software copy so that statistics
>> can be reported regardless of whether the device is down or not.
>>
>
> Thank you.
> I will think about how to do it better.
It appears that the adapter is still reporting the cumulative hardware stats
even while its down. The user is just losing the per queue stats.
Although the loss of the per queue stats is not ideal, this patch still fixes a
crash.
It might be worthwhile to refactor this patch as a short term solution and then
subsequently produce a version that contains cached statistics. Assuming that
is amenable to everyone of course.
-DA
>
> Regards,
> Pavel
^ permalink raw reply
* Re: Re: [PATCH 2/4] dt-bindings: add binding for RTL8211E Ethernet PHY
From: Icenowy Zheng @ 2017-05-04 18:26 UTC (permalink / raw)
To: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, Florian Fainelli
Cc: Andrew Lunn, Rob Herring, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng
In-Reply-To: <a455c822-d5aa-3f66-03c5-4d1268f9104b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
于 2017年5月5日 GMT+08:00 上午2:21:29, Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写到:
>On 05/04/2017 11:10 AM, icenowy-h8G6r0blFSE@public.gmane.org wrote:
>> 在 2017-04-22 08:22,Florian Fainelli 写道:
>>> On 04/21/2017 04:24 PM, Icenowy Zheng wrote:
>>>> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>>>
>>>> Some RTL8211E Ethernet PHY have an issue that needs a workaround
>>>> indicated with device tree.
>>>>
>>>> Add the binding for a property that indicates this workaround.
>>>>
>>>> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>>> ---
>>>> .../devicetree/bindings/net/realtek,rtl8211e.txt | 22
>>>> ++++++++++++++++++++++
>>>> 1 file changed, 22 insertions(+)
>>>> create mode 100644
>>>> Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>>
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>> b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>> new file mode 100644
>>>> index 000000000000..c1913301bfe8
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>> @@ -0,0 +1,22 @@
>>>> +Realtek RTL8211E Ethernet PHY
>>>> +
>>>> +One batch of RTL8211E is slight broken, that needs some special
>(and
>>>> +full of magic numbers) tweaking in order to make GbE to operate
>>>> properly.
>>>> +The only well-known board that used the broken batch is Pine64+.
>>>> +Configure it through an Ethernet OF device node.
>>>> +
>>>> +Optional properties:
>>>> +
>>>> +- realtek,disable-rx-delay:
>>>> + If set, RX delay will be completely disabled (according to
>>>> Realtek). This
>>>> + will affect the performance on non-broken boards.
>>>> + default: do not disable RX delay.
>>>
>>> Please don't introduce custom properties to do that, instead correct
>>> specify the "phy-mode" such that it is e.g: "rgmii-txid" which
>indicates
>>> that there should be no RX internal delay, but a TX internal delay
>added
>>> by the PHY.
>>
>> Checked the document, the meaning of "rgmii-txid" is not correct
>here.
>>
>> This doesn't effect the MAC, and the MAC should still add TX delay.
>>
>> The definition of "rgmii-txid" in
>> Documentation/devicetree/binding/net/ethernet.txt is "RGMII with
>> internal TX delay provided by the PHY, the MAC should not add an TX
>delay
>> in this case". However, this do not indicate that the MAC doesn't add
>TX
>> delay; in fact that just totally disabled the PHY to provide the RX
>delay.
>> MAC still should to add delay on both TX/RX, which is the semantic of
>> standard "rgmii".
>>
>> So I cannot used "rgmii-txid" here, but should continue to use this
>> custom property.
>
>This is absolutely not a correct understanding. The 'phy-mode' property
>defines the contract between the MAC and PHY. It is defined from the
>PHY's perspective of the delay, which means that the MAC has to either
>also provide an adequate delay (RX or TX) or not (RX or TX). So if you
>specified 'phy-mode' = "rgmii" this means that the MAC needs to adds
>the
>TX and RX delay, so implcitly this means that your MAC operates in
The MAC doesn't lose its responsibility to tweak RX/TX delays with this property set.
This situation is that, the PHY's RX delay tweaking function is broken. But it doesn't mean that the PHY can take over *all* responsibility to tweak TX, it still needs MAC to tweak TX.
>"rgmii-id", if the property was defined from the perspective of the
>MAC,
>which it is not.
>
>Both the Ethernet PHY driver and the MAC driver need to take care of
>adjusting the delays based on the phydev->interface value.
>
>The property you are introducing here is absolutely not appropriate
>because it is entirely redundant with what 'phy-mode' already defines,
>except the latter also covers a lot more cases.
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* Re: [RFC iproute2 0/8] RDMA tool
From: Leon Romanovsky @ 2017-05-04 18:25 UTC (permalink / raw)
To: Bart Van Assche
Cc: stephen@networkplumber.org, dledford@redhat.com,
jiri@mellanox.com, linux-rdma@vger.kernel.org,
ram.amrani@cavium.com, sagi@grimberg.me, ogerlitz@mellanox.com,
dennis.dalessandro@intel.com, hch@lst.de, netdev@vger.kernel.org,
jgunthorpe@obsidianresearch.com, ariela@mellanox.com
In-Reply-To: <1493921453.2692.6.camel@sandisk.com>
[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]
On Thu, May 04, 2017 at 06:10:54PM +0000, Bart Van Assche wrote:
> On Thu, 2017-05-04 at 21:02 +0300, Leon Romanovsky wrote:
> > Following our discussion both in mailing list [1] and at the LPC 2016 [2],
> > we would like to propose this RDMA tool to be part of iproute2 package
> > and finally improve this situation.
>
> Hello Leon,
>
> Although I really appreciate your work: can you clarify why you would like to
> add *RDMA* functionality to an *IP routing* tool? I haven't found any motivation
> for adding RDMA functionality to iproute2 in [1].
We are planning to reuse the same infrastructure provided by iproute2,
like netlink parsing, access to distributions, same CLI and same standards.
Right now, RDMA is already tightened to netdev: iWARP, RoCE, IPoIB, HFI-VNIC.
Many drivers (mlx, qed, i40, cxgb) are sharing code between net and
RDMA.
I do expect that iproute2 will be installed on every machine with any
type of connection, including IB and OPA.
So I think that it is enough to be part of that suite and don't invent
our own for one specific tool.
Thanks
>
> Thanks,
>
> Bart.--
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 2/4] dt-bindings: add binding for RTL8211E Ethernet PHY
From: Florian Fainelli @ 2017-05-04 18:21 UTC (permalink / raw)
To: icenowy-h8G6r0blFSE
Cc: Andrew Lunn, Rob Herring, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng
In-Reply-To: <edf26d7de605a93bfce258de0353df6d-h8G6r0blFSE@public.gmane.org>
On 05/04/2017 11:10 AM, icenowy-h8G6r0blFSE@public.gmane.org wrote:
> 在 2017-04-22 08:22,Florian Fainelli 写道:
>> On 04/21/2017 04:24 PM, Icenowy Zheng wrote:
>>> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>>
>>> Some RTL8211E Ethernet PHY have an issue that needs a workaround
>>> indicated with device tree.
>>>
>>> Add the binding for a property that indicates this workaround.
>>>
>>> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>> ---
>>> .../devicetree/bindings/net/realtek,rtl8211e.txt | 22
>>> ++++++++++++++++++++++
>>> 1 file changed, 22 insertions(+)
>>> create mode 100644
>>> Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>> b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>> new file mode 100644
>>> index 000000000000..c1913301bfe8
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>> @@ -0,0 +1,22 @@
>>> +Realtek RTL8211E Ethernet PHY
>>> +
>>> +One batch of RTL8211E is slight broken, that needs some special (and
>>> +full of magic numbers) tweaking in order to make GbE to operate
>>> properly.
>>> +The only well-known board that used the broken batch is Pine64+.
>>> +Configure it through an Ethernet OF device node.
>>> +
>>> +Optional properties:
>>> +
>>> +- realtek,disable-rx-delay:
>>> + If set, RX delay will be completely disabled (according to
>>> Realtek). This
>>> + will affect the performance on non-broken boards.
>>> + default: do not disable RX delay.
>>
>> Please don't introduce custom properties to do that, instead correct
>> specify the "phy-mode" such that it is e.g: "rgmii-txid" which indicates
>> that there should be no RX internal delay, but a TX internal delay added
>> by the PHY.
>
> Checked the document, the meaning of "rgmii-txid" is not correct here.
>
> This doesn't effect the MAC, and the MAC should still add TX delay.
>
> The definition of "rgmii-txid" in
> Documentation/devicetree/binding/net/ethernet.txt is "RGMII with
> internal TX delay provided by the PHY, the MAC should not add an TX delay
> in this case". However, this do not indicate that the MAC doesn't add TX
> delay; in fact that just totally disabled the PHY to provide the RX delay.
> MAC still should to add delay on both TX/RX, which is the semantic of
> standard "rgmii".
>
> So I cannot used "rgmii-txid" here, but should continue to use this
> custom property.
This is absolutely not a correct understanding. The 'phy-mode' property
defines the contract between the MAC and PHY. It is defined from the
PHY's perspective of the delay, which means that the MAC has to either
also provide an adequate delay (RX or TX) or not (RX or TX). So if you
specified 'phy-mode' = "rgmii" this means that the MAC needs to adds the
TX and RX delay, so implcitly this means that your MAC operates in
"rgmii-id", if the property was defined from the perspective of the MAC,
which it is not.
Both the Ethernet PHY driver and the MAC driver need to take care of
adjusting the delays based on the phydev->interface value.
The property you are introducing here is absolutely not appropriate
because it is entirely redundant with what 'phy-mode' already defines,
except the latter also covers a lot more cases.
--
Florian
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
From: Joe Perches @ 2017-05-04 18:17 UTC (permalink / raw)
To: Pavel Belous, David Arcari, David S . Miller; +Cc: netdev
In-Reply-To: <800da97f-7a4b-6f61-f4ff-51d4ef50e05f@aquantia.com>
On Thu, 2017-05-04 at 20:08 +0300, Pavel Belous wrote:
> I will prepare another patch with Lino and David M. comments.
I'm not submitting this because it'd just cause merge conflicts,
but
something you could do one day is remove the AQ_DIMOF macro
and just use ARRAY_SIZE directly.
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ++--
drivers/net/ethernet/aquantia/atlantic/aq_utils.h | 2 --
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 2 +-
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +-
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 +-
5 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index cdb02991f249..cffae53414ba 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -154,7 +154,7 @@ static void aq_nic_service_timer_cb(unsigned long param)
memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
memset(&stats_tx, 0U, sizeof(struct aq_ring_stats_tx_s));
- for (i = AQ_DIMOF(self->aq_vec); i--;) {
+ for (i = ARRAY_SIZE(self->aq_vec); i--;) {
if (self->aq_vec[i])
aq_vec_add_stats(self->aq_vec[i], &stats_rx, &stats_tx);
}
@@ -958,7 +958,7 @@ void aq_nic_free_hot_resources(struct aq_nic_s *self)
if (!self)
goto err_exit;
- for (i = AQ_DIMOF(self->aq_vec); i--;) {
+ for (i = ARRAY_SIZE(self->aq_vec); i--;) {
if (self->aq_vec[i])
aq_vec_free(self->aq_vec[i]);
}
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
index f6012b34abe6..64a8c3c781ff 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
@@ -14,8 +14,6 @@
#include "aq_common.h"
-#define AQ_DIMOF(_ARY_) ARRAY_SIZE(_ARY_)
-
struct aq_obj_s {
spinlock_t lock; /* spinlock for nic/rings processing */
atomic_t flags;
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 4ee15ff06a44..96c3360e7060 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -182,7 +182,7 @@ static int hw_atl_a0_hw_rss_set(struct aq_hw_s *self,
((i * 3U) & 0xFU));
}
- for (i = AQ_DIMOF(bitary); i--;) {
+ for (i = ARRAY_SIZE(bitary); i--;) {
rpf_rss_redir_tbl_wr_data_set(self, bitary[i]);
rpf_rss_redir_tbl_addr_set(self, i);
rpf_rss_redir_wr_en_set(self, 1U);
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 42150708191d..5a19eba31786 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -182,7 +182,7 @@ static int hw_atl_b0_hw_rss_set(struct aq_hw_s *self,
((i * 3U) & 0xFU));
}
- for (i = AQ_DIMOF(bitary); i--;) {
+ for (i = ARRAY_SIZE(bitary); i--;) {
rpf_rss_redir_tbl_wr_data_set(self, bitary[i]);
rpf_rss_redir_tbl_addr_set(self, i);
rpf_rss_redir_wr_en_set(self, 1U);
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 8d6d8f5804da..922af5f36d37 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -385,7 +385,7 @@ int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
aq_hw_read_reg(self, 0x00000374U) +
(40U * 4U),
mac_addr,
- AQ_DIMOF(mac_addr));
+ ARRAY_SIZE(mac_addr));
if (err < 0) {
mac_addr[0] = 0U;
mac_addr[1] = 0U;
^ permalink raw reply related
* Re: [RFC iproute2 0/8] RDMA tool
From: Bart Van Assche @ 2017-05-04 18:10 UTC (permalink / raw)
To: stephen@networkplumber.org, leon@kernel.org, dledford@redhat.com
Cc: leonro@mellanox.com, jiri@mellanox.com,
linux-rdma@vger.kernel.org, ram.amrani@cavium.com,
sagi@grimberg.me, ogerlitz@mellanox.com,
dennis.dalessandro@intel.com, hch@lst.de, netdev@vger.kernel.org,
jgunthorpe@obsidianresearch.com, ariela@mellanox.com
In-Reply-To: <20170504180216.7665-1-leon@kernel.org>
On Thu, 2017-05-04 at 21:02 +0300, Leon Romanovsky wrote:
> Following our discussion both in mailing list [1] and at the LPC 2016 [2],
> we would like to propose this RDMA tool to be part of iproute2 package
> and finally improve this situation.
Hello Leon,
Although I really appreciate your work: can you clarify why you would like to
add *RDMA* functionality to an *IP routing* tool? I haven't found any motivation
for adding RDMA functionality to iproute2 in [1].
Thanks,
Bart.
^ permalink raw reply
* Re: [PATCH 2/4] dt-bindings: add binding for RTL8211E Ethernet PHY
From: icenowy-h8G6r0blFSE @ 2017-05-04 18:10 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Rob Herring, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng
In-Reply-To: <c7aa9d7a-5e97-0e7f-2b1c-584a4de00837-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
在 2017-04-22 08:22,Florian Fainelli 写道:
> On 04/21/2017 04:24 PM, Icenowy Zheng wrote:
>> From: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>>
>> Some RTL8211E Ethernet PHY have an issue that needs a workaround
>> indicated with device tree.
>>
>> Add the binding for a property that indicates this workaround.
>>
>> Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org>
>> ---
>> .../devicetree/bindings/net/realtek,rtl8211e.txt | 22
>> ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>> create mode 100644
>> Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>>
>> diff --git
>> a/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>> b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>> new file mode 100644
>> index 000000000000..c1913301bfe8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/realtek,rtl8211e.txt
>> @@ -0,0 +1,22 @@
>> +Realtek RTL8211E Ethernet PHY
>> +
>> +One batch of RTL8211E is slight broken, that needs some special (and
>> +full of magic numbers) tweaking in order to make GbE to operate
>> properly.
>> +The only well-known board that used the broken batch is Pine64+.
>> +Configure it through an Ethernet OF device node.
>> +
>> +Optional properties:
>> +
>> +- realtek,disable-rx-delay:
>> + If set, RX delay will be completely disabled (according to
>> Realtek). This
>> + will affect the performance on non-broken boards.
>> + default: do not disable RX delay.
>
> Please don't introduce custom properties to do that, instead correct
> specify the "phy-mode" such that it is e.g: "rgmii-txid" which
> indicates
> that there should be no RX internal delay, but a TX internal delay
> added
> by the PHY.
Checked the document, the meaning of "rgmii-txid" is not correct here.
This doesn't effect the MAC, and the MAC should still add TX delay.
The definition of "rgmii-txid" in
Documentation/devicetree/binding/net/ethernet.txt is "RGMII with
internal TX delay provided by the PHY, the MAC should not add an TX
delay
in this case". However, this do not indicate that the MAC doesn't add TX
delay; in fact that just totally disabled the PHY to provide the RX
delay.
MAC still should to add delay on both TX/RX, which is the semantic of
standard "rgmii".
So I cannot used "rgmii-txid" here, but should continue to use this
custom property.
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply
* [RFC iproute2 6/8] rdma: add stubs for future objects
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
The following objects (monitor, providers, stats and protocols) are not
implemented yet, however it is worth to place their stubs in the code.
This will serve as an initial starting point for other developers to
extend RDMA tool.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/Makefile | 2 +-
rdma/monitor.c | 22 ++++++++++++++++++++++
rdma/protocols.c | 22 ++++++++++++++++++++++
rdma/providers.c | 28 ++++++++++++++++++++++++++++
rdma/rdma.c | 6 +++++-
rdma/rdma.h | 4 ++++
rdma/stats.c | 22 ++++++++++++++++++++++
7 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 rdma/monitor.c
create mode 100644 rdma/protocols.c
create mode 100644 rdma/providers.c
create mode 100644 rdma/stats.c
diff --git a/rdma/Makefile b/rdma/Makefile
index 5cf0d29f..eb71da68 100644
--- a/rdma/Makefile
+++ b/rdma/Makefile
@@ -1,6 +1,6 @@
include ../Config
-RDMA_OBJ = rdma.o utils.o dev.o link.o ipoib.o memory.o
+RDMA_OBJ = rdma.o utils.o dev.o link.o ipoib.o memory.o stats.o protocols.o providers.o monitor.o
TARGETS=rdma
all: $(TARGETS) $(LIBS)
diff --git a/rdma/monitor.c b/rdma/monitor.c
new file mode 100644
index 00000000..99d4b042
--- /dev/null
+++ b/rdma/monitor.c
@@ -0,0 +1,22 @@
+/*
+ * monitor.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+int obj_monitor(struct rdma *rd)
+{
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return 0;
+}
diff --git a/rdma/protocols.c b/rdma/protocols.c
new file mode 100644
index 00000000..26de7d2b
--- /dev/null
+++ b/rdma/protocols.c
@@ -0,0 +1,22 @@
+/*
+ * protocols.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+int obj_protocols(struct rdma *rd)
+{
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return 0;
+}
diff --git a/rdma/providers.c b/rdma/providers.c
new file mode 100644
index 00000000..8d516cca
--- /dev/null
+++ b/rdma/providers.c
@@ -0,0 +1,28 @@
+/*
+ * providers.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+static void providers_help(char *filename)
+{
+ pr_out("Usage: %s providers show [ DEV ]\n", filename);
+}
+
+int obj_providers(struct rdma *rd)
+{
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ providers_help(rd->filename);
+ return 0;
+}
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 094d490d..a0a3ec81 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -17,7 +17,7 @@
static void help(char *name)
{
pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
- "where OBJECT := { dev | link | ipoib | memory }\n"
+ "where OBJECT := { dev | link | ipoib | memory | stats | protocols | providers | monitor }\n"
" OPTIONS := { -V[ersion] }\n", name);
}
@@ -35,6 +35,10 @@ static int rd_cmd(struct rdma *rd)
{ "link", obj_link },
{ "ipoib", obj_ipoib },
{ "memory", obj_memory },
+ { "stats", obj_stats },
+ { "providers", obj_providers },
+ { "protocols", obj_protocols },
+ { "monitor", obj_monitor },
{ "help", obj_help },
{ 0 }
};
diff --git a/rdma/rdma.h b/rdma/rdma.h
index dcff066f..11d940d7 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -66,6 +66,10 @@ int obj_dev(struct rdma *rd);
int obj_link(struct rdma *rd);
int obj_ipoib(struct rdma *rd);
int obj_memory(struct rdma *rd);
+int obj_protocols(struct rdma *rd);
+int obj_stats(struct rdma *rd);
+int obj_providers(struct rdma *rd);
+int obj_monitor(struct rdma *rd);
/*
* Parser interface
diff --git a/rdma/stats.c b/rdma/stats.c
new file mode 100644
index 00000000..a557e59b
--- /dev/null
+++ b/rdma/stats.c
@@ -0,0 +1,22 @@
+/*
+ * stats.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+int obj_stats(struct rdma *rd)
+{
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return 0;
+}
^ permalink raw reply related
* [RFC iproute2 5/8] rdma: Add memory object
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Memory object gives to the user ability to manipulate over general
properties of memory for the specific devices. The memory properties
have broader usage than dev object can provide.
For example, on-demand-paging (ODP) configurations are mostly software related.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/Makefile | 2 +-
rdma/memory.c | 30 ++++++++++++++++++++++++++++++
rdma/rdma.c | 3 ++-
rdma/rdma.h | 1 +
4 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 rdma/memory.c
diff --git a/rdma/Makefile b/rdma/Makefile
index dd702b9f..5cf0d29f 100644
--- a/rdma/Makefile
+++ b/rdma/Makefile
@@ -1,6 +1,6 @@
include ../Config
-RDMA_OBJ = rdma.o utils.o dev.o link.o ipoib.o
+RDMA_OBJ = rdma.o utils.o dev.o link.o ipoib.o memory.o
TARGETS=rdma
all: $(TARGETS) $(LIBS)
diff --git a/rdma/memory.c b/rdma/memory.c
new file mode 100644
index 00000000..68fd5dd3
--- /dev/null
+++ b/rdma/memory.c
@@ -0,0 +1,30 @@
+/*
+ * memory.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+static void memory_help(char *filename)
+{
+ pr_out("Usage: %s memory show [ DEV ]\n", filename);
+ pr_out(" %s memory set DEV { odp { off | on } |\n", filename);
+ pr_out(" %s memic SIZE }\n", filename);
+}
+
+int obj_memory(struct rdma *rd)
+{
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ memory_help(rd->filename);
+ return 0;
+}
diff --git a/rdma/rdma.c b/rdma/rdma.c
index ffd70899..094d490d 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -17,7 +17,7 @@
static void help(char *name)
{
pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
- "where OBJECT := { dev | link | ipoib }\n"
+ "where OBJECT := { dev | link | ipoib | memory }\n"
" OPTIONS := { -V[ersion] }\n", name);
}
@@ -34,6 +34,7 @@ static int rd_cmd(struct rdma *rd)
{ "dev", obj_dev },
{ "link", obj_link },
{ "ipoib", obj_ipoib },
+ { "memory", obj_memory },
{ "help", obj_help },
{ 0 }
};
diff --git a/rdma/rdma.h b/rdma/rdma.h
index 1fef4eb8..dcff066f 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -65,6 +65,7 @@ struct rdma_obj {
int obj_dev(struct rdma *rd);
int obj_link(struct rdma *rd);
int obj_ipoib(struct rdma *rd);
+int obj_memory(struct rdma *rd);
/*
* Parser interface
^ permalink raw reply related
* [RFC iproute2 2/8] rdma: Add dev object
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Device (dev) object represents struct ib_device to user space.
The supported commands are show, set and help.
Print all devices:
# rdma dev
1: mlx5_0: board_id MT_2190110032 fw_pages 261002 fw_ver 12.17.2046 hca_type MT4115 hw_rev 0
node_desc hpchead HCA-1 node_guid e41d:2d03:0066:dee6 node_type 1: CA reg_pages 0
sys_image_guid e41d:2d03:0066:dee6
2: mlx5_1: board_id MT_2190110032 fw_pages 250793 fw_ver 12.17.2046 hca_type MT4115 hw_rev 0
node_desc hpchead HCA-2 node_guid e41d:2d03:0066:dee7 node_type 1: CA reg_pages 0
sys_image_guid e41d:2d03:0066:dee6
3: mlx5_2: board_id MT_1210110019 fw_pages 68067 fw_ver 10.16.1020 hca_type MT4113 hw_rev 0
node_desc hpchead HCA-3 node_guid 0002:c903:0016:75b0 node_type 1: CA reg_pages 0
sys_image_guid 0002:c903:0016:75b0
Print specific device:
# rdma dev show mlx5_1
2: mlx5_1: board_id MT_2190110032 fw_pages 250793 fw_ver 12.17.2046 hca_type MT4115 hw_rev 0
node_desc hpchead HCA-2 node_guid e41d:2d03:0066:dee7 node_type 1: CA reg_pages 0
sys_image_guid e41d:2d03:0066:dee6
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/Makefile | 2 +-
rdma/dev.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rdma/rdma.c | 3 +-
rdma/rdma.h | 5 +++
4 files changed, 109 insertions(+), 2 deletions(-)
create mode 100644 rdma/dev.c
diff --git a/rdma/Makefile b/rdma/Makefile
index 65248b31..67e349b0 100644
--- a/rdma/Makefile
+++ b/rdma/Makefile
@@ -1,6 +1,6 @@
include ../Config
-RDMA_OBJ = rdma.o utils.o
+RDMA_OBJ = rdma.o utils.o dev.o
TARGETS=rdma
all: $(TARGETS) $(LIBS)
diff --git a/rdma/dev.c b/rdma/dev.c
new file mode 100644
index 00000000..e6d71035
--- /dev/null
+++ b/rdma/dev.c
@@ -0,0 +1,101 @@
+/*
+ * dev.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+static int dev_help(struct rdma *rd)
+{
+ pr_out("Usage: %s dev show [DEV]\n", rd->filename);
+ pr_out(" %s dev set DEV [ node_desc { DESCRIPTION } ]\n", rd->filename);
+ /* Add masking of device capabilities */
+ return 0;
+}
+
+static void dev_one_show(const struct dev_map *dev_map)
+{
+ char *nodes[] = { "board_id",
+ "fw_pages",
+ "fw_ver",
+ "hca_type",
+ "hw_rev",
+ "node_desc",
+ "node_guid",
+ "node_type",
+ "reg_pages",
+ "sys_image_guid",
+ /* hfi1 specific */
+ "nctxts",
+ "nfreectxts",
+ "serial",
+ "boardversion",
+ "tempsense",
+ NULL };
+
+ char data[4096];
+ int i;
+ pr_out("%u: %s:", dev_map->idx, dev_map->dev_name);
+ for (i = 0 ; nodes[i] ; i++) {
+ if (rdma_sysfs_read_ib(dev_map->dev_name, 0, nodes[i], data))
+ continue;
+
+ /* Split line before "node_desc" */
+ if (!strcmp(nodes[i], "node_desc") ||
+ !strcmp(nodes[i], "sys_image_guid"))
+ printf("\n\t");
+
+ pr_out(" %s %s", nodes[i], data);
+ }
+ pr_out("\n");
+}
+
+static int dev_show(struct rdma *rd)
+{
+ struct dev_map *dev_map;
+
+ if (rd_no_arg(rd)) {
+ list_for_each_entry(dev_map, &rd->dev_map_list, list)
+ dev_one_show(dev_map);
+ }
+ else {
+ dev_map = dev_map_lookup(rd, false);
+ if (!dev_map) {
+ pr_err("Wrong device name\n");
+ return -ENOENT;
+ }
+ dev_one_show(dev_map);
+ }
+ return 0;
+}
+
+static int dev_set(struct rdma *rd)
+{
+ /* Not implemented yet */
+ return 0;
+}
+
+int obj_dev(struct rdma *rd)
+{
+ const struct rdma_obj objs[] = {
+ { NULL, dev_show },
+ { "show", dev_show },
+ { "list", dev_show },
+ { "set", dev_set },
+ { "help", dev_help },
+ { 0 }
+ };
+
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return rdma_exec_cmd(rd, objs, "dev command");
+}
diff --git a/rdma/rdma.c b/rdma/rdma.c
index bc7d1483..7c537c5e 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -17,7 +17,7 @@
static void help(char *name)
{
pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
- "where OBJECT := { }\n"
+ "where OBJECT := { dev }\n"
" OPTIONS := { -V[ersion] }\n", name);
}
@@ -31,6 +31,7 @@ static int rd_cmd(struct rdma *rd)
{
const struct rdma_obj objs[] = {
{ NULL, obj_help },
+ { "dev", obj_dev },
{ "help", obj_help },
{ 0 }
};
diff --git a/rdma/rdma.h b/rdma/rdma.h
index 156bb74c..2d81cd92 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -60,6 +60,11 @@ struct rdma_obj {
};
/*
+ * Command interfaces
+ */
+int obj_dev(struct rdma *rd);
+
+/*
* Parser interface
*/
bool rd_no_arg(struct rdma *rd);
^ permalink raw reply related
* [RFC iproute2 3/8] rdma: Add link object
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Link object represents port of struct ib_device.
Supported commands are show, set and help.
Print all links for all devices:
# rdma link
1/1: mlx5_0/1: ifname ib0 cap_mask 0x2651e848 lid 0x13 lid_mask_count 0 link_layer InfiniBand
phys_state 5: LinkUp rate 100 Gb/sec (4X EDR) sm_lid 0x2 sm_sl 0 state 4: ACTIVE
2/1: mlx5_1/1: ifname ib1 cap_mask 0x2651e848 lid 0xffff lid_mask_count 0 link_layer InfiniBand
phys_state 3: Disabled rate 10 Gb/sec (4X) sm_lid 0x0 sm_sl 0 state 1: DOWN
3/1: mlx5_2/1: ifname ib2 cap_mask 0x26516848 lid 0x1a lid_mask_count 0 link_layer InfiniBand
phys_state 5: LinkUp rate 56 Gb/sec (4X FDR) sm_lid 0x2 sm_sl 0 state 4: ACTIVE
3/2: mlx5_2/2: ifname ib3 cap_mask 0x26516848 lid 0xffff lid_mask_count 0 link_layer InfiniBand
phys_state 3: Disabled rate 10 Gb/sec (4X) sm_lid 0x0 sm_sl 0 state 1: DOWN
Print all links for specific device:
# rdma link show mlx5_2
3/1: mlx5_2/1: ifname ib2 cap_mask 0x26516848 lid 0x1a lid_mask_count 0 link_layer InfiniBand
phys_state 5: LinkUp rate 56 Gb/sec (4X FDR) sm_lid 0x2 sm_sl 0 state 4: ACTIVE
3/2: mlx5_2/2: ifname ib3 cap_mask 0x26516848 lid 0xffff lid_mask_count 0 link_layer InfiniBand
phys_state 3: Disabled rate 10 Gb/sec (4X) sm_lid 0x0 sm_sl 0 state 1: DOWN
Print specific link:
# rdma link show mlx5_2/2
3/2: mlx5_2/2: ifname ib3 cap_mask 0x26516848 lid 0xffff lid_mask_count 0 link_layer InfiniBand
phys_state 3: Disabled rate 10 Gb/sec (4X) sm_lid 0x0 sm_sl 0 state 1: DOWN
Set parameter;
# rdma link set mlx5_2/2 type auto lb_unicast off
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
rdma/Makefile | 2 +-
rdma/link.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rdma/rdma.c | 3 +-
rdma/rdma.h | 1 +
4 files changed, 116 insertions(+), 2 deletions(-)
create mode 100644 rdma/link.c
diff --git a/rdma/Makefile b/rdma/Makefile
index 67e349b0..cf54ed36 100644
--- a/rdma/Makefile
+++ b/rdma/Makefile
@@ -1,6 +1,6 @@
include ../Config
-RDMA_OBJ = rdma.o utils.o dev.o
+RDMA_OBJ = rdma.o utils.o dev.o link.o
TARGETS=rdma
all: $(TARGETS) $(LIBS)
diff --git a/rdma/link.c b/rdma/link.c
new file mode 100644
index 00000000..e86ff399
--- /dev/null
+++ b/rdma/link.c
@@ -0,0 +1,112 @@
+/*
+ * link.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro@mellanox.com>
+ */
+
+#include "rdma.h"
+
+static int link_help(struct rdma *rd)
+{
+ pr_out("Usage: %s link show [ DEV | DEV/PORT ]\n", rd->filename);
+ pr_out(" %s link set DEV/PORT { type { eth | ib | auto } |\n", rd->filename);
+ pr_out(" lb_unicast { on | off } |\n");
+ pr_out(" lb_multicast { on | off } }\n");
+ return 0;
+}
+
+static void dev_one_show(const struct dev_map *dev_map, uint32_t port_idx_first, uint32_t port_idx_last)
+{
+ char *nodes[] = { "cap_mask",
+ "lid",
+ "lid_mask_count",
+ "link_layer",
+ "phys_state",
+ "rate",
+ "sm_lid",
+ "sm_sl",
+ "state",
+ NULL };
+
+ struct port_map *port_map;
+ char data[4096];
+ int i, j;
+
+ for(j = port_idx_first ; j <= port_idx_last; j++) {
+ pr_out("%u/%u: %s/%u:", dev_map->idx, j, dev_map->dev_name, j);
+ list_for_each_entry(port_map, &dev_map->port_map_list, list)
+ if (j == port_map->idx)
+ printf(" ifname %s", (port_map->ifname)?:"NONE");
+
+ for (i = 0 ; nodes[i] ; i++) {
+ if (rdma_sysfs_read_ib(dev_map->dev_name, j, nodes[i], data))
+ continue;
+
+ /* Split line before "phys_state" */
+ if (!strcmp(nodes[i], "phys_state"))
+ printf("\n\t");
+
+ pr_out(" %s %s", nodes[i], data);
+ }
+ pr_out("\n");
+ }
+}
+
+static int link_show(struct rdma *rd)
+{
+ struct dev_map *dev_map;
+
+ if (rd_no_arg(rd)) {
+ list_for_each_entry(dev_map, &rd->dev_map_list, list)
+ dev_one_show(dev_map, 1, dev_map->num_ports);
+ }
+ else {
+ uint32_t port_idx;
+ uint32_t num_ports;
+ dev_map = dev_map_lookup(rd, true);
+ port_idx = get_port_from_argv(rd);
+ if (!dev_map || port_idx > dev_map->num_ports) {
+ pr_err("Wrong device name\n");
+ return -EINVAL;
+ }
+ if (port_idx)
+ num_ports = port_idx;
+ else {
+ port_idx = 1;
+ num_ports = dev_map->num_ports;
+ }
+
+ dev_one_show(dev_map, port_idx, num_ports);
+ }
+ return 0;
+}
+
+static int link_set(struct rdma *rd)
+{
+ /* Not supported yet */
+ return 0;
+}
+
+int obj_link(struct rdma *rd)
+{
+ const struct rdma_obj objs[] = {
+ { NULL, link_show },
+ { "show", link_show },
+ { "list", link_show },
+ { "set", link_set },
+ { "help", link_help },
+ { 0 }
+ };
+
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return rdma_exec_cmd(rd, objs, "link command");
+}
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 7c537c5e..55cbf0e3 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -17,7 +17,7 @@
static void help(char *name)
{
pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
- "where OBJECT := { dev }\n"
+ "where OBJECT := { dev | link }\n"
" OPTIONS := { -V[ersion] }\n", name);
}
@@ -32,6 +32,7 @@ static int rd_cmd(struct rdma *rd)
const struct rdma_obj objs[] = {
{ NULL, obj_help },
{ "dev", obj_dev },
+ { "link", obj_link },
{ "help", obj_help },
{ 0 }
};
diff --git a/rdma/rdma.h b/rdma/rdma.h
index 2d81cd92..bdb77b5e 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -63,6 +63,7 @@ struct rdma_obj {
* Command interfaces
*/
int obj_dev(struct rdma *rd);
+int obj_link(struct rdma *rd);
/*
* Parser interface
^ permalink raw reply related
* [RFC iproute2 8/8] rdma: Add link capability parsing
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Add parsing interface for the cap_mask
$./rdma/rdma link show mlx5_2/2 cap_mask
3/2: mlx5_2/2: sm off notice off trap on opt_ipd off auto_migr off sl_map on mkey_nvram off
pkey_nvram off led_info off sm_disabled off sys_image_guid on pkey_sw_ext_port_trap off
extended_speeds on cm on snmp_tunnel off reinit off device_mgmt off vendor_class on dr_notice off
cap_mask_notice on boot_mgmt off link_latency off client_reg on ip_based_gids on
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
rdma/link.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
rdma/rdma.h | 4 ++++
rdma/utils.c | 4 ++--
3 files changed, 67 insertions(+), 15 deletions(-)
diff --git a/rdma/link.c b/rdma/link.c
index e86ff399..e9880914 100644
--- a/rdma/link.c
+++ b/rdma/link.c
@@ -14,13 +14,48 @@
static int link_help(struct rdma *rd)
{
pr_out("Usage: %s link show [ DEV | DEV/PORT ]\n", rd->filename);
+ pr_out(" %s link show [ DEV | DEV/PORT ] cap_mask\n", rd->filename);
pr_out(" %s link set DEV/PORT { type { eth | ib | auto } |\n", rd->filename);
pr_out(" lb_unicast { on | off } |\n");
pr_out(" lb_multicast { on | off } }\n");
return 0;
}
-static void dev_one_show(const struct dev_map *dev_map, uint32_t port_idx_first, uint32_t port_idx_last)
+static void print_cap_mask(uint32_t cap_mask)
+{
+#define PRINT_PORT_CAP(name, val, offset) (printf(" %s %s", name, (((val) >> (offset))&0x1)?"on":"off"))
+
+ /* Naive copy/paste from include/rdma/ib_verbs.h */
+ PRINT_PORT_CAP("sm", cap_mask, 1);
+ PRINT_PORT_CAP("notice", cap_mask, 2);
+ PRINT_PORT_CAP("trap", cap_mask, 3);
+ PRINT_PORT_CAP("opt_ipd", cap_mask, 4);
+ PRINT_PORT_CAP("auto_migr", cap_mask, 5);
+ PRINT_PORT_CAP("sl_map", cap_mask, 6);
+ PRINT_PORT_CAP("mkey_nvram", cap_mask, 7);
+ printf("\n\t");
+ PRINT_PORT_CAP("pkey_nvram", cap_mask, 8);
+ PRINT_PORT_CAP("led_info", cap_mask, 9);
+ PRINT_PORT_CAP("sm_disabled", cap_mask, 10);
+ PRINT_PORT_CAP("sys_image_guid", cap_mask, 11);
+ PRINT_PORT_CAP("pkey_sw_ext_port_trap", cap_mask, 12);
+ printf("\n\t");
+ PRINT_PORT_CAP("extended_speeds", cap_mask, 14);
+ PRINT_PORT_CAP("cm", cap_mask, 16);
+ PRINT_PORT_CAP("snmp_tunnel", cap_mask, 17);
+ PRINT_PORT_CAP("reinit", cap_mask, 18);
+ PRINT_PORT_CAP("device_mgmt", cap_mask, 19);
+ PRINT_PORT_CAP("vendor_class", cap_mask, 20);
+ PRINT_PORT_CAP("dr_notice", cap_mask, 21);
+ printf("\n\t");
+ PRINT_PORT_CAP("cap_mask_notice", cap_mask, 22);
+ PRINT_PORT_CAP("boot_mgmt", cap_mask, 23);
+ PRINT_PORT_CAP("link_latency", cap_mask, 24);
+ PRINT_PORT_CAP("client_reg", cap_mask, 25);
+ PRINT_PORT_CAP("ip_based_gids", cap_mask, 26);
+}
+static void dev_one_show(struct rdma *rd, const struct dev_map *dev_map,
+ uint32_t port_idx_first, uint32_t port_idx_last)
{
char *nodes[] = { "cap_mask",
"lid",
@@ -35,23 +70,36 @@ static void dev_one_show(const struct dev_map *dev_map, uint32_t port_idx_first,
struct port_map *port_map;
char data[4096];
+ uint32_t cap_mask;
+ bool cap_mask_r = false;
int i, j;
+ rd_arg_inc(rd);
+ if (rd_argv_match(rd, "cap_mask"))
+ cap_mask_r = true;
+
for(j = port_idx_first ; j <= port_idx_last; j++) {
pr_out("%u/%u: %s/%u:", dev_map->idx, j, dev_map->dev_name, j);
- list_for_each_entry(port_map, &dev_map->port_map_list, list)
- if (j == port_map->idx)
- printf(" ifname %s", (port_map->ifname)?:"NONE");
+ if (cap_mask_r) {
+ rdma_sysfs_read_ib(dev_map->dev_name, 1, nodes[0], data);
+ cap_mask = strtoul(data, NULL, 16);
+ print_cap_mask(cap_mask);
+ }
+ else {
+ list_for_each_entry(port_map, &dev_map->port_map_list, list)
+ if (j == port_map->idx)
+ printf(" ifname %s", (port_map->ifname)?:"NONE");
- for (i = 0 ; nodes[i] ; i++) {
- if (rdma_sysfs_read_ib(dev_map->dev_name, j, nodes[i], data))
- continue;
+ for (i = 0 ; nodes[i] ; i++) {
+ if (rdma_sysfs_read_ib(dev_map->dev_name, j, nodes[i], data))
+ continue;
- /* Split line before "phys_state" */
- if (!strcmp(nodes[i], "phys_state"))
- printf("\n\t");
+ /* Split line before "phys_state" */
+ if (!strcmp(nodes[i], "phys_state"))
+ printf("\n\t");
- pr_out(" %s %s", nodes[i], data);
+ pr_out(" %s %s", nodes[i], data);
+ }
}
pr_out("\n");
}
@@ -63,7 +111,7 @@ static int link_show(struct rdma *rd)
if (rd_no_arg(rd)) {
list_for_each_entry(dev_map, &rd->dev_map_list, list)
- dev_one_show(dev_map, 1, dev_map->num_ports);
+ dev_one_show(rd, dev_map, 1, dev_map->num_ports);
}
else {
uint32_t port_idx;
@@ -81,7 +129,7 @@ static int link_show(struct rdma *rd)
num_ports = dev_map->num_ports;
}
- dev_one_show(dev_map, port_idx, num_ports);
+ dev_one_show(rd, dev_map, port_idx, num_ports);
}
return 0;
}
diff --git a/rdma/rdma.h b/rdma/rdma.h
index 11d940d7..12c87048 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -76,6 +76,10 @@ int obj_monitor(struct rdma *rd);
*/
bool rd_no_arg(struct rdma *rd);
uint32_t get_port_from_argv(struct rdma *rd);
+bool rd_no_arg(struct rdma *rd);
+bool rd_argv_match(struct rdma *rd, const char *pattern);
+void rd_arg_inc(struct rdma *rd);
+uint32_t get_port_from_argv(struct rdma *rd);
int rdma_exec_cmd(struct rdma *rd, const struct rdma_obj *o, const char *str);
int rdma_sysfs_read_ib(const char *name, int port, const char *field, char *res);
diff --git a/rdma/utils.c b/rdma/utils.c
index 568d7c0a..fd5fe77f 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -40,14 +40,14 @@ static int strcmpx(const char *str1, const char *str2)
return strncmp(str1, str2, strlen(str1));
}
-static bool rd_argv_match(struct rdma *rd, const char *pattern)
+bool rd_argv_match(struct rdma *rd, const char *pattern)
{
if (!rd_argc(rd))
return false;
return strcmpx(rd_argv(rd), pattern) == 0;
}
-static void rd_arg_inc(struct rdma *rd)
+void rd_arg_inc(struct rdma *rd)
{
if (!rd_argc(rd))
return;
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC iproute2 V1 7/8] man: rdma.8: Document objects and commands
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
man/man8/Makefile | 3 +-
man/man8/rdma.8 | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 111 insertions(+), 1 deletion(-)
create mode 100644 man/man8/rdma.8
diff --git a/man/man8/Makefile b/man/man8/Makefile
index f3318644..81979a07 100644
--- a/man/man8/Makefile
+++ b/man/man8/Makefile
@@ -19,7 +19,8 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 rtpr.8 ss.
tc-simple.8 tc-skbedit.8 tc-vlan.8 tc-xt.8 tc-skbmod.8 tc-ife.8 \
tc-tunnel_key.8 tc-sample.8 \
devlink.8 devlink-dev.8 devlink-monitor.8 devlink-port.8 devlink-sb.8 \
- ifstat.8
+ ifstat.8 \
+ rdma.8
all: $(TARGETS)
diff --git a/man/man8/rdma.8 b/man/man8/rdma.8
new file mode 100644
index 00000000..410b3d7d
--- /dev/null
+++ b/man/man8/rdma.8
@@ -0,0 +1,109 @@
+.TH RDMA 8 "28 Mar 2017" "iproute2" "Linux"
+.SH NAME
+rdma \- RDMA tool
+.SH SYNOPSIS
+.sp
+.ad l
+.in +8
+.ti -8
+.B rdma
+.RI "[ " OPTIONS " ] " OBJECT " { " COMMAND " | "
+.BR help " }"
+.sp
+
+.ti -8
+.IR OBJECT " := { "
+.BR dev " | " link " | " protocol " | " stats " | " monitor " | " memory " | " ipoib " | " provider "}"
+.sp
+
+.ti -8
+.IR OPTIONS " := { "
+\fB\-V\fR[\fIersion\fR] }
+
+.SH OPTIONS
+
+.TP
+.BR "\-V" , " -Version"
+Print the version of the
+.B rdma
+tool and exit.
+
+.SS
+.I OBJECT
+
+.TP
+.B dev
+- RDMA device.
+
+.TP
+.B link
+- RDMA port related.
+
+.TP
+.B protocol
+- RDMA protocol.
+
+.TP
+.B monitor
+- watch for netlink messages.
+
+.TP
+.B memory
+- configure memory related operations.
+
+.TP
+.B ipoib
+- configure IPoIB.
+
+.TP
+.B provider
+- provider specific configurations.
+
+.PP
+The names of all objects may be written in full or
+abbreviated form, for example
+.B stats
+can be abbreviated as
+.B stat
+or just
+.B s.
+
+.SS
+.I COMMAND
+
+Specifies the action to perform on the object.
+The set of possible actions depends on the object type.
+As a rule, it is possible to
+.B show
+(or
+.B list
+) objects, but some objects do not allow all of these operations
+or have some additional commands. The
+.B help
+command is available for all objects. It prints
+out a list of available commands and argument syntax conventions.
+.sp
+If no command is given, some default command is assumed.
+Usually it is
+.B list
+or, if the objects of this class cannot be listed,
+.BR "help" .
+
+.SH EXIT STATUS
+Exit status is 0 if command was successful or a positive integer upon failure.
+
+.SH SEE ALSO
+.BR rdma-link (8),
+.BR rdma-protocol (8),
+.BR rdma-monitor (8),
+.BR rdma-stats (8),
+.br
+
+.SH REPORTING BUGS
+Report any bugs to the Linux RDMA mailing list
+.B <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
+where the development and maintenance is primarily done.
+You do not have to be subscribed to the list to send a message there.
+
+.SH AUTHOR
+Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC iproute2 4/8] rdma: Add IPoIB object
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
IPoIB object allows configuration and presentation of information for
IP-over-Infiniband user level protocol.
Supported commands are show, set and help.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
rdma/Makefile | 2 +-
rdma/ipoib.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
rdma/rdma.c | 3 ++-
rdma/rdma.h | 1 +
4 files changed, 58 insertions(+), 2 deletions(-)
create mode 100644 rdma/ipoib.c
diff --git a/rdma/Makefile b/rdma/Makefile
index cf54ed36..dd702b9f 100644
--- a/rdma/Makefile
+++ b/rdma/Makefile
@@ -1,6 +1,6 @@
include ../Config
-RDMA_OBJ = rdma.o utils.o dev.o link.o
+RDMA_OBJ = rdma.o utils.o dev.o link.o ipoib.o
TARGETS=rdma
all: $(TARGETS) $(LIBS)
diff --git a/rdma/ipoib.c b/rdma/ipoib.c
new file mode 100644
index 00000000..dd0d0285
--- /dev/null
+++ b/rdma/ipoib.c
@@ -0,0 +1,54 @@
+/*
+ * ipoib.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
+ */
+
+#include "rdma.h"
+
+static int ipoib_help(struct rdma *rd)
+{
+ pr_out("Usage: %s ipoib show NAME | DEV | DEV/PORT\n", rd->filename);
+ pr_out(" %s ipoib set NAME [ accel { off | on } ]\n", rd->filename);
+ pr_out(" %s ipoib start NAME dev DEV\n", rd->filename);
+ pr_out(" %s ipoib stop NAME\n", rd->filename);
+ return 0;
+}
+
+static int ipoib_show(struct rdma *rd)
+{
+ if (rd_no_arg(rd))
+ ipoib_help(rd);
+
+ return 0;
+}
+
+static int ipoib_set(struct rdma *rd)
+{
+ /* Not supported yet */
+ return 0;
+}
+
+int obj_ipoib(struct rdma *rd)
+{
+ const struct rdma_obj objs[] = {
+ { NULL, ipoib_show },
+ { "show", ipoib_show },
+ { "list", ipoib_show },
+ { "set", ipoib_set },
+ { "help", ipoib_help },
+ { 0 }
+ };
+
+ if (dev_map_init(rd)) {
+ pr_err("There are no RDMA devices\n");
+ return -ENOENT;
+ }
+
+ return rdma_exec_cmd(rd, objs, "Uknown ipoib command");
+}
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 55cbf0e3..ffd70899 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -17,7 +17,7 @@
static void help(char *name)
{
pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
- "where OBJECT := { dev | link }\n"
+ "where OBJECT := { dev | link | ipoib }\n"
" OPTIONS := { -V[ersion] }\n", name);
}
@@ -33,6 +33,7 @@ static int rd_cmd(struct rdma *rd)
{ NULL, obj_help },
{ "dev", obj_dev },
{ "link", obj_link },
+ { "ipoib", obj_ipoib },
{ "help", obj_help },
{ 0 }
};
diff --git a/rdma/rdma.h b/rdma/rdma.h
index bdb77b5e..1fef4eb8 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -64,6 +64,7 @@ struct rdma_obj {
*/
int obj_dev(struct rdma *rd);
int obj_link(struct rdma *rd);
+int obj_ipoib(struct rdma *rd);
/*
* Parser interface
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC iproute2 1/8] rdma: Add basic infrastructure for RDMA tool
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
In-Reply-To: <20170504180216.7665-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
RDMA devices are cross-functional devices from one side,
but very tailored for the specific markets from another.
Such diversity caused to spread of RDMA related configuration
across various tools, e.g. devlink, ip, ethtool, ib specific and
vendor specific solutions.
This patch adds ability to fill device and port information
by reading sysfs entries (legacy).
All future configuration settings will be implemented in netlink format,
to be aligned with iproute2 package.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Makefile | 2 +-
rdma/.gitignore | 1 +
rdma/Makefile | 15 +++
rdma/rdma.c | 96 +++++++++++++++++
rdma/rdma.h | 77 ++++++++++++++
rdma/utils.c | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 503 insertions(+), 1 deletion(-)
create mode 100644 rdma/.gitignore
create mode 100644 rdma/Makefile
create mode 100644 rdma/rdma.c
create mode 100644 rdma/rdma.h
create mode 100644 rdma/utils.c
diff --git a/Makefile b/Makefile
index 18de7dcb..c255063b 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS)
YACCFLAGS = -d -t -v
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink man
+SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
LDLIBS += $(LIBNETLINK)
diff --git a/rdma/.gitignore b/rdma/.gitignore
new file mode 100644
index 00000000..51fb172b
--- /dev/null
+++ b/rdma/.gitignore
@@ -0,0 +1 @@
+rdma
diff --git a/rdma/Makefile b/rdma/Makefile
new file mode 100644
index 00000000..65248b31
--- /dev/null
+++ b/rdma/Makefile
@@ -0,0 +1,15 @@
+include ../Config
+
+RDMA_OBJ = rdma.o utils.o
+TARGETS=rdma
+
+all: $(TARGETS) $(LIBS)
+
+rdma: $(RDMA_OBJ)
+ $(QUIET_LINK)$(CC) $^ -o $@
+
+install: all
+ install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)
+
+clean:
+ rm -f $(RDMA_OBJ) $(TARGETS)
diff --git a/rdma/rdma.c b/rdma/rdma.c
new file mode 100644
index 00000000..bc7d1483
--- /dev/null
+++ b/rdma/rdma.c
@@ -0,0 +1,96 @@
+/*
+ * rdma.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
+ */
+
+#include <limits.h>
+
+#include "rdma.h"
+#include "SNAPSHOT.h"
+
+static void help(char *name)
+{
+ pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
+ "where OBJECT := { }\n"
+ " OPTIONS := { -V[ersion] }\n", name);
+}
+
+static int obj_help(struct rdma *rd)
+{
+ help(rd->filename);
+ return 0;
+}
+
+static int rd_cmd(struct rdma *rd)
+{
+ const struct rdma_obj objs[] = {
+ { NULL, obj_help },
+ { "help", obj_help },
+ { 0 }
+ };
+
+ return rdma_exec_cmd(rd, objs, "object");
+}
+
+static int rd_init(struct rdma *rd, int argc, char **argv, char *filename)
+{
+ rd->filename = filename;
+ rd->argc = argc;
+ rd->argv = argv;
+ INIT_LIST_HEAD(&rd->dev_map_list);
+ return 0;
+}
+static void rd_free(struct rdma *rd)
+{
+ dev_map_cleanup(rd);
+}
+int main(int argc, char **argv)
+{
+ char *filename;
+ static const struct option long_options[] = {
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
+ };
+ struct rdma rd;
+ int opt;
+ int err;
+
+ filename = basename(argv[0]);
+
+ while ((opt = getopt_long(argc, argv, "Vh",
+ long_options, NULL)) >= 0) {
+
+ switch (opt) {
+ case 'V':
+ printf("%s utility, iproute2-ss%s\n", filename, SNAPSHOT);
+ return EXIT_SUCCESS;
+ case 'h':
+ help(filename);
+ return EXIT_SUCCESS;
+ default:
+ pr_err("Unknown option.\n");
+ help(filename);
+ return EXIT_FAILURE;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ err = rd_init(&rd, argc, argv, filename);
+ if (err)
+ goto out;
+
+ err = rd_cmd(&rd);
+ /* Always cleanup */
+ rd_free(&rd);
+
+out: return (err) ? EXIT_FAILURE:EXIT_SUCCESS;
+}
diff --git a/rdma/rdma.h b/rdma/rdma.h
new file mode 100644
index 00000000..156bb74c
--- /dev/null
+++ b/rdma/rdma.h
@@ -0,0 +1,77 @@
+/*
+ * rdma.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
+ */
+#ifndef _RDMA_TOOL_H_
+#define _RDMA_TOOL_H_
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+#include <stdbool.h>
+
+#include "list.h"
+
+#define pr_err(args...) fprintf(stderr, ##args)
+#define pr_out(args...) fprintf(stdout, ##args)
+
+enum rt_protocols {
+ RT_PROTOCOL_IB,
+ RT_PROTOCOL_IWARP,
+ RT_PROTOCOL_ROCE_V1,
+ RT_PROTOCOL_ROCE_V2,
+ RT_PROTOCOL_OPA,
+ RT_NO_PROTOCOL
+};
+
+struct port_map {
+ struct list_head list;
+ char *ifname;
+ uint32_t idx;
+};
+
+struct dev_map {
+ struct list_head list;
+ char *dev_name;
+ uint32_t num_ports;
+ struct list_head port_map_list;
+ uint32_t idx;
+};
+
+struct rdma {
+ int argc;
+ char **argv;
+ char *filename;
+ struct list_head dev_map_list;
+};
+
+struct rdma_obj {
+ const char *cmd;
+ int (*func)(struct rdma *rd);
+};
+
+/*
+ * Parser interface
+ */
+bool rd_no_arg(struct rdma *rd);
+uint32_t get_port_from_argv(struct rdma *rd);
+
+int rdma_exec_cmd(struct rdma *rd, const struct rdma_obj *o, const char *str);
+int rdma_sysfs_read_ib(const char *name, int port, const char *field, char *res);
+
+/*
+ * Device manipulation
+ */
+int dev_map_init(struct rdma *rd);
+void dev_map_cleanup(struct rdma *rd);
+struct dev_map *dev_map_lookup(struct rdma *rd, bool allow_port_index);
+#endif /* _RDMA_TOOL_H_ */
diff --git a/rdma/utils.c b/rdma/utils.c
new file mode 100644
index 00000000..568d7c0a
--- /dev/null
+++ b/rdma/utils.c
@@ -0,0 +1,313 @@
+/*
+ * utils.c RDMA tool
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
+ */
+
+#include <sys/types.h>
+#include <dirent.h>
+
+#include "rdma.h"
+
+/*
+ * This macro will be moved to generic layer,
+ * after code will be accepted.
+ * it is placed here to avoid rebases with upstream code.
+ */
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
+static int rd_argc(struct rdma *rd)
+{
+ return rd->argc;
+}
+
+static char *rd_argv(struct rdma *rd)
+{
+ if (!rd_argc(rd))
+ return NULL;
+ return *rd->argv;
+}
+
+static int strcmpx(const char *str1, const char *str2)
+{
+ if (strlen(str1) > strlen(str2))
+ return -1;
+ return strncmp(str1, str2, strlen(str1));
+}
+
+static bool rd_argv_match(struct rdma *rd, const char *pattern)
+{
+ if (!rd_argc(rd))
+ return false;
+ return strcmpx(rd_argv(rd), pattern) == 0;
+}
+
+static void rd_arg_inc(struct rdma *rd)
+{
+ if (!rd_argc(rd))
+ return;
+ rd->argc--;
+ rd->argv++;
+}
+
+bool rd_no_arg(struct rdma *rd)
+{
+ return rd_argc(rd) == 0;
+}
+
+#define SYSFS_INFINIBAND "/sys/class/infiniband"
+#define SYSFS_NET "/sys/class/net"
+static int sysfs_read(const char *prefix, const char *name, int port, const char *field, char *res)
+{
+ char fpath[64];
+ FILE *fentry;
+ int result;
+
+ if (port == 0)
+ snprintf(fpath, 64, "%s/%s/%s", prefix, name, field);
+ else
+ snprintf(fpath, 64, "%s/%s/ports/%d/%s", prefix, name, port, field);
+
+ fentry = fopen(fpath, "r");
+ if (!fentry)
+ return -ENOENT;
+
+ result = fread(res, 1, 4096, fentry);
+ /* Remove last "\n" */
+ res[result-1] = '\0';
+ fclose(fentry);
+ return 0;
+}
+
+int rdma_sysfs_read_ib(const char *name, int port, const char *field, char *res)
+{
+ return sysfs_read(SYSFS_INFINIBAND, name, port, field, res);
+}
+
+static int sysfs_read_net(const char *name, const char *field, char *res)
+{
+ return sysfs_read(SYSFS_NET, name, 0, field, res);
+}
+
+static struct dev_map *dev_map_alloc(char *dev_name)
+{
+ struct dev_map *dev_map;
+
+ dev_map = calloc(1, sizeof(*dev_map));
+ if (!dev_map)
+ return NULL;
+ dev_map->dev_name = strdup(dev_name);
+ INIT_LIST_HEAD(&dev_map->port_map_list);
+
+ return dev_map;
+}
+
+static void port_map_free(struct port_map *port_map)
+{
+ free(port_map->ifname);
+ free(port_map);
+}
+
+static void dev_map_free(struct dev_map *dev_map)
+{
+ struct port_map *port_map, *tmp;
+
+ list_for_each_entry_safe(port_map, tmp,
+ &dev_map->port_map_list, list) {
+ list_del(&port_map->list);
+ port_map_free(port_map);
+ }
+
+ free(dev_map->dev_name);
+ free(dev_map);
+}
+
+void dev_map_cleanup(struct rdma *rd)
+{
+ struct dev_map *dev_map, *tmp;
+
+ list_for_each_entry_safe(dev_map, tmp,
+ &rd->dev_map_list, list) {
+ list_del(&dev_map->list);
+ dev_map_free(dev_map);
+ }
+}
+
+uint32_t get_port_from_argv(struct rdma *rd)
+{
+ char *slash;
+
+ slash = strchr(rd_argv(rd), '/');
+ /* if no port found, return 0 */
+ return (slash) ? (atoi(slash + 1)):0;
+}
+
+struct dev_map *dev_map_lookup(struct rdma *rd, bool allow_port_index)
+{
+ struct dev_map *dev_map;
+ char *dev_name;
+ char *slash;
+
+ dev_name = strdup(rd_argv(rd));
+ if (allow_port_index) {
+ slash = strrchr(dev_name, '/');
+ if (slash)
+ *slash = '\0';
+ }
+
+ list_for_each_entry(dev_map, &rd->dev_map_list, list)
+ if (strcmp(dev_name, dev_map->dev_name) == 0) {
+ free(dev_name);
+ return dev_map;
+ }
+
+ free(dev_name);
+ return NULL;
+}
+
+static bool is_dots(char *name)
+{
+ if (!strcmp(name, ".") || !strcmp(name, ".."))
+ return true;
+ return false;
+}
+
+static char *find_ifname(struct dev_map *dev_map, uint32_t port)
+{
+ struct dirent *dentry, *drentry;
+ char data[4096];
+ char drpath[64];
+ uint32_t net_port;
+ DIR *dir, *drdir;
+ char *ifname = NULL;
+
+ dir = opendir(SYSFS_NET);
+ if (!dir)
+ return NULL;
+
+ while ((dentry = readdir(dir))) {
+ if (is_dots(dentry->d_name))
+ continue;
+
+ if (sysfs_read_net(dentry->d_name, "dev_id", data))
+ continue;
+
+ /* handle up to 9 ports, due to insufficient handling of hex */
+ net_port = strtoul(data, NULL, 16);
+
+ snprintf(drpath, 64, "%s/%s/device/infiniband/", SYSFS_NET, dentry->d_name);
+
+ drdir = opendir(drpath);
+ if (!drdir)
+ continue;
+
+ while ((drentry = readdir(drdir))) {
+ if (is_dots(drentry->d_name))
+ continue;
+ if (!strcmp(drentry->d_name, dev_map->dev_name) &&
+ net_port == port - 1) {
+ ifname = strdup(dentry->d_name);
+ closedir(drdir);
+ return ifname;
+ }
+ }
+
+ closedir(drdir);
+
+ }
+
+ closedir(dir);
+ return NULL;
+}
+
+static struct port_map *port_map_alloc(struct dev_map *dev_map, uint32_t port)
+{
+ struct port_map *port_map;
+
+ port_map = calloc(1, sizeof(*port_map));
+ if (!port_map)
+ return NULL;
+
+ port_map->idx = port;
+ /*
+ * Expensive operation in sysfs world, need to rescan all net devices.
+ * Hopefuly, it is one time operation.
+ * In netlink, it will be simpler
+ */
+ port_map->ifname = find_ifname(dev_map, port);
+ return port_map;
+}
+
+int dev_map_init(struct rdma *rd)
+{
+ struct dev_map *dev_map;
+ struct port_map *port_map;
+ struct dirent *dentry, *pentry;
+ uint32_t i = 1;
+ uint32_t num_ports = 0;
+ char ports_name[64];
+ DIR *dir, *pdir;
+ dir = opendir(SYSFS_INFINIBAND);
+ if (!dir)
+ return -ENOENT;
+
+ while ((dentry = readdir(dir))) {
+ num_ports = 0;
+ if (is_dots(dentry->d_name))
+ continue;
+
+ dev_map = dev_map_alloc(dentry->d_name);
+ if (!dev_map)
+ /* The main function will cleanup the allocations */
+ return -ENOMEM;
+ list_add_tail(&dev_map->list, &rd->dev_map_list);
+ dev_map->idx = i;
+ i++;
+
+ snprintf(ports_name, 64, "%s/%s/ports/", SYSFS_INFINIBAND, dentry->d_name);
+ pdir = opendir(ports_name);
+ while ((pentry = readdir(pdir))) {
+ int port;
+ if (is_dots(pentry->d_name))
+ continue;
+
+ port = atoi(pentry->d_name);
+ port_map = port_map_alloc(dev_map, port);
+ if (!port_map)
+ return -ENOENT;
+ list_add_tail(&port_map->list, &dev_map->port_map_list);
+ num_ports = MAX(num_ports, port);
+ }
+ closedir(pdir);
+ dev_map->num_ports = num_ports;
+ }
+ closedir(dir);
+
+ /* num_ports == 0 => no devices in infiniband folder */
+ return (num_ports) ? 0:(-ENOENT);
+}
+
+int rdma_exec_cmd(struct rdma *rd, const struct rdma_obj *objs, const char *str)
+{
+ const struct rdma_obj *o;
+
+ /* First argument in objs table is default variant */
+ if (rd_no_arg(rd))
+ return objs->func(rd);
+
+ for (o = objs + 1; o->cmd; ++o) {
+ if (rd_argv_match(rd, o->cmd)) {
+ /* Move to next argument */
+ rd_arg_inc(rd);
+ return o->func(rd);
+ }
+ }
+
+ pr_err("Unknown %s '%s'.\n", str, rd_argv(rd));
+ return 0;
+}
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC iproute2 0/8] RDMA tool
From: Leon Romanovsky @ 2017-05-04 18:02 UTC (permalink / raw)
To: Stephen Hemminger, Doug Ledford
Cc: Leon Romanovsky, Jiri Pirko, Ariel Almog, Dennis Dalessandro,
Ram Amrani, Bart Van Assche, Sagi Grimberg, Jason Gunthorpe,
Christoph Hellwig, Or Gerlitz, Linux RDMA, Linux Netdev
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
----
This is initial phase to understand if user experience for this tool fits
RDMA and netdev communities exepectations. Also I would like to get feedback
if it is really worth to provide legacy sysfs for old kernels, or maybe I should
implement netlink from the beginning and abandon sysfs completely.
-----
Hi,
Please find below, the patch set with initial implementation of configuration
tool for RDMA subsystem, which will be supplementary tool to already existed
tools in netdev community (ip, devlink, ethtool, ..).
In opposite to netdev community, where standard tools exist to configure and
present different devices abilities, RDMA subsystem historically lacked it.
Following our discussion both in mailing list [1] and at the LPC 2016 [2],
we would like to propose this RDMA tool to be part of iproute2 package
and finally improve this situation.
The development of tool was influenced by ip and devlink tools. This implies
to the object->command interface and naming convention.
In order to close object model, ensure reuse of existing code and make this
tool usable from day one, we decided to implement wrappers over legacy sysfs
prior to implementing netlink functionality. As a nice bonus, it will allow
to use this tool with old kernels too.
It is important to mention that any future extension will be required to be
done with netlink, so for already existing objects small conversion to netlink
will be unavoidable.
# rdma -h
Usage: rdma [ OPTIONS ] OBJECT { COMMAND | help }
where OBJECT := { dev | link | ipoib | memory | stats | protocols | providers | monitor }
OPTIONS := { -V[ersion] }
* DEV object equals to CA in IBTA specification and will provide
a way to configure/present settings relevant to specific struct ib_device.
* LINK object represents port in IBTA specification and will give access to
struct ib_port_immutable. From the day one, It prints netdev name of
the corresponding IB port that makes ibdev2netdev script redundant.
* IPoIB object is supposed to be specific for IP-over-Infiniband upper
layer protocol [3]. This ULP was mainly configured by combination
of various sysfs knobs together with ethtool. Such situation adds
challenges to add new and expose old configuration settings due to
the mix between different subsystems.
* MEMORY object will be used to configure memory related settings,
e.g. on-demand-paging (ODP), force-mr (force usage of MRs for
RDMA READ/WRITE operation).
* STATS object is needed for everything related to statistics
(per-PID, per-QP, per-device etc.). Despite the fact that RDMA
devices provide extensive set of counters, the decision was to
implement it in netlink directly, because there is a need to add
filter mechanism to them, which doesn't exist now.
* PROTOCOLS object is going to be used for device special treatment
of global to protocol settings (e.g. set device in RoCEv2 mode as
a default, instead of RoCEv1, instead of configfs).
* PROVIDERS objects gives ability to get specific to the device
information, like supported kABI objects [4].
* MONITOR object is needed to debug netlink communication and will
follow standard functionality, which exists in ip and devlink tools.
There are number of ULPs which are not covered by this tool yet:
* HFI-VNIC - I have no access to the HW and believe that Intel
will add native object support for it.
* Other storage related ULPs (iSER and SRP) were not introduced too,
because they have special tools (scci-target-utils) to configure them.
However it will be pretty straightforward to introduce new object,
if there is demand for it.
At the initial stage, we implemented infrastructure to read legacy
sysfs entries (Patch #1), initial man pages (Patch #7) and provided
future object examples (Patch #2-6) to allow parallel development.
Following patches will focus on cleaning user interface, parsing other
relevant entries in similar fashion to the link capability mask (Patch #8)
and providing netlink interface.
These patches were tested with two following setups:
* Setup A:
- Two Mellanox ConnectX-4 devices (one port)
- One Mellanox Connect-IB device (two ports)
* Setup B:
- One Mellanox ConnectX-4 device (one port)
- One Mellanox ConnectX-3 Pro device (two ports)
Please consider the inclusion of the RDMA tool into iproute2 package,
so other participants will be able to speed up development.
[1] https://www.mail-archive.com/netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg148523.html
[2] http://www.medkio.com/talks/lpc_debug.pdf
[3] https://tools.ietf.org/html/rfc4392
[4] http://marc.info/?l=linux-rdma&m=149261526916544&w=2
TODO: Add json output
Cc: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Ariel Almog <ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Ram Amrani <ram.amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Cc: Bart Van Assche <Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
Cc: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Linux Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Leon Romanovsky (8):
rdma: Add basic infrastructure for RDMA tool
rdma: Add dev object
rdma: Add link object
rdma: Add IPoIB object
rdma: Add memory object
rdma: add stubs for future objects
man: rdma.8: Document objects and commands
rdma: Add link capability parsing
Makefile | 2 +-
man/man8/Makefile | 3 +-
man/man8/rdma.8 | 109 +++++++++++++++++++
rdma/.gitignore | 1 +
rdma/Makefile | 15 +++
rdma/dev.c | 101 ++++++++++++++++++
rdma/ipoib.c | 54 ++++++++++
rdma/link.c | 160 ++++++++++++++++++++++++++++
rdma/memory.c | 30 ++++++
rdma/monitor.c | 22 ++++
rdma/protocols.c | 22 ++++
rdma/providers.c | 28 +++++
rdma/rdma.c | 104 ++++++++++++++++++
rdma/rdma.h | 93 ++++++++++++++++
rdma/stats.c | 22 ++++
rdma/utils.c | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
16 files changed, 1077 insertions(+), 2 deletions(-)
create mode 100644 man/man8/rdma.8
create mode 100644 rdma/.gitignore
create mode 100644 rdma/Makefile
create mode 100644 rdma/dev.c
create mode 100644 rdma/ipoib.c
create mode 100644 rdma/link.c
create mode 100644 rdma/memory.c
create mode 100644 rdma/monitor.c
create mode 100644 rdma/protocols.c
create mode 100644 rdma/providers.c
create mode 100644 rdma/rdma.c
create mode 100644 rdma/rdma.h
create mode 100644 rdma/stats.c
create mode 100644 rdma/utils.c
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [RFC] iproute: Add support for extended ack to rtnl_talk
From: Leon Romanovsky @ 2017-05-04 17:55 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Daniel Borkmann, netdev
In-Reply-To: <20170504094558.78933e60@xeon-e3>
[-- Attachment #1: Type: text/plain, Size: 2617 bytes --]
On Thu, May 04, 2017 at 09:45:58AM -0700, Stephen Hemminger wrote:
> On Thu, 4 May 2017 17:37:38 +0300
> Leon Romanovsky <leon@kernel.org> wrote:
>
> > On Thu, May 04, 2017 at 11:36:36AM +0200, Daniel Borkmann wrote:
> > > On 05/04/2017 01:56 AM, Stephen Hemminger wrote:
> > > > Add support for extended ack error reporting via libmnl. This
> > > > is a better alternative to use existing library and not copy/paste
> > > > code from the kernel. Also make arguments const where possible.
> > > >
> > > > Add a new function rtnl_talk_extack that takes a callback as an input
> > > > arg. If a netlink response contains extack attributes, the callback is
> > > > is invoked with the the err string, offset in the message and a pointer
> > > > to the message returned by the kernel.
> > > >
> > > > Adding a new function allows commands to be moved over to the
> > > > extended error reporting over time.
> > > >
> > > > For feedback, compile tested only.
> > >
> > > Just out of curiosity, what is the plan regarding converting iproute2
> > > over to libmnl (ip, tc, ss, ...)? In 2015, tipc tool was the first
> > > user merged that requires libmnl, the only other user today in the
> > > tree is devlink, which even seems to define its own libmnl library
> > > helpers. What is the clear benefit/rationale of outsourcing this to
> > > libmnl? I always was the impression we should strive for as little
> > > dependencies as possible?
> >
> > And I would like to get direction for the RDMA tool [1] which I'm
> > working on it now.
> >
> > The overall decision was to use netlink and put it under iproute2
> > umbrella. Currently, I have working RFC which is based on
> > legacy sysfs interface to ensure that we are converging on
> > user-experience even before moving to actual netlink defines.
> >
> > An I would like to continue to work on netlink interface, but which lib interface
> > should I need to base rdmatool's netlink code?
> >
> > [1] https://www.mail-archive.com/netdev@vger.kernel.org/msg148523.html
> >
> > >
> > > I don't really like that we make extended ack reporting now dependent
> > > on libmnl, which further diverts from iproute's native nl library vs
> > > requiring to install another nl library, making the current status
> > > quo even worse ... :/
> > >
> > > Thanks,
> > > Daniel
>
> I would prefer new code use libmnl, but using libnetlink would also be ok.
> Any later conversion to libmnl would be mostly automated anyway.
Thanks, I'm copy/pasting devlink variation of libmnl :)
>
> The real objection was copy/pasting in the kernel netlink parser.
> That was unnecessary bloat.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [net-ipv4] question about arguments position
From: Joe Perches @ 2017-05-04 17:47 UTC (permalink / raw)
To: David Miller, garsilva
Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <20170504.124600.627647229351638856.davem@davemloft.net>
On Thu, 2017-05-04 at 12:46 -0400, David Miller wrote:
> From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
> Date: Thu, 04 May 2017 11:07:54 -0500
>
> > While looking into Coverity ID 1357474 I ran into the following piece
> > of code at net/ipv4/inet_diag.c:392:
>
> Because it's been this way since at least 2005, it doesn't matter if
> the order is correct or not. What's there is the locked in behavior
> exposed to userspace and changing it will break things for people.
Adding a few comments around the code about why
it is this way will help avoid future questions.
^ 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