Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 16-Apr-19 17:39, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* +* Tell upper layers about route +* change and to re-transmit this +* packet: +*/ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU IDFUNCTION:NAME 23 54338ip6_output:return 35 16 54338ip6_output:return 35 21 54338ip6_output:return 35 22 54338ip6_output:return 35 24 54338ip6_output:return 35 23 54338ip6_output:return 35 14 54338ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU IDFUNCTION:NAME 16 69030mlx5e_xmit:return 35 23 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 25 69030mlx5e_xmit:return 35 24 69030mlx5e_xmit:return 35 21 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi Andrey, Thanks for letting us know about this regression. I would like to try to reproduce this issue in house. Can you please share the exact steps to reproduce it? - Can I reproduce the issue with B2B setup? - What is the route command you used to make the route between the VLANs? - What app are you using to generate the traffic? Slava ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348859 - stable/11/sys/ofed/drivers/infiniband/core
Author: slavash Date: Mon Jun 10 13:44:29 2019 New Revision: 348859 URL: https://svnweb.freebsd.org/changeset/base/348859 Log: MFC r348601: Fix prio vs. nonprio tagged traffic in RDMACM In current RDMACM implementation RDMACM server will not find a GID index when the request was prio-tagged and the sever is non prio-tagged and vise-versa. According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged. Treat RDMACM request the same. Reviewed by:hselasky, kib Sponsored by: Mellanox Technologies Approved by:re (gjb@) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c == --- stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 13:38:57 2019(r348858) +++ stable/11/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 13:44:29 2019(r348859) @@ -414,18 +414,32 @@ struct find_gid_index_context { enum ib_gid_type gid_type; }; + +/* + * This function will return true only if a inspected GID index + * matches the request based on the GID type and VLAN configuration + */ static bool find_gid_index(const union ib_gid *gid, const struct ib_gid_attr *gid_attr, void *context) { + u16 vlan_diff; struct find_gid_index_context *ctx = (struct find_gid_index_context *)context; if (ctx->gid_type != gid_attr->gid_type) return false; - if (rdma_vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id) - return false; - return true; + + /* +* The following will verify: +* 1. VLAN ID matching for VLAN tagged requests. +* 2. prio-tagged/untagged to prio-tagged/untagged matching. +* +* This XOR is valid, since 0x0 < vlan_id < 0x0FFF. +*/ + vlan_diff = rdma_vlan_dev_vlan_id(gid_attr->ndev) ^ ctx->vlan_id; + + return (vlan_diff == 0x || vlan_diff == 0x); } static int get_sgid_index_from_eth(struct ib_device *device, u8 port_num, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348849 - stable/12/sys/ofed/drivers/infiniband/core
Author: slavash Date: Mon Jun 10 09:03:08 2019 New Revision: 348849 URL: https://svnweb.freebsd.org/changeset/base/348849 Log: MFC r348601: Fix prio vs. nonprio tagged traffic in RDMACM In current RDMACM implementation RDMACM server will not find a GID index when the request was prio-tagged and the sever is non prio-tagged and vise-versa. According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged. Treat RDMACM request the same. Reviewed by:hselasky, kib Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c == --- stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 07:12:46 2019(r348848) +++ stable/12/sys/ofed/drivers/infiniband/core/ib_verbs.c Mon Jun 10 09:03:08 2019(r348849) @@ -414,18 +414,32 @@ struct find_gid_index_context { enum ib_gid_type gid_type; }; + +/* + * This function will return true only if a inspected GID index + * matches the request based on the GID type and VLAN configuration + */ static bool find_gid_index(const union ib_gid *gid, const struct ib_gid_attr *gid_attr, void *context) { + u16 vlan_diff; struct find_gid_index_context *ctx = (struct find_gid_index_context *)context; if (ctx->gid_type != gid_attr->gid_type) return false; - if (rdma_vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id) - return false; - return true; + + /* +* The following will verify: +* 1. VLAN ID matching for VLAN tagged requests. +* 2. prio-tagged/untagged to prio-tagged/untagged matching. +* +* This XOR is valid, since 0x0 < vlan_id < 0x0FFF. +*/ + vlan_diff = rdma_vlan_dev_vlan_id(gid_attr->ndev) ^ ctx->vlan_id; + + return (vlan_diff == 0x || vlan_diff == 0x); } static int get_sgid_index_from_eth(struct ib_device *device, u8 port_num, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348601 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Tue Jun 4 06:21:31 2019 New Revision: 348601 URL: https://svnweb.freebsd.org/changeset/base/348601 Log: Fix prio vs. nonprio tagged traffic in RDMACM In current RDMACM implementation RDMACM server will not find a GID index when the request was prio-tagged and the sever is non prio-tagged and vise-versa. According to 802.1Q-2014, VLAN tagged packets with VLAN id 0 should be considered as untagged. Treat RDMACM request the same. Reviewed by:hselasky, kib MFC after: 3 Days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c == --- head/sys/ofed/drivers/infiniband/core/ib_verbs.cTue Jun 4 03:04:30 2019(r348600) +++ head/sys/ofed/drivers/infiniband/core/ib_verbs.cTue Jun 4 06:21:31 2019(r348601) @@ -414,18 +414,32 @@ struct find_gid_index_context { enum ib_gid_type gid_type; }; + +/* + * This function will return true only if a inspected GID index + * matches the request based on the GID type and VLAN configuration + */ static bool find_gid_index(const union ib_gid *gid, const struct ib_gid_attr *gid_attr, void *context) { + u16 vlan_diff; struct find_gid_index_context *ctx = (struct find_gid_index_context *)context; if (ctx->gid_type != gid_attr->gid_type) return false; - if (rdma_vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id) - return false; - return true; + + /* +* The following will verify: +* 1. VLAN ID matching for VLAN tagged requests. +* 2. prio-tagged/untagged to prio-tagged/untagged matching. +* +* This XOR is valid, since 0x0 < vlan_id < 0x0FFF. +*/ + vlan_diff = rdma_vlan_dev_vlan_id(gid_attr->ndev) ^ ctx->vlan_id; + + return (vlan_diff == 0x || vlan_diff == 0x); } static int get_sgid_index_from_eth(struct ib_device *device, u8 port_num, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 01-May-19 19:45, John Baldwin wrote: On 5/1/19 1:05 AM, Slava Shwartsman wrote: On 01-May-19 10:28, Slava Shwartsman wrote: On 01-May-19 10:09, Slava Shwartsman wrote: On 30-Apr-19 00:14, John Baldwin wrote: On 4/25/19 12:10 AM, Slava Shwartsman wrote: On 17-Apr-19 00:28, John Baldwin wrote: On 4/16/19 8:32 AM, Hans Petter Selasky wrote: On 4/16/19 4:39 PM, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* + * Tell upper layers about route + * change and to re-transmit this + * packet: + */ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU ID FUNCTION:NAME 23 54338 ip6_output:return 35 16 54338 ip6_output:return 35 21 54338 ip6_output:return 35 22 54338 ip6_output:return 35 24 54338 ip6_output:return 35 23 54338 ip6_output:return 35 14 54338 ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU ID FUNCTION:NAME 16 69030 mlx5e_xmit:return 35 23 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 25 69030 mlx5e_xmit:return 35 24 69030 mlx5e_xmit:return 35 21 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi, This might be a case where rcvif in the mbuf's pktheader is not cleared before the packet is fed back on the wire. John Baldwin is working on the send tags implementation, to eliminate the EAGAIN handling in the network drivers. I will try to push this branch sooner then since it affects more than just TLS. Part of the change includes a new flag we can use to assert that we Thanks John! aren't just getting a stale rcvif (though there are also now assertions in ip_output that should catch this case I think). Hi Andrey, Yes, we were able to reproduce this issue in house. If you don't mind, I prefer to wait for John's update - where he eliminates the EAGAIN handling in the network drivers. I have rebased the branch for this, but for now it will just panic sooner I believe by tripping an assertion. Can you grab the diff (or just the branch) from the 'send_tags' branch at gith
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 01-May-19 10:09, Slava Shwartsman wrote: On 30-Apr-19 00:14, John Baldwin wrote: On 4/25/19 12:10 AM, Slava Shwartsman wrote: On 17-Apr-19 00:28, John Baldwin wrote: On 4/16/19 8:32 AM, Hans Petter Selasky wrote: On 4/16/19 4:39 PM, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* + * Tell upper layers about route + * change and to re-transmit this + * packet: + */ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU ID FUNCTION:NAME 23 54338 ip6_output:return 35 16 54338 ip6_output:return 35 21 54338 ip6_output:return 35 22 54338 ip6_output:return 35 24 54338 ip6_output:return 35 23 54338 ip6_output:return 35 14 54338 ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU ID FUNCTION:NAME 16 69030 mlx5e_xmit:return 35 23 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 25 69030 mlx5e_xmit:return 35 24 69030 mlx5e_xmit:return 35 21 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi, This might be a case where rcvif in the mbuf's pktheader is not cleared before the packet is fed back on the wire. John Baldwin is working on the send tags implementation, to eliminate the EAGAIN handling in the network drivers. I will try to push this branch sooner then since it affects more than just TLS. Part of the change includes a new flag we can use to assert that we Thanks John! aren't just getting a stale rcvif (though there are also now assertions in ip_output that should catch this case I think). Hi Andrey, Yes, we were able to reproduce this issue in house. If you don't mind, I prefer to wait for John's update - where he eliminates the EAGAIN handling in the network drivers. I have rebased the branch for this, but for now it will just panic sooner I believe by tripping an assertion. Can you grab the diff (or just the branch) from the 'send_tags' branch at github/bsdjhb/freebsd and reproduce under a kernel with INVARIANTS? I think we will have to explicitly clear the 'rcvif' pointer somewhere, but I want to
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 01-May-19 10:28, Slava Shwartsman wrote: On 01-May-19 10:09, Slava Shwartsman wrote: On 30-Apr-19 00:14, John Baldwin wrote: On 4/25/19 12:10 AM, Slava Shwartsman wrote: On 17-Apr-19 00:28, John Baldwin wrote: On 4/16/19 8:32 AM, Hans Petter Selasky wrote: On 4/16/19 4:39 PM, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by: hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* + * Tell upper layers about route + * change and to re-transmit this + * packet: + */ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU ID FUNCTION:NAME 23 54338 ip6_output:return 35 16 54338 ip6_output:return 35 21 54338 ip6_output:return 35 22 54338 ip6_output:return 35 24 54338 ip6_output:return 35 23 54338 ip6_output:return 35 14 54338 ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU ID FUNCTION:NAME 16 69030 mlx5e_xmit:return 35 23 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 25 69030 mlx5e_xmit:return 35 24 69030 mlx5e_xmit:return 35 21 69030 mlx5e_xmit:return 35 26 69030 mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi, This might be a case where rcvif in the mbuf's pktheader is not cleared before the packet is fed back on the wire. John Baldwin is working on the send tags implementation, to eliminate the EAGAIN handling in the network drivers. I will try to push this branch sooner then since it affects more than just TLS. Part of the change includes a new flag we can use to assert that we Thanks John! aren't just getting a stale rcvif (though there are also now assertions in ip_output that should catch this case I think). Hi Andrey, Yes, we were able to reproduce this issue in house. If you don't mind, I prefer to wait for John's update - where he eliminates the EAGAIN handling in the network drivers. I have rebased the branch for this, but for now it will just panic sooner I believe by tripping an assertion. Can you grab the diff (or just the branch) from the 'send_tags' branch at github/bsdjhb/freebsd and reproduce under a kernel with INVARIANTS? I think we will have to explicit
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 30-Apr-19 00:14, John Baldwin wrote: On 4/25/19 12:10 AM, Slava Shwartsman wrote: On 17-Apr-19 00:28, John Baldwin wrote: On 4/16/19 8:32 AM, Hans Petter Selasky wrote: On 4/16/19 4:39 PM, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* +* Tell upper layers about route +* change and to re-transmit this +* packet: +*/ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU IDFUNCTION:NAME 23 54338ip6_output:return 35 16 54338ip6_output:return 35 21 54338ip6_output:return 35 22 54338ip6_output:return 35 24 54338ip6_output:return 35 23 54338ip6_output:return 35 14 54338ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU IDFUNCTION:NAME 16 69030mlx5e_xmit:return 35 23 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 25 69030mlx5e_xmit:return 35 24 69030mlx5e_xmit:return 35 21 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi, This might be a case where rcvif in the mbuf's pktheader is not cleared before the packet is fed back on the wire. John Baldwin is working on the send tags implementation, to eliminate the EAGAIN handling in the network drivers. I will try to push this branch sooner then since it affects more than just TLS. Part of the change includes a new flag we can use to assert that we Thanks John! aren't just getting a stale rcvif (though there are also now assertions in ip_output that should catch this case I think). Hi Andrey, Yes, we were able to reproduce this issue in house. If you don't mind, I prefer to wait for John's update - where he eliminates the EAGAIN handling in the network drivers. I have rebased the branch for this, but for now it will just panic sooner I believe by tripping an assertion. Can you grab the diff (or just the branch) from the 'send_tags' branc
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 17-Apr-19 00:28, John Baldwin wrote: On 4/16/19 8:32 AM, Hans Petter Selasky wrote: On 4/16/19 4:39 PM, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* +* Tell upper layers about route +* change and to re-transmit this +* packet: +*/ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU IDFUNCTION:NAME 23 54338ip6_output:return 35 16 54338ip6_output:return 35 21 54338ip6_output:return 35 22 54338ip6_output:return 35 24 54338ip6_output:return 35 23 54338ip6_output:return 35 14 54338ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU IDFUNCTION:NAME 16 69030mlx5e_xmit:return 35 23 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 25 69030mlx5e_xmit:return 35 24 69030mlx5e_xmit:return 35 21 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi, This might be a case where rcvif in the mbuf's pktheader is not cleared before the packet is fed back on the wire. John Baldwin is working on the send tags implementation, to eliminate the EAGAIN handling in the network drivers. I will try to push this branch sooner then since it affects more than just TLS. Part of the change includes a new flag we can use to assert that we Thanks John! aren't just getting a stale rcvif (though there are also now assertions in ip_output that should catch this case I think). Hi Andrey, Yes, we were able to reproduce this issue in house. If you don't mind, I prefer to wait for John's update - where he eliminates the EAGAIN handling in the network drivers. Slava ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
On 16-Apr-19 17:39, Andrey V. Elsukov wrote: On 05.12.2018 17:25, Slava Shwartsman wrote: Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies @@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb) struct mlx5e_sq *sq; int ret; - sq = mlx5e_select_queue(ifp, mb); - if (unlikely(sq == NULL)) { -#ifdef RATELIMIT - /* Check for route change */ - if (mb->m_pkthdr.snd_tag != NULL && - mb->m_pkthdr.snd_tag->ifp != ifp) { + if (mb->m_pkthdr.snd_tag != NULL) { + sq = mlx5e_select_queue_by_send_tag(ifp, mb); + if (unlikely(sq == NULL)) { + /* Check for route change */ + if (mb->m_pkthdr.snd_tag->ifp != ifp) { + /* Free mbuf */ + m_freem(mb); + + /* +* Tell upper layers about route +* change and to re-transmit this +* packet: +*/ + return (EAGAIN); + } Hi, I just discovered something strange and found that this commit is the cause. The test system has mlx5en 100G interface. It has two vlans: vlan500 and vlan100. Via vlan500 it receives some packets flows. Then it routes these packets into vlan100. But packets are dropped in mlx5e_xmit() with EAGAIN error code. # dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}' dtrace: description 'fbt::ip6_output:return ' matched 1 probe CPU IDFUNCTION:NAME 23 54338ip6_output:return 35 16 54338ip6_output:return 35 21 54338ip6_output:return 35 22 54338ip6_output:return 35 24 54338ip6_output:return 35 23 54338ip6_output:return 35 14 54338ip6_output:return 35 ^C # dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}' dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe CPU IDFUNCTION:NAME 16 69030mlx5e_xmit:return 35 23 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 25 69030mlx5e_xmit:return 35 24 69030mlx5e_xmit:return 35 21 69030mlx5e_xmit:return 35 26 69030mlx5e_xmit:return 35 ^C The kernel config is GENERIC. 13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty Hi Andrey, Thanks for letting us know about this regression. I would like to try to reproduce this issue in house. Can you please share the exact steps to reproduce it? - Can I reproduce the issue with B2B setup? - What is the route command you used to make the route between the VLANs? - What app are you using to generate the traffic? Slava ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341586 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:25:03 2018 New Revision: 341586 URL: https://svnweb.freebsd.org/changeset/base/341586 Log: mlx5en: Implement backpressure indication. The backpressure indication is implemented using an unlimited rate type of mbuf send tag. When the upper layers typically the socket layer has obtained such a tag, it can then query the destination driver queue for the current amount of space available in the send queue. A single mbuf send tag may be referenced multiple times and a refcount has been added to the mlx5e_priv structure to track its usage. Because the send tag resides in the mlx5e_channel structure, there is no need to wait for refcounts to reach zero until the mlx4en(4) driver is detached. The channels structure is persistant during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed without any need of synchronization. The mlx5e_snd_tag structure was extended to contain a type field, because there are now two different tag types which end up in the driver which need to be distinguished. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/en_rl.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:25:03 2018 (r341586) @@ -580,6 +580,11 @@ enum { MLX5E_SQ_FULL }; +struct mlx5e_snd_tag { + struct m_snd_tag m_snd_tag; /* send tag */ + u32 type; /* tag type */ +}; + struct mlx5e_sq { /* data path */ struct mtx lock; @@ -640,11 +645,27 @@ mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n) return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc); } +static inline u32 +mlx5e_sq_queue_level(struct mlx5e_sq *sq) +{ + u16 cc; + u16 pc; + + if (sq == NULL) + return (0); + + cc = sq->cc; + pc = sq->pc; + + return (((sq->wq.sz_m1 & (pc - cc)) * + IF_SND_QUEUE_LEVEL_MAX) / sq->wq.sz_m1); +} + struct mlx5e_channel { /* data path */ struct mlx5e_rq rq; + struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; - struct ifnet *ifp; u32 mkey_be; u8 num_tc; @@ -770,6 +791,7 @@ struct mlx5e_priv { u32 pdn; u32 tdn; struct mlx5_core_mr mr; + volatile unsigned int channel_refs; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; @@ -907,6 +929,24 @@ mlx5e_cq_arm(struct mlx5e_cq *cq, spinlock_t *dblock) mcq = >mcq; mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, dblock, cq->wq.cc); +} + +static inline void +mlx5e_ref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs < INT_MAX, + ("Channel refs will overflow")); + atomic_fetchadd_int(>channel_refs, 1); +} + +static inline void +mlx5e_unref_channel(struct mlx5e_priv *priv) +{ + + KASSERT(priv->channel_refs > 0, + ("Channel refs is not greater than zero")); + atomic_fetchadd_int(>channel_refs, -1); } extern const struct ethtool_ops mlx5e_ethtool_ops; Modified: head/sys/dev/mlx5/mlx5_en/en_rl.h == --- head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:25:03 2018 (r341586) @@ -129,7 +129,7 @@ struct mlx5e_rl_channel_param { }; struct mlx5e_rl_channel { - struct m_snd_tag m_snd_tag; + struct mlx5e_snd_tag tag; STAILQ_ENTRY(mlx5e_rl_channel) entry; struct mlx5e_sq * volatile sq; struct mlx5e_rl_worker *worker; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:24:33 2018 (r341585) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:25:03 2018 (r341586) @@ -886,7 +886,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, wq_sz = mlx5_wq_ll_get_size(>wq); - err = -tcp_lro_init_args(>lro, c->ifp, TCP_LRO_ENTRIES, wq_sz); + err = -tcp_lro_init_args(>lro, c->tag.m_snd_tag.ifp, TCP_LRO_ENTRIES, wq_sz); if (err) goto err_rq_wq_destroy; @@ -916,7 +916,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, #endif } - rq->ifp = c->ifp; + rq->ifp = c->tag.m_snd_tag.ifp; rq->channel = c; rq->ix = c->ix; @@ -1778,7 +1778,9 @@ mlx5e_open_channel(struct
svn commit: r341587 - in head/sys/dev: mlx4/mlx4_core mlx4/mlx4_ib mlx5/mlx5_core mlx5/mlx5_en mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 14:25:34 2018 New Revision: 341587 URL: https://svnweb.freebsd.org/changeset/base/341587 Log: mlx4/mlx5: Updated driver version to 3.5.0 Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h == --- head/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Wed Dec 5 14:25:34 2018 (r341587) @@ -53,8 +53,8 @@ #define DRV_NAME "mlx4_core" #define PFXDRV_NAME ": " -#define DRV_VERSION"3.4.1" -#define DRV_RELDATE"October 2017" +#define DRV_VERSION"3.5.0" +#define DRV_RELDATE"November 2018" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c == --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cWed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cWed Dec 5 14:25:34 2018 (r341587) @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION"3.4.1" +#define DRV_VERSION"3.5.0" #endif -#define DRV_RELDATE"February 2018" +#define DRV_RELDATE"November 2018" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFF Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 14:25:34 2018 (r341587) @@ -34,9 +34,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" extern int mlx5_core_debug_mask; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:25:34 2018 (r341587) @@ -31,8 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#defineETH_DRIVER_VERSION "3.4.2" +#defineETH_DRIVER_VERSION "3.5.0" #endif +#define DRIVER_RELDATE "November 2018" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 14:25:03 2018 (r341586) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 14:25:34 2018 (r341587) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.4.2" +#define DRIVER_VERSION "3.5.0" #endif -#define DRIVER_RELDATE "July 2018" +#define DRIVER_RELDATE "November 2018" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341584 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:24:02 2018 New Revision: 341584 URL: https://svnweb.freebsd.org/changeset/base/341584 Log: mlx5en: Count all transmitted and received bytes. Add counter for all transmitted and received bytes. Currently only all transmitted and received packets were counted. Fix description of RX LRO counters while at it. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:24:02 2018 (r341584) @@ -379,9 +379,10 @@ struct mlx5e_port_stats_debug { #defineMLX5E_RQ_STATS(m) \ m(+1, u64 packets, "packets", "Received packets")\ + m(+1, u64 bytes, "bytes", "Received bytes") \ m(+1, u64 csum_none, "csum_none", "Received packets")\ - m(+1, u64 lro_packets, "lro_packets", "Received packets")\ - m(+1, u64 lro_bytes, "lro_bytes", "Received packets")\ + m(+1, u64 lro_packets, "lro_packets", "Received LRO packets")\ + m(+1, u64 lro_bytes, "lro_bytes", "Received LRO bytes") \ m(+1, u64 sw_lro_queued, "sw_lro_queued", "Packets queued for SW LRO") \ m(+1, u64 sw_lro_flushed, "sw_lro_flushed", "Packets flushed from SW LRO") \ m(+1, u64 wqe_err, "wqe_err", "Received packets") @@ -396,6 +397,7 @@ struct mlx5e_rq_stats { #defineMLX5E_SQ_STATS(m) \ m(+1, u64 packets, "packets", "Transmitted packets") \ + m(+1, u64 bytes, "bytes", "Transmitted bytes") \ m(+1, u64 tso_packets, "tso_packets", "Transmitted packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted bytes") \ m(+1, u64 csum_offload_none, "csum_offload_none", "Transmitted packets") \ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Wed Dec 5 14:24:02 2018 (r341584) @@ -482,6 +482,7 @@ mlx5e_poll_rx_cq(struct mlx5e_rq *rq, int budget) } mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt); + rq->stats.bytes += byte_cnt; rq->stats.packets++; #if !defined(HAVE_TCP_LRO_RX) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:23:31 2018 (r341583) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Wed Dec 5 14:24:02 2018 (r341584) @@ -472,7 +472,10 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp) sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); sq->pc += sq->mbuf[pi].num_wqebbs; + /* Count all traffic going out */ sq->stats.packets++; + sq->stats.bytes += sq->mbuf[pi].num_bytes; + *mbp = NULL;/* safety clear */ return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341585 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:24:33 2018 New Revision: 341585 URL: https://svnweb.freebsd.org/changeset/base/341585 Log: mlx5en: Improve configuration of HW LRO. In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config space must be set, and the ifconfig(8) LRO capability must be set. Any other settings will disable HW LRO. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:24:02 2018 (r341584) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:24:33 2018 (r341585) @@ -669,21 +669,24 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_close_locked(priv->ifp); /* import HW LRO mode */ - if (priv->params_ethtool.hw_lro != 0) { - if ((priv->ifp->if_capenable & IFCAP_LRO) && - MLX5_CAP_ETH(priv->mdev, lro_cap)) { - priv->params.hw_lro_en = 1; - priv->params_ethtool.hw_lro = 1; + if (priv->params_ethtool.hw_lro != 0 && + MLX5_CAP_ETH(priv->mdev, lro_cap)) { + priv->params_ethtool.hw_lro = 1; + /* check if feature should actually be enabled */ + if (priv->ifp->if_capenable & IFCAP_LRO) { + priv->params.hw_lro_en = true; } else { - priv->params.hw_lro_en = 0; - priv->params_ethtool.hw_lro = 0; - error = EINVAL; + priv->params.hw_lro_en = false; - if_printf(priv->ifp, "Can't enable HW LRO: " - "The HW or SW LRO feature is disabled\n"); + if_printf(priv->ifp, "To enable HW LRO " + "please also enable LRO via ifconfig(8).\n"); } } else { - priv->params.hw_lro_en = 0; + /* return an error if HW does not support this feature */ + if (priv->params_ethtool.hw_lro != 0) + error = EINVAL; + priv->params.hw_lro_en = false; + priv->params_ethtool.hw_lro = 0; } /* restart network interface, if any */ if (was_opened) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:24:02 2018 (r341584) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:24:33 2018 (r341585) @@ -2898,12 +2898,18 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t bool need_restart = false; ifp->if_capenable ^= IFCAP_LRO; + + /* figure out if updating HW LRO is needed */ if (!(ifp->if_capenable & IFCAP_LRO)) { if (priv->params.hw_lro_en) { priv->params.hw_lro_en = false; need_restart = true; - /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + } + } else { + if (priv->params.hw_lro_en == false && + priv->params_ethtool.hw_lro != 0) { + priv->params.hw_lro_en = true; + need_restart = true; } } if (was_opened && need_restart) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341583 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:23:31 2018 New Revision: 341583 URL: https://svnweb.freebsd.org/changeset/base/341583 Log: mlx5en: Statically allocate and free the channel structure(s). By allocating the worst case size channel structure array at attach time we can eliminate various NULL checks in the fast path. And also reduce the chance for use-after-free issues in the transmit fast path. This change is also a requirement for implementing backpressure support. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:31 2018 (r341583) @@ -596,7 +596,7 @@ struct mlx5e_sq { #defineMLX5E_CEV_STATE_INITIAL 0 /* timer not started */ #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ - u16 stopped;/* set if SQ is stopped */ + u16 running;/* set if SQ is running */ struct callout cev_callout; union { u32 d32[2]; @@ -769,7 +769,6 @@ struct mlx5e_priv { u32 tdn; struct mlx5_core_mr mr; - struct mlx5e_channel *volatile *channel; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; @@ -814,6 +813,8 @@ struct mlx5e_priv { int clbr_curr; struct mlx5e_clbr_point clbr_points[2]; u_int clbr_gen; + + struct mlx5e_channel channel[]; }; #defineMLX5E_NET_IP_ALIGN 2 Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:31 2018 (r341583) @@ -1035,7 +1035,7 @@ mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) if (test_bit(MLX5E_STATE_OPENED, >state) == 0) goto out; for (i = 0; i < priv->params.num_channels; i++) { - c = priv->channel[i]; + c = >channel[i]; rq = >rq; sbuf_printf(, "channel %d rq %d cq %d\n", c->ix, rq->rqn, rq->cq.mcq.cqn); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:23:01 2018 (r341582) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:23:31 2018 (r341583) @@ -473,7 +473,6 @@ mlx5e_update_stats_work(struct work_struct *work) update_stats_work); struct mlx5_core_dev *mdev = priv->mdev; struct mlx5e_vport_stats *s = >stats.vport; - struct mlx5e_rq_stats *rq_stats; struct mlx5e_sq_stats *sq_stats; struct buf_ring *sq_br; #if (__FreeBSD_version < 110) @@ -507,10 +506,10 @@ mlx5e_update_stats_work(struct work_struct *work) /* Collect firts the SW counters and then HW for consistency */ for (i = 0; i < priv->params.num_channels; i++) { - struct mlx5e_rq *rq = >channel[i]->rq; + struct mlx5e_channel *pch = priv->channel + i; + struct mlx5e_rq *rq = >rq; + struct mlx5e_rq_stats *rq_stats = >rq.stats; - rq_stats = >channel[i]->rq.stats; - /* collect stats from LRO */ rq_stats->sw_lro_queued = rq->lro.lro_queued; rq_stats->sw_lro_flushed = rq->lro.lro_flushed; @@ -522,8 +521,8 @@ mlx5e_update_stats_work(struct work_struct *work) rx_wqe_err += rq_stats->wqe_err; for (j = 0; j < priv->num_tc; j++) { - sq_stats = >channel[i]->sq[j].stats; - sq_br = priv->channel[i]->sq[j].br; + sq_stats = >sq[j].stats; + sq_br = pch->sq[j].br; tso_packets += sq_stats->tso_packets; tso_bytes += sq_stats->tso_bytes; @@ -1202,7 +1201,7 @@ mlx5e_refresh_sq_inline(struct mlx5e_priv *priv) return; for (i = 0; i < priv->params.num_channels; i++) - mlx5e_refresh_sq_inline_sub(priv, priv->channel[i]); + mlx5e_refresh_sq_inline_sub(priv, >channel[i]); } static int @@ -1388,6 +1387,8 @@ mlx5e_open_sq(struct mlx5e_channel *c,
svn commit: r341582 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:23:01 2018 New Revision: 341582 URL: https://svnweb.freebsd.org/changeset/base/341582 Log: mlx5en: Fix race in mlx5e_ethtool_debug_stats(). Writing to the debug stats variable must be locked, else serialization will be lost which might cause various kernel panics due to creating and destroying sysctls out of order. Make sure the sysctl context is initialized after freeing the sysctl nodes, else they can be freed twice. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:23:01 2018 (r341582) @@ -794,7 +794,6 @@ struct mlx5e_priv { struct sysctl_oid *sysctl_hw; int sysctl_debug; struct mlx5e_stats stats; - struct sysctl_ctx_list sysctl_ctx_channel_debug; int counter_set_id; struct workqueue_struct *wq; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:23:01 2018 (r341582) @@ -1056,33 +1056,34 @@ static int mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; - int error, sys_debug; + int sys_debug; + int error; + PRIV_LOCK(priv); sys_debug = priv->sysctl_debug; - error = sysctl_handle_int(oidp, >sysctl_debug, 0, req); + error = sysctl_handle_int(oidp, _debug, 0, req); if (error != 0 || !req->newptr) - return (error); - priv->sysctl_debug = priv->sysctl_debug != 0; + goto done; + sys_debug = sys_debug ? 1 : 0; if (sys_debug == priv->sysctl_debug) - return (0); + goto done; - PRIV_LOCK(priv); - if (priv->sysctl_debug) { + if ((priv->sysctl_debug = sys_debug)) { mlx5e_create_stats(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, priv->stats.port_stats_debug.arg); - SYSCTL_ADD_PROC(>sysctl_ctx_channel_debug, + SYSCTL_ADD_PROC(>stats.port_stats_debug.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, "hw_ctx_debug", CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, mlx5e_ethtool_debug_channel_info, "S", ""); } else { sysctl_ctx_free(>stats.port_stats_debug.ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); } +done: PRIV_UNLOCK(priv); - return (0); + return (error); } static void Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:22:30 2018 (r341581) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:23:01 2018 (r341582) @@ -3639,8 +3639,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); - sysctl_ctx_init(>sysctl_ctx_channel_debug); - /* ifnet sysctl tree */ sysctl_ctx_init(>sysctl_ctx); priv->sysctl_ifnet = SYSCTL_ADD_NODE(>sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev), @@ -3831,8 +3829,8 @@ err_free_wq: err_free_sysctl: sysctl_ctx_free(>sysctl_ctx); - sysctl_ctx_free(>sysctl_ctx_channel_debug); - + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); if_free(ifp); err_free_priv: @@ -3889,13 +3887,11 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5e_rl_cleanup(priv); #endif /* destroy all remaining sysctl nodes */ - if (priv->sysctl_debug) { - sysctl_ctx_free(>sysctl_ctx_channel_debug); - sysctl_ctx_free(>stats.port_stats_debug.ctx); - } sysctl_ctx_free(>stats.vport.ctx); sysctl_ctx_free(>stats.pport.ctx); sysctl_ctx_free(>sysctl_ctx); + if (priv->sysctl_debug) + sysctl_ctx_free(>stats.port_stats_debug.ctx); mlx5_core_destroy_mkey(priv->mdev, >mr); mlx5_dealloc_transport_domain(priv->mdev, priv->tdn); ___
svn commit: r341581 - in head/sys/dev/mlx5: . mlx5_core mlx5_en
Author: slavash Date: Wed Dec 5 14:22:30 2018 New Revision: 341581 URL: https://svnweb.freebsd.org/changeset/base/341581 Log: mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types. Inspect the ethernet compliance code to figure out actual cable type by reading the PDDR module info register. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/port.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:22:30 2018 (r341581) @@ -1146,3 +1146,39 @@ out: kfree(out); return err; } + +int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type) +{ + u32 pddr_reg[MLX5_ST_SZ_DW(pddr_reg)] = {}; + int sz = MLX5_ST_SZ_BYTES(pddr_reg); + int error; + u8 ecc; + u8 ci; + + MLX5_SET(pddr_reg, pddr_reg, local_port, local_port); + MLX5_SET(pddr_reg, pddr_reg, page_select, 3 /* module info page */); + + error = mlx5_core_access_reg(mdev, pddr_reg, sz, pddr_reg, sz, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_PDDR, 0, 0); + if (error != 0) + return (error); + + ecc = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.ethernet_compliance_code); + ci = MLX5_GET(pddr_reg, pddr_reg, page_data.pddr_module_info.cable_identifier); + + switch (ci) { + case 0: /* QSFP28 */ + case 1: /* QSFP+ */ + *is_er_type = 0; + break; + case 2: /* SFP28/SFP+ */ + case 3: /* QSA (QSFP->SFP) */ + *is_er_type = ((ecc & (1 << 7)) != 0); + break; + default: + *is_er_type = 0; + break; + } + return (0); +} +EXPORT_SYMBOL_GPL(mlx5_query_pddr_range_info); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:21:59 2018 (r341580) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:22:30 2018 (r341581) @@ -169,6 +169,7 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) u32 eth_proto_oper; int error; u8 port_state; + u8 is_er_type; u8 i; port_state = mlx5_query_vport_state(mdev, @@ -197,10 +198,33 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) if (mlx5e_mode_table[i].baudrate == 0) continue; if (MLX5E_PROT_MASK(i) & eth_proto_oper) { + u32 subtype = mlx5e_mode_table[i].subtype; + priv->ifp->if_baudrate = mlx5e_mode_table[i].baudrate; - priv->media_active_last = - mlx5e_mode_table[i].subtype | IFM_ETHER | IFM_FDX; + + switch (subtype) { + case IFM_10G_ER: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error != 0 || is_er_type == 0) + subtype = IFM_10G_LR; + break; + case IFM_40G_LR4: + error = mlx5_query_pddr_range_info(mdev, 1, _er_type); + if (error != 0) { + if_printf(priv->ifp, "%s: query port pddr failed: %d\n", + __func__, error); + } + if (error == 0 && is_er_type != 0) + subtype = IFM_40G_ER4; + break; + } + priv->media_active_last = subtype | IFM_ETHER | IFM_FDX; + break; } } if_link_state_change(priv->ifp, LINK_STATE_UP); @@ -224,6 +248,15 @@ mlx5e_find_link_mode(u32 subtype) u32 i; u32 link_mode = 0; + switch (subtype) { + case IFM_10G_LR: + subtype = IFM_10G_ER; + break; + case IFM_40G_ER4: + subtype = IFM_40G_LR4; + break; + } + for (i = 0; i < MLX5E_LINK_MODES_NUMBER; ++i) { if
svn commit: r341580 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:21:59 2018 New Revision: 341580 URL: https://svnweb.freebsd.org/changeset/base/341580 Log: mlx5en: Don't set rate on SQs when the SQ is already stopped. This can happen when connections are short lived and leads to a firmware error printout in dmesg, syndrome 0x51cfb0, because the SQ is in the wrong state. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:21:28 2018 (r341579) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 14:21:59 2018 (r341580) @@ -458,9 +458,9 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work howmany(rate, 1000), burst); } - /* set new rate */ + /* set new rate, if SQ is not stopped */ sq = channel->sq; - if (sq != NULL) { + if (sq != NULL && sq->stopped == 0) { error = mlx5e_rl_modify_sq(sq, index); if (error != 0) atomic_add_64(>priv->rl.stats.tx_modify_rate_failure, 1ULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341578 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 14:20:57 2018 New Revision: 341578 URL: https://svnweb.freebsd.org/changeset/base/341578 Log: mlx5en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:57 2018 (r341578) @@ -473,7 +473,6 @@ struct mlx5e_params { m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \ m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \ m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \ - m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: Disable bufring") \ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \ m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \ @@ -606,8 +605,6 @@ struct mlx5e_sq { struct mlx5e_sq_stats stats; struct mlx5e_cq cq; - struct task sq_task; - struct taskqueue *sq_tq; /* pointers to per packet info: write@xmit, read@completion */ struct mlx5e_sq_mbuf *mbuf; @@ -628,7 +625,6 @@ struct mlx5e_sq { struct mlx5_wq_ctrl wq_ctrl; struct mlx5e_priv *priv; int tc; - unsigned int queue_state; } __aligned(MLX5E_CACHELINE_SIZE); static inline bool @@ -857,7 +853,6 @@ voidmlx5e_cq_error_event(struct mlx5_core_cq *mcq, in void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); -void mlx5e_tx_que(void *context, int pending); intmlx5e_open_flow_table(struct mlx5e_priv *priv); void mlx5e_close_flow_table(struct mlx5e_priv *priv); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:57 2018 (r341578) @@ -703,18 +703,6 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) mlx5e_open_locked(priv->ifp); break; - case MLX5_PARAM_OFFSET(tx_bufring_disable): - /* rangecheck input value */ - priv->params_ethtool.tx_bufring_disable = - priv->params_ethtool.tx_bufring_disable ? 1 : 0; - - /* reconfigure the sendqueues, if any */ - if (was_opened) { - mlx5e_close_locked(priv->ifp); - mlx5e_open_locked(priv->ifp); - } - break; - case MLX5_PARAM_OFFSET(tx_completion_fact): /* network interface must be down */ if (was_opened) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:20:26 2018 (r341577) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 14:20:57 2018 (r341578) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1184,37 +1184,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->min_inline_mode = priv->params.tx_min_inline_mode; sq->vlan_inline_cap = MLX5_CAP_ETH(mdev, wqe_vlan_insert); - /* check if we should allocate a second packet buffer */ - if (priv->params_ethtool.tx_bufring_disable == 0) { - sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN, - M_WAITOK, >lock); - if (sq->br == NULL) { - if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n", - __func__); - err = -ENOMEM; - goto err_free_sq_db; - } - - sq->sq_tq =
svn commit: r341579 - in head/sys/dev/mlx5: . mlx5_core mlx5_en
Author: slavash Date: Wed Dec 5 14:21:28 2018 New Revision: 341579 URL: https://svnweb.freebsd.org/changeset/base/341579 Log: mlx5en: Fix for inlining issues in transmit path 1) Don't exceed the drivers own hardcoded TX inline limit. The blueflame register size can be much greater than the hardcoded limit for inlining. Make sure we don't exceed the drivers own limit, because this also means that the maximum number of TX fragments becomes invalid and then memory size assumptions in the TX path no longer hold up. 2) Make sure the mlx5_query_min_inline() function returns an error code. 3) Header inlining is required when using TSO. 4) Catch failure to compute inline header size for TSO. 5) Add support for UDP when computing inline header size. 6) Fix for inlining issues with regards to DSCP. Make sure we inline 4 bytes beyond the ethernet and/or VLAN header to workaround a hardware bug extracting the DSCP field from the IPv4/v6 header. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/en_rl.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c head/sys/dev/mlx5/vport.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec 5 14:21:28 2018 (r341579) @@ -222,20 +222,28 @@ int mlx5_query_nic_vport_min_inline(struct mlx5_core_d } EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); -void mlx5_query_min_inline(struct mlx5_core_dev *mdev, - u8 *min_inline_mode) +int mlx5_query_min_inline(struct mlx5_core_dev *mdev, + u8 *min_inline_mode) { + int err; + switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { case MLX5_CAP_INLINE_MODE_L2: *min_inline_mode = MLX5_INLINE_MODE_L2; + err = 0; break; case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT: - mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); + err = mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode); break; case MLX5_CAP_INLINE_MODE_NOT_REQUIRED: *min_inline_mode = MLX5_INLINE_MODE_NONE; + err = 0; break; + default: + err = -EINVAL; + break; } + return err; } EXPORT_SYMBOL_GPL(mlx5_query_min_inline); Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:21:28 2018 (r341579) @@ -619,7 +619,9 @@ struct mlx5e_sq { u32 mkey_be; u16 max_inline; u8 min_inline_mode; - u8 vlan_inline_cap; + u8 min_insert_caps; +#defineMLX5E_INSERT_VLAN 1 +#defineMLX5E_INSERT_NON_VLAN 2 /* control path */ struct mlx5_wq_ctrl wq_ctrl; @@ -925,6 +927,7 @@ voidmlx5e_drain_sq(struct mlx5e_sq *); void mlx5e_modify_tx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint8_t value); void mlx5e_resume_sq(struct mlx5e_sq *sq); -u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev); +void mlx5e_update_sq_inline(struct mlx5e_sq *sq); +void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/en_rl.h == --- head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Wed Dec 5 14:21:28 2018 (r341579) @@ -166,6 +166,7 @@ struct mlx5e_rl_priv_data { int mlx5e_rl_init(struct mlx5e_priv *priv); void mlx5e_rl_cleanup(struct mlx5e_priv *priv); +void mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl); if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; if_snd_tag_query_t mlx5e_rl_snd_tag_query; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:20:57 2018 (r341578) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Dec 5 14:21:28 2018 (r341579) @@ -374,6 +374,12 @@ mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS)
svn commit: r341577 - in head/sys/dev/mlx5: . mlx5_core mlx5_en
Author: slavash Date: Wed Dec 5 14:20:26 2018 New Revision: 341577 URL: https://svnweb.freebsd.org/changeset/base/341577 Log: mlx5en: Implement support for bandwidth limiting in by ratio, ETS. Add support for setting the bandwidth limit as a ratio rather than in bits per second. The ratio must be an integer number between 1 and 100 inclusivly. Implement the needed firmware commands and SYSCTLs through mlx5en(4). Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/port.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 14:20:26 2018 (r341577) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -931,6 +931,74 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, return (err); } EXPORT_SYMBOL_GPL(mlx5_set_port_prio_tc); + +int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, const u8 *tc_group) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].g, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].group, tc_group[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); + +int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, +u8 tc, u8 *tc_group) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, + tc_configuration[tc]); + + *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, +group); + + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group); + +int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, const u8 *tc_bw) +{ + u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {}; + int i; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + MLX5_SET(qetc_reg, in, tc_configuration[i].b, 1); + MLX5_SET(qetc_reg, in, tc_configuration[i].bw_allocation, tc_bw[i]); + } + + return mlx5_set_port_qetcr_reg(mdev, in, sizeof(in)); +} +EXPORT_SYMBOL_GPL(mlx5_set_port_tc_bw_alloc); + +int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *bw_pct) +{ + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; + void *ets_tcn_conf; + int err; + int i; + + err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); + if (err) + return err; + + for (i = 0; i <= mlx5_max_tc(mdev); i++) { + ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, tc_configuration[i]); + bw_pct[i] = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, bw_allocation); + } + return 0; +} +EXPORT_SYMBOL_GPL(mlx5_query_port_tc_bw_alloc); int mlx5_modify_port_cong_params(struct mlx5_core_dev *mdev, void *in, int in_size) Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:19:55 2018 (r341576) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 14:20:26 2018 (r341577) @@ -493,6 +493,7 @@ struct mlx5e_params_ethtool { u64 arg [0]; MLX5E_PARAMS(MLX5E_STATS_VAR) u64 max_bw_value[IEEE_8021QAZ_MAX_TCS]; + u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; u8 prio_tc[IEEE_8021QAZ_MAX_TCS]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; @@ -844,19 +845,6 @@ struct mlx5e_eeprom { int page_valid; u32 *data; }; - -/* - * This structure contains rate limit extension to the IEEE 802.1Qaz ETS - * managed object. - * Values are 64 bits long and specified in Kbps to enable usage over both - * slow and very fast networks. - * - * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class - */ -struct ieee_maxrate { - __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; -}; - #defineMLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
svn commit: r341574 - in head/sys/dev/mlx5: . mlx5_fpga
Author: slavash Date: Wed Dec 5 14:18:52 2018 New Revision: 341574 URL: https://svnweb.freebsd.org/changeset/base/341574 Log: mlx5fpga: Support MorseQ board Added and supported new enum "morseQ = 4" for fpga_id field Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c == --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec 5 14:17:22 2018 (r341573) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c Wed Dec 5 14:18:52 2018 (r341574) @@ -138,6 +138,8 @@ static const char *mlx5_fpga_name(u32 fpga_id) return "Edison"; case MLX5_FPGA_MORSE: return "Morse"; + case MLX5_FPGA_MORSEQ: + return "MorseQ"; } snprintf(ret, sizeof(ret), "Unknown %d", fpga_id); @@ -148,6 +150,7 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg { struct mlx5_fpga_query query; int err; + u32 fpga_id; err = mlx5_fpga_query(fdev->mdev, ); if (err) { @@ -162,8 +165,9 @@ static int mlx5_fpga_device_load_check(struct mlx5_fpg mlx5_fpga_info(fdev, "Status %u; Admin image %u; Oper image %u\n", query.image_status, query.admin_image, query.oper_image); - /* For Morse project FPGA has no influence to network functionality */ - if (MLX5_CAP_FPGA(fdev->mdev, fpga_id) == MLX5_FPGA_MORSE) + /* For Morse projects FPGA has no influence to network functionality */ + fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return 0; if (query.image_status != MLX5_FPGA_STATUS_SUCCESS) { @@ -226,7 +230,7 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev) fpga_id = MLX5_CAP_FPGA(fdev->mdev, fpga_id); mlx5_fpga_info(fdev, "FPGA card %s\n", mlx5_fpga_name(fpga_id)); - if (fpga_id == MLX5_FPGA_MORSE) + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) goto out; mlx5_fpga_info(fdev, "%s(%d) image, version %u; SBU %06x:%04x version %d\n", @@ -361,13 +365,16 @@ void mlx5_fpga_device_stop(struct mlx5_core_dev *mdev) unsigned int max_num_qps; unsigned long flags; int err; + u32 fpga_id; if (!fdev) return; - spin_lock_irqsave(>state_lock, flags); - if (MLX5_CAP_FPGA(mdev, fpga_id) == MLX5_FPGA_MORSE) + fpga_id = MLX5_CAP_FPGA(mdev, fpga_id); + if (fpga_id == MLX5_FPGA_MORSE || fpga_id == MLX5_FPGA_MORSEQ) return; + + spin_lock_irqsave(>state_lock, flags); if (fdev->fdev_state != MLX5_FDEV_STATE_SUCCESS) { spin_unlock_irqrestore(>state_lock, flags); Modified: head/sys/dev/mlx5/mlx5io.h == --- head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:17:22 2018(r341573) +++ head/sys/dev/mlx5/mlx5io.h Wed Dec 5 14:18:52 2018(r341574) @@ -61,6 +61,7 @@ enum mlx5_fpga_id { MLX5_FPGA_NEWTON = 0, MLX5_FPGA_EDISON = 1, MLX5_FPGA_MORSE = 2, + MLX5_FPGA_MORSEQ = 3, }; enum mlx5_fpga_image { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341576 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: slavash Date: Wed Dec 5 14:19:55 2018 New Revision: 341576 URL: https://svnweb.freebsd.org/changeset/base/341576 Log: mlx5fpga: Add set and query connect/disconnect FPGA Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h head/sys/dev/mlx5/mlx5_fpga/core.h head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c head/sys/dev/mlx5/mlx5_fpga/sdk.h head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h == --- head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:55 2018 (r341576) @@ -69,6 +69,8 @@ int mlx5_fpga_sbu_caps(struct mlx5_core_dev *dev, void int mlx5_fpga_load(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); int mlx5_fpga_image_select(struct mlx5_core_dev *dev, enum mlx5_fpga_image image); +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect); int mlx5_fpga_shell_counters(struct mlx5_core_dev *dev, bool clear, struct mlx5_fpga_shell_counters *data); Modified: head/sys/dev/mlx5/mlx5_fpga/core.h == --- head/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/core.h Wed Dec 5 14:19:55 2018 (r341576) @@ -52,6 +52,7 @@ enum mlx5_fdev_state { MLX5_FDEV_STATE_SUCCESS = 0, MLX5_FDEV_STATE_FAILURE = 1, MLX5_FDEV_STATE_IN_PROGRESS = 2, + MLX5_FDEV_STATE_DISCONNECTED = 3, MLX5_FDEV_STATE_NONE = 0x, }; Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h == --- head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h Wed Dec 5 14:19:55 2018 (r341576) @@ -133,6 +133,8 @@ enum { MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON = 0x4, MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF = 0x5, MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX = 0x6, + MLX5_FPGA_CTRL_OPERATION_DISCONNECT = 0x9, + MLX5_FPGA_CTRL_OPERATION_CONNECT = 0xA, }; struct mlx5_ifc_fpga_ctrl_bits { Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:55 2018 (r341576) @@ -37,6 +37,7 @@ #include #include #include +#include #define MLX5_FPGA_ACCESS_REG_SZ (MLX5_ST_SZ_DW(fpga_access_reg) + \ MLX5_FPGA_ACCESS_REG_SIZE_MAX) @@ -162,6 +163,33 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct query->admin_image = MLX5_GET(fpga_ctrl, out, flash_select_admin); query->oper_image = MLX5_GET(fpga_ctrl, out, flash_select_oper); return 0; +} + +int mlx5_fpga_ctrl_connect(struct mlx5_core_dev *dev, + enum mlx5_fpga_connect *connect) +{ + u32 in[MLX5_ST_SZ_DW(fpga_ctrl)] = {0}; + u32 out[MLX5_ST_SZ_DW(fpga_ctrl)]; + int status; + int err; + + if (*connect == MLX5_FPGA_CONNECT_QUERY) { + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, false); + if (err) + return err; + status = MLX5_GET(fpga_ctrl, out, status); + *connect = (status == MLX5_FDEV_STATE_DISCONNECTED) ? + MLX5_FPGA_CONNECT_DISCONNECT : + MLX5_FPGA_CONNECT_CONNECT; + } else { + MLX5_SET(fpga_ctrl, in, operation, *connect); + err = mlx5_core_access_reg(dev, in, sizeof(in), out, + sizeof(out), MLX5_REG_FPGA_CTRL, + 0, true); + } + return err; } int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:23 2018 (r341575) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:55 2018 (r341576) @@ -342,6 +342,7 @@ int mlx5_fpga_device_reload(struct mlx5_fpga_device *f
svn commit: r341575 - in head/sys/dev/mlx5: . mlx5_fpga mlx5_fpga_tools
Author: slavash Date: Wed Dec 5 14:19:23 2018 New Revision: 341575 URL: https://svnweb.freebsd.org/changeset/base/341575 Log: mlx5fpga: IOCTL for FPGA temperature measurement Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_fpga/cmd.h head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c head/sys/dev/mlx5/mlx5_fpga/sdk.h head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/mlx5io.h Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 14:18:52 2018(r341574) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 14:19:23 2018(r341575) @@ -151,6 +151,7 @@ enum { MLX5_REG_PMLP= 0x5002, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, + MLX5_REG_MTMP= 0x900a, MLX5_REG_MCIA= 0x9014, MLX5_REG_MPCNT = 0x9051, }; Modified: head/sys/dev/mlx5/mlx5_fpga/cmd.h == --- head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/cmd.h Wed Dec 5 14:19:23 2018 (r341575) @@ -60,6 +60,8 @@ struct mlx5_fpga_shell_counters { int mlx5_fpga_caps(struct mlx5_core_dev *dev); int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp); int mlx5_fpga_ctrl_op(struct mlx5_core_dev *dev, u8 op); int mlx5_fpga_access_reg(struct mlx5_core_dev *dev, u8 size, u64 addr, void *buf, bool write); Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c == --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c Wed Dec 5 14:19:23 2018 (r341575) @@ -164,6 +164,38 @@ int mlx5_fpga_query(struct mlx5_core_dev *dev, struct return 0; } +int mlx5_fpga_query_mtmp(struct mlx5_core_dev *dev, +struct mlx5_fpga_temperature *temp) +{ + u32 in[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + u32 out[MLX5_ST_SZ_DW(mtmp_reg)] = {0}; + int err; + + MLX5_SET(mtmp_reg, in, sensor_index, temp->index); + MLX5_SET(mtmp_reg, in, i, +((temp->index < MLX5_FPGA_INTERNAL_SENSORS_LOW) || +(temp->index > MLX5_FPGA_INTERNAL_SENSORS_HIGH)) ? 1 : 0); + + err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), + MLX5_REG_MTMP, 0, false); + if (err) + return err; + + temp->index = MLX5_GET(mtmp_reg, out, sensor_index); + temp->temperature = MLX5_GET(mtmp_reg, out, temperature); + temp->mte = MLX5_GET(mtmp_reg, out, mte); + temp->max_temperature = MLX5_GET(mtmp_reg, out, max_temperature); + temp->tee = MLX5_GET(mtmp_reg, out, tee); + temp->temperature_threshold_hi = MLX5_GET(mtmp_reg, out, + temperature_threshold_hi); + temp->temperature_threshold_lo = MLX5_GET(mtmp_reg, out, + temperature_threshold_lo); + memcpy(temp->sensor_name, MLX5_ADDR_OF(mtmp_reg, out, sensor_name), + MLX5_FLD_SZ_BYTES(mtmp_reg, sensor_name)); + + return 0; +} + int mlx5_fpga_create_qp(struct mlx5_core_dev *dev, void *fpga_qpc, u32 *fpga_qpn) { Modified: head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c == --- head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c Wed Dec 5 14:19:23 2018 (r341575) @@ -442,6 +442,13 @@ int mlx5_fpga_flash_select(struct mlx5_fpga_device *fd } EXPORT_SYMBOL(mlx5_fpga_flash_select); +int mlx5_fpga_temperature(struct mlx5_fpga_device *fdev, + struct mlx5_fpga_temperature *temp) +{ + return mlx5_fpga_query_mtmp(fdev->mdev, temp); +} +EXPORT_SYMBOL(mlx5_fpga_temperature); + struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev) { return >mdev->pdev->dev; Modified: head/sys/dev/mlx5/mlx5_fpga/sdk.h == --- head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:18:52 2018 (r341574) +++ head/sys/dev/mlx5/mlx5_fpga/sdk.h Wed Dec 5 14:19:23 2018 (r341575) @@ -356,6 +356,16 @@ void mlx5_fpga_device_query(struct mlx5_fpga_device *f struct device *mlx5_fpga_dev(struct mlx5_fpga_device *fdev); /** + *
svn commit: r341573 - in head/sys: dev/mlx5 dev/mlx5/mlx5_fpga_tools modules/mlx5fpga_tools
Author: slavash Date: Wed Dec 5 14:17:22 2018 New Revision: 341573 URL: https://svnweb.freebsd.org/changeset/base/341573 Log: mlx5fpga_tools initial code import. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_fpga_tools/ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/tools.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga_tools/tools_char.h (contents, props changed) head/sys/modules/mlx5fpga_tools/ head/sys/modules/mlx5fpga_tools/Makefile (contents, props changed) Modified: head/sys/dev/mlx5/mlx5io.h Added: head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_char.c Wed Dec 5 14:17:22 2018(r341573) @@ -0,0 +1,325 @@ +/*- + * Copyright (c) 2017 Mellanox Technologies. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * + * - Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +#define CHUNK_SIZE (128 * 1024) + +struct tools_context { + struct mlx5_fpga_tools_dev *tdev; + enum mlx5_fpga_access_type access_type; +}; + +static void +tools_char_ctx_dtor(void *data) +{ + + free(data, M_DEVBUF); +} + +static int +tools_char_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + struct tools_context *context; + + context = malloc(sizeof(*context), M_DEVBUF, M_WAITOK); + context->tdev = dev->si_drv1; + context->access_type = MLX5_FPGA_ACCESS_TYPE_DONTCARE; + devfs_set_cdevpriv(context, tools_char_ctx_dtor); + return (0); +} + +static int +mem_read(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count, +u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt) +{ + int ret; + + ret = sx_xlock_sig(>lock); + if (ret != 0) + return (ret); + ret = mlx5_fpga_mem_read(tdev->fdev, count, address, buf, access_type); + sx_xunlock(>lock); + if (ret < 0) { + dev_dbg(mlx5_fpga_dev(tdev->fdev), + "Failed to read %zu bytes at address 0x%jx: %d\n", + count, (uintmax_t)address, ret); + return (-ret); + } + *retcnt = ret; + return (0); +} + +static int +mem_write(struct mlx5_fpga_tools_dev *tdev, void *buf, size_t count, +u64 address, enum mlx5_fpga_access_type access_type, size_t *retcnt) +{ + int ret; + + ret = sx_xlock_sig(>lock); + if (ret != 0) + return (ret); + ret = mlx5_fpga_mem_write(tdev->fdev, count, address, buf, access_type); + sx_xunlock(>lock); + if (ret < 0) { + dev_dbg(mlx5_fpga_dev(tdev->fdev), + "Failed to write %zu bytes at address 0x%jx: %d\n", + count, (uintmax_t)address, ret); + return (-ret); + } + *retcnt = ret; + return (0); +} + +static void +tools_char_llseek(struct tools_context *context, struct uio *uio, ssize_t *len) +{ + uint64_t fbase, fsize; + size_t llen; + + llen = uio->uio_resid; + if (llen < 1) { + *len = 0; + return; + } + if (llen > CHUNK_SIZE) + llen = CHUNK_SIZE; + fbase =
svn commit: r341572 - in head/sys: dev/mlx5 dev/mlx5/mlx5_accel dev/mlx5/mlx5_core dev/mlx5/mlx5_fpga dev/mlx5/mlx5_lib modules/mlx5 modules/mlx5en modules/mlx5ib
Author: slavash Date: Wed Dec 5 14:11:20 2018 New Revision: 341572 URL: https://svnweb.freebsd.org/changeset/base/341572 Log: mlx5fpga: Initial code import. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_accel/ head/sys/dev/mlx5/mlx5_accel/ipsec.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/ head/sys/dev/mlx5/mlx5_fpga/cmd.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/conn.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/core.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/ipsec.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5_ifc_fpga.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_cmd.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_conn.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_core.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_ipsec.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_sdk.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_trans.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/mlx5fpga_xfer.c (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/sdk.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/trans.h (contents, props changed) head/sys/dev/mlx5/mlx5_fpga/xfer.h (contents, props changed) head/sys/dev/mlx5/mlx5_lib/ head/sys/dev/mlx5/mlx5_lib/mlx5.h (contents, props changed) head/sys/dev/mlx5/mlx5_lib/mlx5_gid.c (contents, props changed) Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_core/wq.h head/sys/dev/mlx5/mlx5_ifc.h head/sys/dev/mlx5/mlx5io.h head/sys/modules/mlx5/Makefile head/sys/modules/mlx5en/Makefile head/sys/modules/mlx5ib/Makefile Modified: head/sys/dev/mlx5/device.h == --- head/sys/dev/mlx5/device.h Wed Dec 5 13:49:11 2018(r341571) +++ head/sys/dev/mlx5/device.h Wed Dec 5 14:11:20 2018(r341572) @@ -1034,6 +1034,12 @@ enum mlx5_qcam_feature_groups { #defineMLX5_CAP_QCAM_FEATURE(mdev, fld) \ MLX5_GET(qcam_reg, (mdev)->caps.qcam, qos_feature_cap_mask.feature_cap.fld) +#define MLX5_CAP_FPGA(mdev, cap) \ + MLX5_GET(fpga_cap, (mdev)->caps.fpga, cap) + +#define MLX5_CAP64_FPGA(mdev, cap) \ + MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) + enum { MLX5_CMD_STAT_OK= 0x0, MLX5_CMD_STAT_INT_ERR = 0x1, Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:49:11 2018(r341571) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 14:11:20 2018(r341572) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -131,6 +132,10 @@ enum { MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP= 0x4021, MLX5_REG_PCAP= 0x5001, + MLX5_REG_FPGA_CAP= 0x4022, + MLX5_REG_FPGA_CTRL = 0x4023, + MLX5_REG_FPGA_ACCESS_REG = 0x4024, + MLX5_REG_FPGA_SHELL_CNTR = 0x4025, MLX5_REG_PMTU= 0x5003, MLX5_REG_PTYS= 0x5004, MLX5_REG_PAOS= 0x5006, @@ -404,6 +409,13 @@ struct mlx5_buf { u8 load_done; }; +struct mlx5_frag_buf { + struct mlx5_buf_list*frags; + int npages; + int size; + u8 page_shift; +}; + struct mlx5_eq { struct mlx5_core_dev *dev; __be32 __iomem *doorbell; @@ -442,6 +454,20 @@ struct mlx5_core_sig_ctx { u32 sigerr_count; }; +enum { + MLX5_MKEY_MR = 1, + MLX5_MKEY_MW, + MLX5_MKEY_MR_USER, +}; + +struct mlx5_core_mkey { + u64 iova; + u64 size; + u32 key; + u32 pd; + u32 type; +}; + struct mlx5_core_mr { u64 iova; u64 size; @@ -645,6 +671,14 @@ enum mlx5_pci_status { MLX5_PCI_STATUS_ENABLED, }; +#defineMLX5_MAX_RESERVED_GIDS 8 + +struct mlx5_rsvd_gids { + unsigned int start; + unsigned int count; + struct ida ida; +}; + struct mlx5_special_contexts { int resd_lkey; }; @@ -663,6 +697,7 @@ struct mlx5_core_dev { u32 hca_caps_max[MLX5_CAP_NUM][MLX5_UN_SZ_DW(hca_cap_union)]; struct { u32 qcam[MLX5_ST_SZ_DW(qcam_reg)]; + u32 fpga[MLX5_ST_SZ_DW(fpga_cap)]; } caps;
svn commit: r341571 - head/sys/dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:49:11 2018 New Revision: 341571 URL: https://svnweb.freebsd.org/changeset/base/341571 Log: mlx5ib: Set default active width and speed when querying port. Make sure the active width and speed is set in case the translate_eth_proto_oper() function doesn't recognize the current port operation mask. Linux commit: 7672ed33c4c15dbe9d56880683baaba4227cf940 Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:48:39 2018 (r341570) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:49:11 2018 (r341571) @@ -219,6 +219,8 @@ static int translate_eth_proto_oper(u32 eth_proto_oper *active_speed = IB_SPEED_EDR; break; default: + *active_width = IB_WIDTH_4X; + *active_speed = IB_SPEED_QDR; return -EINVAL; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341568 - head/sys/dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:47:41 2018 New Revision: 341568 URL: https://svnweb.freebsd.org/changeset/base/341568 Log: mlx5ib: Fix sign extension in mlx5_ib_query_device "fw_rev_min(dev->mdev)" with type "unsigned short" (16 bits, unsigned) is promoted in "fw_rev_min(dev->mdev) << 16" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "fw_rev_min(dev->mdev) << 16" is greater than 0x7FFF, the upper bits of the result will all be 1. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:47:10 2018 (r341567) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:47:41 2018 (r341568) @@ -605,7 +605,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde return err; props->fw_ver = ((u64)fw_rev_maj(dev->mdev) << 32) | - (fw_rev_min(dev->mdev) << 16) | + ((u32)fw_rev_min(dev->mdev) << 16) | fw_rev_sub(dev->mdev); props->device_cap_flags= IB_DEVICE_CHANGE_PHY_PORT | IB_DEVICE_PORT_ACTIVE_EVENT | ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341570 - head/sys/dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:48:39 2018 New Revision: 341570 URL: https://svnweb.freebsd.org/changeset/base/341570 Log: mlx5ib: Make sure the congestion work timer does not escape the drain procedure. If the mlx5_ib_read_cong_stats() function was running when mlx5ib was unloaded, because this function unconditionally restarts the timer, the timer can still be pending after the delayed work has been cancelled. To fix this simply loop on the delayed work cancel procedure as long as it returns non-zero. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.cWed Dec 5 13:48:10 2018 (r341569) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cong.cWed Dec 5 13:48:39 2018 (r341570) @@ -393,7 +393,8 @@ void mlx5_ib_cleanup_congestion(struct mlx5_ib_dev *dev) { - cancel_delayed_work_sync(>congestion.dwork); + while (cancel_delayed_work_sync(>congestion.dwork)) + ; sysctl_ctx_free(>congestion.ctx); sx_destroy(>congestion.lock); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341569 - head/sys/dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:48:10 2018 New Revision: 341569 URL: https://svnweb.freebsd.org/changeset/base/341569 Log: mlx5ib: Fix null pointer dereference in mlx5_ib_create_srq Although "create_srq_user" does overwrite "in.pas" on some paths, it also contains at least one feasible path which does not overwrite it. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:47:41 2018 (r341568) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:48:10 2018 (r341569) @@ -287,7 +287,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, else err = create_srq_kernel(dev, srq, , buf_size); - if (err) { + if (err || !in.pas) { mlx5_ib_warn(dev, "create srq %s failed, err %d\n", pd->uobject ? "user" : "kernel", err); goto err_srq; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341567 - in head/sys: compat/linuxkpi/common/src dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:47:10 2018 New Revision: 341567 URL: https://svnweb.freebsd.org/changeset/base/341567 Log: mlx5: Fix driver version location Driver description should be set by core and not by the Ethernet driver. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c == --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 5 13:46:39 2018(r341566) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Dec 5 13:47:10 2018(r341567) @@ -199,6 +199,7 @@ linux_pci_detach(device_t dev) spin_lock(_lock); list_del(>links); spin_unlock(_lock); + device_set_desc(dev, NULL); put_device(>dev); return (0); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:47:10 2018 (r341567) @@ -44,6 +44,8 @@ #include "mlx5_core.h" #include "fs_core.h" +static const char mlx5_version[] = "Mellanox Core driver " + DRIVER_VERSION " (" DRIVER_RELDATE ")"; MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver"); MODULE_LICENSE("Dual BSD/GPL"); @@ -1219,6 +1221,9 @@ static int init_one(struct pci_dev *pdev, dev->profile = [prof_sel]; dev->pdev = pdev; dev->event = mlx5_core_event; + + /* Set desc */ + device_set_desc(bsddev, mlx5_version); sysctl_ctx_init(>sysctl_ctx); SYSCTL_ADD_INT(>sysctl_ctx, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:47:10 2018 (r341567) @@ -34,8 +34,8 @@ #defineETH_DRIVER_VERSION "3.4.2" #endif -char mlx5e_version[] = "Mellanox Ethernet driver" -" (" ETH_DRIVER_VERSION ")"; +static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " + ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; static int mlx5e_get_wqe_sz(struct mlx5e_priv *priv, u32 *wqe_sz, u32 *nsegs); @@ -3687,9 +3687,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) /* set default MTU */ mlx5e_set_dev_port_mtu(ifp, ifp->if_mtu); - /* Set desc */ - device_set_desc(mdev->pdev->dev.bsddev, mlx5e_version); - /* Set default media status */ priv->media_status_last = IFM_AVALID; priv->media_active_last = IFM_ETHER | IFM_AUTO | @@ -3805,13 +3802,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* don't allow more IOCTLs */ priv->gone = 1; - /* -* Clear the device description to avoid use after free, -* because the bsddev is not destroyed when this module is -* unloaded: -*/ - device_set_desc(mdev->pdev->dev.bsddev, NULL); - /* XXX wait a bit to allow IOCTL handlers to complete */ pause("W", hz); @@ -3896,6 +3886,14 @@ mlx5e_cleanup(void) { mlx5_unregister_interface(_interface); } + +static void +mlx5e_show_version(void __unused *arg) +{ + + printf("%s", mlx5e_version); +} +SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, NULL); module_init_order(mlx5e_init, SI_ORDER_THIRD); module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD); Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:46:39 2018 (r341566) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:47:10 2018 (r341567) @@ -50,7 +50,7 @@ #include #include "mlx5_ib.h" -#define DRIVER_NAME "mlx5_ib" +#define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION #define DRIVER_VERSION "3.4.2" #endif @@ -2963,8 +2963,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce)) return NULL; - printk_once(KERN_INFO "%s", mlx5_version); - dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); if (!dev) return NULL; @@ -3258,6 +3256,14 @@ static void __exit mlx5_ib_cleanup(void) mlx5_unregister_interface(_ib_interface); mlx5_ib_odp_cleanup(); } + +static void +mlx5_ib_show_version(void __unused *arg) +{ + + printf("%s",
svn commit: r341566 - in head/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Wed Dec 5 13:46:39 2018 New Revision: 341566 URL: https://svnweb.freebsd.org/changeset/base/341566 Log: mlx5: Fixes to allow command polling mode to exist alongside event mode. A command is either polling or event driven and the mode cannot change during execution of a command. Make sure the event handler only handle commands which are not polled. This is done by checking the command mode in the command handler before completing commands. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_eq.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:46:09 2018(r341565) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:46:39 2018(r341566) @@ -327,6 +327,11 @@ struct mlx5_traffic_counter { u64 octets; }; +enum mlx5_cmd_mode { + MLX5_CMD_MODE_POLLING, + MLX5_CMD_MODE_EVENTS +}; + struct mlx5_cmd_stats { u64 sum; u64 n; @@ -370,8 +375,9 @@ struct mlx5_cmd { struct workqueue_struct *wq; struct semaphore sem; struct semaphore pages_sem; - int mode; - struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS]; + enum mlx5_cmd_mode mode; + struct mlx5_cmd_work_ent * volatile ent_arr[MLX5_MAX_COMMANDS]; + volatile enum mlx5_cmd_mode ent_mode[MLX5_MAX_COMMANDS]; struct mlx5_cmd_debug dbg; struct cmd_msg_cache cache; int checksum_disabled; @@ -984,7 +990,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:46:09 2018 (r341565) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:46:39 2018 (r341566) @@ -50,11 +50,6 @@ enum { }; enum { - CMD_MODE_POLLING, - CMD_MODE_EVENTS -}; - -enum { NUM_LONG_LISTS= 2, NUM_MED_LISTS = 64, LONG_LIST_SIZE= (2ULL * 1024 * 1024 * 1024 / PAGE_SIZE) * 8 + 16 + @@ -160,6 +155,8 @@ static int alloc_ent(struct mlx5_cmd_work_ent *ent) ent->busy = 1; ent->idx = ret; clear_bit(ent->idx, >bitmask); + cmd->ent_mode[ent->idx] = + ent->polling ? MLX5_CMD_MODE_POLLING : MLX5_CMD_MODE_EVENTS; cmd->ent_arr[ent->idx] = ent; } spin_unlock_irqrestore(>alloc_lock, flags); @@ -172,6 +169,8 @@ static void free_ent(struct mlx5_cmd *cmd, int idx) unsigned long flags; spin_lock_irqsave(>alloc_lock, flags); + cmd->ent_arr[idx] = NULL; /* safety clear */ + cmd->ent_mode[idx] = MLX5_CMD_MODE_POLLING; /* reset mode */ set_bit(idx, >bitmask); spin_unlock_irqrestore(>alloc_lock, flags); } @@ -786,7 +785,7 @@ static void cb_timeout_handler(struct work_struct *wor mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); -mlx5_cmd_comp_handler(dev, 1UL << ent->idx); +mlx5_cmd_comp_handler(dev, 1UL << ent->idx, MLX5_CMD_MODE_EVENTS); } static void complete_command(struct mlx5_cmd_work_ent *ent) @@ -897,11 +896,12 @@ static void cmd_work_handler(struct work_struct *work) mlx5_fwp_flush(cmd->cmd_page); iowrite32be(1 << ent->idx, >iseg->cmd_dbell); mmiowb(); - /* if not in polling don't use ent after this point*/ - if (cmd->mode == CMD_MODE_POLLING || poll_cmd) { + + /* if not in polling don't use ent after this point */ + if (poll_cmd) { poll_timeout(ent); /* make sure we read the descriptor after ownership is SW */ - mlx5_cmd_comp_handler(dev, 1U << ent->idx); + mlx5_cmd_comp_handler(dev, 1U << ent->idx, MLX5_CMD_MODE_POLLING); } } @@ -938,15
svn commit: r341564 - head/sys/dev/mlx5/mlx5_en
Author: slavash Date: Wed Dec 5 13:45:37 2018 New Revision: 341564 URL: https://svnweb.freebsd.org/changeset/base/341564 Log: mlx5: Add software tx_jumbo_packets counter This counter will represent transmitted packets which has more than 1518 octets. The NIC has multiple hardware counters for counting transmitted packets larger than 1518 octets. Each counter counts the packets in specific range. We accumulate those counters to have a single counter. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 13:45:08 2018 (r341563) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Dec 5 13:45:37 2018 (r341564) @@ -178,7 +178,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); m(+1, u64 tx_csum_offload, "tx_csum_offload", "Transmit checksum offload packets") \ m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \ m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \ - m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") + m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \ + m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") #defineMLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:45:08 2018 (r341563) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:45:37 2018 (r341564) @@ -502,6 +502,12 @@ mlx5e_update_stats_work(struct work_struct *work) } } + s->tx_jumbo_packets = + priv->stats.port_stats_debug.p1519to2047octets + + priv->stats.port_stats_debug.p2048to4095octets + + priv->stats.port_stats_debug.p4096to8191octets + + priv->stats.port_stats_debug.p8192to10239octets; + /* update counters */ s->tso_packets = tso_packets; s->tso_bytes = tso_bytes; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341565 - head/sys/dev/mlx5/mlx5_core
Author: slavash Date: Wed Dec 5 13:46:09 2018 New Revision: 341565 URL: https://svnweb.freebsd.org/changeset/base/341565 Log: mlx5: Fix wrong size allocation for QoS ETC TC register The driver allocates wrong size (due to wrong struct name) when issuing a query/set request to NIC's register. Linux commit: d14fcb8d877caf1b8d6bd65d444bf62b21f2070c Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 13:45:37 2018 (r341564) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Dec 5 13:46:09 2018 (r341565) @@ -810,7 +810,7 @@ int mlx5_query_port_cong_params(struct mlx5_core_dev * static int mlx5_query_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *out, int outlen) { - u32 in[MLX5_ST_SZ_DW(qtct_reg)]; + u32 in[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; @@ -831,7 +831,7 @@ EXPORT_SYMBOL_GPL(mlx5_max_tc); static int mlx5_set_port_qetcr_reg(struct mlx5_core_dev *mdev, u32 *in, int inlen) { - u32 out[MLX5_ST_SZ_DW(qtct_reg)]; + u32 out[MLX5_ST_SZ_DW(qetc_reg)]; if (!MLX5_CAP_GEN(mdev, ets)) return -ENOTSUPP; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341563 - in head/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Wed Dec 5 13:45:08 2018 New Revision: 341563 URL: https://svnweb.freebsd.org/changeset/base/341563 Log: mlx5: Implement support for configuring PCIe packet write ordering via a sysctl. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_mr.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_mr.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 5 13:44:38 2018 (r341562) +++ head/sys/dev/mlx5/mlx5_core/mlx5_mr.c Wed Dec 5 13:45:08 2018 (r341563) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,11 @@ #include #include "mlx5_core.h" +static int mlx5_relaxed_ordering_write; +SYSCTL_INT(_hw_mlx5, OID_AUTO, relaxed_ordering_write, CTLFLAG_RWTUN, +_relaxed_ordering_write, 0, +"Set to enable relaxed ordering for PCIe writes"); + void mlx5_init_mr_table(struct mlx5_core_dev *dev) { struct mlx5_mr_table *table = >priv.mr_table; @@ -63,6 +68,14 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry); MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY); MLX5_SET(mkc, mkc, mkey_7_0, key); + + if (mlx5_relaxed_ordering_write != 0) { + if (MLX5_CAP_GEN(dev, relaxed_ordering_write)) + MLX5_SET(mkc, mkc, relaxed_ordering_write, 1); + else + return (-EPROTONOSUPPORT); + } + if (callback) return mlx5_cmd_exec_cb(dev, in, inlen, out, outlen, callback, context); Modified: head/sys/dev/mlx5/mlx5_ifc.h == --- head/sys/dev/mlx5/mlx5_ifc.hWed Dec 5 13:44:38 2018 (r341562) +++ head/sys/dev/mlx5/mlx5_ifc.hWed Dec 5 13:45:08 2018 (r341563) @@ -933,7 +933,8 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 log_max_cq[0x5]; u8 log_max_eq_sz[0x8]; - u8 reserved_6[0x2]; + u8 relaxed_ordering_write[1]; + u8 reserved_6[0x1]; u8 log_max_mkey[0x6]; u8 reserved_7[0xc]; u8 log_max_eq[0x4]; @@ -2424,9 +2425,13 @@ enum { }; struct mlx5_ifc_mkc_bits { - u8 reserved_0[0x1]; + u8 reserved_at_0[0x1]; u8 free[0x1]; - u8 reserved_1[0xd]; + u8 reserved_at_2[0x1]; + u8 access_mode_4_2[0x3]; + u8 reserved_at_6[0x7]; + u8 relaxed_ordering_write[0x1]; + u8 reserved_at_e[0x1]; u8 small_fence_on_rdma_read_response[0x1]; u8 umr_en[0x1]; u8 a[0x1]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341562 - in head/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Wed Dec 5 13:44:38 2018 New Revision: 341562 URL: https://svnweb.freebsd.org/changeset/base/341562 Log: mlx5: Extend vector argument to u64. Else the MLX5_TRIGGERED_CMD_COMP flag will be masked away. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:44:08 2018(r341561) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:44:38 2018(r341562) @@ -984,7 +984,7 @@ void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector); +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, int nent, u64 mask, const char *name, struct mlx5_uar *uar); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:44:08 2018 (r341561) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Dec 5 13:44:38 2018 (r341562) @@ -1179,10 +1179,12 @@ static void free_msg(struct mlx5_core_dev *dev, struct } } -void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u32 vector) +void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector_flags) { struct mlx5_cmd *cmd = >cmd; struct mlx5_cmd_work_ent *ent; + bool triggered = (vector_flags & MLX5_TRIGGERED_CMD_COMP) ? 1 : 0; + u32 vector = vector_flags; /* discard flags in the upper dword */ int i; /* make sure data gets read from RAM */ @@ -1206,7 +1208,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, else ent->ret = 0; ent->status = ent->lay->status_own >> 1; - if (vector & MLX5_TRIGGERED_CMD_COMP) + if (triggered) ent->status = MLX5_DRIVER_STATUS_ABORTED; else ent->status = ent->lay->status_own >> 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341561 - head/sys/dev/mlx5/mlx5_core
Author: slavash Date: Wed Dec 5 13:44:08 2018 New Revision: 341561 URL: https://svnweb.freebsd.org/changeset/base/341561 Log: mlx5: Add global control to disable firmware reset, for all mlx5 devices. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:37 2018 (r341560) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:44:08 2018 (r341561) @@ -59,6 +59,11 @@ enum { MLX5_SENSOR_FW_SYND_RFR = 5, }; +static int mlx5_fw_reset_enable = 1; +SYSCTL_INT(_hw_mlx5, OID_AUTO, fw_reset_enable, CTLFLAG_RWTUN, +_fw_reset_enable, 0, +"Enable firmware reset"); + static int lock_sem_sw_reset(struct mlx5_core_dev *dev) { int ret; @@ -180,10 +185,13 @@ static u32 check_fatal_sensors(struct mlx5_core_dev *d static void reset_fw_if_needed(struct mlx5_core_dev *dev) { - bool supported = (ioread32be(>iseg->initializing) >> - MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; + bool supported; u32 cmdq_addr, fatal_error; + if (!mlx5_fw_reset_enable) + return; + supported = (ioread32be(>iseg->initializing) >> + MLX5_FW_RESET_SUPPORTED_OFFSET) & 1; if (!supported) return; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341560 - in head/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Wed Dec 5 13:43:37 2018 New Revision: 341560 URL: https://svnweb.freebsd.org/changeset/base/341560 Log: mlx5: Fix use-after-free in self-healing flow When the mlx5 health mechanism detects a problem while the driver is in the middle of init_one or remove_one, the driver needs to prevent the health mechanism from scheduling future work; if future work is scheduled, there is a problem with use-after-free: the system WQ tries to run the work item (which has been freed) at the scheduled future time. Prevent this by disabling work item scheduling in the health mechanism when the driver is in the middle of init_one() or remove_one(). Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:43:07 2018(r341559) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:43:37 2018(r341560) @@ -923,7 +923,7 @@ void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, s void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); -void mlx5_stop_health_poll(struct mlx5_core_dev *dev); +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_drain_health_recovery(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:07 2018 (r341559) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:43:37 2018 (r341560) @@ -516,9 +516,17 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev) round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); } -void mlx5_stop_health_poll(struct mlx5_core_dev *dev) +void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health) { struct mlx5_core_health *health = >priv.health; + unsigned long flags; + + if (disable_health) { + spin_lock_irqsave(>wq_lock, flags); + set_bit(MLX5_DROP_NEW_HEALTH_WORK, >flags); + set_bit(MLX5_DROP_NEW_RECOVERY_WORK, >flags); + spin_unlock_irqrestore(>wq_lock, flags); + } del_timer_sync(>timer); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:07 2018 (r341559) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:37 2018 (r341560) @@ -1107,7 +1107,7 @@ err_cleanup_once: mlx5_cleanup_once(dev); err_stop_poll: - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, boot); if (mlx5_cmd_teardown_hca(dev)) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); goto out_err; @@ -1159,7 +1159,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_disable_msix(dev); if (cleanup) mlx5_cleanup_once(dev); - mlx5_stop_health_poll(dev); + mlx5_stop_health_poll(dev, cleanup); err = mlx5_cmd_teardown_hca(dev); if (err) { device_printf((>pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); @@ -1405,6 +1405,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev * mlx5_core_dbg(dev, "Device in internal error state, giving up\n"); return -EAGAIN; } + + /* Panic tear down fw command will stop the PCI bus communication +* with the HCA, so the health polll is no longer needed. +*/ + mlx5_drain_health_wq(dev); + mlx5_stop_health_poll(dev, false); err = mlx5_cmd_force_teardown_hca(dev); if (err) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341559 - in head/sys/dev/mlx5: mlx5_core mlx5_en
Author: slavash Date: Wed Dec 5 13:43:07 2018 New Revision: 341559 URL: https://svnweb.freebsd.org/changeset/base/341559 Log: mlx5: Move hw.mlx5 node definition to mlx5_core. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Dec 5 13:43:07 2018 (r341559) @@ -103,4 +103,6 @@ struct mlx5_crspace_regmap { extern struct pci_driver mlx5_core_driver; +SYSCTL_DECL(_hw_mlx5); + #endif /* __MLX5_CORE_H__ */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:43:07 2018 (r341559) @@ -61,6 +61,8 @@ static int prof_sel = MLX5_DEFAULT_PROF; module_param_named(prof_sel, prof_sel, int, 0444); MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2"); +SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 HW controls"); + #define NUMA_NO_NODE -1 static LIST_HEAD(intf_list); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:42:36 2018 (r341558) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Dec 5 13:43:07 2018 (r341559) @@ -159,7 +159,7 @@ static const struct { MALLOC_DEFINE(M_MLX5EN, "MLX5EN", "MLX5 Ethernet"); -static SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "MLX5 driver parameters"); +SYSCTL_DECL(_hw_mlx5); static void mlx5e_update_carrier(struct mlx5e_priv *priv) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341558 - head/sys/dev/mlx5/mlx5_core
Author: slavash Date: Wed Dec 5 13:42:36 2018 New Revision: 341558 URL: https://svnweb.freebsd.org/changeset/base/341558 Log: mlx5: Convert some spaces into tabs and use device_printf() instead of printf(). Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:06 2018 (r341557) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Dec 5 13:42:36 2018 (r341558) @@ -1211,7 +1211,7 @@ static int init_one(struct pci_dev *pdev, priv->pci_dev_data = id->driver_data; if (prof_sel < 0 || prof_sel >= ARRAY_SIZE(profiles)) { - printf("mlx5_core: WARN: ""selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); + device_printf(bsddev, "WARN: selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); prof_sel = MLX5_DEFAULT_PROF; } dev->profile = [prof_sel]; @@ -1226,38 +1226,38 @@ static int init_one(struct pci_dev *pdev, INIT_LIST_HEAD(>ctx_list); spin_lock_init(>ctx_lock); -mutex_init(>pci_status_mutex); -mutex_init(>intf_state_mutex); + mutex_init(>pci_status_mutex); + mutex_init(>intf_state_mutex); err = mlx5_pci_init(dev, priv); if (err) { - device_printf((>dev)->bsddev, "ERR: ""mlx5_pci_init failed %d\n", err); + device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err); goto clean_dev; } -err = mlx5_health_init(dev); -if (err) { -device_printf((>dev)->bsddev, "ERR: ""mlx5_health_init failed %d\n", err); -goto close_pci; -} + err = mlx5_health_init(dev); + if (err) { + device_printf(bsddev, "ERR: mlx5_health_init failed %d\n", err); + goto close_pci; + } mlx5_pagealloc_init(dev); err = mlx5_load_one(dev, priv, true); if (err) { - device_printf((>dev)->bsddev, "ERR: ""mlx5_register_device failed %d\n", err); + device_printf(bsddev, "ERR: mlx5_load_one failed %d\n", err); goto clean_health; } mlx5_fwdump_prep(dev); - pci_save_state(pdev->dev.bsddev); + pci_save_state(bsddev); return 0; clean_health: mlx5_pagealloc_cleanup(dev); -mlx5_health_cleanup(dev); + mlx5_health_cleanup(dev); close_pci: -mlx5_pci_close(dev, priv); + mlx5_pci_close(dev, priv); clean_dev: sysctl_ctx_free(>sysctl_ctx); kfree(dev); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341557 - in head/sys/dev/mlx5: . mlx5_ib
Author: slavash Date: Wed Dec 5 13:42:06 2018 New Revision: 341557 URL: https://svnweb.freebsd.org/changeset/base/341557 Log: mlx5: Add SRQ fixes from Linux Combine multiple fixes from Linux to SRQ. Linux commits: c73b791 IB/mlx5: Assign SRQ type earlier 0fd27a8 IB/mlx5: Fix out-of-bound access c2b37f7 IB/mlx5: Fix integer overflows in mlx5_ib_create_srq d63c467 RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Dec 5 13:41:37 2018(r341556) +++ head/sys/dev/mlx5/driver.h Wed Dec 5 13:42:06 2018(r341557) @@ -462,8 +462,8 @@ struct mlx5_core_srq { struct mlx5_core_rsc_common common; /* must be first */ u32 srqn; int max; - int max_gs; - int max_avail_gather; + size_t max_gs; + size_t max_avail_gather; int wqe_shift; void(*event)(struct mlx5_core_srq *, int); atomic_trefcount; Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:41:37 2018 (r341556) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_srq.c Wed Dec 5 13:42:06 2018 (r341557) @@ -159,8 +159,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, int err; int i; struct mlx5_wqe_srq_next_seg *next; - int page_shift; - int npages; err = mlx5_db_alloc(dev->mdev, >db); if (err) { @@ -173,7 +171,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, err = -ENOMEM; goto err_db; } - page_shift = srq->buf.page_shift; srq->head= 0; srq->tail= srq->msrq.max - 1; @@ -185,10 +182,8 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, cpu_to_be16((i + 1) & (srq->msrq.max - 1)); } - npages = DIV_ROUND_UP(srq->buf.npages, 1 << (page_shift - PAGE_SHIFT)); - mlx5_ib_dbg(dev, "buf_size %d, page_shift %d, npages %d, calc npages %d\n", - buf_size, page_shift, srq->buf.npages, npages); - in->pas = mlx5_vzalloc(sizeof(*in->pas) * npages); + mlx5_ib_dbg(dev, "srq->buf.page_shift = %d\n", srq->buf.page_shift); + in->pas = mlx5_vzalloc(sizeof(*in->pas) * srq->buf.npages); if (!in->pas) { err = -ENOMEM; goto err_buf; @@ -204,7 +199,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, } srq->wq_sig = !!srq_signature; - in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT; + in->log_page_size = srq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT; if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 && in->type == IB_SRQT_XRC) in->user_index = MLX5_IB_DEFAULT_UIDX; @@ -242,8 +237,8 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, { struct mlx5_ib_dev *dev = to_mdev(pd->device); struct mlx5_ib_srq *srq; - int desc_size; - int buf_size; + size_t desc_size; + size_t buf_size; int err; struct mlx5_srq_attr in = {0}; __u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz); @@ -267,15 +262,25 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd, desc_size = sizeof(struct mlx5_wqe_srq_next_seg) + srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg); + if (desc_size == 0 || srq->msrq.max_gs > desc_size) { + err = -EINVAL; + goto err_srq; + } desc_size = roundup_pow_of_two(desc_size); - desc_size = max_t(int, 32, desc_size); + desc_size = max_t(size_t, 32, desc_size); + if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg)) { + err = -EINVAL; + goto err_srq; + } srq->msrq.max_avail_gather = (desc_size - sizeof(struct mlx5_wqe_srq_next_seg)) / sizeof(struct mlx5_wqe_data_seg); srq->msrq.wqe_shift = ilog2(desc_size); buf_size = srq->msrq.max * desc_size; - mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n", - desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs, - srq->msrq.max_avail_gather); + if (buf_size < desc_size) { + err = -EINVAL; +
svn commit: r341555 - in head/sys/dev/mlx5: mlx5_core mlx5_en
Author: slavash Date: Wed Dec 5 13:41:06 2018 New Revision: 341555 URL: https://svnweb.freebsd.org/changeset/base/341555 Log: mlx5: Discard unused return values. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec 5 13:40:36 2018(r341554) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec 5 13:41:06 2018(r341555) @@ -128,7 +128,7 @@ mlx5_fwp_alloc(struct mlx5_core_dev *dev, gfp_t flags, /* load memory into DMA */ MLX5_DMA_LOCK(dev); - err = bus_dmamap_load( + (void) bus_dmamap_load( dev->cmd.dma_tag, fwp[x].dma_map, fwp[x].virt_addr, MLX5_ADAPTER_PAGE_SIZE, _fwp_load_mem_cb, fwp + x, BUS_DMA_WAITOK | BUS_DMA_COHERENT); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 13:40:36 2018 (r341554) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Wed Dec 5 13:41:06 2018 (r341555) @@ -421,7 +421,6 @@ mlx5e_rlw_channel_set_rate_locked(struct mlx5e_rl_work if (rate == 0) { /* rate doesn't exist, fallback to unlimited */ - error = EINVAL; index = 0; rate = 0; atomic_add_64(>priv->rl.stats.tx_modify_rate_failure, 1ULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341556 - head/sys/dev/mlx5/mlx5_core
Author: slavash Date: Wed Dec 5 13:41:37 2018 New Revision: 341556 URL: https://svnweb.freebsd.org/changeset/base/341556 Log: mlx5: Fix for potential memory leaks. Make sure allocated data gets freed in error cases. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c head/sys/dev/mlx5/mlx5_core/mlx5_vport.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:06 2018 (r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Wed Dec 5 13:41:37 2018 (r341556) @@ -1601,9 +1601,10 @@ static char *get_dest_name(struct mlx5_flow_destinatio case MLX5_FLOW_CONTEXT_DEST_TYPE_TIR: snprintf(name, 20, "dest_%s_%u", "tir", dest->tir_num); return name; + default: + kfree(name); + return NULL; } - - return NULL; } /* assumed fg is locked */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec 5 13:41:06 2018(r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.cWed Dec 5 13:41:37 2018(r341556) @@ -153,6 +153,7 @@ failure: bus_dmamem_free(dev->cmd.dma_tag, fwp[x].virt_addr, fwp[x].dma_map); } sx_xunlock(>cmd.dma_sx); + kfree(fwp); return (NULL); } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vport.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec 5 13:41:06 2018 (r341555) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vport.cWed Dec 5 13:41:37 2018 (r341556) @@ -1597,8 +1597,8 @@ int mlx5_query_vport_counter(struct mlx5_core_dev *dev err = mlx5_cmd_exec(dev, in, in_sz, out, out_size); - kvfree(in); ex: + kvfree(in); return err; } EXPORT_SYMBOL_GPL(mlx5_query_vport_counter); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341554 - in head/sys/dev/mlx5: mlx5_core mlx5_ib
Author: slavash Date: Wed Dec 5 13:40:36 2018 New Revision: 341554 URL: https://svnweb.freebsd.org/changeset/base/341554 Log: mlx5: Raise fatal IB event when sys error occurs All other mlx5_events report the port number as 1 based, which is how FW reports it in the port event EQE. Reporting 0 for this event causes mlx5_ib to not raise a fatal event notification to registered clients due to a seemingly invalid port. All switch cases in mlx5_ib_event that go through the port check are supposed to set the port now, so just do it once at variable declaration. Linux commit: aba462134634b502d720e15b23154f21cfa277e5 Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:40:05 2018 (r341553) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Dec 5 13:40:36 2018 (r341554) @@ -269,7 +269,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, mlx5_core_err(dev, "system error event triggered\n"); err_state_done: - mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0); + mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 1); mutex_unlock(>intf_state_mutex); } Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:40:05 2018 (r341553) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Dec 5 13:40:36 2018 (r341554) @@ -2335,7 +2335,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v struct mlx5_ib_dev *ibdev = (struct mlx5_ib_dev *)context; struct ib_event ibev; bool fatal = false; - u8 port = 0; + u8 port = (u8)param; switch (event) { case MLX5_DEV_EVENT_SYS_ERROR: @@ -2347,8 +2347,6 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v case MLX5_DEV_EVENT_PORT_UP: case MLX5_DEV_EVENT_PORT_DOWN: case MLX5_DEV_EVENT_PORT_INITIALIZED: - port = (u8)param; - /* In RoCE, port up/down events are handled in * mlx5_netdev_event(). */ @@ -2362,24 +2360,20 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v case MLX5_DEV_EVENT_LID_CHANGE: ibev.event = IB_EVENT_LID_CHANGE; - port = (u8)param; break; case MLX5_DEV_EVENT_PKEY_CHANGE: ibev.event = IB_EVENT_PKEY_CHANGE; - port = (u8)param; schedule_work(>devr.ports[port - 1].pkey_change_work); break; case MLX5_DEV_EVENT_GUID_CHANGE: ibev.event = IB_EVENT_GID_CHANGE; - port = (u8)param; break; case MLX5_DEV_EVENT_CLIENT_REREG: ibev.event = IB_EVENT_CLIENT_REREGISTER; - port = (u8)param; break; default: @@ -2390,7 +2384,7 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, v ibev.device = >ib_dev; ibev.element.port_num = port; - if (port < 1 || port > ibdev->num_ports) { + if (!rdma_is_port_valid(>ib_dev, port)) { mlx5_ib_warn(ibdev, "warning: event(%d) on port %d\n", event, port); return; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341553 - head/sys/dev/mlx5/mlx5_ib
Author: slavash Date: Wed Dec 5 13:40:05 2018 New Revision: 341553 URL: https://svnweb.freebsd.org/changeset/base/341553 Log: mlx5: Fix integer overflow while resizing CQ The user can provide very large cqe_size which will cause to integer overflow. Linux commit: 28e9091e3119933c38933cb8fc48d5618eb784c8 Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Dec 5 13:39:35 2018 (r341552) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Dec 5 13:40:05 2018 (r341553) @@ -1124,7 +1124,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct if (ucmd.reserved0 || ucmd.reserved1) return -EINVAL; - umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size, + /* check multiplication overflow */ + if (ucmd.cqe_size && SIZE_MAX / ucmd.cqe_size <= entries - 1) + return -EINVAL; + + umem = ib_umem_get(context, ucmd.buf_addr, + (size_t)ucmd.cqe_size * entries, IB_ACCESS_LOCAL_WRITE, 1); if (IS_ERR(umem)) { err = PTR_ERR(umem); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341551 - head/sys/dev/mlx4/mlx4_core
Author: slavash Date: Wed Dec 5 13:39:05 2018 New Revision: 341551 URL: https://svnweb.freebsd.org/changeset/base/341551 Log: mlx4: Make sure default VNET is set when adding a new interface. Adding an interface might be done outside the device_attach() routine and will then cause a panic, due to the VNET not being defined. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_intf.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec 5 13:38:35 2018 (r341550) +++ head/sys/dev/mlx4/mlx4_core/mlx4_intf.c Wed Dec 5 13:39:05 2018 (r341551) @@ -62,8 +62,11 @@ static void mlx4_add_device(struct mlx4_interface *int spin_lock_irq(>ctx_lock); list_add_tail(_ctx->list, >ctx_list); spin_unlock_irq(>ctx_lock); - if (intf->activate) + if (intf->activate) { + CURVNET_SET_QUIET(vnet0); intf->activate(>dev, dev_ctx->context); + CURVNET_RESTORE(); + } } else kfree(dev_ctx); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341552 - head/sys/dev/mlx4/mlx4_en
Author: slavash Date: Wed Dec 5 13:39:35 2018 New Revision: 341552 URL: https://svnweb.freebsd.org/changeset/base/341552 Log: mlx4en: Optimise reception of small packets. Copy small packets like TCP ACKs into a new mbuf reusing the existing mbuf to receive a new ethernet frame. This avoids wasting buffer space for small sized packets. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:39:05 2018 (r341551) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:39:35 2018 (r341552) @@ -629,6 +629,24 @@ mlx4_en_rx_mb(struct mlx4_en_priv *priv, struct mlx4_e #endif struct mbuf *mb; + /* optimise reception of small packets */ + if (length <= (MHLEN - MLX4_NET_IP_ALIGN) && + (mb = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { + + /* set packet length */ + mb->m_pkthdr.len = mb->m_len = length; + + /* make sure IP header gets aligned */ + mb->m_data += MLX4_NET_IP_ALIGN; + + bus_dmamap_sync(ring->dma_tag, mb_list->dma_map, + BUS_DMASYNC_POSTREAD); + + bcopy(mtod(mb_list->mbuf, caddr_t), mtod(mb, caddr_t), length); + + return (mb); + } + /* get mbuf */ mb = mb_list->mbuf; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341550 - head/sys/dev/mlx4/mlx4_en
Author: slavash Date: Wed Dec 5 13:38:35 2018 New Revision: 341550 URL: https://svnweb.freebsd.org/changeset/base/341550 Log: mlx4en: Remove duplicate statistics variable assignment. The "priv->pkstats.rx_dropped" is written twice in a row. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_port.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cWed Dec 5 13:32:46 2018 (r341549) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_port.cWed Dec 5 13:38:35 2018 (r341550) @@ -256,7 +256,6 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u priv->pkstats.rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength); priv->pkstats.rx_over_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw); priv->pkstats.rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC); - priv->pkstats.rx_dropped = be32_to_cpu(mlx4_en_stats->RdropOvflw); priv->pkstats.tx_dropped = be32_to_cpu(mlx4_en_stats->TDROP); /* RX stats */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341542 - head/sys/dev/mlx4/mlx4_core
Author: slavash Date: Wed Dec 5 13:29:16 2018 New Revision: 341542 URL: https://svnweb.freebsd.org/changeset/base/341542 Log: mlx4core: Avoid multiplication overflow by casting multiplication. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_icm.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Wed Dec 5 13:28:46 2018 (r341541) +++ head/sys/dev/mlx4/mlx4_core/mlx4_icm.c Wed Dec 5 13:29:16 2018 (r341542) @@ -411,7 +411,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct m size = (u64) nobj * obj_size; for (i = 0; i * MLX4_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) { chunk_size = MLX4_TABLE_CHUNK_SIZE; - if ((i + 1) * MLX4_TABLE_CHUNK_SIZE > size) + if ((u64) (i + 1) * MLX4_TABLE_CHUNK_SIZE > size) chunk_size = PAGE_ALIGN(size - i * MLX4_TABLE_CHUNK_SIZE); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341540 - head/contrib/ofed/libibverbs
Author: slavash Date: Wed Dec 5 13:28:17 2018 New Revision: 341540 URL: https://svnweb.freebsd.org/changeset/base/341540 Log: libibverbs: Fix memory leak in ibv_read_sysfs_file(). Testing packetdrill using valgrind resulted in finding a memory leak in ibv_read_sysfs_file(). The attached patch fixes it. Submitted by: tuexen@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/libibverbs/sysfs.c Modified: head/contrib/ofed/libibverbs/sysfs.c == --- head/contrib/ofed/libibverbs/sysfs.cWed Dec 5 13:27:48 2018 (r341539) +++ head/contrib/ofed/libibverbs/sysfs.cWed Dec 5 13:28:17 2018 (r341540) @@ -79,7 +79,7 @@ int ibv_read_sysfs_file(const char *dir, const char *f char *buf, size_t size) { char *path, *s; - int fd; + int ret; size_t len; if (asprintf(, "%s/%s", dir, file) < 0) @@ -89,11 +89,12 @@ int ibv_read_sysfs_file(const char *dir, const char *f if (*s == '/') *s = '.'; -len = size; -if (sysctlbyname([1], buf, , NULL, 0) == -1) - return -1; - + len = size; + ret = sysctlbyname([1], buf, , NULL, 0); free(path); + + if (ret == -1) + return -1; if (len > 0 && buf[len - 1] == '\n') buf[--len] = '\0'; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341547 - head/sys/dev/mlx4/mlx4_en
Author: slavash Date: Wed Dec 5 13:31:45 2018 New Revision: 341547 URL: https://svnweb.freebsd.org/changeset/base/341547 Log: mlx4en: Remove the DRBR and associated logic in the transmit path. The hardware queues are deep enough currently and using the DRBR and associated callbacks only leads to more task switching in the TX path. The is also a race setting the queue_state which can lead to hung TX rings. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/mlx4_en/en.h == --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:45 2018 (r341547) @@ -271,10 +271,8 @@ struct mlx4_en_tx_ring { u32 doorbell_qpn; u8 *buf; u16 poll_cnt; - int blocked; struct mlx4_en_tx_info *tx_info; u8 queue_index; - struct buf_ring *br; u32 last_nr_txbb; struct mlx4_qp qp; struct mlx4_qp_context context; @@ -806,7 +804,6 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, u32 size, u16 stride); -void mlx4_en_tx_que(void *context, int pending); void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_cq.c Wed Dec 5 13:31:45 2018 (r341547) @@ -44,6 +44,10 @@ static void mlx4_en_cq_event(struct mlx4_cq *cq, enum return; } +static void mlx4_en_tx_que(void *arg, int pending) +{ + +} int mlx4_en_create_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:45 2018 (r341547) @@ -1574,9 +1574,12 @@ static void mlx4_en_restart(struct work_struct *work) if (priv->blocked == 0 || priv->port_up == 0) return; for (i = 0; i < priv->tx_ring_num; i++) { + int watchdog_time; + ring = priv->tx_ring[i]; - if (ring->blocked && - ring->watchdog_time + MLX4_EN_WATCHDOG_TIMEOUT < ticks) + watchdog_time = READ_ONCE(ring->watchdog_time); + if (watchdog_time != 0 && + time_after(ticks, ring->watchdog_time)) goto reset; } return; Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:31:14 2018 (r341546) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Wed Dec 5 13:31:45 2018 (r341547) @@ -94,15 +94,6 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, mtx_init(>tx_lock.m, "mlx4 tx", NULL, MTX_DEF); mtx_init(>comp_lock.m, "mlx4 comp", NULL, MTX_DEF); - /* Allocate the buf ring */ - ring->br = buf_ring_alloc(MLX4_EN_DEF_TX_QUEUE_SIZE, M_DEVBUF, - M_WAITOK, >tx_lock.m); - if (ring->br == NULL) { - en_err(priv, "Failed allocating tx_info ring\n"); - err = -ENOMEM; - goto err_free_dma_tag; - } - tmp = size * sizeof(struct mlx4_en_tx_info); ring->tx_info = kzalloc_node(tmp, GFP_KERNEL, node); if (!ring->tx_info) { @@ -190,8 +181,6 @@ err_dma_map: err_info: vfree(ring->tx_info); err_ring: - buf_ring_free(ring->br, M_DEVBUF); -err_free_dma_tag: bus_dma_tag_destroy(ring->dma_tag); done: kfree(ring); @@ -206,7 +195,6 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv uint32_t x; en_dbg(DRV, priv, "Destroying tx ring, qpn: %d\n", ring->qpn); - buf_ring_free(ring->br, M_DEVBUF); if (ring->bf_enabled) mlx4_bf_free(mdev->dev, >bf); mlx4_qp_remove(mdev->dev, >qp); @@ -236,8 +224,8 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv ring->cons = 0x; ring->last_nr_txbb = 1; ring->poll_cnt = 0;
svn commit: r341549 - head/sys/dev/mlx4/mlx4_en
Author: slavash Date: Wed Dec 5 13:32:46 2018 New Revision: 341549 URL: https://svnweb.freebsd.org/changeset/base/341549 Log: mlx4en: Add support for receiving all data using one or more MCLBYTES sized mbufs. Also when the MTU is greater than MCLBYTES. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Modified: head/sys/dev/mlx4/mlx4_en/en.h == --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:46 2018 (r341549) @@ -75,6 +75,15 @@ #define MAX_RX_RINGS 128 #define MIN_RX_RINGS 4 #define TXBB_SIZE 64 + +#ifndef MLX4_EN_MAX_RX_SEGS +#defineMLX4_EN_MAX_RX_SEGS 1 /* or 8 */ +#endif + +#ifndef MLX4_EN_MAX_RX_BYTES +#defineMLX4_EN_MAX_RX_BYTES MCLBYTES +#endif + #define HEADROOM (2048 / TXBB_SIZE + 1) #define INIT_OWNER_BIT 0x #define STAMP_STRIDE 64 @@ -297,10 +306,12 @@ struct mlx4_en_tx_ring { }; struct mlx4_en_rx_desc { - /* actual number of entries depends on rx ring stride */ - struct mlx4_wqe_data_seg data[0]; + struct mlx4_wqe_data_seg data[MLX4_EN_MAX_RX_SEGS]; }; +/* the size of the structure above must be power of two */ +CTASSERT(powerof2(sizeof(struct mlx4_en_rx_desc))); + struct mlx4_en_rx_mbuf { bus_dmamap_t dma_map; struct mbuf *mbuf; @@ -309,7 +320,7 @@ struct mlx4_en_rx_mbuf { struct mlx4_en_rx_spare { bus_dmamap_t dma_map; struct mbuf *mbuf; - u64 paddr_be; + bus_dma_segment_t segs[MLX4_EN_MAX_RX_SEGS]; }; struct mlx4_en_rx_ring { @@ -319,7 +330,6 @@ struct mlx4_en_rx_ring { u32 size ; /* number of Rx descs*/ u32 actual_size; u32 size_mask; - u16 stride; u16 log_stride; u16 cqn;/* index of port CQ associated with this ring */ u32 prod; @@ -327,6 +337,7 @@ struct mlx4_en_rx_ring { u32 buf_size; u8 fcs_del; u32 rx_mb_size; + u32 rx_mr_key_be; int qpn; u8 *buf; struct mlx4_en_rx_mbuf *mbuf; @@ -559,7 +570,6 @@ struct mlx4_en_priv { int registered; int gone; int allocated; - int stride; unsigned char current_mac[ETH_ALEN + 2]; u64 mac; int mac_index; @@ -805,7 +815,7 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, u32 size, int node); void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, -u32 size, u16 stride); +u32 size); void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:46 2018 (r341549) @@ -1683,7 +1683,7 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) for (i = 0; i < priv->rx_ring_num; i++) { if (priv->rx_ring[i]) mlx4_en_destroy_rx_ring(priv, >rx_ring[i], - priv->prof->rx_ring_size, priv->stride); + priv->prof->rx_ring_size); if (priv->rx_cq[i]) mlx4_en_destroy_cq(priv, >rx_cq[i]); } @@ -1734,8 +1734,7 @@ err: for (i = 0; i < priv->rx_ring_num; i++) { if (priv->rx_ring[i]) mlx4_en_destroy_rx_ring(priv, >rx_ring[i], - prof->rx_ring_size, - priv->stride); + prof->rx_ring_size); if (priv->rx_cq[i]) mlx4_en_destroy_cq(priv, >rx_cq[i]); } @@ -2236,9 +2235,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int err = -EINVAL; goto out; } - - priv->stride = roundup_pow_of_two(sizeof(struct mlx4_en_rx_desc) + - DS_SIZE); mlx4_en_sysctl_conf(priv); Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed Dec 5 13:32:15 2018 (r341548) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c Wed
svn commit: r341548 - in head/sys/dev/mlx4: . mlx4_core mlx4_en
Author: slavash Date: Wed Dec 5 13:32:15 2018 New Revision: 341548 URL: https://svnweb.freebsd.org/changeset/base/341548 Log: mlx4en: Add support for netdump. Implement the needed callback functions and support for polling the driver. Differential Revision: https://reviews.freebsd.org/D15259 Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/driver.h head/sys/dev/mlx4/mlx4_core/mlx4_eq.c head/sys/dev/mlx4/mlx4_en/en.h head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c head/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c Modified: head/sys/dev/mlx4/driver.h == --- head/sys/dev/mlx4/driver.h Wed Dec 5 13:31:45 2018(r341547) +++ head/sys/dev/mlx4/driver.h Wed Dec 5 13:32:15 2018(r341548) @@ -101,4 +101,7 @@ static inline u64 mlx4_mac_to_u64(const u8 *addr) return mac; } +void mlx4_disable_interrupts(struct mlx4_dev *); +void mlx4_poll_interrupts(struct mlx4_dev *); + #endif /* MLX4_DRIVER_H */ Modified: head/sys/dev/mlx4/mlx4_core/mlx4_eq.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_eq.c Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_core/mlx4_eq.c Wed Dec 5 13:32:15 2018 (r341548) @@ -1535,3 +1535,34 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) } EXPORT_SYMBOL(mlx4_release_eq); +void +mlx4_disable_interrupts(struct mlx4_dev *dev) +{ + struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev); + int i; + + if (dev->flags & MLX4_FLAG_MSI_X) { + for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i) + disable_irq(priv->eq_table.eq[i].irq); + } else { + disable_irq(dev->persist->pdev->irq); + } +} +EXPORT_SYMBOL(mlx4_disable_interrupts); + +void +mlx4_poll_interrupts(struct mlx4_dev *dev) +{ + struct mlx4_priv *priv = container_of(dev, struct mlx4_priv, dev); + int i; + + if (dev->flags & MLX4_FLAG_MSI_X) { + for (i = 0; i < (dev->caps.num_comp_vectors + 1); ++i) { + mlx4_msi_x_interrupt(priv->eq_table.eq[i].irq, +priv->eq_table.eq + i); + } + } else { + mlx4_interrupt(dev->persist->pdev->irq, dev); + } +} +EXPORT_SYMBOL(mlx4_poll_interrupts); Modified: head/sys/dev/mlx4/mlx4_en/en.h == --- head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_en/en.h Wed Dec 5 13:32:15 2018 (r341548) @@ -54,6 +54,7 @@ #include #include +#include #include "en_port.h" #include @@ -784,6 +785,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct m void mlx4_en_tx_irq(struct mlx4_cq *mcq); u16 mlx4_en_select_queue(struct net_device *dev, struct mbuf *mb); +int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp); int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m); int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring **pring, Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c == --- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:31:45 2018 (r341547) +++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c Wed Dec 5 13:32:15 2018 (r341548) @@ -53,6 +53,8 @@ #include "en.h" #include "en_port.h" +NETDUMP_DEFINE(mlx4_en); + static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); @@ -2311,6 +2313,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int ifmedia_add(>media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(>media, IFM_ETHER | IFM_AUTO); + NETDUMP_SET(dev, mlx4_en); + en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num); en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); @@ -2892,3 +2896,54 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *p CTLFLAG_RD, _ring->errors, 0, "RX soft errors"); } } + +#ifdef NETDUMP +static void +mlx4_en_netdump_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) +{ + struct mlx4_en_priv *priv; + + priv = if_getsoftc(dev); + mutex_lock(>mdev->state_lock); + *nrxr = priv->rx_ring_num; + *ncl = NETDUMP_MAX_IN_FLIGHT; + *clsize = priv->rx_mb_size; + mutex_unlock(>mdev->state_lock); +} + +static void +mlx4_en_netdump_event(struct ifnet *dev, enum netdump_ev event) +{ +} + +static int +mlx4_en_netdump_transmit(struct ifnet *dev, struct mbuf *m) +{ + struct mlx4_en_priv *priv; + int err; + + priv = if_getsoftc(dev);
svn commit: r341536 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: slavash Date: Wed Dec 5 13:26:17 2018 New Revision: 341536 URL: https://svnweb.freebsd.org/changeset/base/341536 Log: ipoib: Don't do a light flush when MTU is unchanged. When changing the MTU of ibX network interfaces, check that the MTU was really changed before requesting an update of the multicast rules. Else we might go into an infinite loop joining and leaving ibX multicast groups towards the opensm master interface. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:47 2018(r341535) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:26:17 2018(r341536) @@ -305,9 +305,11 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_ priv->admin_mtu = new_mtu; error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu, priv->admin_mtu), propagate); - if (error == 0) - queue_work(ipoib_workqueue, >flush_light); - else + if (error == 0) { + /* check for MTU change to avoid infinite loop */ + if (prev_admin_mtu != new_mtu) + queue_work(ipoib_workqueue, >flush_light); + } else priv->admin_mtu = prev_admin_mtu; return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341546 - head/sys/dev/mlx4/mlx4_core
Author: slavash Date: Wed Dec 5 13:31:14 2018 New Revision: 341546 URL: https://svnweb.freebsd.org/changeset/base/341546 Log: mlx4en: Add driver version to sysctl desc Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:31:14 2018 (r341546) @@ -121,6 +121,9 @@ MODULE_PARM_DESC(enable_4k_uar, #define RESET_PERSIST_MASK_FLAGS (MLX4_FLAG_SRIOV) +static char mlx4_description[] = "Mellanox driver" +" (" DRV_VERSION ")"; + static char mlx4_version[] = DRV_NAME ": Mellanox ConnectX core driver v" DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -3780,6 +3783,7 @@ static int mlx4_init_one(struct pci_dev *pdev, const s kfree(priv); return ret; } else { + device_set_desc(pdev->dev.bsddev, mlx4_description); pci_save_state(pdev->dev.bsddev); } @@ -3907,6 +3911,13 @@ static void mlx4_remove_one(struct pci_dev *pdev) mutex_lock(>interface_state_mutex); persist->interface_state |= MLX4_INTERFACE_STATE_DELETION; mutex_unlock(>interface_state_mutex); + + /* +* Clear the device description to avoid use after free, +* because the bsddev is not destroyed when this module is +* unloaded: +*/ + device_set_desc(pdev->dev.bsddev, NULL); /* Disabling SR-IOV is not allowed while there are active vf's */ if (mlx4_is_master(dev) && dev->flags & MLX4_FLAG_SRIOV) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341545 - in head/sys/dev/mlx4: . mlx4_core
Author: slavash Date: Wed Dec 5 13:30:48 2018 New Revision: 341545 URL: https://svnweb.freebsd.org/changeset/base/341545 Log: mlx4: Add board identifier and firmware version to sysctl In last mlx4 update (r325841) we lost the sysctl to show the firmware version for mlx4 devices. Add both board identifier and firmware version under: sys.device.mlx4_core0.hw sysctl node. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/device.h head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/device.h == --- head/sys/dev/mlx4/device.h Wed Dec 5 13:30:16 2018(r341544) +++ head/sys/dev/mlx4/device.h Wed Dec 5 13:30:48 2018(r341545) @@ -877,6 +877,8 @@ struct mlx4_dev { u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; struct mlx4_vf_dev *dev_vfs; u8 uar_page_shift; + struct sysctl_ctx_list hw_ctx; + charfw_str[64]; }; struct mlx4_clock_params { Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:16 2018 (r341544) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:30:48 2018 (r341545) @@ -1893,6 +1893,7 @@ static void unmap_internal_clock(struct mlx4_dev *dev) static void mlx4_close_hca(struct mlx4_dev *dev) { + sysctl_ctx_free(>hw_ctx); unmap_internal_clock(dev); unmap_bf_area(dev); if (mlx4_is_slave(dev)) @@ -3745,10 +3746,14 @@ err_disable_pdev: static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { - struct mlx4_priv *priv; - struct mlx4_dev *dev; - int ret; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *node; + struct sysctl_oid_list *node_list; + struct mlx4_priv*priv; + struct mlx4_dev *dev; + int ret; + printk_once(KERN_INFO "%s", mlx4_version); priv = kzalloc(sizeof(*priv), GFP_KERNEL); @@ -3773,8 +3778,28 @@ static int mlx4_init_one(struct pci_dev *pdev, const s if (ret) { kfree(dev->persist); kfree(priv); + return ret; } else { pci_save_state(pdev->dev.bsddev); + } + + snprintf(dev->fw_str, sizeof(dev->fw_str), "%d.%d.%d", +(int) (dev->caps.fw_ver >> 32), +(int) (dev->caps.fw_ver >> 16) & 0x, +(int) (dev->caps.fw_ver & 0x)); + + ctx = >hw_ctx; + sysctl_ctx_init(ctx); + node = SYSCTL_ADD_NODE(ctx,SYSCTL_CHILDREN(pdev->dev.kobj.oidp), + OID_AUTO, "hw" , CTLFLAG_RD, 0, "mlx4 dev hw information"); + if (node != NULL) { + node_list = SYSCTL_CHILDREN(node); + SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO, + "fw_version", CTLFLAG_RD, dev->fw_str, 0, + "Device firmware version"); + SYSCTL_ADD_STRING(ctx, node_list, OID_AUTO, + "board_id", CTLFLAG_RD, dev->board_id, 0, + "Device board identifier"); } return ret; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341534 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:25:13 2018 New Revision: 341534 URL: https://svnweb.freebsd.org/changeset/base/341534 Log: ibcore: Fix clearing of bound device interface. Binding to a loopback device is not allowed. Make sure the destination device address is global by clearing the bound device interface. Only do this conditionally, else link local addresses won't work. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c == --- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:43 2018(r341533) +++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:25:13 2018(r341534) @@ -649,8 +649,13 @@ static int addr_resolve_neigh(struct ifnet *dev, if (dev->if_flags & IFF_LOOPBACK) { int ret; - /* find real device, not loopback one */ - addr->bound_dev_if = 0; + /* +* Binding to a loopback device is not allowed. Make +* sure the destination device address is global by +* clearing the bound device interface: +*/ + if (addr->bound_dev_if == dev->if_index) + addr->bound_dev_if = 0; ret = rdma_translate_ip(dst_in, addr); if (ret == 0) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341533 - in head/sys: compat/linuxkpi/common/include/linux ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:24:43 2018 New Revision: 341533 URL: https://svnweb.freebsd.org/changeset/base/341533 Log: ibcore: ip6_dev_find() needs to know the scope ID. Else the wrong network device can be returned for link-local addresses. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h head/sys/ofed/drivers/infiniband/core/ib_addr.c head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h == --- head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Wed Dec 5 13:24:12 2018(r341532) +++ head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Wed Dec 5 13:24:43 2018(r341533) @@ -59,37 +59,32 @@ ip_dev_find(struct vnet *vnet, uint32_t addr) } static inline struct net_device * -ip6_dev_find(struct vnet *vnet, struct in6_addr addr) +ip6_dev_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) { struct sockaddr_in6 sin6; - struct ifaddr *ifa = NULL; - struct ifnet *ifp = NULL; - int x; + struct ifaddr *ifa; + struct ifnet *ifp; memset(, 0, sizeof(sin6)); sin6.sin6_addr = addr; sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; - NET_EPOCH_ENTER(); - CURVNET_SET_QUIET(vnet); if (IN6_IS_SCOPE_LINKLOCAL() || IN6_IS_ADDR_MC_INTFACELOCAL()) { - /* XXX need to search all scope ID's */ - for (x = 0; x <= V_if_index && x < 65536; x++) { - sin6.sin6_addr.s6_addr16[1] = htons(x); - ifa = ifa_ifwithaddr((struct sockaddr *)); - if (ifa != NULL) - break; - } - } else { - ifa = ifa_ifwithaddr((struct sockaddr *)); + /* embed the IPv6 scope ID */ + sin6.sin6_addr.s6_addr16[1] = htons(scope_id); } + NET_EPOCH_ENTER(); + CURVNET_SET_QUIET(vnet); + ifa = ifa_ifwithaddr((struct sockaddr *)); + CURVNET_RESTORE(); if (ifa != NULL) { ifp = ifa->ifa_ifp; if_ref(ifp); + } else { + ifp = NULL; } NET_EPOCH_EXIT(); - CURVNET_RESTORE(); return (ifp); } Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c == --- head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:12 2018(r341532) +++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Wed Dec 5 13:24:43 2018(r341533) @@ -185,7 +185,7 @@ int rdma_translate_ip(const struct sockaddr *addr, #ifdef INET6 case AF_INET6: dev = ip6_dev_find(dev_addr->net, - ((const struct sockaddr_in6 *)addr)->sin6_addr); + ((const struct sockaddr_in6 *)addr)->sin6_addr, 0); break; #endif default: @@ -525,7 +525,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, if (addr->bound_dev_if != 0) { ifp = dev_get_by_index(addr->net, addr->bound_dev_if); } else { - ifp = ip6_dev_find(addr->net, src_in->sin6_addr); + ifp = ip6_dev_find(addr->net, src_in->sin6_addr, 0); } /* check source interface */ Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c == --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:24:12 2018(r341532) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:24:43 2018(r341533) @@ -1329,7 +1329,8 @@ static bool validate_ipv6_net_dev(struct net_device *n struct rtentry *rte; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr); + dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr, + net_dev->if_index); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341544 - head/sys/dev/mlx4/mlx4_core
Author: slavash Date: Wed Dec 5 13:30:16 2018 New Revision: 341544 URL: https://svnweb.freebsd.org/changeset/base/341544 Log: mlx4core: Add checks for invalid port numbers. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:29:46 2018 (r341543) +++ head/sys/dev/mlx4/mlx4_core/mlx4_cmd.c Wed Dec 5 13:30:16 2018 (r341544) @@ -961,6 +961,8 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, if (!err && slave != mlx4_master_func_num(dev)) { u8 *state = outsmp->data + PORT_STATE_OFFSET; + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; *state = (*state & 0xf0) | vf_port_state(dev, port, slave); slave_cap_mask = priv->mfunc.master.slave_state[slave].ib_cap_mask[port]; memcpy(outsmp->data + PORT_CAPABILITY_LOCATION_IN_SMP, _cap_mask, 4); @@ -968,8 +970,12 @@ static int mlx4_MAD_IFC_wrapper(struct mlx4_dev *dev, return err; } if (smp->attr_id == IB_SMP_ATTR_GUID_INFO) { - __be64 guid = mlx4_get_admin_guid(dev, slave, - port); + __be64 guid; + + if (port < 1 || port > dev->caps.num_ports) + return -EINVAL; + + guid = mlx4_get_admin_guid(dev, slave, port); /* set the PF admin guid to the FW/HW burned * GUID, if it wasn't yet set ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341543 - head/sys/dev/mlx4/mlx4_core
Author: slavash Date: Wed Dec 5 13:29:46 2018 New Revision: 341543 URL: https://svnweb.freebsd.org/changeset/base/341543 Log: mlx4: Zero initialize device capabilities to avoid use of uninitialized fields. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c == --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:29:16 2018 (r341542) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Wed Dec 5 13:29:46 2018 (r341543) @@ -2208,7 +2208,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) { struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_adapteradapter; - struct mlx4_dev_capdev_cap; + struct mlx4_dev_capdev_cap = {}; struct mlx4_profileprofile; struct mlx4_init_hca_param init_hca; u64 icm_size; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341532 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:24:12 2018 New Revision: 341532 URL: https://svnweb.freebsd.org/changeset/base/341532 Log: ibcore: Fix sleeping in atomic when RoCE is used A couple of places in the CM do spin_lock_irq(_id_priv->lock); ... if (cm_alloc_response_msg(work->port, work->mad_recv_wc, )) However when the underlying transport is RoCE, this leads to a sleeping function being called with the lock held - the callchain is cm_alloc_response_msg() -> ib_create_ah_from_wc() -> ib_init_ah_from_wc() -> rdma_addr_find_l2_eth_by_grh() -> rdma_resolve_ip() and rdma_resolve_ip() starts out by doing req = kzalloc(sizeof *req, GFP_KERNEL); not to mention rdma_addr_find_l2_eth_by_grh() doing wait_for_completion(); to wait for the task that rdma_resolve_ip() queues up. Fix this by moving the AH creation out of the lock. Linux commit: c76161181193985087cd716fdf69b5cb6cf9ee85 Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c == --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:23:44 2018(r341531) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:24:12 2018(r341532) @@ -332,11 +332,19 @@ out: return ret; } -static int cm_alloc_response_msg(struct cm_port *port, -struct ib_mad_recv_wc *mad_recv_wc, -struct ib_mad_send_buf **msg) +static struct ib_mad_send_buf *cm_alloc_response_msg_no_ah(struct cm_port *port, + struct ib_mad_recv_wc *mad_recv_wc) { - struct ib_mad_send_buf *m; + return ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, + 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, + GFP_ATOMIC, + IB_MGMT_BASE_VERSION); +} + +static int cm_create_response_msg_ah(struct cm_port *port, +struct ib_mad_recv_wc *mad_recv_wc, +struct ib_mad_send_buf *msg) +{ struct ib_ah *ah; ah = ib_create_ah_from_wc(port->mad_agent->qp->pd, mad_recv_wc->wc, @@ -344,27 +352,40 @@ static int cm_alloc_response_msg(struct cm_port *port, if (IS_ERR(ah)) return PTR_ERR(ah); - m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, - 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, - GFP_ATOMIC, - IB_MGMT_BASE_VERSION); - if (IS_ERR(m)) { - ib_destroy_ah(ah); - return PTR_ERR(m); - } - m->ah = ah; - *msg = m; + msg->ah = ah; return 0; } static void cm_free_msg(struct ib_mad_send_buf *msg) { - ib_destroy_ah(msg->ah); + if (msg->ah) + ib_destroy_ah(msg->ah); if (msg->context[0]) cm_deref_id(msg->context[0]); ib_free_send_mad(msg); } +static int cm_alloc_response_msg(struct cm_port *port, +struct ib_mad_recv_wc *mad_recv_wc, +struct ib_mad_send_buf **msg) +{ + struct ib_mad_send_buf *m; + int ret; + + m = cm_alloc_response_msg_no_ah(port, mad_recv_wc); + if (IS_ERR(m)) + return PTR_ERR(m); + + ret = cm_create_response_msg_ah(port, mad_recv_wc, m); + if (ret) { + cm_free_msg(m); + return ret; + } + + *msg = m; + return 0; +} + static void * cm_copy_private_data(const void *private_data, u8 private_data_len) { @@ -2331,7 +2352,8 @@ static int cm_dreq_handler(struct cm_work *work) case IB_CM_TIMEWAIT: atomic_long_inc(>port->counter_group[CM_RECV_DUPLICATES]. counter[CM_DREQ_COUNTER]); - if (cm_alloc_response_msg(work->port, work->mad_recv_wc, )) + msg = cm_alloc_response_msg_no_ah(work->port, work->mad_recv_wc); + if (IS_ERR(msg)) goto unlock; cm_format_drep((struct cm_drep_msg *) msg->mad, cm_id_priv, @@ -2339,7 +2361,8 @@ static int cm_dreq_handler(struct cm_work *work) cm_id_priv->private_data_len); spin_unlock_irq(_id_priv->lock); - if (ib_post_send_mad(msg, NULL)) + if (cm_create_response_msg_ah(work->port, work->mad_recv_wc, msg) || + ib_post_send_mad(msg, NULL))
svn commit: r341531 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:23:44 2018 New Revision: 341531 URL: https://svnweb.freebsd.org/changeset/base/341531 Log: ibcore: Add missing unref of netdevice. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c == --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:14 2018(r341530) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:44 2018(r341531) @@ -1335,6 +1335,7 @@ static bool validate_ipv6_net_dev(struct net_device *n dev_put(dst_dev); return false; } + dev_put(dst_dev); CURVNET_SET(net_dev->if_vnet); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341539 - head/sys/contrib/rdma/krping
Author: slavash Date: Wed Dec 5 13:27:48 2018 New Revision: 341539 URL: https://svnweb.freebsd.org/changeset/base/341539 Log: krping: Fix for memory leak in error case. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping_dev.c Modified: head/sys/contrib/rdma/krping/krping_dev.c == --- head/sys/contrib/rdma/krping/krping_dev.c Wed Dec 5 13:27:17 2018 (r341538) +++ head/sys/contrib/rdma/krping/krping_dev.c Wed Dec 5 13:27:48 2018 (r341539) @@ -187,7 +187,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io err = uiomove(cp, amt, uio); if (err) { uprintf("Write failed: bad address!\n"); - return err; + goto done; } cp += amt; remain -= amt; @@ -195,7 +195,8 @@ krping_write(struct cdev *dev, struct uio *uio, int io if (uio->uio_resid != 0) { uprintf("Message too big. max size is %d!\n", BUFFERSIZE); - return EMSGSIZE; + err = EMSGSIZE; + goto done; } /* null terminate and remove the \n */ @@ -204,6 +205,7 @@ krping_write(struct cdev *dev, struct uio *uio, int io krpingmsg->len = (unsigned long)(cp - krpingmsg->msg); uprintf("krping: write string = |%s|\n", krpingmsg->msg); err = krping_doit(krpingmsg->msg); +done: free(krpingmsg, M_DEVBUF); return(err); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341541 - head/contrib/ofed/opensm/opensm
Author: slavash Date: Wed Dec 5 13:28:46 2018 New Revision: 341541 URL: https://svnweb.freebsd.org/changeset/base/341541 Log: opensm: Use precision specifier for scanf If user input a string larger than the length of buffer, the stack memory will be corrupted. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/opensm/opensm/main.c Modified: head/contrib/ofed/opensm/opensm/main.c == --- head/contrib/ofed/opensm/opensm/main.c Wed Dec 5 13:28:17 2018 (r341540) +++ head/contrib/ofed/opensm/opensm/main.c Wed Dec 5 13:28:46 2018 (r341541) @@ -492,7 +492,7 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_os fflush(stdout); if (scanf("%u", ) <= 0) { char junk[128]; - if (scanf("%s", junk) <= 0) + if (scanf("%127s", junk) <= 0) printf("\nError: Cannot scan!\n"); } else if (choice == 0) return 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341538 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: slavash Date: Wed Dec 5 13:27:17 2018 New Revision: 341538 URL: https://svnweb.freebsd.org/changeset/base/341538 Log: ipoib: Notify on modify QP failure only when relevant Modify QP can fail and it can be acceptable, like when moving from RST to ERR state, all the rest are not acceptable and a message to the log should be printed. The current code prints on all failures and many messages like: "Failed to modify QP to ERROR state" appear, even when supported by the state machine of the QP object. Linux commit: 5dc78ad1904db597bdb4427f3ead437aae86f54c Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Dec 5 13:26:47 2018(r341537) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Dec 5 13:27:17 2018(r341538) @@ -710,6 +710,30 @@ static int recvs_pending(struct ipoib_dev_priv *priv) return pending; } +static void check_qp_movement_and_print(struct ipoib_dev_priv *priv, + struct ib_qp *qp, + enum ib_qp_state new_state) +{ + struct ib_qp_attr qp_attr; + struct ib_qp_init_attr query_init_attr; + int ret; + + ret = ib_query_qp(qp, _attr, IB_QP_STATE, _init_attr); + if (ret) { + ipoib_warn(priv, "%s: Failed to query QP (%d)\n", __func__, ret); + return; + } + + /* print according to the new-state and the previous state */ + if (new_state == IB_QPS_ERR && qp_attr.qp_state == IB_QPS_RESET) { + ipoib_dbg(priv, "Failed to modify QP %d->%d, acceptable\n", + qp_attr.qp_state, new_state); + } else { + ipoib_warn(priv, "Failed to modify QP %d->%d\n", + qp_attr.qp_state, new_state); + } +} + void ipoib_drain_cq(struct ipoib_dev_priv *priv) { int i, n; @@ -761,7 +785,7 @@ int ipoib_ib_dev_stop(struct ipoib_dev_priv *priv, int */ qp_attr.qp_state = IB_QPS_ERR; if (ib_modify_qp(priv->qp, _attr, IB_QP_STATE)) - ipoib_warn(priv, "Failed to modify QP to ERROR state\n"); + check_qp_movement_and_print(priv, priv->qp, IB_QPS_ERR); /* Wait for all sends and receives to complete */ begin = jiffies; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341530 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:23:14 2018 New Revision: 341530 URL: https://svnweb.freebsd.org/changeset/base/341530 Log: ibcore: Fix loopback with rdma-cm. Trying to validate loopback fails because rtalloc1() resolves system local addresses to the loopback network interface, lo0. Fix this by explicitly checking for loopback during validation of the source and destination network address. If the source address belongs to a local network interface and is equal to the destination address, there is no need to run the destination address through rtalloc1(). Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c == --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:22:43 2018(r341529) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:23:14 2018(r341530) @@ -1292,6 +1292,12 @@ static bool validate_ipv4_net_dev(struct net_device *n dev_put(dst_dev); /* +* Check for loopback. +*/ + if (saddr == daddr) + return true; + + /* * Make sure the socket address length field * is set, else rtalloc1() will fail. */ @@ -1318,12 +1324,12 @@ static bool validate_ipv6_net_dev(struct net_device *n { #ifdef INET6 struct sockaddr_in6 src_tmp = *src_addr; - struct in6_addr in6_addr = dst_addr->sin6_addr; + struct sockaddr_in6 dst_tmp = *dst_addr; struct net_device *dst_dev; struct rtentry *rte; bool ret; - dst_dev = ip6_dev_find(net_dev->if_vnet, in6_addr); + dst_dev = ip6_dev_find(net_dev->if_vnet, dst_tmp.sin6_addr); if (dst_dev != net_dev) { if (dst_dev != NULL) dev_put(dst_dev); @@ -1345,12 +1351,25 @@ static bool validate_ipv6_net_dev(struct net_device *n src_tmp.sin6_scope_id = net_dev->if_index; sa6_embedscope(_tmp, 0); - rte = rtalloc1((struct sockaddr *)_tmp, 1, 0); - if (rte != NULL) { - ret = (rte->rt_ifp == net_dev); - RTFREE_LOCKED(rte); + dst_tmp.sin6_scope_id = net_dev->if_index; + sa6_embedscope(_tmp, 0); + + /* +* Check for loopback after scope ID +* has been embedded: +*/ + if (memcmp(_tmp.sin6_addr, _tmp.sin6_addr, + sizeof(dst_tmp.sin6_addr)) == 0) { + ret = true; } else { - ret = false; + /* non-loopback case */ + rte = rtalloc1((struct sockaddr *)_tmp, 1, 0); + if (rte != NULL) { + ret = (rte->rt_ifp == net_dev); + RTFREE_LOCKED(rte); + } else { + ret = false; + } } CURVNET_RESTORE(); return ret; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341537 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: slavash Date: Wed Dec 5 13:26:47 2018 New Revision: 341537 URL: https://svnweb.freebsd.org/changeset/base/341537 Log: ipoib: increase the non-cm queue length When a packet needs fragmentation, it might generate more than 3 fragments. With the queue length 3, all fragments are generated faster than the queue is drained, which effectively drops fourth and later fragments on the floor. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:26:17 2018(r341536) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:26:47 2018(r341537) @@ -133,8 +133,8 @@ enum { IPOIB_NUM_WC = 4, - IPOIB_MAX_PATH_REC_QUEUE = 3, - IPOIB_MAX_MCAST_QUEUE = 3, + IPOIB_MAX_PATH_REC_QUEUE = 16, + IPOIB_MAX_MCAST_QUEUE = 16, IPOIB_FLAG_OPER_UP= 0, IPOIB_FLAG_INITIALIZED= 1, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341535 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: slavash Date: Wed Dec 5 13:25:47 2018 New Revision: 341535 URL: https://svnweb.freebsd.org/changeset/base/341535 Log: ipoib: correct setting MTU from inside ipoib(4). It is not enough to set ifnet->if_mtu to change the interface MTU. System saves the MTU for route in the radix tree, and route cache keeps the interface MTU as well. Since addition of the multicast group causes recalculation of MTU, even bringing the interface up changes MTU from 4042 to 1500, which makes the system configuration inconsistent. Worse, ip_output() prefers route MTU over interface MTU, so large packets are not fragmented and dropped on floor. Fix it for ipoib(4) using the same approach (or hack) as was applied for it_tun/if_tap in r339012. Thanks to bz@ for giving the hint. Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:25:13 2018(r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Dec 5 13:25:47 2018(r341535) @@ -518,7 +518,7 @@ void ipoib_path_iter_read(struct ipoib_path_iter *iter struct ipoib_path *path); #endif -int ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu); +int ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate); int ipoib_mcast_attach(struct ipoib_dev_priv *priv, u16 mlid, union ib_gid *mgid, int set_qkey); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:13 2018(r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Dec 5 13:25:47 2018(r341535) @@ -257,10 +257,34 @@ ipoib_stop(struct ipoib_dev_priv *priv) return 0; } +static int +ipoib_propagate_ifnet_mtu(struct ipoib_dev_priv *priv, int new_mtu, +bool propagate) +{ + struct ifnet *ifp; + struct ifreq ifr; + int error; + + ifp = priv->dev; + if (ifp->if_mtu == new_mtu) + return (0); + if (propagate) { + strlcpy(ifr.ifr_name, if_name(ifp), IFNAMSIZ); + ifr.ifr_mtu = new_mtu; + CURVNET_SET(ifp->if_vnet); + error = ifhwioctl(SIOCSIFMTU, ifp, (caddr_t), curthread); + CURVNET_RESTORE(); + } else { + ifp->if_mtu = new_mtu; + error = 0; + } + return (error); +} + int -ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu) +ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate) { - struct ifnet *dev = priv->dev; + int error, prev_admin_mtu; /* dev->if_mtu > 2K ==> connected mode */ if (ipoib_cm_admin_enabled(priv)) { @@ -271,20 +295,21 @@ ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_ ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n", priv->mcast_mtu); - dev->if_mtu = new_mtu; - return 0; + return (ipoib_propagate_ifnet_mtu(priv, new_mtu, propagate)); } if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu)) return -EINVAL; + prev_admin_mtu = priv->admin_mtu; priv->admin_mtu = new_mtu; - - dev->if_mtu = min(priv->mcast_mtu, priv->admin_mtu); - - queue_work(ipoib_workqueue, >flush_light); - - return 0; + error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu, + priv->admin_mtu), propagate); + if (error == 0) + queue_work(ipoib_workqueue, >flush_light); + else + priv->admin_mtu = prev_admin_mtu; + return (error); } static int @@ -338,7 +363,7 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t /* * Set the interface MTU. */ - error = -ipoib_change_mtu(priv, ifr->ifr_mtu); + error = -ipoib_change_mtu(priv, ifr->ifr_mtu, false); break; default: error = EINVAL; Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.cWed Dec 5 13:25:13 2018(r341534) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.cWed Dec 5 13:25:47 2018
svn commit: r341529 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:22:43 2018 New Revision: 341529 URL: https://svnweb.freebsd.org/changeset/base/341529 Log: ibcore: Make sure all VNETs are scanned for VLAN interfaces. The master network interface and the VLANs may reside in different VNETs. Make sure that all VNETs are searched when scanning for GID entries. Submitted by: netapp Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c Modified: head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c == --- head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.cWed Dec 5 13:22:07 2018(r341528) +++ head/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.cWed Dec 5 13:22:43 2018(r341529) @@ -167,6 +167,7 @@ roce_gid_update_addr_callback(struct ib_device *device #if defined(INET) || defined(INET6) struct ifaddr *ifa; #endif + VNET_ITERATOR_DECL(vnet_iter); struct ib_gid_attr gid_attr; union ib_gid gid; int default_gids; @@ -180,9 +181,11 @@ roce_gid_update_addr_callback(struct ib_device *device /* make sure default GIDs are in */ default_gids = roce_gid_enum_netdev_default(device, port, ndev); - CURVNET_SET(ndev->if_vnet); - IFNET_RLOCK(); - CK_STAILQ_FOREACH(idev, _ifnet, if_link) { + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + IFNET_RLOCK(); + CK_STAILQ_FOREACH(idev, _ifnet, if_link) { if (idev != ndev) { if (idev->if_type != IFT_L2VLAN) continue; @@ -230,9 +233,11 @@ roce_gid_update_addr_callback(struct ib_device *device } #endif IF_ADDR_RUNLOCK(idev); + } + IFNET_RUNLOCK(); + CURVNET_RESTORE(); } - IFNET_RUNLOCK(); - CURVNET_RESTORE(); + VNET_LIST_RUNLOCK(); /* add missing GIDs, if any */ STAILQ_FOREACH(entry, _head, entry) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341528 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:22:07 2018 New Revision: 341528 URL: https://svnweb.freebsd.org/changeset/base/341528 Log: ibcore: Always check return value from ib_init_ah_from_wc(). This prevents code from accepting RoCEv1 connections when only ROCEv2 is enabled and vice versa. Linux commit: 0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c == --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:21:20 2018(r341527) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:22:07 2018(r341528) @@ -390,13 +390,13 @@ static void cm_set_private_data(struct cm_id_private * cm_id_priv->private_data_len = private_data_len; } -static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, - struct ib_grh *grh, struct cm_av *av) +static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, + struct ib_grh *grh, struct cm_av *av) { av->port = port; av->pkey_index = wc->pkey_index; - ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, - grh, >ah_attr); + return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, + grh, >ah_attr); } static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av, @@ -1678,9 +1678,11 @@ static int cm_req_handler(struct cm_work *work) cm_id_priv = container_of(cm_id, struct cm_id_private, id); cm_id_priv->id.remote_id = req_msg->local_comm_id; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - _id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + _id_priv->av); + if (ret) + goto destroy; cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> id.local_id); if (IS_ERR(cm_id_priv->timewait_info)) { @@ -2905,9 +2907,11 @@ static int cm_lap_handler(struct cm_work *work) cm_id_priv->id.lap_state = IB_CM_LAP_RCVD; cm_id_priv->tid = lap_msg->hdr.tid; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - _id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + _id_priv->av); + if (ret) + goto unlock; ret = cm_init_av_by_path(param->alternate_path, _id_priv->alt_av, cm_id_priv); if (ret) @@ -3164,6 +3168,7 @@ static int cm_sidr_req_handler(struct cm_work *work) struct cm_id_private *cm_id_priv, *cur_cm_id_priv; struct cm_sidr_req_msg *sidr_req_msg; struct ib_wc *wc; + int ret; cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); if (IS_ERR(cm_id)) @@ -3176,9 +3181,11 @@ static int cm_sidr_req_handler(struct cm_work *work) wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); cm_id_priv->av.dgid.global.interface_id = 0; - cm_init_av_for_response(work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - _id_priv->av); + ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + _id_priv->av); + if (ret) + goto out; cm_id_priv->id.remote_id = sidr_req_msg->request_id; cm_id_priv->tid = sidr_req_msg->hdr.tid; atomic_inc(_id_priv->work_count); Modified: head/sys/ofed/drivers/infiniband/core/ib_user_mad.c == --- head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Dec 5 13:21:20 2018(r341527) +++ head/sys/ofed/drivers/infiniband/core/ib_user_mad.c Wed Dec 5 13:22:07 2018(r341528) @@ -240,10 +240,13 @@ static void recv_handler(struct ib_mad_agent *agent, packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); if (packet->mad.hdr.grh_present) {
svn commit: r341527 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:21:20 2018 New Revision: 341527 URL: https://svnweb.freebsd.org/changeset/base/341527 Log: ibcore: Add missing check for failure. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cm.c == --- head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:20:51 2018(r341526) +++ head/sys/ofed/drivers/infiniband/core/ib_cm.c Wed Dec 5 13:21:20 2018(r341527) @@ -2908,8 +2908,10 @@ static int cm_lap_handler(struct cm_work *work) cm_init_av_for_response(work->port, work->mad_recv_wc->wc, work->mad_recv_wc->recv_buf.grh, _id_priv->av); - cm_init_av_by_path(param->alternate_path, _id_priv->alt_av, - cm_id_priv); + ret = cm_init_av_by_path(param->alternate_path, _id_priv->alt_av, +cm_id_priv); + if (ret) + goto unlock; ret = atomic_inc_and_test(_id_priv->work_count); if (!ret) list_add_tail(>list, _id_priv->work_list); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341525 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:20:22 2018 New Revision: 341525 URL: https://svnweb.freebsd.org/changeset/base/341525 Log: ibcore: Check ib_find_pkey() return value. Linux commit: d3a2418ee36a59bc02e9d454723f3175dcf4bfd9 Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_multicast.c Modified: head/sys/ofed/drivers/infiniband/core/ib_multicast.c == --- head/sys/ofed/drivers/infiniband/core/ib_multicast.cWed Dec 5 13:19:52 2018(r341524) +++ head/sys/ofed/drivers/infiniband/core/ib_multicast.cWed Dec 5 13:20:22 2018(r341525) @@ -525,8 +525,9 @@ static void join_handler(int status, struct ib_sa_mcme process_join_error(group, status); else { int mgids_changed, is_mgid0; - ib_find_pkey(group->port->dev->device, group->port->port_num, -be16_to_cpu(rec->pkey), _index); + if (ib_find_pkey(group->port->dev->device, group->port->port_num, +be16_to_cpu(rec->pkey), _index)) + pkey_index = MCAST_INVALID_PKEY_INDEX; spin_lock_irq(>port->lock); if (group->state == MCAST_BUSY && ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341526 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:20:51 2018 New Revision: 341526 URL: https://svnweb.freebsd.org/changeset/base/341526 Log: ibcore: Fix an array index check The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS (80) elements. Hence compare the array index with that value instead of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity reports the following: Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127). Linux commit: 2fe2f378dd45847d2643638c07a7658822087836 Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c Modified: head/sys/ofed/drivers/infiniband/core/ib_mad.c == --- head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:22 2018(r341525) +++ head/sys/ofed/drivers/infiniband/core/ib_mad.c Wed Dec 5 13:20:51 2018(r341526) @@ -1753,7 +1753,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv, if (!class) goto out; if (convert_mgmt_class(mad_hdr->mgmt_class) >= - IB_MGMT_MAX_METHODS) + ARRAY_SIZE(class->method_table)) goto out; method = class->method_table[convert_mgmt_class( mad_hdr->mgmt_class)]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341524 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:19:52 2018 New Revision: 341524 URL: https://svnweb.freebsd.org/changeset/base/341524 Log: ibcore: Add support for IB_SPEED_HDR in sysfs rate printout. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_sysfs.c Modified: head/sys/ofed/drivers/infiniband/core/ib_sysfs.c == --- head/sys/ofed/drivers/infiniband/core/ib_sysfs.cWed Dec 5 13:19:21 2018(r341523) +++ head/sys/ofed/drivers/infiniband/core/ib_sysfs.cWed Dec 5 13:19:52 2018(r341524) @@ -258,8 +258,13 @@ static ssize_t rate_show(struct ib_port *p, struct por speed = " EDR"; rate = 250; break; + case IB_SPEED_HDR: + speed = " HDR"; + rate = 500; + break; case IB_SPEED_SDR: default:/* default to SDR for invalid rates */ + speed = " SDR"; rate = 25; break; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341523 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:19:21 2018 New Revision: 341523 URL: https://svnweb.freebsd.org/changeset/base/341523 Log: ibcore: Don't access invalid port. The port number in the listen_id_priv has been observed to be zero which means no port has been selected. The current code lacks a check for invalid port number. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c Modified: head/sys/ofed/drivers/infiniband/core/ib_cma.c == --- head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:18:50 2018(r341522) +++ head/sys/ofed/drivers/infiniband/core/ib_cma.c Wed Dec 5 13:19:21 2018(r341523) @@ -621,16 +621,19 @@ static int cma_acquire_dev(struct rdma_id_private *id_ if (listen_id_priv) { cma_dev = listen_id_priv->cma_dev; port = listen_id_priv->id.port_num; - gidp = rdma_protocol_roce(cma_dev->device, port) ? - _gid : - ret = cma_validate_port(cma_dev->device, port, - rdma_protocol_ib(cma_dev->device, port) ? - IB_GID_TYPE_IB : - listen_id_priv->gid_type, gidp, dev_addr); - if (!ret) { - id_priv->id.port_num = port; - goto out; + if (rdma_is_port_valid(cma_dev->device, port)) { + gidp = rdma_protocol_roce(cma_dev->device, port) ? + _gid : + + ret = cma_validate_port(cma_dev->device, port, + rdma_protocol_ib(cma_dev->device, port) ? + IB_GID_TYPE_IB : + listen_id_priv->gid_type, gidp, dev_addr); + if (!ret) { + id_priv->id.port_num = port; + goto out; + } } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341522 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:18:50 2018 New Revision: 341522 URL: https://svnweb.freebsd.org/changeset/base/341522 Log: ibcore: Discard unused error codes. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Modified: head/sys/ofed/drivers/infiniband/core/ib_iwcm.c == --- head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Wed Dec 5 13:18:20 2018(r341521) +++ head/sys/ofed/drivers/infiniband/core/ib_iwcm.c Wed Dec 5 13:18:50 2018(r341522) @@ -308,9 +308,9 @@ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrup if (qp) { if (abrupt) - ret = iwcm_modify_qp_err(qp); + (void) iwcm_modify_qp_err(qp); else - ret = iwcm_modify_qp_sqd(qp); + (void) iwcm_modify_qp_sqd(qp); /* * If both sides are disconnecting the QP could ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341520 - head/sys/compat/linuxkpi/common/include/linux
Author: slavash Date: Wed Dec 5 13:17:45 2018 New Revision: 341520 URL: https://svnweb.freebsd.org/changeset/base/341520 Log: linuxkpi: Really check if PCI is offline Currently we always return false if for PCI offline query. Try to read PCI config, if the return value if 0x probably the PCI is offline. Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h == --- head/sys/compat/linuxkpi/common/include/linux/pci.h Wed Dec 5 13:17:15 2018(r341519) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Wed Dec 5 13:17:45 2018(r341520) @@ -601,9 +601,11 @@ pci_enable_msix_range(struct pci_dev *dev, struct msix return (nvec); } -static inline int pci_channel_offline(struct pci_dev *pdev) +static inline int +pci_channel_offline(struct pci_dev *pdev) { - return false; + + return (pci_get_vendor(pdev->dev.bsddev) == 0x); } static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341521 - head/sys/ofed/drivers/infiniband/core
Author: slavash Date: Wed Dec 5 13:18:20 2018 New Revision: 341521 URL: https://svnweb.freebsd.org/changeset/base/341521 Log: ibcore: Make sure GID index variable gets initialized. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c Modified: head/sys/ofed/drivers/infiniband/core/ib_verbs.c == --- head/sys/ofed/drivers/infiniband/core/ib_verbs.cWed Dec 5 13:17:45 2018(r341520) +++ head/sys/ofed/drivers/infiniband/core/ib_verbs.cWed Dec 5 13:18:20 2018(r341521) @@ -458,7 +458,7 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 po struct ib_ah_attr *ah_attr) { u32 flow_class; - u16 gid_index; + u16 gid_index = 0; int ret; enum rdma_network_type net_type = RDMA_NETWORK_IB; enum ib_gid_type gid_type = IB_GID_TYPE_IB; @@ -524,8 +524,6 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 po _index); if (ret) return ret; - } else { - gid_index = 0; } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341519 - head/sys/compat/linuxkpi/common/include/linux
Author: slavash Date: Wed Dec 5 13:17:15 2018 New Revision: 341519 URL: https://svnweb.freebsd.org/changeset/base/341519 Log: linuxkpi: properly implement netif_carrier_ok(). Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h == --- head/sys/compat/linuxkpi/common/include/linux/netdevice.h Wed Dec 5 13:16:39 2018(r341518) +++ head/sys/compat/linuxkpi/common/include/linux/netdevice.h Wed Dec 5 13:17:15 2018(r341519) @@ -77,7 +77,7 @@ dev_get_by_index(struct vnet *vnet, int if_index) #definenetif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) #definenetif_oper_up(dev) !!((dev)->if_flags & IFF_UP) -#definenetif_carrier_ok(dev) netif_running(dev) +#definenetif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) static inline void * netdev_priv(const struct net_device *dev) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341517 - head/sys/compat/linuxkpi/common/include/linux
Author: slavash Date: Wed Dec 5 13:15:57 2018 New Revision: 341517 URL: https://svnweb.freebsd.org/changeset/base/341517 Log: linuxkpi: implement idr_is_empty() and ida_is_empty(). Submitted by: kib@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h == --- head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 11:57:16 2018(r341516) +++ head/sys/compat/linuxkpi/common/include/linux/idr.h Wed Dec 5 13:15:57 2018(r341517) @@ -91,6 +91,7 @@ void idr_init(struct idr *idp); intidr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t); intidr_alloc_cyclic(struct idr *idp, void *ptr, int start, int end, gfp_t); intidr_for_each(struct idr *idp, int (*fn)(int id, void *p, void *data), void *data); +bool idr_is_empty(struct idr *idp); #defineidr_for_each_entry(idp, entry, id) \ for ((id) = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++(id)) @@ -122,7 +123,15 @@ void ida_simple_remove(struct ida *ida, unsigned int i static inline int ida_get_new(struct ida *ida, int *p_id) { + return (ida_get_new_above(ida, 0, p_id)); +} + +static inline bool +ida_is_empty(struct ida *ida) +{ + + return (idr_is_empty(>idr)); } #endif /* _LINUX_IDR_H_ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r341518 - in head/sys/compat/linuxkpi/common: include/linux src
Author: slavash Date: Wed Dec 5 13:16:39 2018 New Revision: 341518 URL: https://svnweb.freebsd.org/changeset/base/341518 Log: linuxkpi: Fix for use-after-free when tearing down character devices. Make sure we hold a reference on the character device for every opened file to prevent the character device to be freed prematurely. Submitted by: hselasky@ Approved by:hselasky (mentor) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h head/sys/compat/linuxkpi/common/include/linux/fs.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/cdev.h == --- head/sys/compat/linuxkpi/common/include/linux/cdev.hWed Dec 5 13:15:57 2018(r341517) +++ head/sys/compat/linuxkpi/common/include/linux/cdev.hWed Dec 5 13:16:39 2018(r341518) @@ -36,6 +36,8 @@ #include #include +#include + struct file_operations; struct inode; struct module; @@ -50,6 +52,7 @@ struct linux_cdev { struct cdev *cdev; dev_t dev; const struct file_operations *ops; + atomic_long_t refs; }; static inline void @@ -58,6 +61,7 @@ cdev_init(struct linux_cdev *cdev, const struct file_o kobject_init(>kobj, _cdev_static_ktype); cdev->ops = ops; + atomic_long_set(>refs, 0); } static inline struct linux_cdev * @@ -130,13 +134,13 @@ cdev_add_ext(struct linux_cdev *cdev, dev_t dev, uid_t return (0); } +void linux_destroy_dev(struct linux_cdev *); + static inline void cdev_del(struct linux_cdev *cdev) { - if (cdev->cdev) { - destroy_dev(cdev->cdev); - cdev->cdev = NULL; - } + + linux_destroy_dev(cdev); kobject_put(>kobj); } Modified: head/sys/compat/linuxkpi/common/include/linux/fs.h == --- head/sys/compat/linuxkpi/common/include/linux/fs.h Wed Dec 5 13:15:57 2018(r341517) +++ head/sys/compat/linuxkpi/common/include/linux/fs.h Wed Dec 5 13:16:39 2018(r341518) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,7 @@ struct vm_area_struct; struct poll_table_struct; struct files_struct; struct pfs_node; +struct linux_cdev; #defineinode vnode #definei_cdev v_rdev @@ -105,6 +106,9 @@ struct linux_file { /* protects f_selinfo.si_note */ spinlock_t f_kqlock; struct linux_file_wait_queue f_wait_queue; + + /* pointer to associated character device, if any */ + struct linux_cdev *f_cdev; }; #definefilelinux_file Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c == --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed Dec 5 13:15:57 2018(r341517) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed Dec 5 13:16:39 2018(r341518) @@ -699,12 +699,20 @@ linux_dev_fdopen(struct cdev *dev, int fflags, struct filp->f_flags = file->f_flag; filp->f_vnode = file->f_vnode; filp->_file = file; + filp->f_cdev = ldev; linux_set_current(td); + /* get a reference on the Linux character device */ + if (atomic_long_add_unless(>refs, 1, -1L) == 0) { + kfree(filp); + return (EINVAL); + } + if (filp->f_op->open) { error = -filp->f_op->open(file->f_vnode, filp); if (error) { + atomic_long_dec(>refs); kfree(filp); return (error); } @@ -1396,6 +1404,10 @@ linux_file_close(struct file *file, struct thread *td) funsetown(>f_sigio); if (filp->f_vnode != NULL) vdrop(filp->f_vnode); + if (filp->f_cdev != NULL) { + /* put a reference on the Linux character device */ + atomic_long_dec(>f_cdev->refs); + } kfree(filp); return (error); @@ -1947,8 +1959,7 @@ linux_cdev_release(struct kobject *kobj) cdev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - if (cdev->cdev) - destroy_dev(cdev->cdev); + linux_destroy_dev(cdev); kfree(cdev); kobject_put(parent); } @@ -1961,9 +1972,25 @@ linux_cdev_static_release(struct kobject *kobj) cdev = container_of(kobj, struct linux_cdev, kobj);
svn commit: r339713 - in stable/10/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Thu Oct 25 14:12:48 2018 New Revision: 339713 URL: https://svnweb.freebsd.org/changeset/base/339713 Log: MFC r339584: mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation If power exceed the slot limit, or slot limit is unknown the ConnectX-6 firmware will shutdown its port. Inform the user via debug message. Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/device.h stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/device.h == --- stable/10/sys/dev/mlx5/device.h Thu Oct 25 14:10:28 2018 (r339712) +++ stable/10/sys/dev/mlx5/device.h Thu Oct 25 14:12:48 2018 (r339713) @@ -475,6 +475,7 @@ enum { MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER= 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, + MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED = 0xc, }; struct mlx5_eqe_port_module_event { Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 14:10:28 2018 (r339712) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 14:12:48 2018 (r339713) @@ -618,6 +618,12 @@ static const char *mlx5_port_module_event_error_type_t return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: return "Cable is shorted"; + case MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED: + return "One or more network ports have been powered " + "down due to insufficient/unadvertised power on " + "the PCIe slot. Please refer to the card's user " + "manual for power specifications or contact " + "Mellanox support."; default: return "Unknown error type"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339712 - in stable/11/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Thu Oct 25 14:10:28 2018 New Revision: 339712 URL: https://svnweb.freebsd.org/changeset/base/339712 Log: MFC r339584 : mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation If power exceed the slot limit, or slot limit is unknown the ConnectX-6 firmware will shutdown its port. Inform the user via debug message. Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/device.h stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/device.h == --- stable/11/sys/dev/mlx5/device.h Thu Oct 25 14:07:28 2018 (r339711) +++ stable/11/sys/dev/mlx5/device.h Thu Oct 25 14:10:28 2018 (r339712) @@ -549,6 +549,7 @@ enum { MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE = 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, + MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED = 0xc, }; struct mlx5_eqe_port_module_event { Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 14:07:28 2018 (r339711) +++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 14:10:28 2018 (r339712) @@ -615,6 +615,12 @@ static const char *mlx5_port_module_event_error_type_t return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: return "Cable is shorted"; + case MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED: + return "One or more network ports have been powered " + "down due to insufficient/unadvertised power on " + "the PCIe slot. Please refer to the card's user " + "manual for power specifications or contact " + "Mellanox support."; default: return "Unknown error type"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339711 - in stable/12/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Thu Oct 25 14:07:28 2018 New Revision: 339711 URL: https://svnweb.freebsd.org/changeset/base/339711 Log: MFC r339584: mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation If power exceed the slot limit, or slot limit is unknown the ConnectX-6 firmware will shutdown its port. Inform the user via debug message. Approved by:re(rgrimes), hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h == --- stable/12/sys/dev/mlx5/device.h Thu Oct 25 13:46:28 2018 (r339710) +++ stable/12/sys/dev/mlx5/device.h Thu Oct 25 14:07:28 2018 (r339711) @@ -549,6 +549,7 @@ enum { MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE = 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, + MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED = 0xc, }; struct mlx5_eqe_port_module_event { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 13:46:28 2018 (r339710) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Oct 25 14:07:28 2018 (r339711) @@ -615,6 +615,12 @@ static const char *mlx5_port_module_event_error_type_t return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: return "Cable is shorted"; + case MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED: + return "One or more network ports have been powered " + "down due to insufficient/unadvertised power on " + "the PCIe slot. Please refer to the card's user " + "manual for power specifications or contact " + "Mellanox support."; default: return "Unknown error type"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339584 - in head/sys/dev/mlx5: . mlx5_core
Author: slavash Date: Mon Oct 22 10:38:38 2018 New Revision: 339584 URL: https://svnweb.freebsd.org/changeset/base/339584 Log: mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation If power exceed the slot limit, or slot limit is unknown the ConnectX-6 firmware will shutdown its port. Inform the user via debug message. MFC after: 3 days Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Modified: head/sys/dev/mlx5/device.h == --- head/sys/dev/mlx5/device.h Mon Oct 22 08:59:20 2018(r339583) +++ head/sys/dev/mlx5/device.h Mon Oct 22 10:38:38 2018(r339584) @@ -549,6 +549,7 @@ enum { MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE = 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, + MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED = 0xc, }; struct mlx5_eqe_port_module_event { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 22 08:59:20 2018 (r339583) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 22 10:38:38 2018 (r339584) @@ -615,6 +615,12 @@ static const char *mlx5_port_module_event_error_type_t return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: return "Cable is shorted"; + case MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED: + return "One or more network ports have been powered " + "down due to insufficient/unadvertised power on " + "the PCIe slot. Please refer to the card's user " + "manual for power specifications or contact " + "Mellanox support."; default: return "Unknown error type"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r339021 - stable/11/sys/dev/pci
Author: slavash Date: Sun Sep 30 08:41:14 2018 New Revision: 339021 URL: https://svnweb.freebsd.org/changeset/base/339021 Log: MFC r338942: Add PCIV_INVALID definition From PCI Spec rev 2.2, 6.2.1. Device Identification: Vendor ID This field identifies the manufacturer of the device. Valid vendor identifiers are allocated by the PCI SIG to ensure uniqueness. 0h is an invalid value for Vendor ID. Approved by:kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/pci/pcireg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pcireg.h == --- stable/11/sys/dev/pci/pcireg.h Sat Sep 29 21:14:54 2018 (r339020) +++ stable/11/sys/dev/pci/pcireg.h Sun Sep 30 08:41:14 2018 (r339021) @@ -120,6 +120,9 @@ #definePCIM_MFDEV 0x80 #definePCIR_BIST 0x0f +/* PCI Spec rev 2.2: 0h is an invalid value for Vendor ID. */ +#definePCIV_INVALID0x + /* Capability Register Offsets */ #definePCICAP_ID 0x0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338942 - head/sys/dev/pci
Author: slavash Date: Wed Sep 26 13:16:55 2018 New Revision: 338942 URL: https://svnweb.freebsd.org/changeset/base/338942 Log: Add PCIV_INVALID definition From PCI Spec rev 2.2, 6.2.1. Device Identification: Vendor ID This field identifies the manufacturer of the device. Valid vendor identifiers are allocated by the PCI SIG to ensure uniqueness. 0h is an invalid value for Vendor ID. MFC after: 3 days Approved by:re (Glen), hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pcireg.h == --- head/sys/dev/pci/pcireg.h Wed Sep 26 10:24:50 2018(r338941) +++ head/sys/dev/pci/pcireg.h Wed Sep 26 13:16:55 2018(r338942) @@ -122,6 +122,9 @@ #definePCIM_MFDEV 0x80 #definePCIR_BIST 0x0f +/* PCI Spec rev 2.2: 0h is an invalid value for Vendor ID. */ +#definePCIV_INVALID0x + /* Capability Register Offsets */ #definePCICAP_ID 0x0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r338491 - head/sys/ofed/include/rdma
Author: slavash Date: Thu Sep 6 12:26:57 2018 New Revision: 338491 URL: https://svnweb.freebsd.org/changeset/base/338491 Log: ibcore: Fix endless loop in searching for matching VLAN device In r337943 ifnet's if_pcp was set to the PCP value in use instead of IFNET_PCP_NONE. Current ibcore code assumes that if_pcp is IFNET_PCP_NONE with VLAN interfaces so it can identify prio-tagged traffic. Fix that by explicitly verifying that that the if_type is IFT_ETHER and not IFT_L2VLAN. MFC after: 3 days Approved by:re (Marius), hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/sys/ofed/include/rdma/ib_addr.h Modified: head/sys/ofed/include/rdma/ib_addr.h == --- head/sys/ofed/include/rdma/ib_addr.hThu Sep 6 12:19:36 2018 (r338490) +++ head/sys/ofed/include/rdma/ib_addr.hThu Sep 6 12:26:57 2018 (r338491) @@ -167,7 +167,7 @@ static inline u16 rdma_vlan_dev_vlan_id(const struct n { uint16_t tag; - if (dev->if_pcp != IFNET_PCP_NONE) + if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE) return 0x; /* prio-tagged traffic */ if (VLAN_TAG(__DECONST(struct ifnet *, dev), ) != 0) return 0x; @@ -350,7 +350,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid) static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev) { - if (dev->if_pcp != IFNET_PCP_NONE) + if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE) return dev; /* prio-tagged traffic */ return VLAN_TRUNKDEV(__DECONST(struct ifnet *, dev)); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r336903 - stable/11/contrib/tcpdump
Author: slavash Date: Mon Jul 30 12:51:57 2018 New Revision: 336903 URL: https://svnweb.freebsd.org/changeset/base/336903 Log: MFC r334318: Vendor import two upstream commits: c1bb8784abd3ca978e376b0d10e324db0491237b 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72 Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/contrib/tcpdump/tcpdump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tcpdump/tcpdump.c == --- stable/11/contrib/tcpdump/tcpdump.c Mon Jul 30 12:44:44 2018 (r336902) +++ stable/11/contrib/tcpdump/tcpdump.c Mon Jul 30 12:51:57 2018 (r336903) @@ -77,7 +77,6 @@ The Regents of the University of California. All righ */ #ifdef HAVE_CAPSICUM #include -#include #include #include #include @@ -114,6 +113,10 @@ The Regents of the University of California. All righ #endif /* HAVE_CAP_NG_H */ #endif /* HAVE_LIBCAP_NG */ +#ifdef __FreeBSD__ +#include +#endif /* __FreeBSD__ */ + #include "netdissect.h" #include "interface.h" #include "addrtoname.h" @@ -1095,6 +1098,10 @@ open_interface(const char *device, netdissect_options sysctlbyname(sysctl, parent, , NULL, 0); strlcpy(newdev, device, sizeof(newdev)); /* Suggest a new wlan device. */ + /* FIXME: incrementing the index this way is not going to work well +* when the index is 9 or greater but the only consequence in this +* specific case would be an error message that looks a bit odd. +*/ newdev[strlen(newdev)-1]++; error("%s is not a monitor mode VAP\n" "To create a new monitor mode VAP use:\n" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r335614 - stable/11/contrib/ofed/librdmacm/examples
Author: slavash Date: Mon Jun 25 07:25:41 2018 New Revision: 335614 URL: https://svnweb.freebsd.org/changeset/base/335614 Log: MFC r335282: Fix false positive on failure When running mckey, errors may happen in the init/connect stage. When leaving multicast groups, we override this value. Fix that by saving the return value from rdma_leave_multicast to different parameter, and only in case of failure in rdma_leave_multicast override it. Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/librdmacm/examples/mckey.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/librdmacm/examples/mckey.c == --- stable/11/contrib/ofed/librdmacm/examples/mckey.c Mon Jun 25 06:57:10 2018(r335613) +++ stable/11/contrib/ofed/librdmacm/examples/mckey.c Mon Jun 25 07:25:41 2018(r335614) @@ -475,7 +475,7 @@ static int get_dst_addr(char *dst, struct sockaddr *ad static int run(void) { - int i, ret; + int i, ret, err; printf("mckey: starting %s\n", is_sender ? "client" : "server"); if (src_addr) { @@ -543,10 +543,12 @@ static int run(void) } out: for (i = 0; i < connections; i++) { - ret = rdma_leave_multicast(test.nodes[i].cma_id, + err = rdma_leave_multicast(test.nodes[i].cma_id, test.dst_addr); - if (ret) + if (err) { perror("mckey: failure leaving"); + ret = err; + } } return ret; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r335282 - head/contrib/ofed/librdmacm/examples
Author: slavash Date: Sun Jun 17 07:08:47 2018 New Revision: 335282 URL: https://svnweb.freebsd.org/changeset/base/335282 Log: Fix false positive on failure When running mckey, errors may happen in the init/connect stage. When leaving multicast groups, we override this value. Fix that by saving the return value from rdma_leave_multicast to different parameter, and only in case of failure in rdma_leave_multicast override it. MFC after: 1 week Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/librdmacm/examples/mckey.c Modified: head/contrib/ofed/librdmacm/examples/mckey.c == --- head/contrib/ofed/librdmacm/examples/mckey.cSun Jun 17 06:25:32 2018(r335281) +++ head/contrib/ofed/librdmacm/examples/mckey.cSun Jun 17 07:08:47 2018(r335282) @@ -475,7 +475,7 @@ static int get_dst_addr(char *dst, struct sockaddr *ad static int run(void) { - int i, ret; + int i, ret, err; printf("mckey: starting %s\n", is_sender ? "client" : "server"); if (src_addr) { @@ -543,10 +543,12 @@ static int run(void) } out: for (i = 0; i < connections; i++) { - ret = rdma_leave_multicast(test.nodes[i].cma_id, + err = rdma_leave_multicast(test.nodes[i].cma_id, test.dst_addr); - if (ret) + if (err) { perror("mckey: failure leaving"); + ret = err; + } } return ret; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r334318 - head/contrib/tcpdump
Author: slavash Date: Tue May 29 10:29:04 2018 New Revision: 334318 URL: https://svnweb.freebsd.org/changeset/base/334318 Log: MFV r333668: Vendor import two upstream commits: c1bb8784abd3ca978e376b0d10e324db0491237b 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72 When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP, tcpdump will print an error message saying rfmon is not supported. Give a concise explanation as to how one might solve this problem by creating a monitor mode VAP. MFC after: 1 month Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/contrib/tcpdump/tcpdump.c Directory Properties: head/contrib/tcpdump/ (props changed) Modified: head/contrib/tcpdump/tcpdump.c == --- head/contrib/tcpdump/tcpdump.c Tue May 29 10:28:20 2018 (r334317) +++ head/contrib/tcpdump/tcpdump.c Tue May 29 10:29:04 2018 (r334318) @@ -77,7 +77,6 @@ The Regents of the University of California. All righ */ #ifdef HAVE_CAPSICUM #include -#include #include #include #include @@ -114,6 +113,10 @@ The Regents of the University of California. All righ #endif /* HAVE_CAP_NG_H */ #endif /* HAVE_LIBCAP_NG */ +#ifdef __FreeBSD__ +#include +#endif /* __FreeBSD__ */ + #include "netdissect.h" #include "interface.h" #include "addrtoname.h" @@ -1095,6 +1098,10 @@ open_interface(const char *device, netdissect_options sysctlbyname(sysctl, parent, , NULL, 0); strlcpy(newdev, device, sizeof(newdev)); /* Suggest a new wlan device. */ + /* FIXME: incrementing the index this way is not going to work well +* when the index is 9 or greater but the only consequence in this +* specific case would be an error message that looks a bit odd. +*/ newdev[strlen(newdev)-1]++; error("%s is not a monitor mode VAP\n" "To create a new monitor mode VAP use:\n" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333668 - vendor/tcpdump/dist
Author: slavash Date: Wed May 16 08:43:08 2018 New Revision: 333668 URL: https://svnweb.freebsd.org/changeset/base/333668 Log: Vendor import two upstream commits: c1bb8784abd3ca978e376b0d10e324db0491237b 9c4af7213cc2543a1f5586d8f2c19f86aa0cbe72 When using tcpdump -I -i wlanN and wlanN is not a monitor mode VAP, tcpdump will print an error message saying rfmon is not supported. Give a concise explanation as to how one might solve this problem by creating a monitor mode VAP. Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: vendor/tcpdump/dist/tcpdump.c Modified: vendor/tcpdump/dist/tcpdump.c == --- vendor/tcpdump/dist/tcpdump.c Wed May 16 06:52:08 2018 (r333667) +++ vendor/tcpdump/dist/tcpdump.c Wed May 16 08:43:08 2018 (r333668) @@ -108,6 +108,10 @@ The Regents of the University of California. All righ #endif /* HAVE_CAP_NG_H */ #endif /* HAVE_LIBCAP_NG */ +#ifdef __FreeBSD__ +#include +#endif /* __FreeBSD__ */ + #include "netdissect.h" #include "interface.h" #include "addrtoname.h" @@ -1044,6 +1048,30 @@ open_interface(const char *device, netdissect_options } else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0') error("%s: %s\n(%s)", device, pcap_statustostr(status), cp); +#ifdef __FreeBSD__ + else if (status == PCAP_ERROR_RFMON_NOTSUP && + strncmp(device, "wlan", 4) == 0) { + char parent[8], newdev[8]; + char sysctl[32]; + size_t s = sizeof(parent); + + snprintf(sysctl, sizeof(sysctl), + "net.wlan.%d.%%parent", atoi(device + 4)); + sysctlbyname(sysctl, parent, , NULL, 0); + strlcpy(newdev, device, sizeof(newdev)); + /* Suggest a new wlan device. */ + /* FIXME: incrementing the index this way is not going to work well +* when the index is 9 or greater but the only consequence in this +* specific case would be an error message that looks a bit odd. +*/ + newdev[strlen(newdev)-1]++; + error("%s is not a monitor mode VAP\n" + "To create a new monitor mode VAP use:\n" + " ifconfig %s create wlandev %s wlanmode monitor\n" + "and use %s as the tcpdump interface", + device, newdev, parent, newdev); + } +#endif else error("%s: %s", device, pcap_statustostr(status)); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333217 - stable/11/contrib/ofed/libibumad
Author: slavash Date: Thu May 3 16:19:47 2018 New Revision: 333217 URL: https://svnweb.freebsd.org/changeset/base/333217 Log: MFC r333115: libibumad/umad.c: In get_port, ignore sysctl get rate errors This can cause ibpanic in ibstat when width is not set properly as can occur when Ethernet port is connected to InfiniBand fabric. ibpanic: [8167] main: stat of IB device 'mlx5_0' failed: m With this change, Rate is displayed as 0 with ibstat for this scenario. Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/contrib/ofed/libibumad/umad.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libibumad/umad.c == --- stable/11/contrib/ofed/libibumad/umad.c Thu May 3 15:47:49 2018 (r333216) +++ stable/11/contrib/ofed/libibumad/umad.c Thu May 3 16:19:47 2018 (r333217) @@ -138,6 +138,7 @@ static int get_port(const char *ca_name, const char *d strncpy(port->ca_name, ca_name, sizeof port->ca_name - 1); port->portnum = portnum; port->pkeys = NULL; + port->rate = 0; len = snprintf(port_dir, sizeof(port_dir), "%s/%d", dir, portnum); if (len < 0 || len > sizeof(port_dir)) @@ -155,8 +156,12 @@ static int get_port(const char *ca_name, const char *d goto clean; if (sys_read_uint(port_dir, SYS_PORT_PHY_STATE, >phys_state) < 0) goto clean; - if (sys_read_uint(port_dir, SYS_PORT_RATE, >rate) < 0) - goto clean; + /* +* If width was not set properly this read may fail. +* Instead of failing everything, we will just skip the check +* and it will be set to 0. +*/ + sys_read_uint(port_dir, SYS_PORT_RATE, >rate); if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, ) < 0) goto clean; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333115 - head/contrib/ofed/libibumad
Author: slavash Date: Mon Apr 30 15:23:45 2018 New Revision: 333115 URL: https://svnweb.freebsd.org/changeset/base/333115 Log: libibumad/umad.c: In get_port, ignore sysctl get rate errors This can cause ibpanic in ibstat when width is not set properly as can occur when Ethernet port is connected to InfiniBand fabric. ibpanic: [8167] main: stat of IB device 'mlx5_0' failed: m With this change, Rate is displayed as 0 with ibstat for this scenario. MFC after: 3 days Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/contrib/ofed/libibumad/umad.c Modified: head/contrib/ofed/libibumad/umad.c == --- head/contrib/ofed/libibumad/umad.c Mon Apr 30 15:18:38 2018 (r333114) +++ head/contrib/ofed/libibumad/umad.c Mon Apr 30 15:23:45 2018 (r333115) @@ -138,6 +138,7 @@ static int get_port(const char *ca_name, const char *d strncpy(port->ca_name, ca_name, sizeof port->ca_name - 1); port->portnum = portnum; port->pkeys = NULL; + port->rate = 0; len = snprintf(port_dir, sizeof(port_dir), "%s/%d", dir, portnum); if (len < 0 || len > sizeof(port_dir)) @@ -155,8 +156,12 @@ static int get_port(const char *ca_name, const char *d goto clean; if (sys_read_uint(port_dir, SYS_PORT_PHY_STATE, >phys_state) < 0) goto clean; - if (sys_read_uint(port_dir, SYS_PORT_RATE, >rate) < 0) - goto clean; + /* +* If width was not set properly this read may fail. +* Instead of failing everything, we will just skip the check +* and it will be set to 0. +*/ + sys_read_uint(port_dir, SYS_PORT_RATE, >rate); if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, ) < 0) goto clean; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r333107 - stable/11/sys/dev/mlx5/mlx5_en
Author: slavash Date: Mon Apr 30 08:51:04 2018 New Revision: 333107 URL: https://svnweb.freebsd.org/changeset/base/333107 Log: MFC r332003: Bump driver version number in mlx5en(4). Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 30 08:39:23 2018(r333106) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 30 08:51:04 2018(r333107) @@ -30,7 +30,9 @@ #include #include -#defineETH_DRIVER_VERSION "3.1.0-dev" +#ifndef ETH_DRIVER_VERSION +#defineETH_DRIVER_VERSION "3.4.1" +#endif char mlx5e_version[] = "Mellanox Ethernet driver" " (" ETH_DRIVER_VERSION ")"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r330652 - head/share/misc
Author: slavash Date: Thu Mar 8 14:33:59 2018 New Revision: 330652 URL: https://svnweb.freebsd.org/changeset/base/330652 Log: Add myself and Hans Petter Selasky Approved by:hselasky (mentor), kib (mentor) Sponsored by: Mellanox Technologies Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Thu Mar 8 11:59:47 2018 (r330651) +++ head/share/misc/committers-src.dot Thu Mar 8 14:33:59 2018 (r330652) @@ -187,6 +187,7 @@ gshapiro [label="Gregory Shapiro\ngshap...@freebsd.org harti [label="Hartmut Brandt\nha...@freebsd.org\n2003/01/29"] hiren [label="Hiren Panchasara\nhi...@freebsd.org\n2013/04/12"] hmp [label="Hiten Pandya\n...@freebsd.org\n2004/03/23"] +hselasky [label="Hans Petter Selasky\nhsela...@freebsd.org\n"] ian [label="Ian Lepore\n...@freebsd.org\n2013/01/07"] iedowse [label="Ian Dowse\niedo...@freebsd.org\n2000/12/01"] imp [label="Warner Losh\n...@freebsd.org\n1996/09/20"] @@ -313,6 +314,7 @@ shurd [label="Stephen Hurd\nsh...@freebsd.org\n2017/09 simon [label="Simon L. Nielsen\nsi...@freebsd.org\n2006/03/07"] sjg [label="Simon J. Gerraty\n...@freebsd.org\n2012/10/23"] skra [label="Svatopluk Kraus\ns...@freebsd.org\n2015/10/28"] +slavash [label="Slava Shwartsman\nslav...@freebsd.org\n2018/02/08"] slm [label="Stephen McConnell\n...@freebsd.org\n2014/05/07"] smh [label="Steven Hartland\n...@freebsd.org\n2012/11/12"] sobomax [label="Maxim Sobolev\nsobo...@freebsd.org\n2001/07/25"] @@ -524,6 +526,8 @@ grog -> edwin grog -> le grog -> peterj +hselasky -> slavash + imp -> akiyama imp -> ambrisko imp -> andrew @@ -640,6 +644,7 @@ kib -> rdivacky kib -> rmacklem kib -> rmh kib -> skra +kib -> slavash kib -> stas kib -> tijl kib -> trociny ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"