9 #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
11 #include <linux/stddef.h>
13 #include <linux/slab.h>
15 #include <linux/netdevice.h>
20 #define container_obj(layr) container_of(layr, struct cffrml, layer)
28 static int cffrml_receive(
struct cflayer *layr,
struct cfpkt *pkt);
29 static int cffrml_transmit(
struct cflayer *layr,
struct cfpkt *pkt);
33 static u32 cffrml_rcv_error;
34 static u32 cffrml_rcv_checsum_error;
48 this->
layer.receive = cffrml_receive;
49 this->
layer.transmit = cffrml_transmit;
50 this->
layer.ctrlcmd = cffrml_ctrlcmd;
52 this->
dofcs = use_fcs;
53 this->
layer.id = phyid;
82 static int cffrml_receive(
struct cflayer *layr,
struct cfpkt *pkt)
100 pr_err(
"Framing length error (%d)\n", len);
112 if (pktchks != hdrchks) {
115 ++cffrml_rcv_checsum_error;
116 pr_info(
"Frame checksum error (0x%x != 0x%x)\n",
123 pr_err(
"Packet is erroneous!\n");
129 pr_err(
"Layr up is missing!\n");
134 return layr->
up->receive(layr->
up, pkt);
137 static int cffrml_transmit(
struct cflayer *layr,
struct cfpkt *pkt)
156 pr_err(
"Packet is erroneous!\n");
166 return layr->
dn->transmit(layr->
dn, pkt);
172 if (layr->
up && layr->
up->ctrlcmd)
173 layr->
up->ctrlcmd(layr->
up, ctrl, layr->
id);