# Re: \[PATCH net-next v3 04/12\] net: wwan: t7xx: Add control port

- From: Ilpo Järvinen \<ilpo.jarvinen@linux.intel.com\>
- Date: 2021-12-16 13:44:46 
- List: linux-wireless
- Page: https://ratatoskr.run/linux-wireless/2021/12/11219059
- Thread: https://ratatoskr.run/netdev/2021/12/11218124/t.md

```text
On Mon, 6 Dec 2021, Ricardo Martinez wrote:

> From: Haijun Liu <haijun.liu@mediatek.com>
> 
> Control Port implements driver control messages such as modem-host
> handshaking, controls port enumeration, and handles exception messages.
> 
> The handshaking process between the driver and the modem happens during
> the init sequence. The process involves the exchange of a list of
> supported runtime features to make sure that modem and host are ready
> to provide proper feature lists including port enumeration. Further
> features can be enabled and controlled in this handshaking process.
> 
> Signed-off-by: Haijun Liu <haijun.liu@mediatek.com>
> Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
> Co-developed-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
> Signed-off-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>



> +	ccci_h->packet_header = 0;
> +	ccci_h->packet_len = cpu_to_le32(packet_size);
> +	ccci_h->status &= cpu_to_le32(~HDR_FLD_CHN);
> +	ccci_h->status |= cpu_to_le32(FIELD_PREP(HDR_FLD_CHN, port_static->tx_ch));
> +	ccci_h->status &= cpu_to_le32(~HDR_FLD_SEQ);
> +	ccci_h->ex_msg = 0;

...

> +		ccci_h->packet_header = cpu_to_le32(CCCI_HEADER_NO_DATA);
> +		ccci_h->packet_len = cpu_to_le32(sizeof(*ctrl_msg_h) + CCCI_H_LEN);
> +		ccci_h->status &= cpu_to_le32(~HDR_FLD_CHN);
> +		ccci_h->status |= cpu_to_le32(FIELD_PREP(HDR_FLD_CHN, ch));
> +		ccci_h->ex_msg = 0;

...

> +		ccci_h->packet_header = cpu_to_le32(CCCI_HEADER_NO_DATA);
> +		ccci_h->packet_len = cpu_to_le32(msg);
> +		ccci_h->status &= cpu_to_le32(~HDR_FLD_CHN);
> +		ccci_h->status |= cpu_to_le32(FIELD_PREP(HDR_FLD_CHN, ch));
> +		ccci_h->ex_msg = cpu_to_le32(ex_msg);

A helper to handle the common part of ccci_h init would be useful.


-- 
 i.

```
