^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) ST-Ericsson AB 2010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Sjur Brendeland
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef CAIF_DEVICE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define CAIF_DEVICE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/net.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/caif/caif_socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <net/caif/caif_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * struct caif_dev_common - data shared between CAIF drivers and stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * @flowctrl: Flow Control callback function. This function is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * supplied by CAIF Core Stack and is used by CAIF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * Link Layer to send flow-stop to CAIF Core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * The flow information will be distributed to all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * clients of CAIF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @link_select: Profile of device, either high-bandwidth or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * low-latency. This member is set by CAIF Link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Layer Device in order to indicate if this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * is a high bandwidth or low latency device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * @use_frag: CAIF Frames may be fragmented.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * Is set by CAIF Link Layer in order to indicate if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * interface receives fragmented frames that must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * assembled by CAIF Core Layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * @use_fcs: Indicate if Frame CheckSum (fcs) is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * Is set if the physical interface is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * using Frame Checksum on the CAIF Frames.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * @use_stx: Indicate STart of frame eXtension (stx) in use.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * Is set if the CAIF Link Layer expects
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * CAIF Frames to start with the STX byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * This structure is shared between the CAIF drivers and the CAIF stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * It is used by the device to register its behavior.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * CAIF Core layer must set the member flowctrl in order to supply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * CAIF Link Layer with the flow control function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct caif_dev_common {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) void (*flowctrl)(struct net_device *net, int on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) enum caif_link_selector link_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int use_frag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) int use_fcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int use_stx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #endif /* CAIF_DEVICE_H_ */