Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> writes: > On 1/29/2024 8:02 PM, Kang Yang wrote: > >> P2P Element is a necessary component of P2P protocol communication. >> It contains the Vendor Specific Information Element which includes >> the WFA OUI and an OUI Type indicating P2P. >> >> Add P2P IE in beacon template, and implement WMI interface for it. >> >> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 >> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 >> >> Signed-off-by: Kang Yang <quic_kangyang@xxxxxxxxxxx> [...] >> +int ath12k_wmi_p2p_go_bcn_ie(struct ath12k *ar, u32 vdev_id, >> + const u8 *p2p_ie) >> +{ > ... >> + ptr = skb->data; >> + cmd = ptr; >> + cmd->tlv_header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_P2P_GO_SET_BEACON_IE, >> + sizeof(*cmd)); >> + cmd->vdev_id = cpu_to_le32(vdev_id); >> + cmd->ie_buf_len = cpu_to_le32(p2p_ie_len); >> + >> + ptr = skb->data + sizeof(*cmd); > > IMO better would be: ptr += sizeof(*cmd); > > Kalle can probably adjust this in the pending branch Yeah, I changed that. But I think even better would be to avoid pointer arightmetic and do something like this: struct wmi_p2p_go_set_beacon_ie_cmd { __le32 tlv_header; __le32 vdev_id; __le32 ie_buf_len; u8 tlv[]; } __packed; tlv = cmd->tlv; tlv->header = ath12k_wmi_tlv_cmd_hdr(WMI_TAG_ARRAY_BYTE, aligned_len); But that's separate cleanup, I see pointer arithmetic used quite a lot in wmi.c. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches