* Re: pull-request: can 2012-10-10
From: Marc Kleine-Budde @ 2012-10-10 20:42 UTC (permalink / raw)
To: davem; +Cc: linux-can, socketcan, netdev, dhowells, Marc Kleine-Budde
In-Reply-To: <1349901576-30774-1-git-send-email-mkl@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
On 10/10/2012 10:39 PM, Marc Kleine-Budde wrote:
> Hello David,
>
> this pull request for net, i.e. the v3.7 release cycle, contains the patch by
> David Howells to move the UAPI related headers for the CAN subsystem.
I cherry picked David's patch, hope this is correct. Let me know, if a
merge is preferred here and I'll do so.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* pull-request: can 2012-10-10
From: Marc Kleine-Budde @ 2012-10-10 20:39 UTC (permalink / raw)
To: davem; +Cc: linux-can, socketcan, netdev, dhowells
Hello David,
this pull request for net, i.e. the v3.7 release cycle, contains the patch by
David Howells to move the UAPI related headers for the CAN subsystem.
regards, Marc
--
The following changes since commit 85457685e0e314f6902caaef976b3fd8ef4f51b4:
Merge tag 'master-2012-10-08' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2012-10-10 11:59:54 -0400)
are available in the git repository at:
git://gitorious.org/linux-can/linux-can.git uapi-for-3.7
for you to fetch changes up to 922cd657c95fe3e4214d68a958e98288b7a55bba:
UAPI: (Scripted) Disintegrate include/linux/can (2012-10-10 22:24:21 +0200)
----------------------------------------------------------------
David Howells (1):
UAPI: (Scripted) Disintegrate include/linux/can
include/linux/can/Kbuild | 5 -----
include/uapi/linux/can/Kbuild | 5 +++++
include/{ => uapi}/linux/can/bcm.h | 0
include/{ => uapi}/linux/can/error.h | 0
include/{ => uapi}/linux/can/gw.h | 0
include/{ => uapi}/linux/can/netlink.h | 0
include/{ => uapi}/linux/can/raw.h | 0
7 files changed, 5 insertions(+), 5 deletions(-)
rename include/{ => uapi}/linux/can/bcm.h (100%)
rename include/{ => uapi}/linux/can/error.h (100%)
rename include/{ => uapi}/linux/can/gw.h (100%)
rename include/{ => uapi}/linux/can/netlink.h (100%)
rename include/{ => uapi}/linux/can/raw.h (100%)
^ permalink raw reply
* [PATCH] UAPI: (Scripted) Disintegrate include/linux/can
From: Marc Kleine-Budde @ 2012-10-10 20:39 UTC (permalink / raw)
To: davem; +Cc: linux-can, socketcan, netdev, dhowells, Marc Kleine-Budde
In-Reply-To: <1349901576-30774-1-git-send-email-mkl@pengutronix.de>
From: David Howells <dhowells@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
include/linux/can/Kbuild | 5 --
include/linux/can/bcm.h | 66 ----------------
include/linux/can/error.h | 91 ---------------------
include/linux/can/gw.h | 162 --------------------------------------
include/linux/can/netlink.h | 122 ----------------------------
include/linux/can/raw.h | 30 -------
include/uapi/linux/can/Kbuild | 5 ++
include/uapi/linux/can/bcm.h | 66 ++++++++++++++++
include/uapi/linux/can/error.h | 91 +++++++++++++++++++++
include/uapi/linux/can/gw.h | 162 ++++++++++++++++++++++++++++++++++++++
include/uapi/linux/can/netlink.h | 122 ++++++++++++++++++++++++++++
include/uapi/linux/can/raw.h | 30 +++++++
12 files changed, 476 insertions(+), 476 deletions(-)
delete mode 100644 include/linux/can/bcm.h
delete mode 100644 include/linux/can/error.h
delete mode 100644 include/linux/can/gw.h
delete mode 100644 include/linux/can/netlink.h
delete mode 100644 include/linux/can/raw.h
create mode 100644 include/uapi/linux/can/bcm.h
create mode 100644 include/uapi/linux/can/error.h
create mode 100644 include/uapi/linux/can/gw.h
create mode 100644 include/uapi/linux/can/netlink.h
create mode 100644 include/uapi/linux/can/raw.h
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
index c62b7f1..e69de29 100644
--- a/include/linux/can/Kbuild
+++ b/include/linux/can/Kbuild
@@ -1,5 +0,0 @@
-header-y += raw.h
-header-y += bcm.h
-header-y += gw.h
-header-y += error.h
-header-y += netlink.h
diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h
deleted file mode 100644
index 3ebe387..0000000
--- a/include/linux/can/bcm.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * linux/can/bcm.h
- *
- * Definitions for CAN Broadcast Manager (BCM)
- *
- * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- */
-
-#ifndef CAN_BCM_H
-#define CAN_BCM_H
-
-#include <linux/types.h>
-#include <linux/can.h>
-
-/**
- * struct bcm_msg_head - head of messages to/from the broadcast manager
- * @opcode: opcode, see enum below.
- * @flags: special flags, see below.
- * @count: number of frames to send before changing interval.
- * @ival1: interval for the first @count frames.
- * @ival2: interval for the following frames.
- * @can_id: CAN ID of frames to be sent or received.
- * @nframes: number of frames appended to the message head.
- * @frames: array of CAN frames.
- */
-struct bcm_msg_head {
- __u32 opcode;
- __u32 flags;
- __u32 count;
- struct timeval ival1, ival2;
- canid_t can_id;
- __u32 nframes;
- struct can_frame frames[0];
-};
-
-enum {
- TX_SETUP = 1, /* create (cyclic) transmission task */
- TX_DELETE, /* remove (cyclic) transmission task */
- TX_READ, /* read properties of (cyclic) transmission task */
- TX_SEND, /* send one CAN frame */
- RX_SETUP, /* create RX content filter subscription */
- RX_DELETE, /* remove RX content filter subscription */
- RX_READ, /* read properties of RX content filter subscription */
- TX_STATUS, /* reply to TX_READ request */
- TX_EXPIRED, /* notification on performed transmissions (count=0) */
- RX_STATUS, /* reply to RX_READ request */
- RX_TIMEOUT, /* cyclic message is absent */
- RX_CHANGED /* updated CAN frame (detected content change) */
-};
-
-#define SETTIMER 0x0001
-#define STARTTIMER 0x0002
-#define TX_COUNTEVT 0x0004
-#define TX_ANNOUNCE 0x0008
-#define TX_CP_CAN_ID 0x0010
-#define RX_FILTER_ID 0x0020
-#define RX_CHECK_DLC 0x0040
-#define RX_NO_AUTOTIMER 0x0080
-#define RX_ANNOUNCE_RESUME 0x0100
-#define TX_RESET_MULTI_IDX 0x0200
-#define RX_RTR_FRAME 0x0400
-
-#endif /* CAN_BCM_H */
diff --git a/include/linux/can/error.h b/include/linux/can/error.h
deleted file mode 100644
index 7b7148b..0000000
--- a/include/linux/can/error.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * linux/can/error.h
- *
- * Definitions of the CAN error messages to be filtered and passed to the user.
- *
- * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- */
-
-#ifndef CAN_ERROR_H
-#define CAN_ERROR_H
-
-#define CAN_ERR_DLC 8 /* dlc for error message frames */
-
-/* error class (mask) in can_id */
-#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
-#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
-#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
-#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
-#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
-#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
-#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
-#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
-#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
-
-/* arbitration lost in bit ... / data[0] */
-#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
- /* else bit number in bitstream */
-
-/* error status of CAN-controller / data[1] */
-#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
-#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
-#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
-#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
-#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
-#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
-#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
- /* (at least one error counter exceeds */
- /* the protocol-defined level of 127) */
-
-/* error in CAN protocol (type) / data[2] */
-#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
-#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
-#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
-#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
-#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
-#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
-#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
-#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
-#define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */
-
-/* error in CAN protocol (location) / data[3] */
-#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
-#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
-#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
-#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
-#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
-#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
-#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
-#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
-#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
-#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
-#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
-#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
-#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
-#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
-#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
-#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
-#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
-#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
-#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
-#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
-
-/* error status of CAN-transceiver / data[4] */
-/* CANH CANL */
-#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
-#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
-#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
-#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
-#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
-#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
-#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
-#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
-#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
-#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
-
-/* controller specific additional information / data[5..7] */
-
-#endif /* CAN_ERROR_H */
diff --git a/include/linux/can/gw.h b/include/linux/can/gw.h
deleted file mode 100644
index 8e1db18..0000000
--- a/include/linux/can/gw.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * linux/can/gw.h
- *
- * Definitions for CAN frame Gateway/Router/Bridge
- *
- * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
- * Copyright (c) 2011 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- */
-
-#ifndef CAN_GW_H
-#define CAN_GW_H
-
-#include <linux/types.h>
-#include <linux/can.h>
-
-struct rtcanmsg {
- __u8 can_family;
- __u8 gwtype;
- __u16 flags;
-};
-
-/* CAN gateway types */
-enum {
- CGW_TYPE_UNSPEC,
- CGW_TYPE_CAN_CAN, /* CAN->CAN routing */
- __CGW_TYPE_MAX
-};
-
-#define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1)
-
-/* CAN rtnetlink attribute definitions */
-enum {
- CGW_UNSPEC,
- CGW_MOD_AND, /* CAN frame modification binary AND */
- CGW_MOD_OR, /* CAN frame modification binary OR */
- CGW_MOD_XOR, /* CAN frame modification binary XOR */
- CGW_MOD_SET, /* CAN frame modification set alternate values */
- CGW_CS_XOR, /* set data[] XOR checksum into data[index] */
- CGW_CS_CRC8, /* set data[] CRC8 checksum into data[index] */
- CGW_HANDLED, /* number of handled CAN frames */
- CGW_DROPPED, /* number of dropped CAN frames */
- CGW_SRC_IF, /* ifindex of source network interface */
- CGW_DST_IF, /* ifindex of destination network interface */
- CGW_FILTER, /* specify struct can_filter on source CAN device */
- __CGW_MAX
-};
-
-#define CGW_MAX (__CGW_MAX - 1)
-
-#define CGW_FLAGS_CAN_ECHO 0x01
-#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
-
-#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
-
-/* CAN frame elements that are affected by curr. 3 CAN frame modifications */
-#define CGW_MOD_ID 0x01
-#define CGW_MOD_DLC 0x02
-#define CGW_MOD_DATA 0x04
-
-#define CGW_FRAME_MODS 3 /* ID DLC DATA */
-
-#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
-
-struct cgw_frame_mod {
- struct can_frame cf;
- __u8 modtype;
-} __attribute__((packed));
-
-#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
-
-struct cgw_csum_xor {
- __s8 from_idx;
- __s8 to_idx;
- __s8 result_idx;
- __u8 init_xor_val;
-} __attribute__((packed));
-
-struct cgw_csum_crc8 {
- __s8 from_idx;
- __s8 to_idx;
- __s8 result_idx;
- __u8 init_crc_val;
- __u8 final_xor_val;
- __u8 crctab[256];
- __u8 profile;
- __u8 profile_data[20];
-} __attribute__((packed));
-
-/* length of checksum operation parameters. idx = index in CAN frame data[] */
-#define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor)
-#define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8)
-
-/* CRC8 profiles (compute CRC for additional data elements - see below) */
-enum {
- CGW_CRC8PRF_UNSPEC,
- CGW_CRC8PRF_1U8, /* compute one additional u8 value */
- CGW_CRC8PRF_16U8, /* u8 value table indexed by data[1] & 0xF */
- CGW_CRC8PRF_SFFID_XOR, /* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */
- __CGW_CRC8PRF_MAX
-};
-
-#define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1)
-
-/*
- * CAN rtnetlink attribute contents in detail
- *
- * CGW_XXX_IF (length 4 bytes):
- * Sets an interface index for source/destination network interfaces.
- * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory.
- *
- * CGW_FILTER (length 8 bytes):
- * Sets a CAN receive filter for the gateway job specified by the
- * struct can_filter described in include/linux/can.h
- *
- * CGW_MOD_XXX (length 17 bytes):
- * Specifies a modification that's done to a received CAN frame before it is
- * send out to the destination interface.
- *
- * <struct can_frame> data used as operator
- * <u8> affected CAN frame elements
- *
- * CGW_CS_XOR (length 4 bytes):
- * Set a simple XOR checksum starting with an initial value into
- * data[result-idx] using data[start-idx] .. data[end-idx]
- *
- * The XOR checksum is calculated like this:
- *
- * xor = init_xor_val
- *
- * for (i = from_idx .. to_idx)
- * xor ^= can_frame.data[i]
- *
- * can_frame.data[ result_idx ] = xor
- *
- * CGW_CS_CRC8 (length 282 bytes):
- * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table,
- * a given initial value and a defined input data[start-idx] .. data[end-idx].
- * Finally the result value is XOR'ed with the final_xor_val.
- *
- * The CRC8 checksum is calculated like this:
- *
- * crc = init_crc_val
- *
- * for (i = from_idx .. to_idx)
- * crc = crctab[ crc ^ can_frame.data[i] ]
- *
- * can_frame.data[ result_idx ] = crc ^ final_xor_val
- *
- * The calculated CRC may contain additional source data elements that can be
- * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs
- * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf
- * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs)
- * that are used depending on counter values inside the CAN frame data[].
- * So far only three profiles have been implemented for illustration.
- *
- * Remark: In general the attribute data is a linear buffer.
- * Beware of sending unpacked or aligned structs!
- */
-
-#endif
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
deleted file mode 100644
index 14966dd..0000000
--- a/include/linux/can/netlink.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * linux/can/netlink.h
- *
- * Definitions for the CAN netlink interface
- *
- * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
- *
- */
-
-#ifndef CAN_NETLINK_H
-#define CAN_NETLINK_H
-
-#include <linux/types.h>
-
-/*
- * CAN bit-timing parameters
- *
- * For further information, please read chapter "8 BIT TIMING
- * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
- * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
- */
-struct can_bittiming {
- __u32 bitrate; /* Bit-rate in bits/second */
- __u32 sample_point; /* Sample point in one-tenth of a percent */
- __u32 tq; /* Time quanta (TQ) in nanoseconds */
- __u32 prop_seg; /* Propagation segment in TQs */
- __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
- __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
- __u32 sjw; /* Synchronisation jump width in TQs */
- __u32 brp; /* Bit-rate prescaler */
-};
-
-/*
- * CAN harware-dependent bit-timing constant
- *
- * Used for calculating and checking bit-timing parameters
- */
-struct can_bittiming_const {
- char name[16]; /* Name of the CAN controller hardware */
- __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
- __u32 tseg1_max;
- __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
- __u32 tseg2_max;
- __u32 sjw_max; /* Synchronisation jump width */
- __u32 brp_min; /* Bit-rate prescaler */
- __u32 brp_max;
- __u32 brp_inc;
-};
-
-/*
- * CAN clock parameters
- */
-struct can_clock {
- __u32 freq; /* CAN system clock frequency in Hz */
-};
-
-/*
- * CAN operational and error states
- */
-enum can_state {
- CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
- CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
- CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
- CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
- CAN_STATE_STOPPED, /* Device is stopped */
- CAN_STATE_SLEEPING, /* Device is sleeping */
- CAN_STATE_MAX
-};
-
-/*
- * CAN bus error counters
- */
-struct can_berr_counter {
- __u16 txerr;
- __u16 rxerr;
-};
-
-/*
- * CAN controller mode
- */
-struct can_ctrlmode {
- __u32 mask;
- __u32 flags;
-};
-
-#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */
-#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */
-#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
-#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
-#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
-
-/*
- * CAN device statistics
- */
-struct can_device_stats {
- __u32 bus_error; /* Bus errors */
- __u32 error_warning; /* Changes to error warning state */
- __u32 error_passive; /* Changes to error passive state */
- __u32 bus_off; /* Changes to bus off state */
- __u32 arbitration_lost; /* Arbitration lost errors */
- __u32 restarts; /* CAN controller re-starts */
-};
-
-/*
- * CAN netlink interface
- */
-enum {
- IFLA_CAN_UNSPEC,
- IFLA_CAN_BITTIMING,
- IFLA_CAN_BITTIMING_CONST,
- IFLA_CAN_CLOCK,
- IFLA_CAN_STATE,
- IFLA_CAN_CTRLMODE,
- IFLA_CAN_RESTART_MS,
- IFLA_CAN_RESTART,
- IFLA_CAN_BERR_COUNTER,
- __IFLA_CAN_MAX
-};
-
-#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
-
-#endif /* CAN_NETLINK_H */
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h
deleted file mode 100644
index a814062..0000000
--- a/include/linux/can/raw.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * linux/can/raw.h
- *
- * Definitions for raw CAN sockets
- *
- * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
- * Urs Thuermann <urs.thuermann@volkswagen.de>
- * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
- * All rights reserved.
- *
- */
-
-#ifndef CAN_RAW_H
-#define CAN_RAW_H
-
-#include <linux/can.h>
-
-#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
-
-/* for socket options affecting the socket (not the global system) */
-
-enum {
- CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
- CAN_RAW_ERR_FILTER, /* set filter for error frames */
- CAN_RAW_LOOPBACK, /* local loopback (default:on) */
- CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */
- CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */
-};
-
-#endif
diff --git a/include/uapi/linux/can/Kbuild b/include/uapi/linux/can/Kbuild
index aafaa5a..21c91bf 100644
--- a/include/uapi/linux/can/Kbuild
+++ b/include/uapi/linux/can/Kbuild
@@ -1 +1,6 @@
# UAPI Header export list
+header-y += bcm.h
+header-y += error.h
+header-y += gw.h
+header-y += netlink.h
+header-y += raw.h
diff --git a/include/uapi/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
new file mode 100644
index 0000000..3ebe387
--- /dev/null
+++ b/include/uapi/linux/can/bcm.h
@@ -0,0 +1,66 @@
+/*
+ * linux/can/bcm.h
+ *
+ * Definitions for CAN Broadcast Manager (BCM)
+ *
+ * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
+ * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ */
+
+#ifndef CAN_BCM_H
+#define CAN_BCM_H
+
+#include <linux/types.h>
+#include <linux/can.h>
+
+/**
+ * struct bcm_msg_head - head of messages to/from the broadcast manager
+ * @opcode: opcode, see enum below.
+ * @flags: special flags, see below.
+ * @count: number of frames to send before changing interval.
+ * @ival1: interval for the first @count frames.
+ * @ival2: interval for the following frames.
+ * @can_id: CAN ID of frames to be sent or received.
+ * @nframes: number of frames appended to the message head.
+ * @frames: array of CAN frames.
+ */
+struct bcm_msg_head {
+ __u32 opcode;
+ __u32 flags;
+ __u32 count;
+ struct timeval ival1, ival2;
+ canid_t can_id;
+ __u32 nframes;
+ struct can_frame frames[0];
+};
+
+enum {
+ TX_SETUP = 1, /* create (cyclic) transmission task */
+ TX_DELETE, /* remove (cyclic) transmission task */
+ TX_READ, /* read properties of (cyclic) transmission task */
+ TX_SEND, /* send one CAN frame */
+ RX_SETUP, /* create RX content filter subscription */
+ RX_DELETE, /* remove RX content filter subscription */
+ RX_READ, /* read properties of RX content filter subscription */
+ TX_STATUS, /* reply to TX_READ request */
+ TX_EXPIRED, /* notification on performed transmissions (count=0) */
+ RX_STATUS, /* reply to RX_READ request */
+ RX_TIMEOUT, /* cyclic message is absent */
+ RX_CHANGED /* updated CAN frame (detected content change) */
+};
+
+#define SETTIMER 0x0001
+#define STARTTIMER 0x0002
+#define TX_COUNTEVT 0x0004
+#define TX_ANNOUNCE 0x0008
+#define TX_CP_CAN_ID 0x0010
+#define RX_FILTER_ID 0x0020
+#define RX_CHECK_DLC 0x0040
+#define RX_NO_AUTOTIMER 0x0080
+#define RX_ANNOUNCE_RESUME 0x0100
+#define TX_RESET_MULTI_IDX 0x0200
+#define RX_RTR_FRAME 0x0400
+
+#endif /* CAN_BCM_H */
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
new file mode 100644
index 0000000..7b7148b
--- /dev/null
+++ b/include/uapi/linux/can/error.h
@@ -0,0 +1,91 @@
+/*
+ * linux/can/error.h
+ *
+ * Definitions of the CAN error messages to be filtered and passed to the user.
+ *
+ * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
+ * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ */
+
+#ifndef CAN_ERROR_H
+#define CAN_ERROR_H
+
+#define CAN_ERR_DLC 8 /* dlc for error message frames */
+
+/* error class (mask) in can_id */
+#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
+#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
+#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
+#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
+#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
+#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
+#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
+#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
+#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
+
+/* arbitration lost in bit ... / data[0] */
+#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
+ /* else bit number in bitstream */
+
+/* error status of CAN-controller / data[1] */
+#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
+#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
+#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
+#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
+#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
+#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
+#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
+ /* (at least one error counter exceeds */
+ /* the protocol-defined level of 127) */
+
+/* error in CAN protocol (type) / data[2] */
+#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
+#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
+#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
+#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
+#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
+#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
+#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
+#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
+#define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */
+
+/* error in CAN protocol (location) / data[3] */
+#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
+#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
+#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
+#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
+#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
+#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
+#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
+#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
+#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
+#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
+#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
+#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
+#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
+#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
+#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
+#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
+#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
+#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
+#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
+#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
+
+/* error status of CAN-transceiver / data[4] */
+/* CANH CANL */
+#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
+#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
+#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
+#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
+#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
+#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
+#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
+#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
+#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
+#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
+
+/* controller specific additional information / data[5..7] */
+
+#endif /* CAN_ERROR_H */
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h
new file mode 100644
index 0000000..8e1db18
--- /dev/null
+++ b/include/uapi/linux/can/gw.h
@@ -0,0 +1,162 @@
+/*
+ * linux/can/gw.h
+ *
+ * Definitions for CAN frame Gateway/Router/Bridge
+ *
+ * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
+ * Copyright (c) 2011 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ */
+
+#ifndef CAN_GW_H
+#define CAN_GW_H
+
+#include <linux/types.h>
+#include <linux/can.h>
+
+struct rtcanmsg {
+ __u8 can_family;
+ __u8 gwtype;
+ __u16 flags;
+};
+
+/* CAN gateway types */
+enum {
+ CGW_TYPE_UNSPEC,
+ CGW_TYPE_CAN_CAN, /* CAN->CAN routing */
+ __CGW_TYPE_MAX
+};
+
+#define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1)
+
+/* CAN rtnetlink attribute definitions */
+enum {
+ CGW_UNSPEC,
+ CGW_MOD_AND, /* CAN frame modification binary AND */
+ CGW_MOD_OR, /* CAN frame modification binary OR */
+ CGW_MOD_XOR, /* CAN frame modification binary XOR */
+ CGW_MOD_SET, /* CAN frame modification set alternate values */
+ CGW_CS_XOR, /* set data[] XOR checksum into data[index] */
+ CGW_CS_CRC8, /* set data[] CRC8 checksum into data[index] */
+ CGW_HANDLED, /* number of handled CAN frames */
+ CGW_DROPPED, /* number of dropped CAN frames */
+ CGW_SRC_IF, /* ifindex of source network interface */
+ CGW_DST_IF, /* ifindex of destination network interface */
+ CGW_FILTER, /* specify struct can_filter on source CAN device */
+ __CGW_MAX
+};
+
+#define CGW_MAX (__CGW_MAX - 1)
+
+#define CGW_FLAGS_CAN_ECHO 0x01
+#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
+
+#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
+
+/* CAN frame elements that are affected by curr. 3 CAN frame modifications */
+#define CGW_MOD_ID 0x01
+#define CGW_MOD_DLC 0x02
+#define CGW_MOD_DATA 0x04
+
+#define CGW_FRAME_MODS 3 /* ID DLC DATA */
+
+#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
+
+struct cgw_frame_mod {
+ struct can_frame cf;
+ __u8 modtype;
+} __attribute__((packed));
+
+#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
+
+struct cgw_csum_xor {
+ __s8 from_idx;
+ __s8 to_idx;
+ __s8 result_idx;
+ __u8 init_xor_val;
+} __attribute__((packed));
+
+struct cgw_csum_crc8 {
+ __s8 from_idx;
+ __s8 to_idx;
+ __s8 result_idx;
+ __u8 init_crc_val;
+ __u8 final_xor_val;
+ __u8 crctab[256];
+ __u8 profile;
+ __u8 profile_data[20];
+} __attribute__((packed));
+
+/* length of checksum operation parameters. idx = index in CAN frame data[] */
+#define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor)
+#define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8)
+
+/* CRC8 profiles (compute CRC for additional data elements - see below) */
+enum {
+ CGW_CRC8PRF_UNSPEC,
+ CGW_CRC8PRF_1U8, /* compute one additional u8 value */
+ CGW_CRC8PRF_16U8, /* u8 value table indexed by data[1] & 0xF */
+ CGW_CRC8PRF_SFFID_XOR, /* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */
+ __CGW_CRC8PRF_MAX
+};
+
+#define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1)
+
+/*
+ * CAN rtnetlink attribute contents in detail
+ *
+ * CGW_XXX_IF (length 4 bytes):
+ * Sets an interface index for source/destination network interfaces.
+ * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory.
+ *
+ * CGW_FILTER (length 8 bytes):
+ * Sets a CAN receive filter for the gateway job specified by the
+ * struct can_filter described in include/linux/can.h
+ *
+ * CGW_MOD_XXX (length 17 bytes):
+ * Specifies a modification that's done to a received CAN frame before it is
+ * send out to the destination interface.
+ *
+ * <struct can_frame> data used as operator
+ * <u8> affected CAN frame elements
+ *
+ * CGW_CS_XOR (length 4 bytes):
+ * Set a simple XOR checksum starting with an initial value into
+ * data[result-idx] using data[start-idx] .. data[end-idx]
+ *
+ * The XOR checksum is calculated like this:
+ *
+ * xor = init_xor_val
+ *
+ * for (i = from_idx .. to_idx)
+ * xor ^= can_frame.data[i]
+ *
+ * can_frame.data[ result_idx ] = xor
+ *
+ * CGW_CS_CRC8 (length 282 bytes):
+ * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table,
+ * a given initial value and a defined input data[start-idx] .. data[end-idx].
+ * Finally the result value is XOR'ed with the final_xor_val.
+ *
+ * The CRC8 checksum is calculated like this:
+ *
+ * crc = init_crc_val
+ *
+ * for (i = from_idx .. to_idx)
+ * crc = crctab[ crc ^ can_frame.data[i] ]
+ *
+ * can_frame.data[ result_idx ] = crc ^ final_xor_val
+ *
+ * The calculated CRC may contain additional source data elements that can be
+ * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs
+ * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf
+ * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs)
+ * that are used depending on counter values inside the CAN frame data[].
+ * So far only three profiles have been implemented for illustration.
+ *
+ * Remark: In general the attribute data is a linear buffer.
+ * Beware of sending unpacked or aligned structs!
+ */
+
+#endif
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
new file mode 100644
index 0000000..14966dd
--- /dev/null
+++ b/include/uapi/linux/can/netlink.h
@@ -0,0 +1,122 @@
+/*
+ * linux/can/netlink.h
+ *
+ * Definitions for the CAN netlink interface
+ *
+ * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
+ *
+ */
+
+#ifndef CAN_NETLINK_H
+#define CAN_NETLINK_H
+
+#include <linux/types.h>
+
+/*
+ * CAN bit-timing parameters
+ *
+ * For further information, please read chapter "8 BIT TIMING
+ * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
+ * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
+ */
+struct can_bittiming {
+ __u32 bitrate; /* Bit-rate in bits/second */
+ __u32 sample_point; /* Sample point in one-tenth of a percent */
+ __u32 tq; /* Time quanta (TQ) in nanoseconds */
+ __u32 prop_seg; /* Propagation segment in TQs */
+ __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
+ __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
+ __u32 sjw; /* Synchronisation jump width in TQs */
+ __u32 brp; /* Bit-rate prescaler */
+};
+
+/*
+ * CAN harware-dependent bit-timing constant
+ *
+ * Used for calculating and checking bit-timing parameters
+ */
+struct can_bittiming_const {
+ char name[16]; /* Name of the CAN controller hardware */
+ __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
+ __u32 tseg1_max;
+ __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
+ __u32 tseg2_max;
+ __u32 sjw_max; /* Synchronisation jump width */
+ __u32 brp_min; /* Bit-rate prescaler */
+ __u32 brp_max;
+ __u32 brp_inc;
+};
+
+/*
+ * CAN clock parameters
+ */
+struct can_clock {
+ __u32 freq; /* CAN system clock frequency in Hz */
+};
+
+/*
+ * CAN operational and error states
+ */
+enum can_state {
+ CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
+ CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
+ CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
+ CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
+ CAN_STATE_STOPPED, /* Device is stopped */
+ CAN_STATE_SLEEPING, /* Device is sleeping */
+ CAN_STATE_MAX
+};
+
+/*
+ * CAN bus error counters
+ */
+struct can_berr_counter {
+ __u16 txerr;
+ __u16 rxerr;
+};
+
+/*
+ * CAN controller mode
+ */
+struct can_ctrlmode {
+ __u32 mask;
+ __u32 flags;
+};
+
+#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */
+#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */
+#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
+#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
+#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
+
+/*
+ * CAN device statistics
+ */
+struct can_device_stats {
+ __u32 bus_error; /* Bus errors */
+ __u32 error_warning; /* Changes to error warning state */
+ __u32 error_passive; /* Changes to error passive state */
+ __u32 bus_off; /* Changes to bus off state */
+ __u32 arbitration_lost; /* Arbitration lost errors */
+ __u32 restarts; /* CAN controller re-starts */
+};
+
+/*
+ * CAN netlink interface
+ */
+enum {
+ IFLA_CAN_UNSPEC,
+ IFLA_CAN_BITTIMING,
+ IFLA_CAN_BITTIMING_CONST,
+ IFLA_CAN_CLOCK,
+ IFLA_CAN_STATE,
+ IFLA_CAN_CTRLMODE,
+ IFLA_CAN_RESTART_MS,
+ IFLA_CAN_RESTART,
+ IFLA_CAN_BERR_COUNTER,
+ __IFLA_CAN_MAX
+};
+
+#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
+
+#endif /* CAN_NETLINK_H */
diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
new file mode 100644
index 0000000..a814062
--- /dev/null
+++ b/include/uapi/linux/can/raw.h
@@ -0,0 +1,30 @@
+/*
+ * linux/can/raw.h
+ *
+ * Definitions for raw CAN sockets
+ *
+ * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
+ * Urs Thuermann <urs.thuermann@volkswagen.de>
+ * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ */
+
+#ifndef CAN_RAW_H
+#define CAN_RAW_H
+
+#include <linux/can.h>
+
+#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
+
+/* for socket options affecting the socket (not the global system) */
+
+enum {
+ CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
+ CAN_RAW_ERR_FILTER, /* set filter for error frames */
+ CAN_RAW_LOOPBACK, /* local loopback (default:on) */
+ CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */
+ CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */
+};
+
+#endif
--
1.7.10
^ permalink raw reply related
* Re: [RFC] ip tunnel flag byte order issue
From: Stephen Hemminger @ 2012-10-10 20:34 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David Miller, Saurabh Mohan, netdev, linux-kernel
In-Reply-To: <1349900796.2691.32.camel@bwh-desktop.uk.solarflarecom.com>
On Wed, 10 Oct 2012 21:26:36 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:
> On Wed, 2012-10-10 at 12:06 -0700, Stephen Hemminger wrote:
> > Sparse found a real problem with the ABI for tunnelling.
> >
> > The SIT and VTI tunnel ioctl's both overload the i_flags field in the
> > ip_tunnel parameters structure. This field is defined as big endian
> > (be16) and the various GRE_XXX macros do the necessary byte swapping.
> >
> > The problem is that both SIT and VTI are using an additional flag bit
> > that is defined in host byte order, and is then or'd in. It happens to
> > work because both possible locations hit holes in the current usage of
> > GRE. For big endian cpu's it overlaps the GRE_VERSION which is always
> > zero, and for little endian it overlaps the GRE recursion field also
> > always zero.
>
> Why do these fields exist if they're always going to be 0?
They exist in the RFC. GRE implementation mixes bits on the wire
with bits from ioctl().
>
> > Having the field in different places on different CPU architectures
> > was a mistake. The problem is fixing it will break the ABI on one or
> > the other architecture. I choose to break big endian since it the
> > minority.
>
> Or we can define the 'flag' to have both bits set (0x0101, with a
> __cpu_to_be16 to keep sparse happy) while accepting either set on input.
>
> > Also both VTI and SIT are overloading the same bit which is an
> > accident waiting to happen. Since VTI is newer, I propose giving a
> > different bit to VTI.
>
> Indeed VTI is new in 3.6, so there is still a short window in which it's
> fairly safe to tweak its ABI.
>
> > The other alternative is keeping the same ABI, but putting a big note
> > as to why it works in spite of our stupidity.
> [...]
>
> Does it even matter that different tunnel types have different meanings
> for flags?
>
> Ben.
>
^ permalink raw reply
* Re: [RFC] ip tunnel flag byte order issue
From: Ben Hutchings @ 2012-10-10 20:26 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, Saurabh Mohan, netdev, linux-kernel
In-Reply-To: <20121010120630.5e9f2c2c@nehalam.linuxnetplumber.net>
On Wed, 2012-10-10 at 12:06 -0700, Stephen Hemminger wrote:
> Sparse found a real problem with the ABI for tunnelling.
>
> The SIT and VTI tunnel ioctl's both overload the i_flags field in the
> ip_tunnel parameters structure. This field is defined as big endian
> (be16) and the various GRE_XXX macros do the necessary byte swapping.
>
> The problem is that both SIT and VTI are using an additional flag bit
> that is defined in host byte order, and is then or'd in. It happens to
> work because both possible locations hit holes in the current usage of
> GRE. For big endian cpu's it overlaps the GRE_VERSION which is always
> zero, and for little endian it overlaps the GRE recursion field also
> always zero.
Why do these fields exist if they're always going to be 0?
> Having the field in different places on different CPU architectures
> was a mistake. The problem is fixing it will break the ABI on one or
> the other architecture. I choose to break big endian since it the
> minority.
Or we can define the 'flag' to have both bits set (0x0101, with a
__cpu_to_be16 to keep sparse happy) while accepting either set on input.
> Also both VTI and SIT are overloading the same bit which is an
> accident waiting to happen. Since VTI is newer, I propose giving a
> different bit to VTI.
Indeed VTI is new in 3.6, so there is still a short window in which it's
fairly safe to tweak its ABI.
> The other alternative is keeping the same ABI, but putting a big note
> as to why it works in spite of our stupidity.
[...]
Does it even matter that different tunnel types have different meanings
for flags?
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH] flexcan: disable bus error interrupts for the i.MX28
From: Marc Kleine-Budde @ 2012-10-10 20:04 UTC (permalink / raw)
To: Dong Aisheng-B29396
Cc: Wolfgang Grandegger, Shawn Guo, Linux Netdev List, Linux-CAN,
Hui Wang
In-Reply-To: <7FE21149F4667147B645348EC60578850B2A361F@039-SN2MPN1-011.039d.mgd.msft.net>
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]
On 10/08/2012 09:59 AM, Dong Aisheng-B29396 wrote:
[...]
>>>> Concerning the bug, I know that the i.MX35 does have it. Maybe other
>>>> Flexcan cores than on the i.MX28 does *not* have it either. If you
>>>> have a chance, please check on the P1010, i.MX6Q, i.MX51, i.MX53,
>>>> etc.
>>>
>>> >From what I can tell, i.MX35, i.MX51 and i.MX53 use the same version,
>>> so they should all have the bug. And for i.MX6Q, since it uses a
>>> newer version even than i.MX28, I would believe it's affected by the bug.
>>> But I'm copying Dong who should have better knowledge about this to
>>> confirm.
>>
>> Thank for clarification. I have a i.MX6Q board but without CAN adapter :(,
>> unfortunately. Otherwise I would try it out myself.
>>
> How did you verify this issue?
> I just checked our ic guy of flexcan, it seems he also had no sense of this issue.
Wolfgang added this table to the driver code, which is a very good idea.
I've some (nitpicky) questions :)
> Below is some version info what I got:
> Mx6s use FlexCAN3, with IP version 10.00.12.00
^^^
Is this core different from the mx6q? Has the flexcan on mx6 a glitch
filter?
> Mx53 use FlexCAN2 (with glitch filter), with IP version 03.00.00.00
> Mx28 use FlexCAN2 (with glitch filter), with IP version 03.00.04.00
> Mx35 use FlexCAN2 (without glitch filter) , with IP version 03.00.00.00
> Mx25 use FlexCAN2 (without glitch filter), with IP version 03.00.00.00
Do you have access to the powerpc designs which have a flexcan core,
too? I'm interested to complete the above table with powerpcs cores
(p1010 and similar).
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* Re: [PATCH v2] flexcan: disable bus error interrupts for the i.MX28
From: Marc Kleine-Budde @ 2012-10-10 19:59 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: Linux-CAN, Linux Netdev List, Shawn Guo, Hui Wang
In-Reply-To: <5075C832.8080102@grandegger.com>
[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]
On 10/10/2012 09:10 PM, Wolfgang Grandegger wrote:
> Due to a bug in most Flexcan cores, the bus error interrupt needs
> to be enabled. Otherwise we don't get any error warning or passive
> interrupts. This is _not_ necessary for the i.MX28 and this patch
^^^ and i.MX6q
No need to resend the patch, I'll change this while applying the patch.
> disables bus error interrupts if "berr-reporting" is not requested.
> This avoids bus error flooding, which might harm, especially on
> low-end systems.
>
> To handle such quirks of the Flexcan cores, a hardware feature flag
> has been introduced, also replacing the "hw_ver" variable. We got
> some version info about what Flexcan core version is available on
> what Freescale SOC which have been summarized as comment.
>
> Changes since v1:
>
> - add known version info and hw bugs as comment
> - remove FLEXCAN_HAS_BROKEN_ERR_STATE for i.MX6Q
From my point of view, this should go into linux-can.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* [RFC net-next] treewide: s/ipv4_is_<foo>()/ipv4_addr_<foo>/
From: Joe Perches @ 2012-10-10 19:38 UTC (permalink / raw)
To: Eric Dumazet, David Miller; +Cc: netdev, LKML, Brian Haley
In-Reply-To: <1349897005.2035.24.camel@joe-AO722>
ipv4 and ipv6 use different styles for these tests.
ipv4_is_<foo>(__be32)
ipv6_addr_<foo>(struct in6_addr *)
Perhaps it'd be good to convert the ipv4 tests to the ipv6 style.
There are ~100 instances of ipv4_is_<foo> tests treewide.
^ permalink raw reply
* [PATCH net-next? V2] pktgen: Use simpler test for non-zero ipv6 address
From: Joe Perches @ 2012-10-10 19:23 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, LKML, Brian Haley
In-Reply-To: <1349895710.21172.7235.camel@edumazet-glaptop>
Reduces object size and should be slightly faster.
allyesconfig:
$ size net/core/pktgen.o*
text data bss dec hex filename
52284 4321 11840 68445 10b5d net/core/pktgen.o.new
52310 4293 11848 68451 10b63 net/core/pktgen.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
> What about ipv6_addr_any() ?
That's better I guess.
I forgot about it and didn't see it.
I saw the IPV6_ADDR_ANY type tests and
didn't look further.
Anyway, it's odd that it generates slightly larger code
than the original patch's direct tests in 32bit with
gcc 4.7.2. Perhaps an interesting lack of optimization?
cheers, Joe
net/core/pktgen.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 148e73d..a811a7d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2422,11 +2422,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
}
} else { /* IPV6 * */
- if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
- else {
+ if (!ipv6_addr_any(&pkt_dev->min_in6_daddr)) {
int i;
/* Only random destinations yet */
^ permalink raw reply related
* [PATCH v2] flexcan: disable bus error interrupts for the i.MX28
From: Wolfgang Grandegger @ 2012-10-10 19:10 UTC (permalink / raw)
To: Linux-CAN; +Cc: Linux Netdev List, Shawn Guo, Marc Kleine-Budde, Hui Wang
Due to a bug in most Flexcan cores, the bus error interrupt needs
to be enabled. Otherwise we don't get any error warning or passive
interrupts. This is _not_ necessary for the i.MX28 and this patch
disables bus error interrupts if "berr-reporting" is not requested.
This avoids bus error flooding, which might harm, especially on
low-end systems.
To handle such quirks of the Flexcan cores, a hardware feature flag
has been introduced, also replacing the "hw_ver" variable. We got
some version info about what Flexcan core version is available on
what Freescale SOC which have been summarized as comment.
Changes since v1:
- add known version info and hw bugs as comment
- remove FLEXCAN_HAS_BROKEN_ERR_STATE for i.MX6Q
CC: Hui Wang <jason77.wang@gmail.com>
CC: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
drivers/net/can/flexcan.c | 42 ++++++++++++++++++++++++++++++++----------
1 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index c5f1431..f07128b 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -144,6 +144,23 @@
#define FLEXCAN_MB_CODE_MASK (0xf0ffffff)
+/*
+ * FLEXCAN hardware feature flags
+ *
+ * Below is some version info we got:
+ * SOC Version IP-Version Glitch- [TR]WRN_INT
+ * Filter? connected?
+ * MX25 FlexCAN2 03.00.00.00 no no
+ * MX28 FlexCAN2 03.00.04.00 yes yes
+ * MX35 FlexCAN2 03.00.00.00 no no
+ * MX53 FlexCAN2 03.00.00.00 yes no
+ * MX6s FlexCAN3 10.00.12.00 ? yes
+ *
+ * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected.
+ */
+#define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */
+#define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* [TR]WRN_INT not connected */
+
/* Structure of the message buffer */
struct flexcan_mb {
u32 can_ctrl;
@@ -178,7 +195,7 @@ struct flexcan_regs {
};
struct flexcan_devtype_data {
- u32 hw_ver; /* hardware controller version */
+ u32 features; /* hardware controller features */
};
struct flexcan_priv {
@@ -197,11 +214,11 @@ struct flexcan_priv {
};
static struct flexcan_devtype_data fsl_p1010_devtype_data = {
- .hw_ver = 3,
+ .features = FLEXCAN_HAS_BROKEN_ERR_STATE,
};
-
+static struct flexcan_devtype_data fsl_imx28_devtype_data;
static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
- .hw_ver = 10,
+ .features = FLEXCAN_HAS_V10_FEATURES,
};
static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -741,15 +758,19 @@ static int flexcan_chip_start(struct net_device *dev)
* enable tx and rx warning interrupt
* enable bus off interrupt
* (== FLEXCAN_CTRL_ERR_STATE)
- *
- * _note_: we enable the "error interrupt"
- * (FLEXCAN_CTRL_ERR_MSK), too. Otherwise we don't get any
- * warning or bus passive interrupts.
*/
reg_ctrl = flexcan_read(®s->ctrl);
reg_ctrl &= ~FLEXCAN_CTRL_TSYN;
reg_ctrl |= FLEXCAN_CTRL_BOFF_REC | FLEXCAN_CTRL_LBUF |
- FLEXCAN_CTRL_ERR_STATE | FLEXCAN_CTRL_ERR_MSK;
+ FLEXCAN_CTRL_ERR_STATE;
+ /*
+ * enable the "error interrupt" (FLEXCAN_CTRL_ERR_MSK),
+ * on most Flexcan cores, too. Otherwise we don't get
+ * any error warning or passive interrupts.
+ */
+ if (priv->devtype_data->features & FLEXCAN_HAS_BROKEN_ERR_STATE ||
+ priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
+ reg_ctrl |= FLEXCAN_CTRL_ERR_MSK;
/* save for later use */
priv->reg_ctrl_default = reg_ctrl;
@@ -772,7 +793,7 @@ static int flexcan_chip_start(struct net_device *dev)
flexcan_write(0x0, ®s->rx14mask);
flexcan_write(0x0, ®s->rx15mask);
- if (priv->devtype_data->hw_ver >= 10)
+ if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES)
flexcan_write(0x0, ®s->rxfgmask);
flexcan_transceiver_switch(priv, 1);
@@ -954,6 +975,7 @@ static void __devexit unregister_flexcandev(struct net_device *dev)
static const struct of_device_id flexcan_of_match[] = {
{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
+ { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
{ /* sentinel */ },
};
--
1.7.7.6
^ permalink raw reply related
* [RFC] ip tunnel flag byte order issue
From: Stephen Hemminger @ 2012-10-10 19:06 UTC (permalink / raw)
To: David Miller, Saurabh Mohan; +Cc: netdev, linux-kernel
Sparse found a real problem with the ABI for tunnelling.
The SIT and VTI tunnel ioctl's both overload the i_flags field in the
ip_tunnel parameters structure. This field is defined as big endian
(be16) and the various GRE_XXX macros do the necessary byte swapping.
The problem is that both SIT and VTI are using an additional flag bit
that is defined in host byte order, and is then or'd in. It happens to
work because both possible locations hit holes in the current usage of
GRE. For big endian cpu's it overlaps the GRE_VERSION which is always
zero, and for little endian it overlaps the GRE recursion field also
always zero.
Having the field in different places on different CPU architectures
was a mistake. The problem is fixing it will break the ABI on one or
the other architecture. I choose to break big endian since it the
minority.
Also both VTI and SIT are overloading the same bit which is an
accident waiting to happen. Since VTI is newer, I propose giving a
different bit to VTI.
The other alternative is keeping the same ABI, but putting a big note
as to why it works in spite of our stupidity.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/include/linux/if_tunnel.h 2012-10-10 11:37:22.444050762 -0700
+++ b/include/linux/if_tunnel.h 2012-10-10 11:50:34.692168074 -0700
@@ -42,7 +42,7 @@ struct ip_tunnel_parm {
};
/* SIT-mode i_flags */
-#define SIT_ISATAP 0x0001
+#define SIT_ISATAP __cpu_to_be16(0x0100)
struct ip_tunnel_prl {
__be32 addr;
@@ -84,7 +84,7 @@ enum {
#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
/* VTI-mode i_flags */
-#define VTI_ISVTI 0x0001
+#define VTI_ISVTI __cpu_to_be16(0x0200)
enum {
IFLA_VTI_UNSPEC,
^ permalink raw reply
* Re: [Xen-devel] [PATCH V2] xen: netback: handle compound page fragments on transmit.
From: Konrad Rzeszutek Wilk @ 2012-10-10 18:53 UTC (permalink / raw)
To: Ian Campbell
Cc: netdev, xen-devel, Konrad Rzeszutek Wilk, Eric Dumazet,
Sander Eikelenboom
In-Reply-To: <1349876922-11907-1-git-send-email-ian.campbell@citrix.com>
On Wed, Oct 10, 2012 at 02:48:42PM +0100, Ian Campbell wrote:
> An SKB paged fragment can consist of a compound page with order > 0.
> However the netchannel protocol deals only in PAGE_SIZE frames.
>
> Handle this in netbk_gop_frag_copy and xen_netbk_count_skb_slots by
> iterating over the frames which make up the page.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Sander Eikelenboom <linux@eikelenboom.it>
> ---
> v2: Only move to next frame if there is data remaining.
> ---
> drivers/net/xen-netback/netback.c | 40 ++++++++++++++++++++++++++++++++----
> 1 files changed, 35 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 4ebfcf3..f2d6b78 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -335,21 +335,35 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
>
> for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
> + unsigned long offset = skb_shinfo(skb)->frags[i].page_offset;
> unsigned long bytes;
> +
> + offset &= ~PAGE_MASK;
> +
> while (size > 0) {
> + BUG_ON(offset >= PAGE_SIZE);
> BUG_ON(copy_off > MAX_BUFFER_OFFSET);
>
> - if (start_new_rx_buffer(copy_off, size, 0)) {
> + bytes = PAGE_SIZE - offset;
> +
> + if (bytes > size)
> + bytes = size;
> +
> + if (start_new_rx_buffer(copy_off, bytes, 0)) {
> count++;
> copy_off = 0;
> }
>
> - bytes = size;
> if (copy_off + bytes > MAX_BUFFER_OFFSET)
> bytes = MAX_BUFFER_OFFSET - copy_off;
>
> copy_off += bytes;
> +
> + offset += bytes;
> size -= bytes;
> +
> + if (offset == PAGE_SIZE)
> + offset = 0;
> }
> }
> return count;
> @@ -403,14 +417,24 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
> unsigned long bytes;
>
> /* Data must not cross a page boundary. */
> - BUG_ON(size + offset > PAGE_SIZE);
> + BUG_ON(size + offset > PAGE_SIZE<<compound_order(page));
>
> meta = npo->meta + npo->meta_prod - 1;
>
> + /* Skip unused frames from start of page */
> + page += offset >> PAGE_SHIFT;
> + offset &= ~PAGE_MASK;
> +
> while (size > 0) {
> + BUG_ON(offset >= PAGE_SIZE);
> BUG_ON(npo->copy_off > MAX_BUFFER_OFFSET);
>
> - if (start_new_rx_buffer(npo->copy_off, size, *head)) {
> + bytes = PAGE_SIZE - offset;
> +
> + if (bytes > size)
> + bytes = size;
> +
> + if (start_new_rx_buffer(npo->copy_off, bytes, *head)) {
> /*
> * Netfront requires there to be some data in the head
> * buffer.
> @@ -420,7 +444,6 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
> meta = get_next_rx_buffer(vif, npo);
> }
>
> - bytes = size;
> if (npo->copy_off + bytes > MAX_BUFFER_OFFSET)
> bytes = MAX_BUFFER_OFFSET - npo->copy_off;
>
> @@ -453,6 +476,13 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
> offset += bytes;
> size -= bytes;
>
> + /* Next frame */
> + if (offset == PAGE_SIZE && size) {
> + BUG_ON(!PageCompound(page));
> + page++;
> + offset = 0;
> + }
> +
> /* Leave a gap for the GSO descriptor. */
> if (*head && skb_shinfo(skb)->gso_size && !vif->gso_prefix)
> vif->rx.req_cons++;
> --
> 1.7.2.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
^ permalink raw reply
* Re: [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address
From: Eric Dumazet @ 2012-10-10 19:01 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev, LKML
In-Reply-To: <1349894559.2035.12.camel@joe-AO722>
On Wed, 2012-10-10 at 11:42 -0700, Joe Perches wrote:
> Reduces object size and should be slightly faster.
>
> allyesconfig:
>
> $ size net/core/pktgen.o*
> text data bss dec hex filename
> 52251 4293 11824 68368 10b10 net/core/pktgen.o.new
> 52310 4293 11848 68451 10b63 net/core/pktgen.o.old
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> Found by looking for if (foo) ; tests with a perl regex
>
> Yes Eric, it could be 2 compares instead of 4 on 64-bit
> systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
> or if there are other tests that could become something
> like ipv6_is_zeronet.
>
> cheers, Joe
>
> net/core/pktgen.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 148e73d..3aa8417 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -2422,11 +2422,10 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
> }
> } else { /* IPV6 * */
>
> - if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
> - else {
> + if (pkt_dev->min_in6_daddr.s6_addr32[0] |
> + pkt_dev->min_in6_daddr.s6_addr32[1] |
> + pkt_dev->min_in6_daddr.s6_addr32[2] |
> + pkt_dev->min_in6_daddr.s6_addr32[3]) {
> int i;
>
> /* Only random destinations yet */
>
What about ipv6_addr_any() ?
anyway net-next is not opened yet
^ permalink raw reply
* Re: [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address
From: Brian Haley @ 2012-10-10 18:59 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev, LKML
In-Reply-To: <1349894559.2035.12.camel@joe-AO722>
On 10/10/2012 02:42 PM, Joe Perches wrote:
> Found by looking for if (foo) ; tests with a perl regex
>
> Yes Eric, it could be 2 compares instead of 4 on 64-bit
> systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
> or if there are other tests that could become something
> like ipv6_is_zeronet.
>
> cheers, Joe
>
> net/core/pktgen.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 148e73d..3aa8417 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -2422,11 +2422,10 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
> }
> } else { /* IPV6 * */
>
> - if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
> - else {
> + if (pkt_dev->min_in6_daddr.s6_addr32[0] |
> + pkt_dev->min_in6_daddr.s6_addr32[1] |
> + pkt_dev->min_in6_daddr.s6_addr32[2] |
> + pkt_dev->min_in6_daddr.s6_addr32[3]) {
> int i;
Why not just use ipv6_addr_any() ? It has an HAS_EFFICIENT_UNALIGNED_ACCESS
check too.
-Brian
^ permalink raw reply
* Sparse warnings in IPV6 GRE
From: Stephen Hemminger @ 2012-10-10 18:54 UTC (permalink / raw)
To: Dmitry Kozlov; +Cc: netdev
Looks like IPV6 GRE is probably not byte-endian safe?
CHECK net/ipv6/ip6_gre.c
net/ipv6/ip6_gre.c:472:37: warning: restricted __be32 degrades to integer
net/ipv6/ip6_gre.c:484:23: warning: restricted __be32 degrades to integer
net/ipv6/ip6_gre.c:964:26: warning: incorrect type in assignment (different base types)
net/ipv6/ip6_gre.c:964:26: expected unsigned char [unsigned] [addressable] [usertype] flowic_proto
net/ipv6/ip6_gre.c:964:26: got restricted __be16 [usertype] protocol
net/ipv6/ip6_gre.c:1510:33: warning: incorrect type in assignment (different base types)
net/ipv6/ip6_gre.c:1510:33: expected restricted __be32 [usertype] flowinfo
net/ipv6/ip6_gre.c:1510:33: got unsigned int
^ permalink raw reply
* Re: [PATCH 3.6.0- 2/3] net/mdio-octeon: use module_platform_driver macro
From: David Daney @ 2012-10-10 18:46 UTC (permalink / raw)
To: Srinivas KANDAGATLA, davem; +Cc: bordug, netdev, david.daney, linville, kaloz
In-Reply-To: <1349893751-6867-1-git-send-email-srinivas.kandagatla@st.com>
On 10/10/2012 11:29 AM, Srinivas KANDAGATLA wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> This patch removes some code duplication by using
> module_platform_driver.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: David Daney <david.daney@cavium.com>
I have the same thing locally, but you beat me to sending it in.
> ---
> drivers/net/phy/mdio-octeon.c | 14 +-------------
> 1 files changed, 1 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
> index d4015aa..84f7c47 100644
> --- a/drivers/net/phy/mdio-octeon.c
> +++ b/drivers/net/phy/mdio-octeon.c
> @@ -196,19 +196,7 @@ void octeon_mdiobus_force_mod_depencency(void)
> /* Let ethernet drivers force us to be loaded. */
> }
> EXPORT_SYMBOL(octeon_mdiobus_force_mod_depencency);
> -
> -static int __init octeon_mdiobus_mod_init(void)
> -{
> - return platform_driver_register(&octeon_mdiobus_driver);
> -}
> -
> -static void __exit octeon_mdiobus_mod_exit(void)
> -{
> - platform_driver_unregister(&octeon_mdiobus_driver);
> -}
> -
> -module_init(octeon_mdiobus_mod_init);
> -module_exit(octeon_mdiobus_mod_exit);
> +module_platform_driver(octeon_mdiobus_driver);
>
> MODULE_DESCRIPTION(DRV_DESCRIPTION);
> MODULE_VERSION(DRV_VERSION);
>
^ permalink raw reply
* [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address
From: Joe Perches @ 2012-10-10 18:42 UTC (permalink / raw)
To: netdev; +Cc: LKML
Reduces object size and should be slightly faster.
allyesconfig:
$ size net/core/pktgen.o*
text data bss dec hex filename
52251 4293 11824 68368 10b10 net/core/pktgen.o.new
52310 4293 11848 68451 10b63 net/core/pktgen.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
Found by looking for if (foo) ; tests with a perl regex
Yes Eric, it could be 2 compares instead of 4 on 64-bit
systems with HAS_EFFICIENT_UNALIGNED_ACCESS. Maybe later
or if there are other tests that could become something
like ipv6_is_zeronet.
cheers, Joe
net/core/pktgen.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 148e73d..3aa8417 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2422,11 +2422,10 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
}
} else { /* IPV6 * */
- if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
- pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
- else {
+ if (pkt_dev->min_in6_daddr.s6_addr32[0] |
+ pkt_dev->min_in6_daddr.s6_addr32[1] |
+ pkt_dev->min_in6_daddr.s6_addr32[2] |
+ pkt_dev->min_in6_daddr.s6_addr32[3]) {
int i;
/* Only random destinations yet */
^ permalink raw reply related
* [PATCH 3.6.0- 3/3] wireless/ath5k: use module_platform_driver macro
From: Srinivas KANDAGATLA @ 2012-10-10 18:29 UTC (permalink / raw)
To: davem; +Cc: srinivas.kandagatla, bordug, netdev, david.daney, linville, kaloz
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch removes some code duplication by using
module_platform_driver.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/wireless/ath/ath5k/ahb.c | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
index aec33cc..3f9036f 100644
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -235,18 +235,4 @@ static struct platform_driver ath_ahb_driver = {
.owner = THIS_MODULE,
},
};
-
-static int __init
-ath5k_ahb_init(void)
-{
- return platform_driver_register(&ath_ahb_driver);
-}
-
-static void __exit
-ath5k_ahb_exit(void)
-{
- platform_driver_unregister(&ath_ahb_driver);
-}
-
-module_init(ath5k_ahb_init);
-module_exit(ath5k_ahb_exit);
+module_platform_driver(ath_ahb_driver);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3.6.0- 2/3] net/mdio-octeon: use module_platform_driver macro
From: Srinivas KANDAGATLA @ 2012-10-10 18:29 UTC (permalink / raw)
To: davem; +Cc: srinivas.kandagatla, bordug, netdev, david.daney, linville, kaloz
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch removes some code duplication by using
module_platform_driver.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/phy/mdio-octeon.c | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c
index d4015aa..84f7c47 100644
--- a/drivers/net/phy/mdio-octeon.c
+++ b/drivers/net/phy/mdio-octeon.c
@@ -196,19 +196,7 @@ void octeon_mdiobus_force_mod_depencency(void)
/* Let ethernet drivers force us to be loaded. */
}
EXPORT_SYMBOL(octeon_mdiobus_force_mod_depencency);
-
-static int __init octeon_mdiobus_mod_init(void)
-{
- return platform_driver_register(&octeon_mdiobus_driver);
-}
-
-static void __exit octeon_mdiobus_mod_exit(void)
-{
- platform_driver_unregister(&octeon_mdiobus_driver);
-}
-
-module_init(octeon_mdiobus_mod_init);
-module_exit(octeon_mdiobus_mod_exit);
+module_platform_driver(octeon_mdiobus_driver);
MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_VERSION(DRV_VERSION);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 3.6.0- 0/3] NET: use module_platform_driver macro
From: Srinivas KANDAGATLA @ 2012-10-10 18:28 UTC (permalink / raw)
To: davem; +Cc: srinivas.kandagatla, bordug, netdev, david.daney, linville, kaloz
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Running below Coccinelle lookup pattern like below on the
latest kernel showed about 52 hits. This patch series is a subset
of those 52 patches, so that it will be easy for maintainers to review.
Hopefully these patches will get rid of some code duplication in kernel.
@ @
- initfunc(void)
- { return platform_driver_register(&dr); }
...
- module_init(initfunc);
...
- exitfunc(void)
- { platform_driver_unregister(&dr); }
...
- module_exit(exitfunc);
+ module_platform_driver(dr);
Srinivas Kandagatla (3):
net/mdio-gpio: use module_platform_driver macro
net/mdio-octeon: use module_platform_driver macro
wireless/ath5k: use module_platform_driver macro
drivers/net/phy/mdio-gpio.c | 13 +------------
drivers/net/phy/mdio-octeon.c | 14 +-------------
drivers/net/wireless/ath/ath5k/ahb.c | 16 +---------------
3 files changed, 3 insertions(+), 40 deletions(-)
^ permalink raw reply
* [PATCH 3.6.0- 1/3] net/mdio-gpio: use module_platform_driver macro
From: Srinivas KANDAGATLA @ 2012-10-10 18:29 UTC (permalink / raw)
To: davem; +Cc: srinivas.kandagatla, bordug, netdev, david.daney, linville, kaloz
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch removes some code duplication by using
module_platform_driver.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/phy/mdio-gpio.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 899274f..d5d1624 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -231,18 +231,7 @@ static struct platform_driver mdio_gpio_driver = {
.of_match_table = mdio_gpio_of_match,
},
};
-
-static int __init mdio_gpio_init(void)
-{
- return platform_driver_register(&mdio_gpio_driver);
-}
-module_init(mdio_gpio_init);
-
-static void __exit mdio_gpio_exit(void)
-{
- platform_driver_unregister(&mdio_gpio_driver);
-}
-module_exit(mdio_gpio_exit);
+module_platform_driver(mdio_gpio_driver);
MODULE_ALIAS("platform:mdio-gpio");
MODULE_AUTHOR("Laurent Pinchart, Paulius Zaleckas");
--
1.7.0.4
^ permalink raw reply related
* [PATCH] ipv4: fix route mark sparse warning
From: Stephen Hemminger @ 2012-10-10 18:27 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Sparse complains about RTA_MARK which is should be host order according
to include file and usage in iproute.
net/ipv4/route.c:2223:46: warning: incorrect type in argument 3 (different base types)
net/ipv4/route.c:2223:46: expected restricted __be32 [usertype] value
net/ipv4/route.c:2223:46: got unsigned int [unsigned] [usertype] flowic_mark
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/ipv4/route.c 2012-10-09 10:35:03.323140263 -0700
+++ b/net/ipv4/route.c 2012-10-10 10:59:08.774798362 -0700
@@ -2220,7 +2220,7 @@ static int rt_fill_info(struct net *net,
goto nla_put_failure;
if (fl4->flowi4_mark &&
- nla_put_be32(skb, RTA_MARK, fl4->flowi4_mark))
+ nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark))
goto nla_put_failure;
error = rt->dst.error;
^ permalink raw reply
* Re: [PATCH V3] ath/ath9k/ar9003_eeprom.c: Remove semicolon after if
From: Joe Perches @ 2012-10-10 18:22 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: mcgrof, jouni, vthiagar, senthilb, linville, linux-wireless,
ath9k-devel, netdev, linux-kernel, kernel-janitors
In-Reply-To: <1349887097-24980-1-git-send-email-peter.senna@gmail.com>
On Wed, 2012-10-10 at 18:38 +0200, Peter Senna Tschudin wrote:
> This patch remove a semicolon after if(...) that is preventing the
> error check to work correctly. Removing this semicolon will change the
> code behavior, but this is intended.
>
> The semantic patch that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r1@
> position p;
> @@
> if (...);@p
this semantic patch would be a lot less tedious to
inspect the results if it excluded else after the
semicolon.
I've used perl for more or less the same output.
^ permalink raw reply
* Re: [PATCH 0/2] PCI-Express Non-Transparent Bridge Support
From: Nicholas A. Bellinger @ 2012-10-10 18:05 UTC (permalink / raw)
To: Jon Mason
Cc: linux-kernel, netdev, linux-pci, Dave Jiang, David Miller,
Andrew Morton, Linus Torvalds, Bjorn Helgaas
In-Reply-To: <1349213177-9985-1-git-send-email-jon.mason@intel.com>
Hi Jon & Co,
On Tue, 2012-10-02 at 14:26 -0700, Jon Mason wrote:
> I am submitting version 4 of the PCI-Express Non-Transparent Bridge
> patches for inclusion in 3.7. All outstanding issues from the RFC
> process have been addressed.
>
> version 1
> http://thread.gmane.org/gmane.linux.kernel.pci/16443
>
> Version 2 incorporates numerous clean-ups
> http://thread.gmane.org/gmane.linux.kernel.pci/16696
>
> Version 3 incorporates changes to conform NTB and client devices to the
> Linux device model (per Greg KH's request).
> http://thread.gmane.org/gmane.linux.kernel.pci/17808
>
> Version 4 removes the transport transmit tasklet (per Dave Miller's
> request).
> http://thread.gmane.org/gmane.linux.network/244491
>
I'm very happy with the current state of the new NTB subsystem code for
an initial merge.
As we are t-minus ~5 days until the v3.7 merge window closes, you'll
want to (very soon) be sending a PULL request to Linus for drivers/ntb/
with the appropriate Reviewed-By's + Acked-By's in place.
--nab
^ permalink raw reply
* Re: [PATCH 19/20] drivers/net/ethernet/marvell/skge.c: fix error return code
From: Ezequiel Garcia @ 2012-10-10 17:40 UTC (permalink / raw)
To: Peter Senna Tschudin
Cc: Julia Lawall, Joe Perches, David Miller, shemminger, mlindner,
kernel-janitors, netdev, linux-kernel
In-Reply-To: <CA+MoWDp8Y0tJoBbz0nxH3Y7J0ur3TJm-dO9OM5BZVBKcbS9TpA@mail.gmail.com>
Hi Peter,
On Wed, Oct 10, 2012 at 2:08 PM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> Stephen and David,
>
> I've sent V2 of the patches and they were all accepted. Thank you.
>
> I've made a template for the commit message, and then copy and paste
> function names from the code. Something like:
>
> -- // --
> The function sky2_probe() return 0 for success and negative value
> for most of its internal tests failures. There are two exceptions
> that are error cases going to err_out*:. For this two cases, the
> function abort its success execution path, but returns non negative
> value, making it dificult for a caller function to notice the error.
>
> This patch fixes the error cases that do not return negative values.
>
> This was found by Coccinelle, but the code change was made by hand.
> This patch is not robot generated.
> ...
> --//--
>
> How useful it was to have the function names when you were analyzing
> the patches? It took me a lot of time to modify the template by copy
> and paste, check if it is correct, then commit. I have some other
> similar patches to submit and I wonder if having the function names in
> the commit message helped you.
>
Having real function names in your commit message won't make it more useful.
IMHO, the problem is you're still using a template commit message,
which produces
a robot-like commit message.
Developers don't like that, we prefer to see a text written by some
guy explaining
why is this patch needed, and what it's fixing/improving from an
overall point of view.
This is not easy and takes much training.
I believe patches should help maintainers, not only add work them,
so it's important to double-triple-check the patch and
double-triple-check the commit message.
I know this is tedious and it'll slow you a bit. But it's a good
thing: it means you are working :-)
Also, in this particular case, where the coccinelle does not fix
something obvious,
then I'd say you should be *extra* careful.
Hope this helps.
Ezequiel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox