Expanding raw packet capabilities
Subsystems (2)
cover Expanding raw packet capabilities
Hi Doug,
Please find the following patchset from Noa.
This series unifies all existing raw packet capabilities under a new field in ib_device_attr named raw_packet_caps. This field is defined by the ib_raw_packet_caps enum. Such change makes it easier to report those capabilities back to the user.
The existing IP csum and scatter FCS capabilities were added to the enum and a new capability was introduced - cvlan stripping offload.
Cvlan stripping is the device's capability to remove the cvlan from an incoming raw packet and provide the data in the matching work completion.
This series also:
- Allows creation of WQ and raw Ethernet QP with cvlan stripping capability. This is done by setting the IBV_WQ_FLAGS_CVLAN_STRIPPING bit of the create_flags field in ibv_wq_init_attr struct.
- Allows setting and unsetting of cvlan stripping capability for an existing WQ. This is done by setting the following fields of the ibv_wq_attr struct:
- Setting IBV_WQ_ATTR_FLAGS bit of the attr_mask field.
- Setting the IBV_RAW_PACKET_CAP_CVLAN_STRIPPING bit of the flags_mask field.
- Either setting or unsetting the IBV_RAW_PACKET_CAP_CVLAN_STRIPPING bit of the flags field.
- Allows creation of WQ with scatter FCS offload.
This is done by setting the IBV_WQ_FLAGS_SCATTER_FCS bit of the create_flags field in ibv_wq_init_attr struct.
Thanks,
Noa
---
This patchset was generated against commitf502d834950a ("net/mlx5: Activate support for 4K UARs") and it applies cleanly on k.o/for-4.11 branch.
Available in the "topic/raw_packet_caps" topic branch of this git repo:git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/raw_packet_caps
Noa Osherovich (11):
IB/core: Expose vlan offloads capabilities
IB/core: Enable WQ creation and modification with cvlan offload IB/core: Enable QP creation with cvlan offload IB/core: Add scatter FCS flag to use in WQ creation IB/uverbs: Expose vlan offloads capabilities IB/uverbs: Enable WQ creation and modification with cvlan offload IB/uverbs: Enable QP creation with cvlan offload IB/mlx5: Expose vlan offloads capabilities
IB/mlx5: Enable WQ creation and modification with cvlan offload IB/mlx5: Enable QP creation with cvlan offload IB/mlx5: Support creation of a WQ with scatter FCS offload
drivers/infiniband/core/uverbs_cmd.c | 18 +++++++++++-- drivers/infiniband/hw/mlx5/main.c | 14 ++++++++-- drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 +++++ drivers/infiniband/hw/mlx5/qp.c | 50 ++++++++++++++++++++++++++++++++++-- include/rdma/ib_verbs.h | 29 +++++++++++++++++++-- include/uapi/rdma/ib_user_verbs.h | 6 ++++- 6 files changed, 114 insertions(+), 9 deletions(-)
--
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170118134004.5380-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH 1/11 IB/core: Expose vlan offloads capabilities
From: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Expose raw packet capabilities in the core layer to enable a device to report it.
Two existing capabilities, scatter FCS and IP CSUM were added to this field for a better user experience by exposing the raw packet caps from one location.
This field will serve also for future capabilities for raw packet QP.
A new capability was introduced - cvlan stripping, which is the device's ability to remove cvlan tag from an incoming packet and report it in the matching work completion.
--- include/rdma/ib_verbs.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/rdma/ib_verbs.h +15 -0
@@ -207,6 +207,7 @@ enum ib_device_cap_flags {IB_DEVICE_MEM_WINDOW_TYPE_2A = (1 <<23 ),IB_DEVICE_MEM_WINDOW_TYPE_2B = (1 <<24 ),IB_DEVICE_RC_IP_CSUM = (1 <<25 ), +/* Deprecated. Please use IB_RAW_PACKET_CAP_IP_CSUM. */ IB_DEVICE_RAW_IP_CSUM = (1 << 26),/* * Devices should set IB_DEVICE_CROSS_CHANNEL if they
@@ -220,6 +221,7 @@ enum ib_device_cap_flags {IB_DEVICE_ON_DEMAND_PAGING = (1ULL <<31 ),IB_DEVICE_SG_GAPS_REG = (1ULL <<32 ),IB_DEVICE_VIRTUAL_FUNCTION = (1ULL <<33 ), +/* Deprecated. Please use IB_RAW_PACKET_CAP_SCATTER_FCS. */ IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34), };
@@ -330,6 +332,7 @@ struct ib_device_attr {uint64_t hca_core_clock;/* in KHZ */ struct ib_rss_caps rss_caps;u32 max_wq_type_rq; +u32 raw_packet_caps;/* Use ib_raw_packet_caps enum */ };enum ib_mtu {
@@ -1456,6 +1459,18 @@ struct ib_srq { } ext; }; +enum ib_raw_packet_caps { +/* Strip cvlan from incoming packet and report it in the matching work +* completion is supported. +*/ +IB_RAW_PACKET_CAP_CVLAN_STRIPPING = (1 <<0 ), +/* Scatter FCS field of an incoming packet to host memory is supported. +*/ +IB_RAW_PACKET_CAP_SCATTER_FCS = (1 <<1 ), +/* Checksum offloads are supported (for both send and receive). */ +IB_RAW_PACKET_CAP_IP_CSUM = (1 <<2 ), +}; +enum ib_wq_type {IB_WQT_RQ };
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/11 IB/core: Enable WQ creation and modification with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Enable WQ creation and modification with cvlan stripping offload. This includes:
- Adding WQ creation flags.
- Extending modify WQ to get flags and flags mask to enable turning it on and off.
--- include/rdma/ib_verbs.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
include/rdma/ib_verbs.h +10 -2
@@ -1494,6 +1494,10 @@ struct ib_wq {atomic_t usecnt; }; +enum ib_wq_flags { +IB_WQ_FLAGS_CVLAN_STRIPPING =1 <<0 , +}; +struct ib_wq_init_attr {void *wq_context;enum ib_wq_type wq_type;
@@ -1501,16 +1505,20 @@ struct ib_wq_init_attr {u32 max_sge;struct ib_cq *cq;void (*event_handler)(struct ib_event *,void *); +u32 create_flags;/* Use enum ib_wq_flags */ };enum ib_wq_attr_mask { -IB_WQ_STATE =1 <<0 , -IB_WQ_CUR_STATE =1 <<1 , +IB_WQ_STATE =1 <<0 , +IB_WQ_CUR_STATE =1 <<1 , +IB_WQ_FLAGS =1 <<2 , };struct ib_wq_attr {enum ib_wq_state wq_state;enum ib_wq_state curr_wq_state; +u32 flags;/* Use enum ib_wq_flags */ +u32 flags_mask;/* Use enum ib_wq_flags */ };struct ib_rwq_ind_table {
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/11 IB/core: Enable QP creation with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add a QP creation flag to support cvlan stripping, it's applicable for RAW Ethernet QP.
--- include/rdma/ib_verbs.h | 1 + 1 file changed, 1 insertion(+)
include/rdma/ib_verbs.h +1 -0
@@ -1008,6 +1008,7 @@ enum ib_qp_create_flags {IB_QP_CREATE_SIGNATURE_EN =1 <<6 ,IB_QP_CREATE_USE_GFP_NOIO =1 <<7 ,IB_QP_CREATE_SCATTER_FCS =1 <<8 , +IB_QP_CREATE_CVLAN_STRIPPING =1 <<9 ,/* reserve bits 26-31 for low level drivers' internal use */ IB_QP_CREATE_RESERVED_START =1 <<26 , IB_QP_CREATE_RESERVED_END = 1 << 31,
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/11 IB/core: Add scatter FCS flag to use in WQ creation
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add a new creation flag to set the scatter FCS capability of a WQ.
--- include/rdma/ib_verbs.h | 1 + 1 file changed, 1 insertion(+)
include/rdma/ib_verbs.h +1 -0
@@ -1497,6 +1497,7 @@ struct ib_wq {enum ib_wq_flags {IB_WQ_FLAGS_CVLAN_STRIPPING =1 <<0 , +IB_WQ_FLAGS_SCATTER_FCS =1 <<1 , };struct ib_wq_init_attr {
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/11 IB/uverbs: Expose vlan offloads capabilities
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Expose raw packet capabilities to user space as part of query device.
--- drivers/infiniband/core/uverbs_cmd.c | 6 ++++++ include/uapi/rdma/ib_user_verbs.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +6 -0
@@ -4323,6 +4323,12 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, resp.max_wq_type_rq = attr.max_wq_type_rq; resp.response_length +=sizeof (resp.max_wq_type_rq); + +if (ucore->outlen < resp.response_length +sizeof (resp.raw_packet_caps)) + goto end; + + resp.raw_packet_caps = attr.raw_packet_caps; + resp.response_length +=sizeof (resp.raw_packet_caps); end: err =ib_copy_to_udata (ucore, &resp, resp.response_length);return err;
include/uapi/rdma/ib_user_verbs.h +1 -1
@@ -247,7 +247,7 @@ struct ib_uverbs_ex_query_device_resp {__u64 device_cap_flags_ex;struct ib_uverbs_rss_caps rss_caps;__u32 max_wq_type_rq; -__u32 reserved; +__u32 raw_packet_caps; };struct ib_uverbs_query_port {
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/11 IB/uverbs: Enable WQ creation and modification with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Enable user space application via WQ creation and modification to turn on and off cvlan offload.
--- drivers/infiniband/core/uverbs_cmd.c | 9 ++++++++- include/uapi/rdma/ib_user_verbs.h | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +8 -1
@@ -3325,6 +3325,9 @@ int ib_uverbs_ex_create_wq(struct ib_uverbs_file *file, wq_init_attr.wq_context = file; wq_init_attr.wq_type = cmd.wq_type; wq_init_attr.event_handler = ib_uverbs_wq_event_handler; +if (ucore->inlen >= (offsetof(typeof (cmd ), create_flags) + +sizeof (cmd.create_flags))) + wq_init_attr.create_flags = cmd.create_flags; obj->uevent.events_reported =0 ;INIT_LIST_HEAD (&obj->uevent.event_list); wq = pd->device->create_wq (pd, &wq_init_attr, uhw);
@@ -3480,7 +3483,7 @@ int ib_uverbs_ex_modify_wq(struct ib_uverbs_file *file,if (!cmd.attr_mask)return -EINVAL ; -if (cmd.attr_mask > (IB_WQ_STATE |IB_WQ_CUR_STATE )) +if (cmd.attr_mask > (IB_WQ_STATE |IB_WQ_CUR_STATE |IB_WQ_FLAGS ))return -EINVAL ; wq =idr_read_wq (cmd.wq_handle, file->ucontext);
@@ -3489,6 +3492,10 @@ int ib_uverbs_ex_modify_wq(struct ib_uverbs_file *file, wq_attr.curr_wq_state = cmd.curr_wq_state; wq_attr.wq_state = cmd.wq_state; +if (cmd.attr_mask &IB_WQ_FLAGS ) { + wq_attr.flags = cmd.flags; + wq_attr.flags_mask = cmd.flags_mask; + } ret = wq->device->modify_wq (wq, &wq_attr, cmd.attr_mask, uhw);put_wq_read (wq);return ret;
include/uapi/rdma/ib_user_verbs.h +4 -0
@@ -1048,6 +1048,8 @@ struct ib_uverbs_ex_create_wq {__u32 cq_handle;__u32 max_wr;__u32 max_sge; +__u32 create_flags;/* Use enum ib_wq_flags */ +__u32 reserved; };struct ib_uverbs_ex_create_wq_resp {
@@ -1076,6 +1078,8 @@ struct ib_uverbs_ex_modify_wq {__u32 wq_handle;__u32 wq_state;__u32 curr_wq_state; +__u32 flags;/* Use enum ib_wq_flags */ +__u32 flags_mask;/* Use enum ib_wq_flags */ };/* Prevent memory allocation rather than max expected size */
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/11 IB/uverbs: Enable QP creation with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Enable user applications to create a QP with cvlan stripping offload.
--- drivers/infiniband/core/uverbs_cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +2 -1
@@ -1891,7 +1891,8 @@ static int create_qp(struct ib_uverbs_file *file, IB_QP_CREATE_CROSS_CHANNEL | IB_QP_CREATE_MANAGED_SEND | IB_QP_CREATE_MANAGED_RECV | - IB_QP_CREATE_SCATTER_FCS)) { + IB_QP_CREATE_SCATTER_FCS | + IB_QP_CREATE_CVLAN_STRIPPING)) { ret = -EINVAL ; goto err_put; }
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/11 IB/mlx5: Expose vlan offloads capabilities
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Check device's capabilities and report which raw packet capabilities are supported.
--- drivers/infiniband/hw/mlx5/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/main.c +12 -2
@@ -564,8 +564,15 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, props->device_cap_flags |=IB_DEVICE_BLOCK_MULTICAST_LOOPBACK ;if (MLX5_CAP_GEN (dev->mdev, eth_net_offloads)) { -if (MLX5_CAP_ETH (mdev, csum_cap)) +if (MLX5_CAP_ETH (mdev, csum_cap)) { +/* Legacy bit to support old userspace libraries */ props->device_cap_flags |=IB_DEVICE_RAW_IP_CSUM ; + props->raw_packet_caps |=IB_RAW_PACKET_CAP_IP_CSUM ; + } + +if (MLX5_CAP_ETH (dev->mdev, vlan_cap)) + props->raw_packet_caps |= +IB_RAW_PACKET_CAP_CVLAN_STRIPPING ;if (field_avail (typeof (resp), tso_caps, uhw->outlen)) { max_tso =MLX5_CAP_ETH (mdev, max_lso_cap);
@@ -604,8 +611,11 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, }if (MLX5_CAP_GEN (dev->mdev, eth_net_offloads) && -MLX5_CAP_ETH (dev->mdev, scatter_fcs)) +MLX5_CAP_ETH (dev->mdev, scatter_fcs)) { +/* Legacy bit to support old userspace libraries */ props->device_cap_flags |=IB_DEVICE_RAW_SCATTER_FCS ; + props->raw_packet_caps |=IB_RAW_PACKET_CAP_SCATTER_FCS ; + }if (mlx5_get_flow_namespace (dev->mdev,MLX5_FLOW_NAMESPACE_BYPASS )) props->device_cap_flags |=IB_DEVICE_MANAGED_FLOW_STEERING ;
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/11 IB/mlx5: Enable WQ creation and modification with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Allow creating a WQ with cvlan stripping considering device's capabilities. The default value was fixed to disable vlan stripping till was asked explicitly.
In addition, allow modification of a WQ to turn on/off this property.
--- drivers/infiniband/hw/mlx5/qp.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +27 -1
@@ -4610,9 +4610,20 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd,MLX5_SET (wq, wq, log_wq_pg_sz, rwq->log_page_size);MLX5_SET (wq, wq, wq_signature, rwq->wq_sig);MLX5_SET64 (wq, wq, dbr_addr, rwq->db.dma); +if (init_attr->create_flags &IB_WQ_FLAGS_CVLAN_STRIPPING ) { +if (!(MLX5_CAP_GEN (dev->mdev, eth_net_offloads) && +MLX5_CAP_ETH (dev->mdev, vlan_cap))) { +mlx5_ib_dbg (dev,"VLAN offloads are not supported\n" ); + err = -EOPNOTSUPP ; + goto out; + } + }else { +MLX5_SET (rqc, rqc, vsd,1 ); + } rq_pas0 = (__be64 *)MLX5_ADDR_OF (wq, wq, pas);mlx5_ib_populate_pas (dev, rwq->umem, rwq->page_shift, rq_pas0,0 ); err =mlx5_core_create_rq_tracked (dev->mdev, in, inlen, &rwq->core_qp); +out:kvfree (in);return err; }
@@ -4895,11 +4906,26 @@ int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr, wq_state =MLX5_RQC_STATE_ERR ;MLX5_SET (modify_rq_in, in, rq_state, curr_wq_state);MLX5_SET (rqc, rqc, state, wq_state); +if (wq_attr_mask &IB_WQ_FLAGS ) { +if (wq_attr->flags_mask &IB_WQ_FLAGS_CVLAN_STRIPPING ) { +if (!(MLX5_CAP_GEN (dev->mdev, eth_net_offloads) && +MLX5_CAP_ETH (dev->mdev, vlan_cap))) { +mlx5_ib_dbg (dev,"VLAN offloads are not supported\n" ); + err = -EOPNOTSUPP ; + goto out; + } +MLX5_SET64 (modify_rq_in, in, modify_bitmask, +MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD ); +MLX5_SET (rqc, rqc, vsd, + (wq_attr->flags &IB_WQ_FLAGS_CVLAN_STRIPPING ) ?0 :1 ); + } + } err =mlx5_core_modify_rq (dev->mdev, rwq->core_qp.qpn, in, inlen); -kvfree (in);if (!err) rwq->ibwq.state = (wq_state ==MLX5_RQC_STATE_ERR ) ?IB_WQS_ERR : wq_state; +out: +kvfree (in);return err; }
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/11 IB/mlx5: Enable QP creation with cvlan offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Enable creating a RAW Ethernet QP with cvlan stripping offload when it's supported by the hardware.
--- drivers/infiniband/hw/mlx5/mlx5_ib.h | 6 ++++++ drivers/infiniband/hw/mlx5/qp.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +6 -0
@@ -220,6 +220,10 @@ struct wr_list {u16 next; }; +enum mlx5_ib_rq_flags { +MLX5_IB_RQ_CVLAN_STRIPPING =1 <<0 , +}; +struct mlx5_ib_wq {u64 *wrid;u32 *wr_data;
@@ -308,6 +312,7 @@ struct mlx5_ib_rq {struct mlx5_db *doorbell;u32 tirn;u8 state; +u32 flags; };struct mlx5_ib_sq {
@@ -392,6 +397,7 @@ enum mlx5_ib_qp_flags {MLX5_IB_QP_SQPN_QP1 =1 <<6 ,MLX5_IB_QP_CAP_SCATTER_FCS =1 <<7 ,MLX5_IB_QP_RSS =1 <<8 , + MLX5_IB_QP_CVLAN_STRIPPING = 1 << 9, }; struct mlx5_umr_wr {
drivers/infiniband/hw/mlx5/qp.c +12 -1
@@ -1141,7 +1141,8 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,return -ENOMEM ; rqc =MLX5_ADDR_OF (create_rq_in, in, ctx); -MLX5_SET (rqc, rqc, vsd,1 ); +if (!(rq->flags &MLX5_IB_RQ_CVLAN_STRIPPING )) +MLX5_SET (rqc, rqc, vsd,1 );MLX5_SET (rqc, rqc, mem_rq_type,MLX5_RQC_MEM_RQ_TYPE_MEMORY_RQ_INLINE );MLX5_SET (rqc, rqc, state,MLX5_RQC_STATE_RST );MLX5_SET (rqc, rqc, flush_in_error_en,1 );
@@ -1238,6 +1239,8 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,if (qp->rq.wqe_cnt) { rq->base.container_mibqp = qp; +if (qp->flags &MLX5_IB_QP_CVLAN_STRIPPING ) + rq->flags |=MLX5_IB_RQ_CVLAN_STRIPPING ; err =create_raw_packet_qp_rq (dev, rq, in);if (err) goto err_destroy_sq;
@@ -1559,6 +1562,14 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,if (init_attr->sq_sig_type ==IB_SIGNAL_ALL_WR ) qp->sq_signal_bits =MLX5_WQE_CTRL_CQ_UPDATE ; +if (init_attr->create_flags &IB_QP_CREATE_CVLAN_STRIPPING ) { +if (!(MLX5_CAP_GEN (dev->mdev, eth_net_offloads) && +MLX5_CAP_ETH (dev->mdev, vlan_cap)) || + (init_attr->qp_type !=IB_QPT_RAW_PACKET )) +return -EOPNOTSUPP ; + qp->flags |=MLX5_IB_QP_CVLAN_STRIPPING ; + } +if (pd && pd->uobject) {if (ib_copy_from_udata (&ucmd, udata,sizeof (ucmd))) {mlx5_ib_dbg (dev,"copy failed\n" );
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/11 IB/mlx5: Support creation of a WQ with scatter FCS offload
In reply to a message not in the archiveFrom: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add support for creation of a WQ with scatter FCS capability, if this capability is supported by the hardware.
--- drivers/infiniband/hw/mlx5/qp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +11 -2
@@ -4590,6 +4590,7 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, struct ib_wq_init_attr *init_attr) {struct mlx5_ib_dev *dev; +int has_net_offloads;__be64 *rq_pas0;void *in;void *rqc;
@@ -4621,9 +4622,9 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd,MLX5_SET (wq, wq, log_wq_pg_sz, rwq->log_page_size);MLX5_SET (wq, wq, wq_signature, rwq->wq_sig);MLX5_SET64 (wq, wq, dbr_addr, rwq->db.dma); + has_net_offloads =MLX5_CAP_GEN (dev->mdev, eth_net_offloads);if (init_attr->create_flags &IB_WQ_FLAGS_CVLAN_STRIPPING ) { -if (!(MLX5_CAP_GEN (dev->mdev, eth_net_offloads) && -MLX5_CAP_ETH (dev->mdev, vlan_cap))) { +if (!(has_net_offloads &&MLX5_CAP_ETH (dev->mdev, vlan_cap))) {mlx5_ib_dbg (dev,"VLAN offloads are not supported\n" ); err = -EOPNOTSUPP ; goto out;
@@ -4631,6 +4632,14 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, }else {MLX5_SET (rqc, rqc, vsd,1 ); } +if (init_attr->create_flags &IB_WQ_FLAGS_SCATTER_FCS ) { +if (!(has_net_offloads &&MLX5_CAP_ETH (dev->mdev, scatter_fcs))) { +mlx5_ib_dbg (dev,"Scatter FCS is not supported\n" ); + err = -EOPNOTSUPP ; + goto out; + } +MLX5_SET (rqc, rqc, scatter_fcs,1 ); + } rq_pas0 = (__be64 *)MLX5_ADDR_OF (wq, wq, pas);mlx5_ib_populate_pas (dev, rwq->umem, rwq->page_shift, rq_pas0,0 ); err =mlx5_core_create_rq_tracked (dev->mdev, in, inlen, &rwq->core_qp);
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
We would like to have these added capabilities. Was this merged?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): alpine.DEB.2.20.1702081025070.5043-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org
Quoted 1 line · Christoph Lameter
We would like to have these added capabilities. Was this merged?
As of today, yes.
Signature · 4 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
A message that is not in the archive (sent off-list or not yet received): 1487089742.86943.75.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Quoted 4 lines · Doug Ledford
Quoted 1 line · Christoph Lameter
We would like to have these added capabilities. Was this merged?
As of today, yes.
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 35 lines · Leon Romanovsky
Hi Doug,
Please find the following patchset from Noa.
This series unifies all existing raw packet capabilities under a new field in
ib_device_attrnamedraw_packet_caps. This field is defined by theib_raw_packet_capsenum. Such change makes it easier to report those capabilities back to the user.The existing IP csum and scatter FCS capabilities were added to the enum and a new capability was introduced - cvlan stripping offload.
Cvlan stripping is the device's capability to remove the cvlan from an incoming raw packet and provide the data in the matching work completion.
This series also:
- Allows creation of WQ and raw Ethernet QP with cvlan stripping capability.
This is done by setting theIBV_WQ_FLAGS_CVLAN_STRIPPINGbit of thecreate_flagsfield inibv_wq_init_attrstruct.
- Allows setting and unsetting of cvlan stripping capability for an existing WQ.
This is done by setting the following fields of theibv_wq_attrstruct:
- SettingIBV_WQ_ATTR_FLAGSbit of theattr_maskfield.
- Setting theIBV_RAW_PACKET_CAP_CVLAN_STRIPPINGbit of theflags_maskfield.
- Either setting or unsetting theIBV_RAW_PACKET_CAP_CVLAN_STRIPPING
bit of the flags field.
- Allows creation of WQ with scatter FCS offload.
This is done by setting theIBV_WQ_FLAGS_SCATTER_FCSbit of thecreate_flagsfield inibv_wq_init_attrstruct.
Quoted 2 lines
Thanks,
Noa
This is a fairly straightforward expansion of the raw ethernet QP options. Series applied, thanks.
Signature · 4 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD