* [PATCH v2 1/2] ethtool: Support get/set rx-save-fcs flag.
From: greearb @ 2011-06-18 20:58 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
From: Ben Greear <greearb@candelatech.com>
This allows users to receive the Ethernet frame checksum
on supported drivers.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2: Fix typo in man-page description.
:100644 100644 c7a18f7... c059852... M ethtool-copy.h
:100644 100644 7b1cdf5... e2eca31... M ethtool.8.in
:100644 100644 c189c78... b97552c... M ethtool.c
ethtool-copy.h | 2 ++
ethtool.8.in | 18 ++++++++++++++++++
ethtool.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 74 insertions(+), 1 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index c7a18f7..c059852 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -751,6 +751,8 @@ enum ethtool_sfeatures_retval_bits {
#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
+#define ETHTOOL_GET_SAVE_RXFCS 0x00000041 /* Get RX Save Frame Checksum */
+#define ETHTOOL_SET_SAVE_RXFCS 0x00000042 /* Set RX Save Frame Checksum */
/* compatibility with older code */
#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/ethtool.8.in b/ethtool.8.in
index 7b1cdf5..e2eca31 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -274,6 +274,13 @@ ethtool \- query or control network driver and hardware settings
.IR W1
.RB ...\ ]
.HP
+.B ethtool \-z|\-\-get\-save\-rxfcs
+.I ethX
+.HP
+.B ethtool\ \-Z|\-\-set\-save\-rxfcs
+.I ethX
+.BI \ N
+.HP
.B ethtool \-f|\-\-flash
.I ethX
.RI FILE
@@ -630,6 +637,17 @@ Sets the receive flow hash indirection table to spread flows between
receive queues according to the given weights. The sum of the weights
must be non-zero and must not exceed the size of the indirection table.
.TP
+.B \-z \-\-show\-save\-rxfcs
+Retrieves the receive frame checksum flag.
+.TP
+.B \-Z \-\-set\-save\-rxcfs
+Configures the receive frame checksum flag.
+.TP
+.B N
+1 means enable, 0 means disable. When enabled, the 4-byte
+Frame Checksum will be appended to the end of the packet. This
+can be useful when sniffing packets.
+.TP
.B \-f \-\-flash \ FILE
Flash firmware image from the specified file to a region on the adapter.
By default this will flash all the regions on the adapter.
diff --git a/ethtool.c b/ethtool.c
index c189c78..b97552c 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -99,6 +99,8 @@ static int do_flash(int fd, struct ifreq *ifr);
static int do_permaddr(int fd, struct ifreq *ifr);
static int do_getfwdump(int fd, struct ifreq *ifr);
static int do_setfwdump(int fd, struct ifreq *ifr);
+static int do_set_save_rxfcs(int fd, struct ifreq *ifr);
+static int do_get_save_rxfcs(int fd, struct ifreq *ifr);
static int send_ioctl(int fd, struct ifreq *ifr);
@@ -133,6 +135,8 @@ static enum {
MODE_PERMADDR,
MODE_SET_DUMP,
MODE_GET_DUMP,
+ MODE_SET_SAVE_RXFCS,
+ MODE_GET_SAVE_RXFCS,
} mode = MODE_GSET;
static struct option {
@@ -266,6 +270,11 @@ static struct option {
{ "-W", "--set-dump", MODE_SET_DUMP,
"Set dump flag of the device",
" N\n"},
+ { "-z", "--get-save-rxfcs", MODE_GET_SAVE_RXFCS,
+ "Get Save RX-FCS flag" },
+ { "-Z", "--set-save-rxfcs", MODE_SET_SAVE_RXFCS,
+ "Set Save RX-FCS flag of the device",
+ " N\n"},
{ "-h", "--help", MODE_HELP, "Show this help" },
{ NULL, "--version", MODE_VERSION, "Show version number" },
{}
@@ -398,6 +407,7 @@ static u32 msglvl_wanted = 0;
static u32 msglvl_mask = 0;
static u32 dump_flag;
static char *dump_file = NULL;
+static u32 save_rxfcs_flag;
static int rx_class_rule_get = -1;
static int rx_class_rule_del = -1;
@@ -792,7 +802,9 @@ static void parse_cmdline(int argc, char **argp)
(mode == MODE_FLASHDEV) ||
(mode == MODE_PERMADDR) ||
(mode == MODE_SET_DUMP) ||
- (mode == MODE_GET_DUMP)) {
+ (mode == MODE_GET_DUMP) ||
+ (mode == MODE_SET_SAVE_RXFCS) ||
+ (mode == MODE_GET_SAVE_RXFCS)) {
devname = argp[i];
break;
}
@@ -817,6 +829,9 @@ static void parse_cmdline(int argc, char **argp)
} else if (mode == MODE_SET_DUMP) {
dump_flag = get_u32(argp[i], 0);
break;
+ } else if (mode == MODE_SET_SAVE_RXFCS) {
+ save_rxfcs_flag = get_u32(argp[i], 0);
+ break;
}
/* fallthrough */
default:
@@ -1935,6 +1950,10 @@ static int doit(void)
return do_getfwdump(fd, &ifr);
} else if (mode == MODE_SET_DUMP) {
return do_setfwdump(fd, &ifr);
+ } else if (mode == MODE_GET_SAVE_RXFCS) {
+ return do_get_save_rxfcs(fd, &ifr);
+ } else if (mode == MODE_SET_SAVE_RXFCS) {
+ return do_set_save_rxfcs(fd, &ifr);
}
return 69;
@@ -3322,6 +3341,40 @@ static int do_setfwdump(int fd, struct ifreq *ifr)
return 0;
}
+static int do_set_save_rxfcs(int fd, struct ifreq *ifr)
+{
+ int err;
+ struct ethtool_value edata;
+
+ edata.cmd = ETHTOOL_SET_SAVE_RXFCS;
+ edata.data = save_rxfcs_flag;
+ ifr->ifr_data = (caddr_t)&edata;
+ err = send_ioctl(fd, ifr);
+ if (err < 0) {
+ perror("Can not set Save RX FCS level\n");
+ return 1;
+ }
+ return 0;
+}
+
+static int do_get_save_rxfcs(int fd, struct ifreq *ifr)
+{
+ int err;
+ struct ethtool_value edata;
+
+ edata.cmd = ETHTOOL_GET_SAVE_RXFCS;
+ ifr->ifr_data = (caddr_t)&edata;
+ err = send_ioctl(fd, ifr);
+ if (err == 0) {
+ fprintf(stdout, " Save RX-FCS %s\n",
+ edata.data ? "Enabled" : "Disabled");
+ return 0;
+ } else {
+ perror("Can not get Save RX FCS flag\n");
+ return 1;
+ }
+}
+
static int send_ioctl(int fd, struct ifreq *ifr)
{
return ioctl(fd, SIOCETHTOOL, ifr);
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 5/5] e1000e: Support sending frame with custom FCS.
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
In-Reply-To: <1308430045-24816-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This is good for testing by injecting frames with invalid
FCS onto a network.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 3310c3d... 011a95f... M drivers/net/e1000e/netdev.c
drivers/net/e1000e/netdev.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 3310c3d..011a95f 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4417,6 +4417,7 @@ link_up:
#define E1000_TX_FLAGS_VLAN 0x00000002
#define E1000_TX_FLAGS_TSO 0x00000004
#define E1000_TX_FLAGS_IPV4 0x00000008
+#define E1000_TX_FLAGS_NO_FCS 0x00000010
#define E1000_TX_FLAGS_VLAN_MASK 0xffff0000
#define E1000_TX_FLAGS_VLAN_SHIFT 16
@@ -4681,6 +4682,9 @@ static void e1000_tx_queue(struct e1000_adapter *adapter,
txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK);
}
+ if (unlikely(tx_flags & E1000_TX_FLAGS_NO_FCS))
+ txd_lower &= ~(E1000_TXD_CMD_IFCS);
+
i = tx_ring->next_to_use;
do {
@@ -4698,6 +4702,10 @@ static void e1000_tx_queue(struct e1000_adapter *adapter,
tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);
+ /* txd_cmd re-enables FCS, so we'll re-disable it here as desired. */
+ if (unlikely(tx_flags & E1000_TX_FLAGS_NO_FCS))
+ tx_desc->lower.data &= ~(cpu_to_le32(E1000_TXD_CMD_IFCS));
+
/*
* Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only
@@ -4900,6 +4908,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
if (skb->protocol == htons(ETH_P_IP))
tx_flags |= E1000_TX_FLAGS_IPV4;
+ if (unlikely(skb->use_specified_ether_crc))
+ tx_flags |= E1000_TX_FLAGS_NO_FCS;
+
/* if count is 0 then mapping error has occurred */
count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss);
if (count) {
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 4/5] net: Support sending frame with specified FCS.
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
In-Reply-To: <1308430045-24816-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This allows user-space to send a packet with the
ethernet FCS appended to the end. Supporting NICs
will know to disable their own FCS calculations and
send frame as is.
This is useful for injecting bad frames on a network
for testing.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 06edfef... 655fbe7... M arch/alpha/include/asm/socket.h
:100644 100644 90ffd04... 4aa1c92... M arch/arm/include/asm/socket.h
:100644 100644 c8d1fae... b70cfa3... M arch/avr32/include/asm/socket.h
:100644 100644 1a4a619... 54d2d2b... M arch/cris/include/asm/socket.h
:100644 100644 a6b2688... c77015c... M arch/frv/include/asm/socket.h
:100644 100644 04c0f45... 5c8a75d... M arch/h8300/include/asm/socket.h
:100644 100644 51427ea... f0062e6... M arch/ia64/include/asm/socket.h
:100644 100644 469787c3.. a259a66... M arch/m32r/include/asm/socket.h
:100644 100644 9bf49c8... 2442b97... M arch/m68k/include/asm/socket.h
:100644 100644 9de5190... 9b1fe294.. M arch/mips/include/asm/socket.h
:100644 100644 4e60c42... 1eb5bf5... M arch/mn10300/include/asm/socket.h
:100644 100644 225b7d6... 22538f0... M arch/parisc/include/asm/socket.h
:100644 100644 866f760... d1ecf79... M arch/powerpc/include/asm/socket.h
:100644 100644 fdff1e9... c4ab6ea... M arch/s390/include/asm/socket.h
:100644 100644 9d3fefc... af8b622... M arch/sparc/include/asm/socket.h
:100644 100644 cbdf2ff... 4c0cf9c... M arch/xtensa/include/asm/socket.h
:100644 100644 9a6115e... 22193a2... M include/asm-generic/socket.h
:100644 100644 c0a4f3a... 05b15be... M include/linux/skbuff.h
:100644 100644 f2046e4... d7e0d88... M include/net/sock.h
:100644 100644 46cbd28... a552560... M net/core/skbuff.c
:100644 100644 6e81978... 0c5f827... M net/core/sock.c
:100644 100644 c0c3cda... 7b39092... M net/packet/af_packet.c
arch/alpha/include/asm/socket.h | 1 +
arch/arm/include/asm/socket.h | 1 +
arch/avr32/include/asm/socket.h | 1 +
arch/cris/include/asm/socket.h | 1 +
arch/frv/include/asm/socket.h | 1 +
arch/h8300/include/asm/socket.h | 1 +
arch/ia64/include/asm/socket.h | 1 +
arch/m32r/include/asm/socket.h | 1 +
arch/m68k/include/asm/socket.h | 1 +
arch/mips/include/asm/socket.h | 1 +
arch/mn10300/include/asm/socket.h | 1 +
arch/parisc/include/asm/socket.h | 1 +
arch/powerpc/include/asm/socket.h | 1 +
arch/s390/include/asm/socket.h | 1 +
arch/sparc/include/asm/socket.h | 1 +
arch/xtensa/include/asm/socket.h | 1 +
include/asm-generic/socket.h | 7 +++++++
include/linux/skbuff.h | 5 ++++-
include/net/sock.h | 6 ++++++
net/core/skbuff.c | 1 +
net/core/sock.c | 7 +++++++
net/packet/af_packet.c | 18 ++++++++++++++++--
22 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/arch/alpha/include/asm/socket.h b/arch/alpha/include/asm/socket.h
index 06edfef..655fbe7 100644
--- a/arch/alpha/include/asm/socket.h
+++ b/arch/alpha/include/asm/socket.h
@@ -68,6 +68,7 @@
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
diff --git a/arch/arm/include/asm/socket.h b/arch/arm/include/asm/socket.h
index 90ffd04..4aa1c92 100644
--- a/arch/arm/include/asm/socket.h
+++ b/arch/arm/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/avr32/include/asm/socket.h b/arch/avr32/include/asm/socket.h
index c8d1fae..b70cfa3 100644
--- a/arch/avr32/include/asm/socket.h
+++ b/arch/avr32/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/arch/cris/include/asm/socket.h b/arch/cris/include/asm/socket.h
index 1a4a619..54d2d2b 100644
--- a/arch/cris/include/asm/socket.h
+++ b/arch/cris/include/asm/socket.h
@@ -63,6 +63,7 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/frv/include/asm/socket.h b/arch/frv/include/asm/socket.h
index a6b2688..c77015c 100644
--- a/arch/frv/include/asm/socket.h
+++ b/arch/frv/include/asm/socket.h
@@ -61,6 +61,7 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/h8300/include/asm/socket.h b/arch/h8300/include/asm/socket.h
index 04c0f45..5c8a75d 100644
--- a/arch/h8300/include/asm/socket.h
+++ b/arch/h8300/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/ia64/include/asm/socket.h b/arch/ia64/include/asm/socket.h
index 51427ea..f0062e6 100644
--- a/arch/ia64/include/asm/socket.h
+++ b/arch/ia64/include/asm/socket.h
@@ -70,5 +70,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_IA64_SOCKET_H */
diff --git a/arch/m32r/include/asm/socket.h b/arch/m32r/include/asm/socket.h
index 469787c3..a259a66 100644
--- a/arch/m32r/include/asm/socket.h
+++ b/arch/m32r/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_M32R_SOCKET_H */
diff --git a/arch/m68k/include/asm/socket.h b/arch/m68k/include/asm/socket.h
index 9bf49c8..2442b97 100644
--- a/arch/m68k/include/asm/socket.h
+++ b/arch/m68k/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/mips/include/asm/socket.h b/arch/mips/include/asm/socket.h
index 9de5190..9b1fe294 100644
--- a/arch/mips/include/asm/socket.h
+++ b/arch/mips/include/asm/socket.h
@@ -81,6 +81,7 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#ifdef __KERNEL__
diff --git a/arch/mn10300/include/asm/socket.h b/arch/mn10300/include/asm/socket.h
index 4e60c42..1eb5bf5 100644
--- a/arch/mn10300/include/asm/socket.h
+++ b/arch/mn10300/include/asm/socket.h
@@ -61,5 +61,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/parisc/include/asm/socket.h b/arch/parisc/include/asm/socket.h
index 225b7d6..22538f0 100644
--- a/arch/parisc/include/asm/socket.h
+++ b/arch/parisc/include/asm/socket.h
@@ -60,6 +60,7 @@
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 0x4021
+#define SO_NOFCS 0x4022
/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
diff --git a/arch/powerpc/include/asm/socket.h b/arch/powerpc/include/asm/socket.h
index 866f760..d1ecf79 100644
--- a/arch/powerpc/include/asm/socket.h
+++ b/arch/powerpc/include/asm/socket.h
@@ -68,5 +68,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/asm/socket.h
index fdff1e9..c4ab6ea 100644
--- a/arch/s390/include/asm/socket.h
+++ b/arch/s390/include/asm/socket.h
@@ -69,5 +69,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _ASM_SOCKET_H */
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h
index 9d3fefc..af8b622 100644
--- a/arch/sparc/include/asm/socket.h
+++ b/arch/sparc/include/asm/socket.h
@@ -57,6 +57,7 @@
#define SCM_TIMESTAMPING SO_TIMESTAMPING
#define SO_RXQ_OVFL 0x0024
+#define SO_NOFCS 0x0025
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/arch/xtensa/include/asm/socket.h b/arch/xtensa/include/asm/socket.h
index cbdf2ff..4c0cf9c 100644
--- a/arch/xtensa/include/asm/socket.h
+++ b/arch/xtensa/include/asm/socket.h
@@ -72,5 +72,6 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+#define SO_NOFCS 41
#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 9a6115e..22193a2 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -64,4 +64,11 @@
#define SO_DOMAIN 39
#define SO_RXQ_OVFL 40
+
+/* Instruct lower device to not calculate the frame
+ * checksum. Useful for generating Ethernet frames
+ * with custom checksums.
+ */
+#define SO_NOFCS 41
+
#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c0a4f3a..05b15be 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -307,6 +307,8 @@ typedef unsigned char *sk_buff_data_t;
* @peeked: this packet has been seen already, so stats have been
* done for it, don't do them again
* @nf_trace: netfilter packet trace flag
+ * @use_specified_ether_crc: skb is Ethernet frame with FCS already
+ * appended. Use that FCS. Requires special support in NIC.
* @nfctinfo: Relationship of this skb to the connection
* @nfct_reasm: netfilter conntrack re-assembly pointer
* @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
@@ -396,7 +398,8 @@ struct sk_buff {
#ifdef CONFIG_IPV6_NDISC_NODETYPE
__u8 ndisc_nodetype:2;
#endif
- __u8 ooo_okay:1;
+ __u8 ooo_okay:1,
+ use_specified_ether_crc:1;
kmemcheck_bitfield_end(flags2);
/* 0/13 bit hole */
diff --git a/include/net/sock.h b/include/net/sock.h
index f2046e4..d7e0d88 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -563,6 +563,12 @@ enum sock_flags {
SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
SOCK_FASYNC, /* fasync() active */
SOCK_RXQ_OVFL,
+ SOCK_DONT_DO_LL_FCS, /* Tell NIC not to do the Ethernet FCS.
+ * Will use last 4 bytes of packet sent from
+ * user-space instead. Requires special
+ * support in NIC.
+ */
+
};
static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 46cbd28..a552560 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -541,6 +541,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
new->tc_verd = old->tc_verd;
#endif
#endif
+ new->use_specified_ether_crc = old->use_specified_ether_crc;
new->vlan_tci = old->vlan_tci;
skb_copy_secmark(new, old);
diff --git a/net/core/sock.c b/net/core/sock.c
index 6e81978..0c5f827 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -641,6 +641,13 @@ set_rcvbuf:
sock_warn_obsolete_bsdism("setsockopt");
break;
+ case SO_NOFCS:
+ if (valbool)
+ sk->sk_flags |= SOCK_DONT_DO_LL_FCS;
+ else
+ sk->sk_flags &= ~(SOCK_DONT_DO_LL_FCS);
+ break;
+
case SO_PASSCRED:
if (valbool)
set_bit(SOCK_PASSCRED, &sock->flags);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c0c3cda..7b39092 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -430,6 +430,10 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
struct net_device *dev;
__be16 proto = 0;
int err;
+ int fcs_len = 0;
+
+ if (unlikely(sk->sk_flags & SOCK_DONT_DO_LL_FCS))
+ fcs_len = 4; /* We're doing our own FCS */
/*
* Get and verify the address.
@@ -465,7 +469,7 @@ retry:
*/
err = -EMSGSIZE;
- if (len > dev->mtu + dev->hard_header_len + VLAN_HLEN)
+ if (len > dev->mtu + dev->hard_header_len + VLAN_HLEN + fcs_len)
goto out_unlock;
if (!skb) {
@@ -518,6 +522,9 @@ retry:
if (err < 0)
goto out_unlock;
+ if (unlikely(sk->sk_flags & SOCK_DONT_DO_LL_FCS))
+ skb->use_specified_ether_crc = 1;
+
dev_queue_xmit(skb);
rcu_read_unlock();
return len;
@@ -1134,6 +1141,10 @@ static int packet_snd(struct socket *sock,
int vnet_hdr_len;
struct packet_sock *po = pkt_sk(sk);
unsigned short gso_type = 0;
+ int fcs_len = 0;
+
+ if (unlikely(sk->sk_flags & SOCK_DONT_DO_LL_FCS))
+ fcs_len = 4; /* We're doing our own Ethernet FCS */
/*
* Get and verify the address.
@@ -1215,7 +1226,7 @@ static int packet_snd(struct socket *sock,
}
err = -EMSGSIZE;
- if (!gso_type && (len > dev->mtu + reserve + VLAN_HLEN))
+ if (!gso_type && (len > dev->mtu + reserve + VLAN_HLEN + fcs_len))
goto out_unlock;
err = -ENOBUFS;
@@ -1278,6 +1289,9 @@ static int packet_snd(struct socket *sock,
len += vnet_hdr_len;
}
+ if (unlikely(sk->sk_flags & SOCK_DONT_DO_LL_FCS))
+ skb->use_specified_ether_crc = 1;
+
/*
* Now send it
*/
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 3/5] e100: Support receiving errored frames.
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
In-Reply-To: <1308430045-24816-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This can be helpful when sniffing dodgy networks.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 647d8c6... aad303d... M drivers/net/e100.c
drivers/net/e100.c | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 647d8c6..aad303d 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -588,6 +588,7 @@ struct nic {
wol_magic = (1 << 3),
ich_10h_workaround = (1 << 4),
save_rxfcs = (1 << 5),
+ save_rxerr = (1 << 6),
} flags ____cacheline_aligned;
enum mac mac;
@@ -1126,9 +1127,13 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
config->full_duplex_force = 0x1; /* 1=force, 0=auto */
if (nic->flags & promiscuous || nic->loopback) {
+ config->promiscuous_mode = 0x1; /* 1=on, 0=off */
+ }
+
+ if (nic->flags & save_rxerr) {
+ config->rx_discard_overruns = 0x1; /* 1=save, 0=discard */
config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */
config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */
- config->promiscuous_mode = 0x1; /* 1=on, 0=off */
}
if (nic->flags & save_rxfcs)
@@ -1983,7 +1988,18 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
skb_put(skb, actual_size);
skb->protocol = eth_type_trans(skb, nic->netdev);
- if (unlikely(!(rfd_status & cb_ok))) {
+ if (unlikely(nic->flags & save_rxerr)) {
+ if (!(rfd_status & cb_ok)) {
+ skb->pkt_type = PACKET_INVALID;
+ } else if (actual_size >
+ ETH_DATA_LEN + VLAN_ETH_HLEN + rxfcs_pad) {
+ nic->rx_over_length_errors++;
+ skb->pkt_type = PACKET_INVALID;
+ }
+ goto process_skb;
+ }
+
+ if (unlikely((nic->flags & save_rxerr) && !(rfd_status & cb_ok))) {
/* Don't indicate if hardware indicates errors */
dev_kfree_skb_any(skb);
} else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + rxfcs_pad) {
@@ -1991,6 +2007,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
nic->rx_over_length_errors++;
dev_kfree_skb_any(skb);
} else {
+process_skb:
dev->stats.rx_packets++;
dev->stats.rx_bytes += actual_size;
netif_receive_skb(skb);
@@ -2397,6 +2414,25 @@ static u32 e100_get_save_rxfcs(struct net_device *netdev)
return !!(nic->flags & save_rxfcs);
}
+static int e100_set_save_rxerr(struct net_device *netdev, u32 data)
+{
+ struct nic *nic = netdev_priv(netdev);
+ if (data)
+ nic->flags |= save_rxerr;
+ else
+ nic->flags &= ~save_rxerr;
+
+ e100_exec_cb(nic, NULL, e100_configure);
+
+ return 0;
+}
+
+static u32 e100_get_save_rxerr(struct net_device *netdev)
+{
+ struct nic *nic = netdev_priv(netdev);
+ return !!(nic->flags & save_rxerr);
+}
+
static void e100_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{
@@ -2718,6 +2754,8 @@ static const struct ethtool_ops e100_ethtool_ops = {
.get_sset_count = e100_get_sset_count,
.set_save_rxfcs = e100_set_save_rxfcs,
.get_save_rxfcs = e100_get_save_rxfcs,
+ .set_save_rxerr = e100_set_save_rxerr,
+ .get_save_rxerr = e100_get_save_rxerr,
};
static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 2/5] net: Add pkt-type PACKET_INVALID
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
In-Reply-To: <1308430045-24816-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This will be used for errored frames received from NICs.
It re-uses the un-used PACKET_FASTROUTE value, but leaves that
define in just in case some user-space app requires it.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 7b31863... 86f06e4... M include/linux/if_packet.h
include/linux/if_packet.h | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 7b31863..86f06e4 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -26,9 +26,12 @@ struct sockaddr_ll {
#define PACKET_MULTICAST 2 /* To group */
#define PACKET_OTHERHOST 3 /* To someone else */
#define PACKET_OUTGOING 4 /* Outgoing of any type */
-/* These ones are invisible by user level */
+/* This one is invisible by user level */
#define PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
-#define PACKET_FASTROUTE 6 /* Fastrouted frame */
+#define PACKET_FASTROUTE 6 /* Fastrouted frame, not used */
+#define PACKET_INVALID 6 /* Packet has errors, perhaps
+ * received with bad FCS
+ */
/* Packet socket options */
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 1/5] net: Support ethtool ops for rx of errored frames.
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
In-Reply-To: <1308430045-24816-1-git-send-email-greearb@candelatech.com>
From: Ben Greear <greearb@candelatech.com>
This can be useful when sniffing dodgy networks.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 675ddc0... fb0fac9... M include/linux/ethtool.h
:100644 100644 0e01860... 443a63c... M net/core/ethtool.c
include/linux/ethtool.h | 7 +++++++
net/core/ethtool.c | 8 ++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 675ddc0..fb0fac9 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -880,6 +880,9 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
* @set_save_rxfcs: Set flag to save (1), or discard (0), the Ethernet
* Frame Checksum for received packets.
* @get_save_rxfcs: Get current value for Save RX-FCS flag.
+ * @set_save_rxerr: Set flag to save (1), or discard (0), received Ethernet
+ * frames with errors (bad checksum, etc)
+ * @get_save_rxerr: Get current value for Save RX-ERR flag.
*
* All operations are optional (i.e. the function pointer may be set
* to %NULL) and callers must take this into account. Callers must
@@ -960,6 +963,8 @@ struct ethtool_ops {
int (*set_dump)(struct net_device *, struct ethtool_dump *);
int (*set_save_rxfcs)(struct net_device *, u32);
u32 (*get_save_rxfcs)(struct net_device *);
+ int (*set_save_rxerr)(struct net_device *, u32);
+ u32 (*get_save_rxerr)(struct net_device *);
};
#endif /* __KERNEL__ */
@@ -1036,6 +1041,8 @@ struct ethtool_ops {
#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
#define ETHTOOL_GET_SAVE_RXFCS 0x00000041 /* Get RX Save Frame Checksum */
#define ETHTOOL_SET_SAVE_RXFCS 0x00000042 /* Set RX Save Frame Checksum */
+#define ETHTOOL_GET_SAVE_RXERR 0x00000043 /* Get RX Save Errored Frames */
+#define ETHTOOL_SET_SAVE_RXERR 0x00000044 /* Set RX Save Errored Frames */
/* compatibility with older code */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 0e01860..443a63c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2160,6 +2160,14 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
rc = ethtool_get_value(dev, useraddr, ethcmd,
dev->ethtool_ops->get_save_rxfcs);
break;
+ case ETHTOOL_SET_SAVE_RXERR:
+ rc = ethtool_set_value(dev, useraddr,
+ dev->ethtool_ops->set_save_rxerr);
+ break;
+ case ETHTOOL_GET_SAVE_RXERR:
+ rc = ethtool_get_value(dev, useraddr, ethcmd,
+ dev->ethtool_ops->get_save_rxerr);
+ break;
default:
rc = -EOPNOTSUPP;
}
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2 0/5] Ethernet low-level frame debugging support.
From: greearb @ 2011-06-18 20:47 UTC (permalink / raw)
To: netdev; +Cc: Ben Greear
From: Ben Greear <greearb@candelatech.com>
This builds on the previous patches to allow receiving the
Ethernet FCS.
These patches let one receive errored frames up the stack
and generate frames with customized FCS. This allows one
to generate and receive frames with bad CRC for testing
and sniffing purposes.
I'll finish send/rcv support for e100,e1000, and e1000e
if these patches are acceptable.
v2: Change 'kludge' to fcs_len in af_packet.c
Add SO_NOFCS to the rest of the various arch socket.h files.
*** BLURB HERE ***
Ben Greear (5):
net: Support ethtool ops for rx of errored frames.
net: Add pkt-type PACKET_INVALID
e100: Support receiving errored frames.
net: Support sending frame with specified FCS.
e1000e: Support sending frame with custom FCS.
arch/alpha/include/asm/socket.h | 1 +
arch/arm/include/asm/socket.h | 1 +
arch/avr32/include/asm/socket.h | 1 +
arch/cris/include/asm/socket.h | 1 +
arch/frv/include/asm/socket.h | 1 +
arch/h8300/include/asm/socket.h | 1 +
arch/ia64/include/asm/socket.h | 1 +
arch/m32r/include/asm/socket.h | 1 +
arch/m68k/include/asm/socket.h | 1 +
arch/mips/include/asm/socket.h | 1 +
arch/mn10300/include/asm/socket.h | 1 +
arch/parisc/include/asm/socket.h | 1 +
arch/powerpc/include/asm/socket.h | 1 +
arch/s390/include/asm/socket.h | 1 +
arch/sparc/include/asm/socket.h | 1 +
arch/xtensa/include/asm/socket.h | 1 +
drivers/net/e100.c | 42 +++++++++++++++++++++++++++++++++++-
drivers/net/e1000e/netdev.c | 11 +++++++++
include/asm-generic/socket.h | 7 ++++++
include/linux/ethtool.h | 7 ++++++
include/linux/if_packet.h | 7 ++++-
include/linux/skbuff.h | 5 +++-
include/net/sock.h | 6 +++++
net/core/ethtool.c | 8 +++++++
net/core/skbuff.c | 1 +
net/core/sock.c | 7 ++++++
net/packet/af_packet.c | 18 ++++++++++++++-
27 files changed, 128 insertions(+), 7 deletions(-)
--
1.7.3.4
^ permalink raw reply
* Re: [PATCH] net/usb: Add Samsung Kalmia driver for Samsung GT-B3730
From: Marius Kotsbak @ 2011-06-18 20:03 UTC (permalink / raw)
To: Dan Williams
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA, Marius B. Kotsbak
In-Reply-To: <1307978364.2117.11.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
On 13. juni 2011 17:19, Dan Williams wrote:
> On Mon, 2011-06-13 at 17:01 +0200, Marius Kotsbak wrote:
>> On 13. juni 2011 16:57, Dan Williams wrote:
>>>
>>> Why make the driver bind to both the switched and unswitched USB IDs?
>>> Shouldn't the kernel bind the driver after switch when the device
>>> reconnects with the new IDs?
>> No, I tried and it did not happen, so I assumed that the kernel modules
>> are only loaded at USB insertion event, not when the interfaces changes.
>> Does anyone here know if my observation is right?
>>
>> Usb_modeswitch autoloads "option" module after switching, but not my
>> kalmia module.
> Try killing the modeswitch autoload thing first by moving the udev
> script out of the way. Then plug your device in, and run
> "usb-modeswitch -c /path/to/config" so that the usb_modeswitch autoload
> thing doesn't run. Does that work? I don't want to slander
> usb_modeswitch but I've seen some odd behavior which I suspect is it's
> module force-loading feature, though I haven't investigated too much
> yet. But ruling that out could be helpful.
I tried that now, and the "option" module does not load after switch,
even though it is supposed to recognize the switched modem interface
(but not the unswitched):
alias: usb:v04E8p6889d*dc*dsc*dp*ic0Aisc00ip00*
I guess what is happening is that the modem just changes it internal
state to give another usb configuration, but only when requested by the
host (as at modem insertion). The reason "option" module is normally
loaded is that usb_modeswitch does it explicit, but it does not know
that it should insert the "kalmia" module.
Thus I leave the unswitched USB ID there if not anyone has any better
working solution.
--
Marius
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: kernel 2.6.39 eats multicast packets
From: David Miller @ 2011-06-18 18:59 UTC (permalink / raw)
To: eric.dumazet; +Cc: knut.andre.tidemann, netdev
In-Reply-To: <1308392724.3539.48.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 18 Jun 2011 12:25:24 +0200
> [PATCH] ipv4: fix multicast losses
>
> Knut Tidemann found that first packet of a multicast flow was not
> correctly received, and bisected the regression to commit b23dd4fe42b4
> (Make output route lookup return rtable directly.)
>
> Special thanks to Knut, who provided a very nice bug report, including
> sample programs to demonstrate the bug.
>
> Reported-and-bisectedby: Knut Tidemann <knut.andre.tidemann@jotron.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks everyone.
^ permalink raw reply
* Re: [PATCH 2/3] net/fec: add device tree support
From: Arnd Bergmann @ 2011-06-18 18:27 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: patches-QSEj5FYQhm4dnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason Liu,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, David S. Miller
In-Reply-To: <1308410354-21387-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Saturday 18 June 2011 17:19:13 Shawn Guo wrote:
> diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt
> new file mode 100644
> index 0000000..705111d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
> @@ -0,0 +1,14 @@
> +* Freescale Fast Ethernet Controller (FEC)
> +
> +Required properties:
> +- compatible : should be "fsl,<soc>-fec", "fsl,fec"
> +- reg : address and length of the register set for the device
> +- interrupts : should contain fec interrupt
> +
> +Example:
> +
> +fec@83fec000 {
> + compatible = "fsl,imx51-fec", "fsl,fec";
> + reg = <0x83fec000 0x4000>;
> + interrupts = <87>;
> +};
How about also adding device_type="network" as required here, so you
inherit the attributes like "local-mac-address".
I would also suggest adding a call to of_get_mac_address() so you
can read the address out of the device tree when it is not configured
in hardware. Today, the driver relies on a module parameter or
platform_data on hardware with a mac address set.
The other information that is currently encoded in platform_data
is the phy mode. How about adding a property that enables RMII mode
when present?
Arnd
^ permalink raw reply
* Re: [RFT PATCH] net: remove legacy ethtool ops
From: Jeff Kirsher @ 2011-06-18 18:19 UTC (permalink / raw)
To: Michał Mirosław
Cc: netdev@vger.kernel.org, David S. Miller, Patrick McHardy,
Ben Hutchings, e1000-devel@lists.sourceforge.net
In-Reply-To: <20110618171543.GA11090@rere.qmqm.pl>
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
On Sat, 2011-06-18 at 10:15 -0700, Michał Mirosław wrote:
> On Sat, May 07, 2011 at 04:58:07AM -0700, Jeff Kirsher wrote:
> > 2011/5/7 Michał Mirosław <mirq-linux@rere.qmqm.pl>:
> > > As all drivers are converted, we may now remove discrete offload setting
> > > callback handling.
> > >
> > > Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> > > ---
> > >
> > > Note: This needs to wait for Intel guys to finish conversion of their
> > > LAN drivers.
> > >
> > > include/linux/ethtool.h | 52 ------
> > > include/linux/netdevice.h | 16 --
> > > net/8021q/vlan_dev.c | 2 +-
> > > net/core/dev.c | 13 +-
> > > net/core/ethtool.c | 399 +++------------------------------------------
> > > 5 files changed, 28 insertions(+), 454 deletions(-)
> > I do apologize for the delay, we did find several problems with the
> > original set of patches you submitted during review and testing.
> > Currently we have fixed up the e1000e, yet there is still work to be
> > done on the other drivers. I will make every effort to make sure that
> > we complete the work over the next week.
>
> Ping?
>
> Best Regards,
> Michał Mirosław
I will be pushing the patches that have passed validation this weekend.
Don is still working on the ixgbe changes, I will work with him to get
the work wrapped up early this week.
Cheers,
Jeff
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH 1/3] serial/imx: add device tree support
From: Arnd Bergmann @ 2011-06-18 18:11 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: patches-QSEj5FYQhm4dnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason Liu,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jeremy Kerr, Sascha Hauer
In-Reply-To: <20110618162655.GK8195-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
On Saturday 18 June 2011 18:26:55 Grant Likely wrote:
> On Sat, Jun 18, 2011 at 06:21:46PM +0200, Arnd Bergmann wrote:
> > Should this also support the "clock-frequency" property that 8250-style
> > serial ports support [1]?
> >
> > For the flow-control properties, should we name that more generic? The
> > same property certainly makes sense for other serial-ports if it does
> > here. OTOH, I'm not sure it's actually reliable, because it also depends
> > on whether the other side of the connection and the cable support hw flow
> > control.
>
> I'd like to see a few use cases before defining a common property.
> That said, has-rts-cts does sound like a useful generic property.
> Or maybe named "uart-has-rts-cts" to make it clear that it is a uart
> specific binding?
>
Sounds ok to me.
Arnd
^ permalink raw reply
* Re: [PATCH 02/14] SIWv2: iWARP Protocol headers: iwarp.h
From: Bart Van Assche @ 2011-06-18 17:52 UTC (permalink / raw)
To: Bernard Metzler; +Cc: netdev, linux-rdma
In-Reply-To: <1308228112-22582-1-git-send-email-bmt@zurich.ibm.com>
On Thu, Jun 16, 2011 at 2:41 PM, Bernard Metzler <bmt@zurich.ibm.com> wrote:
> ---
> drivers/infiniband/hw/siw/iwarp.h | 324 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 324 insertions(+), 0 deletions(-)
> create mode 100644 drivers/infiniband/hw/siw/iwarp.h
>
> diff --git a/drivers/infiniband/hw/siw/iwarp.h b/drivers/infiniband/hw/siw/iwarp.h
> [ ... ]
> +struct mpa_rr_params {
> +#if defined(__LITTLE_ENDIAN_BITFIELD)
> + __be16 res:5,
> + r:1,
> + c:1,
> + m:1,
> + rev:8;
> +#elif defined(__BIG_ENDIAN_BITFIELD)
> + __be16 m:1,
> + c:1,
> + r:1,
> + res:5,
> + rev:8;
> +#else
> +#error "Adjust your <asm/byteorder.h> defines"
> +#endif
> + __be16 pd_len;
> +};
The above style for declaring endianness specific bitfields in the
kernel is generally frowned upon. The preferred style is to declare a
__be32 or __le32 member variable, to define the bitmasks explicitly,
to use the __constant_cpu_to_be32() conversion function and friends
and to verify the resulting code with sparse (make C=1
CF=-D__CHECK_ENDIAN__ ...).
Bart.
^ permalink raw reply
* Re: [PATCH 01/14] SIWv2: Kconfig and Makefile
From: Bart Van Assche @ 2011-06-18 17:58 UTC (permalink / raw)
To: Bernard Metzler
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1308228106-22565-1-git-send-email-bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
On Thu, Jun 16, 2011 at 2:41 PM, Bernard Metzler <bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org> wrote:
> diff --git a/drivers/infiniband/hw/siw/Kconfig b/drivers/infiniband/hw/siw/Kconfig
> new file mode 100644
> index 0000000..6beff23
> --- /dev/null
> +++ b/drivers/infiniband/hw/siw/Kconfig
> @@ -0,0 +1,14 @@
> +config INFINIBAND_SOFTIWARP
> + tristate "Software iWARP Stack (EXPERIMENTAL)"
> + depends on INET && EXPERIMENTAL
No dependency on INFINIBAND ?
> + ---help---
> + Kernel Software Implementation of the iWARP protocol stack
> +
> + This driver implements the iWARP protocol stack in software
> + and interfaces with in-kernel TCP/IP as well as the OFED
> + verbs interfaces.
> +
> + Please send feedback to <bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>.
> +
> + To compile this driver as a module, choose M here: the module
> + will be called siw.
Seems like a good idea to me to mention that an iWARP device is
created automatically to each Ethernet interface found at the time siw
is loaded.
Also, I think author information should be added to MAINTAINERS file
instead of Kconfig.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 14/14] SIWv2: Documentation: siw.txt
From: Bart Van Assche @ 2011-06-18 17:56 UTC (permalink / raw)
To: Bernard Metzler
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1308228174-22788-1-git-send-email-bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
On Thu, Jun 16, 2011 at 2:42 PM, Bernard Metzler <bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org> wrote:
> ---
> Documentation/networking/siw.txt | 156 ++++++++++++++++++++++++++++++++++++++
> 1 files changed, 156 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/networking/siw.txt
>
> diff --git a/Documentation/networking/siw.txt b/Documentation/networking/siw.txt
> new file mode 100644
> index 0000000..805e21b
> --- /dev/null
> +++ b/Documentation/networking/siw.txt
> @@ -0,0 +1,156 @@
> +SoftiWARP: Software iWARP kernel driver module.
> +
> +General
> +-------
> +SoftiWARP (siw) implements the iWARP protocol suite (MPA/DDP/RDMAP,
> +IETF-RFC 5044/5041/5040) completely in software as a Linux kernel module.
> +siw runs on top of TCP kernel sockets and exports the Linux kernel ibverbs
> +RDMA interface. siw interfaces with the iwcm connection manager.
> +
> +
> +Transmit Path
> +-------------
> +If a send queue (SQ) work queue element gets posted, siw tries to send
> +it directly out of the application context. If the SQ was non-empty,
> +SQ processing is done asynchronously by a kernel worker thread. This
> +thread gets scheduled if the TCP socket signals new write space to
> +be available. If during send operation the socket send space becomes
> +exhausted, SQ processing is abandoned until new socket write space
> +becomes available.
It seems like some information is missing in the above:
- That the siw kernel module creates an iWARP device for each Ethernet
interface found but not for other network interfaces that support the
family of IP protocols.
- Whether or not such an iWARP device is created for Ethernet
interfaces instantiated after the siw kernel module has been loaded.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: what's causing "ip_rt_bug"?
From: Julian Anastasov @ 2011-06-18 17:53 UTC (permalink / raw)
To: Tomasz Chmielewski
Cc: Eric Dumazet, netdev, Balazs Scheidler, KOVACS Krisztian
In-Reply-To: <4DFC627F.7040007@wpkg.org>
Hello,
CC-ing tproxy developers for more ideas...
On Sat, 18 Jun 2011, Tomasz Chmielewski wrote:
> >> It's just a proxy, no special routing set:
> >
> > Is transparent proxy used?
>
> Yes, it is.
>
>
> >> # ip ro
> >> 58.185.117.18 via 119.46.110.193 dev eth0
> >> 119.46.240.13 via 119.46.110.193 dev eth0
> >> 58.185.117.29 via 119.46.110.193 dev eth0
> >> 119.46.241.13 via 119.46.110.193 dev eth0
> >
> > Same route for 58.185.117.28 2nd time? Is that possible?:
>
> Not second time, the addresses are similar, but different: 58.185.117.18, 58.185.117.29, 58.185.117.28. Unless there's something I don't see! ;)
Ops, my fault :)
> >> 58.185.117.28 via 119.46.110.193 dev eth0
> >> 119.46.110.192/26 dev eth0 proto kernel scope link src 119.46.110.197
> >> 169.254.0.0/16 dev eth0 scope link
> >> default via 119.46.110.195 dev eth0
> >>
> >>
> >> The box is also crashing every few days; and I really had no clue why (just connected a serial console to catch any new oops/panic).
> >>
> >>
> >> The last time it crashed, I have this entry in syslog:
> >>
> >> Jun 17 16:16:17 TRUE-SC02 kernel: [172488.602629] ip_rt_bug: 124.121.155.197 -> 119.46.110.197, ?
> >
> > The ip_rt_bug messages show that skb->dev is
> > NULL (OUTPUT hook), daddr in IP header is local address,
> > may be some original received packet. If such packet is
> > provided to ip_route_me_harder(skb, RTN_UNSPEC) an
> > ip_route_input call can happen. Calling later dst_output
> > should lead to this warning. The question is what can
> > cause received packet to appear in OUTPUT hook where
> > a change in mark or TOS can can trigger such ip_route_input
> > call. What kind of netfilter modules are used? nf_queue,
> > -j REJECT, NAT? Is 124.121.155.197 a local address?
>
> No, it's not local.
> With "ip_rt_bug: 124.121.184.77 -> 119.46.110.197, ?" lines, only the address on the right side is local.
Hm, if it happens "sometimes", can it be some
problem with tproxy and TIME_WAIT sockets? I see that
tproxy_sk_is_transparent has special treatment for TW
sockets while ip_route_me_harder is different. As result,
may be input route is assigned for TW packets.
May be inet_sk_flowi_flags() needs fixing, not
sure. But following patch is first step to fix this
problem. I don't have setup to test this patch.
===========================================================
Avoid creating input routes with ip_route_me_harder.
It does not work for locally generated packets. Instead,
restrict sockets to provide valid saddr for output route (or
unicast saddr for transparent proxy). For other traffic
allow saddr to be unicast or local but if callers forget
to check saddr type use 0 for the output route.
The resulting handling should be:
- REJECT TCP:
- in INPUT we can provide addr_type = RTN_LOCAL but
better allow rejecting traffic delivered with
local route (no IP address => use RTN_UNSPEC to
allow also RTN_UNICAST).
- FORWARD: RTN_UNSPEC => allow RTN_LOCAL/RTN_UNICAST
saddr, add fix to ignore RTN_BROADCAST and RTN_MULTICAST
- OUTPUT: RTN_UNSPEC
- NAT, mangle, ip_queue, nf_ip_reroute: RTN_UNSPEC in LOCAL_OUT
- IPVS:
- use RTN_LOCAL in LOCAL_OUT and FORWARD after SNAT
to restrict saddr to be local
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
diff -urp v2.6.39/linux/net/ipv4/netfilter/ipt_REJECT.c linux/net/ipv4/netfilter/ipt_REJECT.c
--- v2.6.39/linux/net/ipv4/netfilter/ipt_REJECT.c 2011-03-20 10:55:56.000000000 +0200
+++ linux/net/ipv4/netfilter/ipt_REJECT.c 2011-06-18 18:22:40.713189957 +0300
@@ -40,7 +40,6 @@ static void send_reset(struct sk_buff *o
struct iphdr *niph;
const struct tcphdr *oth;
struct tcphdr _otcph, *tcph;
- unsigned int addr_type;
/* IP header checks: fragment. */
if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
@@ -55,6 +54,9 @@ static void send_reset(struct sk_buff *o
if (oth->rst)
return;
+ if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
+ return;
+
/* Check checksum */
if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP))
return;
@@ -101,19 +103,11 @@ static void send_reset(struct sk_buff *o
nskb->csum_start = (unsigned char *)tcph - nskb->head;
nskb->csum_offset = offsetof(struct tcphdr, check);
- addr_type = RTN_UNSPEC;
- if (hook != NF_INET_FORWARD
-#ifdef CONFIG_BRIDGE_NETFILTER
- || (nskb->nf_bridge && nskb->nf_bridge->mask & BRNF_BRIDGED)
-#endif
- )
- addr_type = RTN_LOCAL;
-
/* ip_route_me_harder expects skb->dst to be set */
skb_dst_set_noref(nskb, skb_dst(oldskb));
nskb->protocol = htons(ETH_P_IP);
- if (ip_route_me_harder(nskb, addr_type))
+ if (ip_route_me_harder(nskb, RTN_UNSPEC))
goto free_nskb;
niph->ttl = ip4_dst_hoplimit(skb_dst(nskb));
diff -urp v2.6.39/linux/net/ipv4/netfilter.c linux/net/ipv4/netfilter.c
--- v2.6.39/linux/net/ipv4/netfilter.c 2011-05-20 10:38:08.000000000 +0300
+++ linux/net/ipv4/netfilter.c 2011-06-18 19:13:39.299189310 +0300
@@ -17,51 +17,35 @@ int ip_route_me_harder(struct sk_buff *s
const struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;
struct flowi4 fl4 = {};
- unsigned long orefdst;
+ __be32 saddr = iph->saddr;
+ __u8 flags = 0;
unsigned int hh_len;
- unsigned int type;
- type = inet_addr_type(net, iph->saddr);
- if (skb->sk && inet_sk(skb->sk)->transparent)
- type = RTN_LOCAL;
- if (addr_type == RTN_UNSPEC)
- addr_type = type;
+ if (!skb->sk && addr_type != RTN_LOCAL) {
+ if (addr_type == RTN_UNSPEC)
+ addr_type = inet_addr_type(net, saddr);
+ if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
+ flags |= FLOWI_FLAG_ANYSRC;
+ else
+ saddr = 0;
+ }
/* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
* packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook.
*/
- if (addr_type == RTN_LOCAL) {
- fl4.daddr = iph->daddr;
- if (type == RTN_LOCAL)
- fl4.saddr = iph->saddr;
- fl4.flowi4_tos = RT_TOS(iph->tos);
- fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
- fl4.flowi4_mark = skb->mark;
- fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
- rt = ip_route_output_key(net, &fl4);
- if (IS_ERR(rt))
- return -1;
-
- /* Drop old route. */
- skb_dst_drop(skb);
- skb_dst_set(skb, &rt->dst);
- } else {
- /* non-local src, find valid iif to satisfy
- * rp-filter when calling ip_route_input. */
- fl4.daddr = iph->saddr;
- rt = ip_route_output_key(net, &fl4);
- if (IS_ERR(rt))
- return -1;
+ fl4.daddr = iph->daddr;
+ fl4.saddr = saddr;
+ fl4.flowi4_tos = RT_TOS(iph->tos);
+ fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
+ fl4.flowi4_mark = skb->mark;
+ fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : flags;
+ rt = ip_route_output_key(net, &fl4);
+ if (IS_ERR(rt))
+ return -1;
- orefdst = skb->_skb_refdst;
- if (ip_route_input(skb, iph->daddr, iph->saddr,
- RT_TOS(iph->tos), rt->dst.dev) != 0) {
- dst_release(&rt->dst);
- return -1;
- }
- dst_release(&rt->dst);
- refdst_drop(orefdst);
- }
+ /* Drop old route. */
+ skb_dst_drop(skb);
+ skb_dst_set(skb, &rt->dst);
if (skb_dst(skb)->error)
return -1;
=================================================================
> # iptables -L -t nat -n
> Chain PREROUTING (policy ACCEPT)
> target prot opt source destination
> REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8080
>
> Chain OUTPUT (policy ACCEPT)
> target prot opt source destination
>
> Chain POSTROUTING (policy ACCEPT)
> target prot opt source destination
>
>
> # iptables -L -t mangle -n
> Chain PREROUTING (policy ACCEPT)
> target prot opt source destination
> DIVERT tcp -- 0.0.0.0/0 0.0.0.0/0 socket
>
> Chain INPUT (policy ACCEPT)
> target prot opt source destination
>
> Chain FORWARD (policy ACCEPT)
> target prot opt source destination
>
> Chain OUTPUT (policy ACCEPT)
> target prot opt source destination
>
> Chain POSTROUTING (policy ACCEPT)
> target prot opt source destination
>
> Chain DIVERT (1 references)
> target prot opt source destination
> MARK all -- 0.0.0.0/0 0.0.0.0/0 MARK xset 0x1/0xffffffff
> ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
>
>
> # lsmod
> Module Size Used by
> xt_mark 1171 1
> xt_socket 1922 1
> nf_tproxy_core 1752 1 xt_socket,[permanent]
> ipt_REDIRECT 1093 1
> xt_tcpudp 2331 1
> ebt_redirect 1234 1
> ebt_ip 1562 1
> ebtable_broute 1395 1
> bridge 64647 1 ebtable_broute
> stp 1931 1 bridge
> llc 5071 2 bridge,stp
> ebtables 20458 1 ebtable_broute
> iptable_mangle 1351 1
> iptable_nat 3644 1
> nf_nat 16977 2 ipt_REDIRECT,iptable_nat
> nf_conntrack_ipv4 11077 3 iptable_nat,nf_nat
> nf_defrag_ipv4 1337 2 xt_socket,nf_conntrack_ipv4
> i2c_dev 4561 0
> i2c_core 21774 1 i2c_dev
> nf_conntrack_netbios_ns 1486 0
> nf_conntrack 65085 5 xt_socket,iptable_nat,nf_nat,nf_conntrack_ipv4,nf_conntrack_netbios_ns
> iptable_filter 1402 0
> ip_tables 14931 3 iptable_mangle,iptable_nat,iptable_filter
> x_tables 20316 11 xt_mark,xt_socket,ipt_REDIRECT,xt_tcpudp,ebt_redirect,ebt_ip,ebtables,iptable_mangle,iptable_nat,iptable_filter,ip_tables
> dm_mirror 11724 0
> dm_multipath 14772 0
> scsi_dh 5994 1 dm_multipath
> video 21310 0
> output 2103 1 video
> sbs 11378 0
> sbshc 4115 1 sbs
> battery 10902 0
> acpi_memhotplug 4135 0
> ac 3274 0
> parport_pc 21355 0
> lp 9491 0
> parport 33290 2 parport_pc,lp
> option 16045 0
> usb_wwan 10222 1 option
> usbserial 34477 2 option,usb_wwan
> serio_raw 4064 0
> tpm_tis 9203 0
> tpm 14317 1 tpm_tis
> tpm_bios 5252 1 tpm
> rtc_cmos 8731 0
> rtc_core 14080 1 rtc_cmos
> rtc_lib 2497 1 rtc_core
> button 5662 0
> igb 131680 0
> shpchp 29302 0
> pcspkr 1822 0
> dm_region_hash 9574 1 dm_mirror
> dm_log 8359 2 dm_mirror,dm_region_hash
> usb_storage 45133 0
> ata_piix 22147 0
> libata 169650 1 ata_piix
> cciss 88474 24
> sd_mod 28117 0
> scsi_mod 156163 5 scsi_dh,usb_storage,libata,cciss,sd_mod
> ext3 114308 12
> jbd 43368 1 ext3
> uhci_hcd 18941 0
> ohci_hcd 20027 0
> ehci_hcd 33605 0
>
>
> # ifconfig -a
> eth0 Link encap:Ethernet HWaddr 18:A9:05:41:CC:CE
> inet addr:119.46.110.197 Bcast:119.46.110.255 Mask:255.255.255.192
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:4872707550 errors:0 dropped:1177767 overruns:1177767 frame:0
> TX packets:5066061004 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:3719046973104 (3.3 TiB) TX bytes:4237588228875 (3.8 TiB)
>
> eth0:1 Link encap:Ethernet HWaddr 18:A9:05:41:CC:CE
> inet addr:119.46.110.249 Bcast:119.46.110.255 Mask:255.255.255.192
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
>
>
>
> --
> Tomasz Chmielewski
> http://wpkg.org
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [PATCH 10/14] SIWv2: Transmit path: siw_qp_tx.c
From: Bart Van Assche @ 2011-06-18 17:47 UTC (permalink / raw)
To: Bernard Metzler
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1308228153-22720-1-git-send-email-bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
On Thu, Jun 16, 2011 at 2:42 PM, Bernard Metzler <bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org> wrote:
> ---
> drivers/infiniband/hw/siw/siw_qp_tx.c | 1332 +++++++++++++++++++++++++++++++++
> 1 files changed, 1332 insertions(+), 0 deletions(-)
> create mode 100644 drivers/infiniband/hw/siw/siw_qp_tx.c
>
> diff --git a/drivers/infiniband/hw/siw/siw_qp_tx.c b/drivers/infiniband/hw/siw/siw_qp_tx.c
[ ... ]
> +/*
> + * Write out iov referencing hdr, data and trailer of current FPDU.
> + * Update transmit state dependent on write return status
> + */
> +static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
> +{
> + struct siw_wqe *wqe = c_tx->wqe;
> + struct siw_sge *sge = &wqe->wr.sgl.sge[c_tx->sge_idx],
> + *first_sge = sge;
> + struct siw_mr *mr = NULL;
> + struct ib_umem_chunk *chunk = c_tx->umem_chunk;
> +
> + struct kvec iov[MAX_ARRAY];
> + struct page *page_array[MAX_ARRAY];
> + struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
> +
> + int seg = 0, do_crc = c_tx->do_crc, is_kva = 0, rv;
> + unsigned int data_len = c_tx->bytes_unsent,
> + hdr_len = 0,
> + trl_len = 0,
> + sge_off = c_tx->sge_off,
> + sge_idx = c_tx->sge_idx,
> + pg_idx = c_tx->pg_idx;
Have you run the siw source code through sparse ? Sparse reports the
following for the above:
drivers/infiniband/hw/siw/siw_qp_tx.c:694:1: warning: the frame size
of 1120 bytes is larger than 1024 bytes
I assume that you know that one should be careful with stack
allocations in the kernel ?
> + if (tx_type == RDMAP_RDMA_READ_REQ) {
This is what the compiler says about the above statement:
drivers/infiniband/hw/siw/siw_qp_tx.c:1145:15: warning: comparison
between enum siw_wr_opcode and enum rdma_opcode
So how can that statement be correct ?
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 04/14] SIWv2: Module initialization: siw_main.c
From: Bart Van Assche @ 2011-06-18 17:39 UTC (permalink / raw)
To: Bernard Metzler
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1308228122-22616-1-git-send-email-bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org>
On Thu, Jun 16, 2011 at 2:42 PM, Bernard Metzler <bmt-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org> wrote:
> ---
> drivers/infiniband/hw/siw/siw_main.c | 603 ++++++++++++++++++++++++++++++++++
> 1 files changed, 603 insertions(+), 0 deletions(-)
> create mode 100644 drivers/infiniband/hw/siw/siw_main.c
>
> diff --git a/drivers/infiniband/hw/siw/siw_main.c b/drivers/infiniband/hw/siw/siw_main.c
> [ ... ]
> +static ssize_t show_stats(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct siw_dev *siw_dev = container_of(dev, struct siw_dev,
> + ofa_dev.dev);
> +
> + return sprintf(buf, "Allocated SIW Objects:\n"
> +#if DPRINT_MASK > 0
> + "Global :\t%s: %d\n"
> +#endif
> + "Device %s:\t"
> + "%s: %d, %s: %d, %s: %d, %s: %d, %s: %d, %s: %d\n",
> +#if DPRINT_MASK > 0
> + "WQEs", atomic_read(&siw_num_wqe),
> +#endif
> + siw_dev->ofa_dev.name,
> + "PDs", atomic_read(&siw_dev->num_pd),
> + "QPs", atomic_read(&siw_dev->num_qp),
> + "CQs", atomic_read(&siw_dev->num_cq),
> + "SRQs", atomic_read(&siw_dev->num_srq),
> + "MRs", atomic_read(&siw_dev->num_mem),
> + "CEPs", atomic_read(&siw_dev->num_cep));
> +}
The rules for sysfs, documented in Documentation/ABI/README, are:
- One value per file.
- All new sysfs attributes must be documented in Documentation/ABI.
An alternative to following the above rules is moving attributes from
sysfs to debugfs.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: siw-2011-06-16 and ib_uverbs
From: Bart Van Assche @ 2011-06-18 17:26 UTC (permalink / raw)
To: Bernard Metzler
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
On Wed, Jun 15, 2011 at 5:43 PM, Bernard Metzler <BMT-OA+xvbQnYDHMbYB6QlFGEg@public.gmane.org> wrote:
> If I don't hear objection before tomorrow I would post it as an
> increment - as summarized below.
This is what I ran into by unloading ib_uverbs:
$ modprobe siw && modprobe ib_uverbs && rmmod ib_uverbs
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffffa0348809>] uverbs_devnode+0x9/0x30 [ib_uverbs]
PGD 1fb5d067 PUD 1d398067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
[ ... ]
RIP: 0010:[<ffffffffa0348809>] [<ffffffffa0348809>]
uverbs_devnode+0x9/0x30 [ib_uverbs]
RSP: 0018:ffff88001298fbd8 EFLAGS: 00010286
RAX: ffffffffa0348800 RBX: ffff880013d49df8 RCX: 0000000000000001
RDX: ffff88001298fd80 RSI: 0000000000000000 RDI: ffff880013d49df8
RBP: ffff88001298fbd8 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88001a4ee4f0 R14: ffff88001298fd80 R15: 00000000fffffff4
FS: 00007f9b7b8e5720(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000000 CR3: 0000000019026000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process rmmod (pid: 10245, threadinfo ffff88001298e000, task ffff88000c6a3f40)
Stack:
ffff88001298fc08 ffffffff812a30bd ffff880013d49df8 ffff88001dbfc1b0
ffff88001a4ee4f0 00007fff9a4aa8c0 ffff88001298fdb8 ffffffff812aa0a9
0000000000000000 0000000000000006 ffff880013dd62e0 0000000000000000
Call Trace:
[<ffffffff812a30bd>] device_get_devnode+0x8d/0x120
[<ffffffff812aa0a9>] devtmpfs_delete_node+0x69/0x2c0
[<ffffffff8108e2cf>] ? mark_held_locks+0x6f/0xa0
[<ffffffff81128cc6>] ? __slab_free+0xc6/0x240
[<ffffffff813eaae1>] ? klist_release+0x31/0xd0
[<ffffffff812a1510>] ? put_device+0x20/0x20
[<ffffffff811dafe7>] ? kobject_put+0x27/0x60
[<ffffffff812a1507>] ? put_device+0x17/0x20
[<ffffffff812a1522>] ? klist_children_put+0x12/0x20
[<ffffffff812a1fe0>] device_del+0x190/0x1c0
[<ffffffff812a2032>] device_unregister+0x22/0x60
[<ffffffff812a20ab>] device_destroy+0x3b/0x50
[<ffffffffa034808f>] ib_uverbs_remove_one+0x3f/0xa0 [ib_uverbs]
[<ffffffffa022832f>] ib_unregister_device+0x4f/0x100 [ib_core]
[<ffffffffa024dc4d>] siw_exit_module+0x101/0x147 [siw]
[<ffffffff81099273>] sys_delete_module+0x173/0x260
[<ffffffff81402771>] ? retint_swapgs+0xe/0x13
[<ffffffff8108e44d>] ? trace_hardirqs_on_caller+0x14d/0x190
[<ffffffff8140302b>] system_call_fastpath+0x16/0x1b
Code: ff 48 c7 c7 38 e6 34 a0 31 c0 e8 7d 55 0b e1 e9 66 ff ff ff 66
66 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 66 66 66 66 90 <c7>
06 b6 01 00 00 48 c7 c6 17 e5 34 a0 48 8b 57 50 48 85 d2 48
RIP [<ffffffffa0348809>] uverbs_devnode+0x9/0x30 [ib_uverbs]
RSP <ffff88001298fbd8>
CR2: 0000000000000000
---[ end trace 2dab58bcf192cb4b ]---
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [RFT PATCH] net: remove legacy ethtool ops
From: Michał Mirosław @ 2011-06-18 17:15 UTC (permalink / raw)
To: Jeff Kirsher
Cc: netdev, David S. Miller, Patrick McHardy, Ben Hutchings,
e1000-devel
In-Reply-To: <BANLkTikHS0=XaVb4tutWAJTYcMLgYPzTGA@mail.gmail.com>
On Sat, May 07, 2011 at 04:58:07AM -0700, Jeff Kirsher wrote:
> 2011/5/7 Michał Mirosław <mirq-linux@rere.qmqm.pl>:
> > As all drivers are converted, we may now remove discrete offload setting
> > callback handling.
> >
> > Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> > ---
> >
> > Note: This needs to wait for Intel guys to finish conversion of their
> > LAN drivers.
> >
> > include/linux/ethtool.h | 52 ------
> > include/linux/netdevice.h | 16 --
> > net/8021q/vlan_dev.c | 2 +-
> > net/core/dev.c | 13 +-
> > net/core/ethtool.c | 399 +++------------------------------------------
> > 5 files changed, 28 insertions(+), 454 deletions(-)
> I do apologize for the delay, we did find several problems with the
> original set of patches you submitted during review and testing.
> Currently we have fixed up the e1000e, yet there is still work to be
> done on the other drivers. I will make every effort to make sure that
> we complete the work over the next week.
Ping?
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: Section conflict compile failures in net
From: Michał Mirosław @ 2011-06-18 17:06 UTC (permalink / raw)
To: James Bottomley; +Cc: David Miller, netdev
In-Reply-To: <1306892570.11897.35.camel@mulgrave.site>
On Wed, Jun 01, 2011 at 10:42:50AM +0900, James Bottomley wrote:
> On Tue, 2011-05-31 at 15:45 -0700, David Miller wrote:
> > From: James Bottomley <James.Bottomley@HansenPartnership.com>
> > Date: Thu, 26 May 2011 16:39:53 -0500
> >
> > BTW, linux-netdev doesn't exist, it's just plain netdev.
>
> Um, yes ... I thought it was netdev, then I checked MARC and it had
> linux-netdev. I'll remember for next time (well, at least for the next
> six months).
>
> > > Simply reverting
> > >
> > > commit e5cb966c0838e4da43a3b0751bdcac7fe719f7b4
> > > Author: Micha<C5><82> Miros<C5><82>aw <mirq-linux@rere.qmqm.pl>
> > > Date: Mon Apr 18 13:31:20 2011 +0000
> > >
> > > net: fix section mismatches
> > >
> > > Fixes the problem.
> > >
> > > If I look at the first problem in hp100.c, the addition of
> > > __devinitconst to the device tables is fine, but there's no
> > > corresponding sectional tag on their use, so when compiled as a module,
> > > things like hp100_eisa_driver is now in the main data section but refers
> > > to something in the init data section ... I assume all the others are
> > > the same type of problem.
> >
> > Yeah I think the device ID table __devinitconst bits have to be
> > reverted.
> >
> > I'll apply something like the following:
> >
> > net: Revert adding __devinitconst to driver ID tables.
> >
> > If the table is hooked up to foo_driver->id_table we can't
> > mark it __devinitconst otherwise we end up with section
> > mismatches.
> >
> > Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
>
> That fixes some but not all; the pci tables still cause a section
> conflict:
>
> drivers/net/hp100.c:211: error: hp100_pci_tbl causes a section type conflict
> make[2]: *** [drivers/net/hp100.o] Error 1
>
>
> It's really, as has been said, a compiler problem: the compiler is
> confused about the read only sections. However, 4.2 is a pretty common
> compiler (especially for non-x86), so if the compiler can't do the read
> only section tracking, just not using the __devinitconst designation
> globally seems to be the best thing, just change it to __devinitdata
> instead.
So maybe just #define __devinitconst __devinitdata for those broken gcc
versions?
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: software iwarp stack update
From: Bart Van Assche @ 2011-06-18 16:35 UTC (permalink / raw)
To: Roland Dreier
Cc: Bernard Metzler, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <BANLkTi=2woNzF=GL3cT3NB_hye5JHfodMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Thu, Jun 16, 2011 at 7:20 PM, Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org> wrote:
> It does seem we are missing an IB_MANDATORY_FUNC
> entry for modify_port in ib_device_check_mandatory; or on
> the flip side we are missing a check of modify_port and a
> -ENOSYS return... I guess modify_port does not really make
> sense for iWARP so probably the second option is better.
There seems to be disagreement about whether to return 0, -ENOSYS or
-EOPNOTSUPP for not supported functionality. Does the patch below make sense ?
Note: I don't have all the hardware necessary to test the patch below.
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 4007f72..e711de4 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -627,6 +627,9 @@ int ib_modify_device(struct ib_device *device,
int device_modify_mask,
struct ib_device_modify *device_modify)
{
+ if (!device->modify_device)
+ return -ENOSYS;
+
return device->modify_device(device, device_modify_mask,
device_modify);
}
@@ -647,6 +650,9 @@ int ib_modify_port(struct ib_device *device,
u8 port_num, int port_modify_mask,
struct ib_port_modify *port_modify)
{
+ if (!device->modify_port)
+ return -ENOSYS;
+
if (port_num < start_port(device) || port_num > end_port(device))
return -EINVAL;
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c
b/drivers/infiniband/hw/amso1100/c2_provider.c
index aeebc4d..f101bb7 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -99,14 +99,6 @@ static int c2_query_port(struct ib_device *ibdev,
return 0;
}
-static int c2_modify_port(struct ib_device *ibdev,
- u8 port, int port_modify_mask,
- struct ib_port_modify *props)
-{
- pr_debug("%s:%u\n", __func__, __LINE__);
- return 0;
-}
-
static int c2_query_pkey(struct ib_device *ibdev,
u8 port, u16 index, u16 * pkey)
{
@@ -817,7 +809,6 @@ int c2_register_device(struct c2_dev *dev)
dev->ibdev.dma_device = &dev->pcidev->dev;
dev->ibdev.query_device = c2_query_device;
dev->ibdev.query_port = c2_query_port;
- dev->ibdev.modify_port = c2_modify_port;
dev->ibdev.query_pkey = c2_query_pkey;
dev->ibdev.query_gid = c2_query_gid;
dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 2e27413..c7d9411 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -61,13 +61,6 @@
#include "iwch_user.h"
#include "common.h"
-static int iwch_modify_port(struct ib_device *ibdev,
- u8 port, int port_modify_mask,
- struct ib_port_modify *props)
-{
- return -ENOSYS;
-}
-
static struct ib_ah *iwch_ah_create(struct ib_pd *pd,
struct ib_ah_attr *ah_attr)
{
@@ -1392,7 +1385,6 @@ int iwch_register_device(struct iwch_dev *dev)
dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
dev->ibdev.query_device = iwch_query_device;
dev->ibdev.query_port = iwch_query_port;
- dev->ibdev.modify_port = iwch_modify_port;
dev->ibdev.query_pkey = iwch_query_pkey;
dev->ibdev.query_gid = iwch_query_gid;
dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
diff --git a/drivers/infiniband/hw/cxgb4/provider.c
b/drivers/infiniband/hw/cxgb4/provider.c
index 5b9e422..247fe70 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -58,13 +58,6 @@ static int fastreg_support = 1;
module_param(fastreg_support, int, 0644);
MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=1)");
-static int c4iw_modify_port(struct ib_device *ibdev,
- u8 port, int port_modify_mask,
- struct ib_port_modify *props)
-{
- return -ENOSYS;
-}
-
static struct ib_ah *c4iw_ah_create(struct ib_pd *pd,
struct ib_ah_attr *ah_attr)
{
@@ -456,7 +449,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
dev->ibdev.query_device = c4iw_query_device;
dev->ibdev.query_port = c4iw_query_port;
- dev->ibdev.modify_port = c4iw_modify_port;
dev->ibdev.query_pkey = c4iw_query_pkey;
dev->ibdev.query_gid = c4iw_query_gid;
dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c
b/drivers/infiniband/hw/nes/nes_verbs.c
index 95ca93c..9f2f7d4 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -605,16 +605,6 @@ static int nes_query_port(struct ib_device
*ibdev, u8 port, struct ib_port_attr
/**
- * nes_modify_port
- */
-static int nes_modify_port(struct ib_device *ibdev, u8 port,
- int port_modify_mask, struct ib_port_modify *props)
-{
- return 0;
-}
-
-
-/**
* nes_query_pkey
*/
static int nes_query_pkey(struct ib_device *ibdev, u8 port, u16
index, u16 *pkey)
@@ -3882,7 +3872,6 @@ struct nes_ib_device *nes_init_ofa_device(struct
net_device *netdev)
nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev;
nesibdev->ibdev.query_device = nes_query_device;
nesibdev->ibdev.query_port = nes_query_port;
- nesibdev->ibdev.modify_port = nes_modify_port;
nesibdev->ibdev.query_pkey = nes_query_pkey;
nesibdev->ibdev.query_gid = nes_query_gid;
nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
diff --git a/drivers/infiniband/hw/siw/siw_main.c
b/drivers/infiniband/hw/siw/siw_main.c
index b2b7bea..d2346fe 100644
--- a/drivers/infiniband/hw/siw/siw_main.c
+++ b/drivers/infiniband/hw/siw/siw_main.c
@@ -216,13 +216,6 @@ static struct device_attribute *siw_dev_attributes[] = {
&dev_attr_cep
};
-static int siw_modify_port(struct ib_device *ofa_dev, u8 port, int mask,
- struct ib_port_modify *props)
-{
- return -EOPNOTSUPP;
-}
-
-
static int siw_register_device(struct siw_dev *dev)
{
struct ib_device *ibdev = &dev->ofa_dev;
@@ -284,7 +277,6 @@ static int siw_register_device(struct siw_dev *dev)
ibdev->query_device = siw_query_device;
ibdev->query_port = siw_query_port;
ibdev->query_qp = siw_query_qp;
- ibdev->modify_port = siw_modify_port;
ibdev->query_pkey = siw_query_pkey;
ibdev->query_gid = siw_query_gid;
ibdev->alloc_ucontext = siw_alloc_ucontext;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCH 0/3] Add basic device support for imx51 babbage
From: Grant Likely @ 2011-06-18 16:29 UTC (permalink / raw)
To: Shawn Guo
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
patches-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1308410354-21387-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Sat, Jun 18, 2011 at 11:19:11PM +0800, Shawn Guo wrote:
> This patch set adds the basic device tree support for imx51 babbage
> board. With uart and fec dt support added, the dt kernel can boot
> into console with nfs root on babbage, so that we get a good base
> to start playing dt and converting further drivers to use dt on
> imx51.
>
> It creates the platform imx51-dt for using the device tree, and
> leaves existing board support files alone, so nothing should be
> broken. The plan is to add stuff step by step into imx51-dt to
> get it support every existing imx51 boards, and then remove the
> existing board files.
>
> It works against Linus tree plus the dt infrastructure patches
> posted by Grant Likely as part of the following series.
>
> [RFC PATCH 00/11] Full device tree support for ARM Versatile
>
> Comments are appreciated.
>
> Shawn Guo (3):
> serial/imx: add device tree support
> net/fec: add device tree support
> ARM: mx5: add basic device tree support for imx51 babbage
Good work! Other than minor comments, this series looks awesome.
g.
>
> Documentation/devicetree/bindings/net/fsl-fec.txt | 14 +++
> .../bindings/tty/serial/fsl-imx-uart.txt | 21 +++++
> arch/arm/boot/dts/imx51-babbage.dts | 89 ++++++++++++++++++++
> arch/arm/mach-mx5/Kconfig | 8 ++
> arch/arm/mach-mx5/Makefile | 1 +
> arch/arm/mach-mx5/imx51-dt.c | 70 +++++++++++++++
> drivers/net/fec.c | 28 ++++++
> drivers/tty/serial/imx.c | 81 ++++++++++++++++--
> 8 files changed, 302 insertions(+), 10 deletions(-)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH 1/3] serial/imx: add device tree support
From: Grant Likely @ 2011-06-18 16:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: patches-QSEj5FYQhm4dnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason Liu,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jeremy Kerr, Sascha Hauer,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <201106181821.46574.arnd-r2nGTMty4D4@public.gmane.org>
On Sat, Jun 18, 2011 at 06:21:46PM +0200, Arnd Bergmann wrote:
> On Saturday 18 June 2011 17:19:12 Shawn Guo wrote:
> >
> > +Required properties:
> > +- compatible : should be "fsl,<soc>-uart", "fsl,imx-uart"
> > +- reg : address and length of the register set for the device
> > +- interrupts : should contain uart interrupt
> > +- id : should be the port ID defined by soc
> > +
> > +Optional properties:
> > +- fsl,has-rts-cts : indicate it has rts-cts
> > +- fsl,irda-mode : support irda mode
> > +
> > +Example:
> > +
> > +uart@73fbc000 {
> > + compatible = "fsl,imx51-uart", "fsl,imx-uart";
> > + reg = <0x73fbc000 0x4000>;
> > + interrupts = <31>;
> > + id = <1>;
> > + fsl,has-rts-cts;
> > +};
>
> Should this also support the "clock-frequency" property that 8250-style
> serial ports support [1]?
>
> For the flow-control properties, should we name that more generic? The
> same property certainly makes sense for other serial-ports if it does
> here. OTOH, I'm not sure it's actually reliable, because it also depends
> on whether the other side of the connection and the cable support hw flow
> control.
I'd like to see a few use cases before defining a common property.
That said, has-rts-cts does sound like a useful generic property.
Or maybe named "uart-has-rts-cts" to make it clear that it is a uart
specific binding?
g.
>
>
> Arnd
>
> [1] http://playground.sun.com/1275/bindings/devices/html/serial-1_0d.html#HDR9
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH 3/3] ARM: mx5: add basic device tree support for imx51 babbage
From: Grant Likely @ 2011-06-18 16:24 UTC (permalink / raw)
To: Shawn Guo
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
patches-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1308410354-21387-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Sat, Jun 18, 2011 at 11:19:14PM +0800, Shawn Guo wrote:
> This patch adds the i.mx51 dt platform with uart and fec support.
> It also adds the dts file imx51 babbage, so that we can have a dt
> kernel on babbage booting into console with nfs root.
>
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Looks like a good start to me. I'll pick it up into devicetree/test
(probably on Monday). Only think I see that needs changing is to
modify the compatible properties based on my comments on the first 2
patches.
Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
g.
> ---
> arch/arm/boot/dts/imx51-babbage.dts | 89 +++++++++++++++++++++++++++++++++++
> arch/arm/mach-mx5/Kconfig | 8 +++
> arch/arm/mach-mx5/Makefile | 1 +
> arch/arm/mach-mx5/imx51-dt.c | 70 +++++++++++++++++++++++++++
> 4 files changed, 168 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/boot/dts/imx51-babbage.dts
> create mode 100644 arch/arm/mach-mx5/imx51-dt.c
>
> diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
> new file mode 100644
> index 0000000..7976932
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx51-babbage.dts
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright 2011 Freescale Semiconductor, Inc.
> + * Copyright 2011 Linaro Ltd.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +/dts-v1/;
> +/include/ "skeleton.dtsi"
> +
> +/ {
> + model = "Freescale i.MX51 Babbage";
> + compatible = "fsl,imx51-babbage", "fsl,imx51";
> + interrupt-parent = <&tzic>;
> +
> + chosen {
> + bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
> + };
> +
> + memory {
> + reg = <0x90000000 0x20000000>;
> + };
> +
> + tzic: tz-interrupt-controller@e0000000 {
> + compatible = "fsl,imx51-tzic", "fsl,tzic";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xe0000000 0x4000>;
> + };
> +
> + aips@70000000 { /* aips-1 */
> + compatible = "fsl,aips-bus", "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x70000000 0x10000000>;
> + ranges;
> +
> + spba {
> + compatible = "fsl,spba-bus", "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x70000000 0x40000>;
> + ranges;
> +
> + uart@7000c000 {
> + compatible = "fsl,imx51-uart", "fsl,imx-uart";
> + reg = <0x7000c000 0x4000>;
> + interrupts = <33>;
> + id = <3>;
> + fsl,has-rts-cts;
> + };
> + };
> +
> + uart@73fbc000 {
> + compatible = "fsl,imx51-uart", "fsl,imx-uart";
> + reg = <0x73fbc000 0x4000>;
> + interrupts = <31>;
> + id = <1>;
> + fsl,has-rts-cts;
> + };
> +
> + uart@73fc0000 {
> + compatible = "fsl,imx51-uart", "fsl,imx-uart";
> + reg = <0x73fc0000 0x4000>;
> + interrupts = <32>;
> + id = <2>;
> + fsl,has-rts-cts;
> + };
> + };
> +
> + aips@80000000 { /* aips-2 */
> + compatible = "fsl,aips-bus", "simple-bus";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x80000000 0x10000000>;
> + ranges;
> +
> + fec@83fec000 {
> + compatible = "fsl,imx51-fec", "fsl,fec";
> + reg = <0x83fec000 0x4000>;
> + interrupts = <87>;
> + };
> + };
> +};
> diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
> index 799fbc4..8bdd0c4 100644
> --- a/arch/arm/mach-mx5/Kconfig
> +++ b/arch/arm/mach-mx5/Kconfig
> @@ -62,6 +62,14 @@ endif # ARCH_MX50_SUPPORTED
> if ARCH_MX51
> comment "i.MX51 machines:"
>
> +config MACH_IMX51_DT
> + bool "Support i.MX51 platforms from device tree"
> + select SOC_IMX51
> + select USE_OF
> + help
> + Include support for Freescale i.MX51 based platforms
> + using the device tree for discovery
> +
> config MACH_MX51_BABBAGE
> bool "Support MX51 BABBAGE platforms"
> select SOC_IMX51
> diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
> index 0b9338c..47b483f 100644
> --- a/arch/arm/mach-mx5/Makefile
> +++ b/arch/arm/mach-mx5/Makefile
> @@ -7,6 +7,7 @@ obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o system.o
> obj-$(CONFIG_SOC_IMX50) += mm-mx50.o
>
> obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
> +obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
> obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
> obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
> obj-$(CONFIG_MACH_MX53_EVK) += board-mx53_evk.o
> diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c
> new file mode 100644
> index 0000000..8bfdb91
> --- /dev/null
> +++ b/arch/arm/mach-mx5/imx51-dt.c
> @@ -0,0 +1,70 @@
> +/*
> + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> + * Copyright 2011 Linaro Ltd.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include <linux/irq.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/mach/arch.h>
> +#include <asm/mach/time.h>
> +
> +#include <mach/common.h>
> +#include <mach/mx51.h>
> +
> +/*
> + * Lookup table for attaching a specific name and platform_data pointer to
> + * devices as they get created by of_platform_populate(). Ideally this table
> + * would not exist, but the current clock implementation depends on some devices
> + * having a specific name.
> + */
> +static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = {
> + OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART1_BASE_ADDR, "imx-uart.0", NULL),
> + OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART2_BASE_ADDR, "imx-uart.1", NULL),
> + OF_DEV_AUXDATA("fsl,imx51-uart", MX51_UART3_BASE_ADDR, "imx-uart.2", NULL),
> + OF_DEV_AUXDATA("fsl,imx51-fec", MX51_FEC_BASE_ADDR, "fec.0", NULL),
> + {}
> +};
> +
> +static const struct of_device_id tzic_of_match[] __initconst = {
> + { .compatible = "fsl,imx51-tzic", },
> + {}
> +};
> +
> +static void __init imx51_dt_init(void)
> +{
> + irq_domain_generate_simple(tzic_of_match, MX51_TZIC_BASE_ADDR, 0);
> +
> + of_platform_populate(NULL, of_default_bus_match_table,
> + imx51_auxdata_lookup, NULL);
> +}
> +
> +static void __init imx51_timer_init(void)
> +{
> + mx51_clocks_init(32768, 24000000, 22579200, 0);
> +}
> +
> +static struct sys_timer imx51_timer = {
> + .init = imx51_timer_init,
> +};
> +
> +static const char *imx51_dt_board_compat[] __initdata = {
> + "fsl,imx51-babbage",
> + NULL
> +};
> +
> +DT_MACHINE_START(IMX51_DT, "Freescale i.MX51 (Device Tree Support)")
> + .map_io = mx51_map_io,
> + .init_early = imx51_init_early,
> + .init_irq = mx51_init_irq,
> + .timer = &imx51_timer,
> + .init_machine = imx51_dt_init,
> + .dt_compat = imx51_dt_board_compat,
> +MACHINE_END
> --
> 1.7.4.1
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ 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