Пример #1
0
int modem_io_init(struct modemctl *mc, void __iomem *mmio)
{
	struct net_device *ndev;
	struct vnet *vn;
	int r;

	INIT_M_FIFO(mc->fmt_tx, FMT, TX, mmio);
	INIT_M_FIFO(mc->fmt_rx, FMT, RX, mmio);
	INIT_M_FIFO(mc->raw_tx, RAW, TX, mmio);
	INIT_M_FIFO(mc->raw_rx, RAW, RX, mmio);
	INIT_M_FIFO(mc->rfs_tx, RFS, TX, mmio);
	INIT_M_FIFO(mc->rfs_rx, RFS, RX, mmio);

	ndev = alloc_netdev(0, "rmnet%d", vnet_setup);
	if (ndev) {
		vn = netdev_priv(ndev);
		vn->mc = mc;
		skb_queue_head_init(&vn->txq);
		r = register_netdev(ndev);
		if (r)
			free_netdev(ndev);
		else
			mc->ndev = ndev;
	}

	mc->cmd_pipe.tx = &mc->fmt_tx;
	mc->cmd_pipe.rx = &mc->fmt_rx;
	mc->cmd_pipe.tx->bits = MBD_SEND_FMT;
	mc->cmd_pipe.push_header = push_fmt_header;
	mc->cmd_pipe.pull_header = pull_fmt_header;
	mc->cmd_pipe.header_size = sizeof(struct fmt_hdr);
	mc->cmd_pipe.mc = mc;
	if (modem_pipe_register(&mc->cmd_pipe, "modem_fmt"))
		pr_err("failed to register modem_fmt pipe\n");

	mc->rfs_pipe.tx = &mc->rfs_tx;
	mc->rfs_pipe.rx = &mc->rfs_rx;
	mc->rfs_pipe.tx->bits = MBD_SEND_RFS;
	mc->rfs_pipe.push_header = push_rfs_header;
	mc->rfs_pipe.pull_header = pull_rfs_header;
	mc->rfs_pipe.header_size = sizeof(struct rfs_hdr);
	mc->rfs_pipe.mc = mc;
	if (modem_pipe_register(&mc->rfs_pipe, "modem_rfs"))
		pr_err("failed to register modem_rfs pipe\n");

	return 0;
}
Пример #2
0
int modem_io_init(struct modemctl *mc, void __iomem *mmio)
{

	INIT_M_FIFO(mc->packet_tx, PACKET, TX, mmio);
	INIT_M_FIFO(mc->packet_rx, PACKET, RX, mmio);


	mc->packet_pipe.tx = &mc->packet_tx;
	mc->packet_pipe.rx = &mc->packet_rx;
	mc->packet_pipe.tx->bits = MB_PACKET;
	mc->packet_pipe.push_header = push_packet_header;
	mc->packet_pipe.pull_header = pull_packet_header;
	mc->packet_pipe.header_size = sizeof(struct packet_hdr);
	mc->packet_pipe.mc = mc;
	if (modem_pipe_register(&mc->packet_pipe, "modem_packet"))
		pr_err("failed to register modem_fmt pipe\n");

	return 0;
}