#ifndef inc_plcdrv_h #define inc_plcdrv_h /* Cleopatre project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file inc/plcdrv.h * \brief Interfaces for plcdrv layer. * \ingroup plcdrv * * Main structure of the PLC driver module and some small modules. */ #include #include #include #include #include #include #include #include #include #include #include "debug_dump.h" #include "ipmbox.h" #include "qos.h" #include "common/ipmbox/protocol.h" #include "common/ipmbox/msg.h" /** Define plc.rom informations. */ #define ROM_VERSION_SIZE 64 /** * TX pool size for data. */ #define PLCDRV_TX_POOL_DATA (IPMBOX_PROTOCOL_QUEUE_SIZE_A2L_DATA / \ IPMBOX_MSG_DATA_WORDS - 1) /** * RX pool size. */ #define PLCDRV_RX_POOL (IPMBOX_PROTOCOL_QUEUE_SIZE_A2L_EMPTY_BUF \ / IPMBOX_MSG_EMPTY_BUF_WORDS - 1) /** * Watchdog private context. */ typedef struct wd_t { /** Set to 1 when WD IT triggered. */ atomic_t expired; /** User space process sleeping on wait queue for WD IT triggering. */ wait_queue_head_t wq; } wd_t; /** * PLC private stats. */ typedef struct plcdrv_stats_t { /** No headroom in skb to FW, need to re-allocate it. */ atomic_t skb_to_fw_no_headroom; } plcdrv_stats_t; /** * Netlink context. */ typedef struct netlink_t { /** Socket. */ struct sock *sock; /** PID. */ uint32_t pid; } netlink_t; /** * PLC driver private data. */ struct plcdrv_t { /** PLC driver net device. */ struct net_device *dev; /** PLC driver net device stats. */ struct net_device_stats stats; /** IPMbox context. */ ipmbox_ctx_t ipmbox; /** NAPI context. */ struct napi_struct napi; /** Data TX pool (buffers given to firmware for transmission to PLC). */ struct sk_buff_head tx_pool_data; /** MME TX pool (buffers given to firmware for transmission to PLC). */ struct sk_buff_head tx_pool_mme; /** RX pool (buffers waiting to be filled by firmware). */ struct sk_buff_head rx_pool; /** Watchdog context. */ wd_t wd; /** PLC driver stats. */ plcdrv_stats_t plcdrv_stats; /** Netlink for PLCd. */ netlink_t nl_plcd; /** Netlink for Managerd. */ netlink_t nl_managerd; /** PLC driver character device. */ struct cdev cdev; /** PLC driver trace character device. */ struct cdev cdev_trace; /** PLC driver global device number. */ dev_t dev_number; /** PLC driver directory in ProcFS. */ struct proc_dir_entry *proc_dir_plc; /** Debug dump context. */ debug_dump_t debug_dump; /** Version of PLC firmware. */ uint8_t version[ROM_VERSION_SIZE]; /** QOS. */ qos_t qos; #ifdef CONFIG_SEQ_CHECK /** Sequence check context. */ struct seq_check_ctx seq_check_ctx; #endif }; #endif /* inc_plcdrv_h */