Ejemplo n.º 1
0
static int sipc4_rfs_tx(struct sipc4_tx_data *data)
{
	struct sk_buff *skb = data->skb;
	struct rfs_hdr *header = &rfs_frag_tx.header;
	int len = rfs_frag_tx.len + skb->len;
	bool head = 0;
	bool tail = 0;
	int err;

	if (rfs_frag_tx.len == 0) {
		memcpy(header, skb->data, sizeof(struct rfs_hdr));
		head = 1;
	}

	if (header->len == len) {
		rfs_frag_tx.len = 0;
		tail = 1;
	} else if (header->len > len) {
		rfs_frag_tx.len = 0;
		return -EMSGSIZE;
	} else
		rfs_frag_tx.len += skb->len;

	err = sipc4_add_hdlc(data, header, 0, head, tail);
	if (err < 0)
		rfs_frag_tx.len = 0;

	return err;
}
Ejemplo n.º 2
0
static int sipc4_raw_tx(struct sipc4_tx_data *data)
{
	unsigned int ch = SIPC4_CH(data->res);
	struct raw_hdr header;

	header.len = sizeof(struct raw_hdr) + data->skb->len;
	header.channel = ch;
	header.control = 0;

	return sipc4_add_hdlc(data, &header, sizeof(struct raw_hdr), 1, 1);
}
Ejemplo n.º 3
0
static int sipc4_fmt_tx(struct sipc4_tx_data *data)
{
	unsigned int ch = SIPC4_CH(data->res);
	struct fmt_hdr header;

	/* If channel is 0, it is not HDLC frame */
	if (ch == 0)
		return 0;

	header.len = sizeof(struct fmt_hdr) + data->skb->len;
	/* TODO: Multi frame */
	header.control = 0;

	return sipc4_add_hdlc(data, &header, sizeof(struct fmt_hdr), 1, 1);
}
Ejemplo n.º 4
0
static int sipc4_raw_tx(struct sipc4_tx_data *data)
{
	unsigned int ch = SIPC4_CH(data->res);
	struct raw_hdr header;

#ifdef CONFIG_BRIDGE
	if (ch >= CHID_PSD_DATA1 && ch <= CHID_PSD_DATA15)
		skb_pull(data->skb, 14);
#endif

	header.len = sizeof(struct raw_hdr) + data->skb->len;
	header.channel = ch;
	header.control = 0;

	return sipc4_add_hdlc(data, &header, sizeof(struct raw_hdr), 1, 1);
}