| .. | .. |
|---|
| 305 | 305 | rcu_read_lock(); |
|---|
| 306 | 306 | qp0 = rcu_dereference(ibp->rvp.qp[0]); |
|---|
| 307 | 307 | if (qp0) |
|---|
| 308 | | - ah = rdma_create_ah(qp0->ibqp.pd, &attr); |
|---|
| 308 | + ah = rdma_create_ah(qp0->ibqp.pd, &attr, 0); |
|---|
| 309 | 309 | rcu_read_unlock(); |
|---|
| 310 | 310 | return ah; |
|---|
| 311 | 311 | } |
|---|
| .. | .. |
|---|
| 721 | 721 | /* Bad mkey not a violation below level 2 */ |
|---|
| 722 | 722 | if (ibp->rvp.mkeyprot < 2) |
|---|
| 723 | 723 | break; |
|---|
| 724 | | - /* fall through */ |
|---|
| 724 | + fallthrough; |
|---|
| 725 | 725 | case IB_MGMT_METHOD_SET: |
|---|
| 726 | 726 | case IB_MGMT_METHOD_TRAP_REPRESS: |
|---|
| 727 | 727 | if (ibp->rvp.mkey_violations != 0xFFFF) |
|---|
| .. | .. |
|---|
| 1272 | 1272 | case IB_PORT_NOP: |
|---|
| 1273 | 1273 | if (phys_state == IB_PORTPHYSSTATE_NOP) |
|---|
| 1274 | 1274 | break; |
|---|
| 1275 | | - /* FALLTHROUGH */ |
|---|
| 1275 | + fallthrough; |
|---|
| 1276 | 1276 | case IB_PORT_DOWN: |
|---|
| 1277 | 1277 | if (phys_state == IB_PORTPHYSSTATE_NOP) { |
|---|
| 1278 | 1278 | link_state = HLS_DN_DOWNDEF; |
|---|
| .. | .. |
|---|
| 2300 | 2300 | * can be changed from the default values |
|---|
| 2301 | 2301 | */ |
|---|
| 2302 | 2302 | case OPA_VLARB_PREEMPT_ELEMENTS: |
|---|
| 2303 | | - /* FALLTHROUGH */ |
|---|
| 2304 | 2303 | case OPA_VLARB_PREEMPT_MATRIX: |
|---|
| 2305 | 2304 | smp->status |= IB_SMP_UNSUP_METH_ATTR; |
|---|
| 2306 | 2305 | break; |
|---|
| .. | .. |
|---|
| 2381 | 2380 | __be64 port_vl_rcv_bubble; |
|---|
| 2382 | 2381 | __be64 port_vl_mark_fecn; |
|---|
| 2383 | 2382 | __be64 port_vl_xmit_discards; |
|---|
| 2384 | | - } vls[0]; /* real array size defined by # bits set in vl_select_mask */ |
|---|
| 2383 | + } vls[]; /* real array size defined by # bits set in vl_select_mask */ |
|---|
| 2385 | 2384 | }; |
|---|
| 2386 | 2385 | |
|---|
| 2387 | 2386 | enum counter_selects { |
|---|
| .. | .. |
|---|
| 2423 | 2422 | __be16 attr_id; |
|---|
| 2424 | 2423 | __be16 err_reqlength; /* 1 bit, 8 res, 7 bit */ |
|---|
| 2425 | 2424 | __be32 attr_mod; |
|---|
| 2426 | | - u8 data[0]; |
|---|
| 2425 | + u8 data[]; |
|---|
| 2427 | 2426 | }; |
|---|
| 2428 | 2427 | |
|---|
| 2429 | 2428 | #define MSK_LLI 0x000000f0 |
|---|
| .. | .. |
|---|
| 2743 | 2742 | u16 link_width; |
|---|
| 2744 | 2743 | u16 link_speed; |
|---|
| 2745 | 2744 | |
|---|
| 2746 | | - response_data_size = sizeof(struct opa_port_status_rsp) + |
|---|
| 2747 | | - num_vls * sizeof(struct _vls_pctrs); |
|---|
| 2745 | + response_data_size = struct_size(rsp, vls, num_vls); |
|---|
| 2748 | 2746 | if (response_data_size > sizeof(pmp->data)) { |
|---|
| 2749 | 2747 | pmp->mad_hdr.status |= OPA_PM_STATUS_REQUEST_TOO_LARGE; |
|---|
| 2750 | 2748 | return reply((struct ib_mad_hdr *)pmp); |
|---|
| .. | .. |
|---|
| 3010 | 3008 | } |
|---|
| 3011 | 3009 | |
|---|
| 3012 | 3010 | /* Sanity check */ |
|---|
| 3013 | | - response_data_size = sizeof(struct opa_port_data_counters_msg) + |
|---|
| 3014 | | - num_vls * sizeof(struct _vls_dctrs); |
|---|
| 3011 | + response_data_size = struct_size(req, port[0].vls, num_vls); |
|---|
| 3015 | 3012 | |
|---|
| 3016 | 3013 | if (response_data_size > sizeof(pmp->data)) { |
|---|
| 3017 | 3014 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
|---|
| .. | .. |
|---|
| 3227 | 3224 | return reply((struct ib_mad_hdr *)pmp); |
|---|
| 3228 | 3225 | } |
|---|
| 3229 | 3226 | |
|---|
| 3230 | | - response_data_size = sizeof(struct opa_port_error_counters64_msg) + |
|---|
| 3231 | | - num_vls * sizeof(struct _vls_ectrs); |
|---|
| 3227 | + response_data_size = struct_size(req, port[0].vls, num_vls); |
|---|
| 3232 | 3228 | |
|---|
| 3233 | 3229 | if (response_data_size > sizeof(pmp->data)) { |
|---|
| 3234 | 3230 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
|---|
| .. | .. |
|---|
| 4173 | 4169 | return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; |
|---|
| 4174 | 4170 | if (ibp->rvp.port_cap_flags & IB_PORT_SM) |
|---|
| 4175 | 4171 | return IB_MAD_RESULT_SUCCESS; |
|---|
| 4176 | | - /* FALLTHROUGH */ |
|---|
| 4172 | + fallthrough; |
|---|
| 4177 | 4173 | default: |
|---|
| 4178 | 4174 | smp->status |= IB_SMP_UNSUP_METH_ATTR; |
|---|
| 4179 | 4175 | ret = reply((struct ib_mad_hdr *)smp); |
|---|
| .. | .. |
|---|
| 4243 | 4239 | return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; |
|---|
| 4244 | 4240 | if (ibp->rvp.port_cap_flags & IB_PORT_SM) |
|---|
| 4245 | 4241 | return IB_MAD_RESULT_SUCCESS; |
|---|
| 4246 | | - /* FALLTHROUGH */ |
|---|
| 4242 | + fallthrough; |
|---|
| 4247 | 4243 | default: |
|---|
| 4248 | 4244 | smp->status |= IB_SMP_UNSUP_METH_ATTR; |
|---|
| 4249 | 4245 | ret = reply((struct ib_mad_hdr *)smp); |
|---|
| .. | .. |
|---|
| 4918 | 4914 | */ |
|---|
| 4919 | 4915 | int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, |
|---|
| 4920 | 4916 | const struct ib_wc *in_wc, const struct ib_grh *in_grh, |
|---|
| 4921 | | - const struct ib_mad_hdr *in_mad, size_t in_mad_size, |
|---|
| 4922 | | - struct ib_mad_hdr *out_mad, size_t *out_mad_size, |
|---|
| 4923 | | - u16 *out_mad_pkey_index) |
|---|
| 4917 | + const struct ib_mad *in_mad, struct ib_mad *out_mad, |
|---|
| 4918 | + size_t *out_mad_size, u16 *out_mad_pkey_index) |
|---|
| 4924 | 4919 | { |
|---|
| 4925 | | - switch (in_mad->base_version) { |
|---|
| 4920 | + switch (in_mad->mad_hdr.base_version) { |
|---|
| 4926 | 4921 | case OPA_MGMT_BASE_VERSION: |
|---|
| 4927 | | - if (unlikely(in_mad_size != sizeof(struct opa_mad))) { |
|---|
| 4928 | | - dev_err(ibdev->dev.parent, "invalid in_mad_size\n"); |
|---|
| 4929 | | - return IB_MAD_RESULT_FAILURE; |
|---|
| 4930 | | - } |
|---|
| 4931 | 4922 | return hfi1_process_opa_mad(ibdev, mad_flags, port, |
|---|
| 4932 | 4923 | in_wc, in_grh, |
|---|
| 4933 | 4924 | (struct opa_mad *)in_mad, |
|---|
| .. | .. |
|---|
| 4935 | 4926 | out_mad_size, |
|---|
| 4936 | 4927 | out_mad_pkey_index); |
|---|
| 4937 | 4928 | case IB_MGMT_BASE_VERSION: |
|---|
| 4938 | | - return hfi1_process_ib_mad(ibdev, mad_flags, port, |
|---|
| 4939 | | - in_wc, in_grh, |
|---|
| 4940 | | - (const struct ib_mad *)in_mad, |
|---|
| 4941 | | - (struct ib_mad *)out_mad); |
|---|
| 4929 | + return hfi1_process_ib_mad(ibdev, mad_flags, port, in_wc, |
|---|
| 4930 | + in_grh, in_mad, out_mad); |
|---|
| 4942 | 4931 | default: |
|---|
| 4943 | 4932 | break; |
|---|
| 4944 | 4933 | } |
|---|