* [PATCH 10/14] ehea: Simplify type 3 transmit routine
From: Anton Blanchard @ 2011-04-05 11:41 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
If a nonlinear skb fits within the immediate area, use skb_copy_bits
instead of copying the frags by hand.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:44.258651836 +1100
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:50.638888481 +1100
@@ -2095,29 +2095,14 @@ static void ehea_xmit2(struct sk_buff *s
static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
struct ehea_swqe *swqe)
{
- int nfrags = skb_shinfo(skb)->nr_frags;
u8 *imm_data = &swqe->u.immdata_nodesc.immediate_data[0];
- skb_frag_t *frag;
- int i;
xmit_common(skb, swqe);
- if (nfrags == 0) {
+ if (!skb->data_len)
skb_copy_from_linear_data(skb, imm_data, skb->len);
- } else {
- skb_copy_from_linear_data(skb, imm_data,
- skb_headlen(skb));
- imm_data += skb_headlen(skb);
-
- /* ... then copy data from the fragments */
- for (i = 0; i < nfrags; i++) {
- frag = &skb_shinfo(skb)->frags[i];
- memcpy(imm_data,
- page_address(frag->page) + frag->page_offset,
- frag->size);
- imm_data += frag->size;
- }
- }
+ else
+ skb_copy_bits(skb, 0, imm_data, skb->len);
swqe->immediate_data_length = skb->len;
dev_kfree_skb(skb);
^ permalink raw reply
* [PATCH 9/14] ehea: Merge swqe2 TSO and non TSO paths
From: Anton Blanchard @ 2011-04-05 11:40 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
write_swqe2_TSO and write_swqe2_nonTSO are almost identical.
For TSO we have to set the TSO and mss bits in the wqe and we only
put the header in the immediate area, no data. Collapse both
functions into write_swqe2_immediate.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:42.518587298 +1100
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:44.258651836 +1100
@@ -1681,65 +1681,35 @@ static int ehea_clean_portres(struct ehe
return ret;
}
-static void write_swqe2_TSO(struct sk_buff *skb,
- struct ehea_swqe *swqe, u32 lkey)
-{
- struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
- u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
- int skb_data_size = skb_headlen(skb);
- int headersize;
-
- /* Packet is TCP with TSO enabled */
- swqe->tx_control |= EHEA_SWQE_TSO;
- swqe->mss = skb_shinfo(skb)->gso_size;
- /* copy only eth/ip/tcp headers to immediate data and
- * the rest of skb->data to sg1entry
- */
- headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
-
- skb_data_size = skb_headlen(skb);
-
- if (skb_data_size >= headersize) {
- /* copy immediate data */
- skb_copy_from_linear_data(skb, imm_data, headersize);
- swqe->immediate_data_length = headersize;
-
- if (skb_data_size > headersize) {
- /* set sg1entry data */
- sg1entry->l_key = lkey;
- sg1entry->len = skb_data_size - headersize;
- sg1entry->vaddr =
- ehea_map_vaddr(skb->data + headersize);
- swqe->descriptors++;
- }
- } else
- pr_err("cannot handle fragmented headers\n");
-}
-
-static void write_swqe2_nonTSO(struct sk_buff *skb,
- struct ehea_swqe *swqe, u32 lkey)
+static void write_swqe2_immediate(struct sk_buff *skb, struct ehea_swqe *swqe,
+ u32 lkey)
{
int skb_data_size = skb_headlen(skb);
u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
+ unsigned int immediate_len = SWQE2_MAX_IMM;
- /* Packet is any nonTSO type
- *
- * Copy as much as possible skb->data to immediate data and
- * the rest to sg1entry
- */
- if (skb_data_size >= SWQE2_MAX_IMM) {
- /* copy immediate data */
- skb_copy_from_linear_data(skb, imm_data, SWQE2_MAX_IMM);
+ swqe->descriptors = 0;
+
+ if (skb_is_gso(skb)) {
+ swqe->tx_control |= EHEA_SWQE_TSO;
+ swqe->mss = skb_shinfo(skb)->gso_size;
+ /*
+ * For TSO packets we only copy the headers into the
+ * immediate area.
+ */
+ immediate_len = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
+ }
- swqe->immediate_data_length = SWQE2_MAX_IMM;
+ if (skb_is_gso(skb) || skb_data_size >= SWQE2_MAX_IMM) {
+ skb_copy_from_linear_data(skb, imm_data, immediate_len);
+ swqe->immediate_data_length = immediate_len;
- if (skb_data_size > SWQE2_MAX_IMM) {
- /* copy sg1entry data */
+ if (skb_data_size > immediate_len) {
sg1entry->l_key = lkey;
- sg1entry->len = skb_data_size - SWQE2_MAX_IMM;
+ sg1entry->len = skb_data_size - immediate_len;
sg1entry->vaddr =
- ehea_map_vaddr(skb->data + SWQE2_MAX_IMM);
+ ehea_map_vaddr(skb->data + immediate_len);
swqe->descriptors++;
}
} else {
@@ -1758,13 +1728,9 @@ static inline void write_swqe2_data(stru
nfrags = skb_shinfo(skb)->nr_frags;
sg1entry = &swqe->u.immdata_desc.sg_entry;
sg_list = (struct ehea_vsgentry *)&swqe->u.immdata_desc.sg_list;
- swqe->descriptors = 0;
sg1entry_contains_frag_data = 0;
- if (skb_is_gso(skb))
- write_swqe2_TSO(skb, swqe, lkey);
- else
- write_swqe2_nonTSO(skb, swqe, lkey);
+ write_swqe2_immediate(skb, swqe, lkey);
/* write descriptors */
if (nfrags > 0) {
^ permalink raw reply
* [PATCH 8/14] ehea: Simplify ehea_xmit2 and ehea_xmit3
From: Anton Blanchard @ 2011-04-05 11:39 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
Based on a patch from Michael Ellerman, clean up a significant
portion of the transmit path. There was a lot of duplication here.
Even worse, we were always checksumming tx packets and ignoring the
skb->ip_summed field.
Also remove NETIF_F_FRAGLIST from dev->features, I'm not sure why
it was enabled.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-04-05 20:36:34.437226735 +1000
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-04-05 20:36:38.726736977 +1000
@@ -1681,37 +1681,6 @@ static int ehea_clean_portres(struct ehe
return ret;
}
-/*
- * The write_* functions store information in swqe which is used by
- * the hardware to calculate the ip/tcp/udp checksum
- */
-
-static inline void write_ip_start_end(struct ehea_swqe *swqe,
- const struct sk_buff *skb)
-{
- swqe->ip_start = skb_network_offset(skb);
- swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
-}
-
-static inline void write_tcp_offset_end(struct ehea_swqe *swqe,
- const struct sk_buff *skb)
-{
- swqe->tcp_offset =
- (u8)(swqe->ip_end + 1 + offsetof(struct tcphdr, check));
-
- swqe->tcp_end = (u16)skb->len - 1;
-}
-
-static inline void write_udp_offset_end(struct ehea_swqe *swqe,
- const struct sk_buff *skb)
-{
- swqe->tcp_offset =
- (u8)(swqe->ip_end + 1 + offsetof(struct udphdr, check));
-
- swqe->tcp_end = (u16)skb->len - 1;
-}
-
-
static void write_swqe2_TSO(struct sk_buff *skb,
struct ehea_swqe *swqe, u32 lkey)
{
@@ -2113,41 +2082,46 @@ static int ehea_change_mtu(struct net_de
return 0;
}
-static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
- struct ehea_swqe *swqe, u32 lkey)
+static void xmit_common(struct sk_buff *skb, struct ehea_swqe *swqe)
{
- if (skb->protocol == htons(ETH_P_IP)) {
- const struct iphdr *iph = ip_hdr(skb);
+ swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC;
- /* IPv4 */
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IP_CHECKSUM
- | EHEA_SWQE_TCP_CHECKSUM
- | EHEA_SWQE_IMM_DATA_PRESENT
- | EHEA_SWQE_DESCRIPTORS_PRESENT;
-
- write_ip_start_end(swqe, skb);
-
- if (iph->protocol == IPPROTO_UDP) {
- if ((iph->frag_off & IP_MF) ||
- (iph->frag_off & IP_OFFSET))
- /* IP fragment, so don't change cs */
- swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM;
- else
- write_udp_offset_end(swqe, skb);
- } else if (iph->protocol == IPPROTO_TCP) {
- write_tcp_offset_end(swqe, skb);
- }
+ if (skb->protocol != htons(ETH_P_IP))
+ return;
- /* icmp (big data) and ip segmentation packets (all other ip
- packets) do not require any special handling */
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ swqe->tx_control |= EHEA_SWQE_IP_CHECKSUM;
- } else {
- /* Other Ethernet Protocol */
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IMM_DATA_PRESENT
- | EHEA_SWQE_DESCRIPTORS_PRESENT;
+ swqe->ip_start = skb_network_offset(skb);
+ swqe->ip_end = swqe->ip_start + ip_hdrlen(skb) - 1;
+
+ switch (ip_hdr(skb)->protocol) {
+ case IPPROTO_UDP:
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ swqe->tx_control |= EHEA_SWQE_TCP_CHECKSUM;
+
+ swqe->tcp_offset = swqe->ip_end + 1 +
+ offsetof(struct udphdr, check);
+ swqe->tcp_end = skb->len - 1;
+ break;
+
+ case IPPROTO_TCP:
+ if (skb->ip_summed == CHECKSUM_PARTIAL)
+ swqe->tx_control |= EHEA_SWQE_TCP_CHECKSUM;
+
+ swqe->tcp_offset = swqe->ip_end + 1 +
+ offsetof(struct tcphdr, check);
+ swqe->tcp_end = skb->len - 1;
+ break;
}
+}
+
+static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
+ struct ehea_swqe *swqe, u32 lkey)
+{
+ swqe->tx_control |= EHEA_SWQE_DESCRIPTORS_PRESENT;
+
+ xmit_common(skb, swqe);
write_swqe2_data(skb, dev, swqe, lkey);
}
@@ -2160,51 +2134,11 @@ static void ehea_xmit3(struct sk_buff *s
skb_frag_t *frag;
int i;
- if (skb->protocol == htons(ETH_P_IP)) {
- const struct iphdr *iph = ip_hdr(skb);
-
- /* IPv4 */
- write_ip_start_end(swqe, skb);
+ xmit_common(skb, swqe);
- if (iph->protocol == IPPROTO_TCP) {
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IP_CHECKSUM
- | EHEA_SWQE_TCP_CHECKSUM
- | EHEA_SWQE_IMM_DATA_PRESENT;
-
- write_tcp_offset_end(swqe, skb);
-
- } else if (iph->protocol == IPPROTO_UDP) {
- if ((iph->frag_off & IP_MF) ||
- (iph->frag_off & IP_OFFSET))
- /* IP fragment, so don't change cs */
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IMM_DATA_PRESENT;
- else {
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IP_CHECKSUM
- | EHEA_SWQE_TCP_CHECKSUM
- | EHEA_SWQE_IMM_DATA_PRESENT;
-
- write_udp_offset_end(swqe, skb);
- }
- } else {
- /* icmp (big data) and
- ip segmentation packets (all other ip packets) */
- swqe->tx_control |= EHEA_SWQE_CRC
- | EHEA_SWQE_IP_CHECKSUM
- | EHEA_SWQE_IMM_DATA_PRESENT;
- }
- } else {
- /* Other Ethernet Protocol */
- swqe->tx_control |= EHEA_SWQE_CRC | EHEA_SWQE_IMM_DATA_PRESENT;
- }
- /* copy (immediate) data */
if (nfrags == 0) {
- /* data is in a single piece */
skb_copy_from_linear_data(skb, imm_data, skb->len);
} else {
- /* first copy data from the skb->data buffer ... */
skb_copy_from_linear_data(skb, imm_data,
skb_headlen(skb));
imm_data += skb_headlen(skb);
@@ -2218,6 +2152,7 @@ static void ehea_xmit3(struct sk_buff *s
imm_data += frag->size;
}
}
+
swqe->immediate_data_length = skb->len;
dev_kfree_skb(skb);
}
@@ -3221,7 +3156,7 @@ struct ehea_port *ehea_setup_single_port
dev->netdev_ops = &ehea_netdev_ops;
ehea_set_ethtool_ops(dev);
- dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
+ dev->features = NETIF_F_SG | NETIF_F_TSO
| NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
| NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA |
^ permalink raw reply
* [PATCH] net: netxen: convert to hw_features
From: Michał Mirosław @ 2011-04-05 11:36 UTC (permalink / raw)
To: netdev; +Cc: Amit Kumar Salecha
Rather simple conversion to hw_features.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
[x86 build-tested only, as I don't have the hardware.]
drivers/net/netxen/netxen_nic.h | 2 +-
drivers/net/netxen/netxen_nic_ethtool.c | 102 -------------------------------
drivers/net/netxen/netxen_nic_init.c | 3 +-
drivers/net/netxen/netxen_nic_main.c | 53 +++++++++++++---
4 files changed, 46 insertions(+), 114 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index d7299f1..15595b3 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1177,7 +1177,7 @@ struct netxen_adapter {
u8 max_sds_rings;
u8 driver_mismatch;
u8 msix_supported;
- u8 rx_csum;
+ u8 __pad;
u8 pci_using_dac;
u8 portnum;
u8 physical_port;
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 3bdcc80..29f90ba 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -676,62 +676,6 @@ netxen_nic_get_ethtool_stats(struct net_device *dev,
}
}
-static u32 netxen_nic_get_tx_csum(struct net_device *dev)
-{
- return dev->features & NETIF_F_IP_CSUM;
-}
-
-static u32 netxen_nic_get_rx_csum(struct net_device *dev)
-{
- struct netxen_adapter *adapter = netdev_priv(dev);
- return adapter->rx_csum;
-}
-
-static int netxen_nic_set_rx_csum(struct net_device *dev, u32 data)
-{
- struct netxen_adapter *adapter = netdev_priv(dev);
-
- if (data) {
- adapter->rx_csum = data;
- return 0;
- }
-
- if (dev->features & NETIF_F_LRO) {
- if (netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_DISABLED))
- return -EIO;
-
- dev->features &= ~NETIF_F_LRO;
- netxen_send_lro_cleanup(adapter);
- netdev_info(dev, "disabling LRO as rx_csum is off\n");
- }
- adapter->rx_csum = data;
- return 0;
-}
-
-static u32 netxen_nic_get_tso(struct net_device *dev)
-{
- struct netxen_adapter *adapter = netdev_priv(dev);
-
- if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
- return (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) != 0;
-
- return (dev->features & NETIF_F_TSO) != 0;
-}
-
-static int netxen_nic_set_tso(struct net_device *dev, u32 data)
-{
- if (data) {
- struct netxen_adapter *adapter = netdev_priv(dev);
-
- dev->features |= NETIF_F_TSO;
- if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
- dev->features |= NETIF_F_TSO6;
- } else
- dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
-
- return 0;
-}
-
static void
netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
@@ -866,43 +810,6 @@ static int netxen_get_intr_coalesce(struct net_device *netdev,
return 0;
}
-static int netxen_nic_set_flags(struct net_device *netdev, u32 data)
-{
- struct netxen_adapter *adapter = netdev_priv(netdev);
- int hw_lro;
-
- if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
- return -EINVAL;
-
- if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO))
- return -EINVAL;
-
- if (!adapter->rx_csum) {
- netdev_info(netdev, "rx csum is off, cannot toggle LRO\n");
- return -EINVAL;
- }
-
- if (!!(data & ETH_FLAG_LRO) == !!(netdev->features & NETIF_F_LRO))
- return 0;
-
- if (data & ETH_FLAG_LRO) {
- hw_lro = NETXEN_NIC_LRO_ENABLED;
- netdev->features |= NETIF_F_LRO;
- } else {
- hw_lro = NETXEN_NIC_LRO_DISABLED;
- netdev->features &= ~NETIF_F_LRO;
- }
-
- if (netxen_config_hw_lro(adapter, hw_lro))
- return -EIO;
-
- if ((hw_lro == 0) && netxen_send_lro_cleanup(adapter))
- return -EIO;
-
-
- return 0;
-}
-
const struct ethtool_ops netxen_nic_ethtool_ops = {
.get_settings = netxen_nic_get_settings,
.set_settings = netxen_nic_set_settings,
@@ -916,21 +823,12 @@ const struct ethtool_ops netxen_nic_ethtool_ops = {
.set_ringparam = netxen_nic_set_ringparam,
.get_pauseparam = netxen_nic_get_pauseparam,
.set_pauseparam = netxen_nic_set_pauseparam,
- .get_tx_csum = netxen_nic_get_tx_csum,
- .set_tx_csum = ethtool_op_set_tx_csum,
- .set_sg = ethtool_op_set_sg,
- .get_tso = netxen_nic_get_tso,
- .set_tso = netxen_nic_set_tso,
.get_wol = netxen_nic_get_wol,
.set_wol = netxen_nic_set_wol,
.self_test = netxen_nic_diag_test,
.get_strings = netxen_nic_get_strings,
.get_ethtool_stats = netxen_nic_get_ethtool_stats,
.get_sset_count = netxen_get_sset_count,
- .get_rx_csum = netxen_nic_get_rx_csum,
- .set_rx_csum = netxen_nic_set_rx_csum,
.get_coalesce = netxen_get_intr_coalesce,
.set_coalesce = netxen_set_intr_coalesce,
- .get_flags = ethtool_op_get_flags,
- .set_flags = netxen_nic_set_flags,
};
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 731077d..7f99967 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1483,7 +1483,8 @@ static struct sk_buff *netxen_process_rxbuf(struct netxen_adapter *adapter,
if (!skb)
goto no_skb;
- if (likely(adapter->rx_csum && cksum == STATUS_CKSUM_OK)) {
+ if (likely((adapter->netdev->features & NETIF_F_RXCSUM)
+ && cksum == STATUS_CKSUM_OK)) {
adapter->stats.csummed++;
skb->ip_summed = CHECKSUM_UNNECESSARY;
} else
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 9336715..201b944 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -485,6 +485,37 @@ static void netxen_set_multicast_list(struct net_device *dev)
adapter->set_multi(dev);
}
+static u32 netxen_fix_features(struct net_device *dev, u32 features)
+{
+ if (!(features & NETIF_F_RXCSUM)) {
+ netdev_info(dev, "disabling LRO as RXCSUM is off\n");
+
+ features &= ~NETIF_F_LRO;
+ }
+
+ return features;
+}
+
+static int netxen_set_features(struct net_device *dev, u32 features)
+{
+ struct netxen_adapter *adapter = netdev_priv(dev);
+ int hw_lro;
+
+ if (!((dev->features ^ features) & NETIF_F_LRO))
+ return 0;
+
+ hw_lro = (features & NETIF_F_LRO) ? NETXEN_NIC_LRO_ENABLED
+ : NETXEN_NIC_LRO_DISABLED;
+
+ if (netxen_config_hw_lro(adapter, hw_lro))
+ return -EIO;
+
+ if (!(features & NETIF_F_LRO) && netxen_send_lro_cleanup(adapter))
+ return -EIO;
+
+ return 0;
+}
+
static const struct net_device_ops netxen_netdev_ops = {
.ndo_open = netxen_nic_open,
.ndo_stop = netxen_nic_close,
@@ -495,6 +526,8 @@ static const struct net_device_ops netxen_netdev_ops = {
.ndo_set_mac_address = netxen_nic_set_mac,
.ndo_change_mtu = netxen_nic_change_mtu,
.ndo_tx_timeout = netxen_tx_timeout,
+ .ndo_fix_features = netxen_fix_features,
+ .ndo_set_features = netxen_set_features,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = netxen_nic_poll_controller,
#endif
@@ -1196,7 +1229,6 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
int err = 0;
struct pci_dev *pdev = adapter->pdev;
- adapter->rx_csum = 1;
adapter->mc_enabled = 0;
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
adapter->max_mc_count = 38;
@@ -1210,14 +1242,13 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
- netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
- netdev->features |= (NETIF_F_GRO);
- netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
+ netdev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
+ NETIF_F_RXCSUM;
- if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
- netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
- netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
- }
+ if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
+ netdev->hw_features |= NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
+
+ netdev->vlan_features |= netdev->hw_features;
if (adapter->pci_using_dac) {
netdev->features |= NETIF_F_HIGHDMA;
@@ -1225,10 +1256,12 @@ netxen_setup_netdev(struct netxen_adapter *adapter,
}
if (adapter->capabilities & NX_FW_CAPABILITY_FVLANTX)
- netdev->features |= (NETIF_F_HW_VLAN_TX);
+ netdev->hw_features |= NETIF_F_HW_VLAN_TX;
if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)
- netdev->features |= NETIF_F_LRO;
+ netdev->hw_features |= NETIF_F_LRO;
+
+ netdev->features |= netdev->hw_features;
netdev->irq = adapter->msix_entries[0].vector;
--
1.7.2.5
^ permalink raw reply related
* [PATCH 7/14] ehea: Allocate large enough skbs to avoid partial cacheline DMA writes
From: Anton Blanchard @ 2011-04-05 11:36 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
The ehea adapter has a mode where it will avoid partial cacheline DMA
writes on receive by always padding packets to fall on a cacheline
boundary.
Unfortunately we currently aren't allocating enough space for a full
ethernet MTU packet to be rounded up, so this optimisation doesn't hit.
It's unfortunate that the next largest packet size exposed by the
hypervisor interface is 2kB, meaning our skb allocation comes out of a
4kB SLAB. However the performance increase due to this optimisation is
quite large and my TCP stream numbers increase from 900MB to 1000MB/sec.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea.h
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea.h 2011-03-21 08:11:58.336990054 +1100
+++ linux-2.6/drivers/net/ehea/ehea.h 2011-03-21 08:12:35.578366957 +1100
@@ -82,7 +82,7 @@
#define EHEA_SG_RQ3 0
#define EHEA_MAX_PACKET_SIZE 9022 /* for jumbo frames */
-#define EHEA_RQ2_PKT_SIZE 1522
+#define EHEA_RQ2_PKT_SIZE 2048
#define EHEA_L_PKT_SIZE 256 /* low latency */
#define MAX_LRO_DESCRIPTORS 8
@@ -93,7 +93,7 @@
#define EHEA_PD_ID 0xaabcdeff
#define EHEA_RQ2_THRESHOLD 1
-#define EHEA_RQ3_THRESHOLD 9 /* use RQ3 threshold of 1522 bytes */
+#define EHEA_RQ3_THRESHOLD 4 /* use RQ3 threshold of 2048 bytes */
#define EHEA_SPEED_10G 10000
#define EHEA_SPEED_1G 1000
^ permalink raw reply
* [PATCH 6/14] ehea: Add vlan_features
From: Anton Blanchard @ 2011-04-05 11:35 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
We weren't enabling any VLAN features so we missed out on checksum
offload and TSO when using VLANs. Enable them.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-04-05 20:36:33.847294106 +1000
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-04-05 20:36:34.437226735 +1000
@@ -3224,6 +3224,8 @@ struct ehea_port *ehea_setup_single_port
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
| NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
| NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
+ dev->vlan_features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HIGHDMA |
+ NETIF_F_IP_CSUM;
dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
if (use_lro)
^ permalink raw reply
* [PATCH 5/14] ehea: Don't check NETIF_F_TSO in TX path
From: Anton Blanchard @ 2011-04-05 11:33 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
It seems like the ehea xmit routine and an ethtool change of TSO
mode could race, resulting in corrupt packets. Checking gso_size
is enough and we can use the helper function.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:34.568292440 +1100
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-03-21 18:32:37.398397405 +1100
@@ -1792,7 +1792,7 @@ static inline void write_swqe2_data(stru
swqe->descriptors = 0;
sg1entry_contains_frag_data = 0;
- if ((dev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size)
+ if (skb_is_gso(skb))
write_swqe2_TSO(skb, swqe, lkey);
else
write_swqe2_nonTSO(skb, swqe, lkey);
^ permalink raw reply
* [PATCH 4/14] ehea: Remove num_tx_qps module option
From: Anton Blanchard @ 2011-04-05 11:32 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
The num_tx_qps module option allows a user to configure a different
number of tx and rx queues. Now the networking stack is multiqueue
aware it makes little sense just to enable the tx queues and not the
rx queues so remove the option.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea.h
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea.h 2011-04-05 20:35:41.000000000 +1000
+++ linux-2.6/drivers/net/ehea/ehea.h 2011-04-05 20:36:04.160683726 +1000
@@ -58,7 +58,6 @@
#define EHEA_MIN_ENTRIES_QP 127
#define EHEA_SMALL_QUEUES
-#define EHEA_NUM_TX_QP 1
#define EHEA_LRO_MAX_AGGR 64
#ifdef EHEA_SMALL_QUEUES
@@ -460,8 +459,6 @@ struct ehea_port {
char int_aff_name[EHEA_IRQ_NAME_SIZE];
int allmulti; /* Indicates IFF_ALLMULTI state */
int promisc; /* Indicates IFF_PROMISC state */
- int num_tx_qps;
- int num_add_tx_qps;
int num_mcs;
int resets;
unsigned long flags;
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-04-05 20:35:41.013326677 +1000
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-04-05 20:36:22.128632142 +1000
@@ -63,7 +63,6 @@ static int sq_entries = EHEA_DEF_ENTRIES
static int use_mcs = 1;
static int use_lro;
static int lro_max_aggr = EHEA_LRO_MAX_AGGR;
-static int num_tx_qps = EHEA_NUM_TX_QP;
static int prop_carrier_state;
module_param(msg_level, int, 0);
@@ -75,9 +74,7 @@ module_param(prop_carrier_state, int, 0)
module_param(use_mcs, int, 0);
module_param(use_lro, int, 0);
module_param(lro_max_aggr, int, 0);
-module_param(num_tx_qps, int, 0);
-MODULE_PARM_DESC(num_tx_qps, "Number of TX-QPS");
MODULE_PARM_DESC(msg_level, "msg_level");
MODULE_PARM_DESC(prop_carrier_state, "Propagate carrier state of physical "
"port to stack. 1:yes, 0:no. Default = 0 ");
@@ -172,7 +169,7 @@ static void ehea_update_firmware_handles
continue;
num_ports++;
- num_portres += port->num_def_qps + port->num_add_tx_qps;
+ num_portres += port->num_def_qps;
}
}
@@ -198,9 +195,7 @@ static void ehea_update_firmware_handles
(num_ports == 0))
continue;
- for (l = 0;
- l < port->num_def_qps + port->num_add_tx_qps;
- l++) {
+ for (l = 0; l < port->num_def_qps; l++) {
struct ehea_port_res *pr = &port->port_res[l];
arr[i].adh = adapter->handle;
@@ -360,7 +355,7 @@ static struct net_device_stats *ehea_get
}
tx_packets = 0;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
tx_packets += port->port_res[i].tx_packets;
tx_bytes += port->port_res[i].tx_bytes;
}
@@ -814,7 +809,7 @@ static void reset_sq_restart_flag(struct
{
int i;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
struct ehea_port_res *pr = &port->port_res[i];
pr->sq_restart_flag = 0;
}
@@ -827,7 +822,7 @@ static void check_sqs(struct ehea_port *
int swqe_index;
int i, k;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
struct ehea_port_res *pr = &port->port_res[i];
int ret;
k = 0;
@@ -1117,13 +1112,6 @@ int ehea_sense_port_attr(struct ehea_por
goto out_free;
}
- port->num_tx_qps = num_tx_qps;
-
- if (port->num_def_qps >= port->num_tx_qps)
- port->num_add_tx_qps = 0;
- else
- port->num_add_tx_qps = port->num_tx_qps - port->num_def_qps;
-
ret = 0;
out_free:
if (ret || netif_msg_probe(port))
@@ -1364,7 +1352,7 @@ static int ehea_reg_interrupts(struct ne
port->qp_eq->attr.ist1);
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
pr = &port->port_res[i];
snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-queue%d", dev->name, i);
@@ -1407,7 +1395,7 @@ static void ehea_free_interrupts(struct
/* send */
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
pr = &port->port_res[i];
ibmebus_free_irq(pr->eq->attr.ist1, pr);
netif_info(port, intr, dev,
@@ -2476,8 +2464,7 @@ out:
return ret;
}
-static int ehea_port_res_setup(struct ehea_port *port, int def_qps,
- int add_tx_qps)
+static int ehea_port_res_setup(struct ehea_port *port, int def_qps)
{
int ret, i;
struct port_res_cfg pr_cfg, pr_cfg_small_rx;
@@ -2510,7 +2497,7 @@ static int ehea_port_res_setup(struct eh
if (ret)
goto out_clean_pr;
}
- for (i = def_qps; i < def_qps + add_tx_qps; i++) {
+ for (i = def_qps; i < def_qps; i++) {
ret = ehea_init_port_res(port, &port->port_res[i],
&pr_cfg_small_rx, i);
if (ret)
@@ -2533,7 +2520,7 @@ static int ehea_clean_all_portres(struct
int ret = 0;
int i;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
+ for (i = 0; i < port->num_def_qps; i++)
ret |= ehea_clean_portres(port, &port->port_res[i]);
ret |= ehea_destroy_eq(port->qp_eq);
@@ -2565,8 +2552,7 @@ static int ehea_up(struct net_device *de
if (port->state == EHEA_PORT_UP)
return 0;
- ret = ehea_port_res_setup(port, port->num_def_qps,
- port->num_add_tx_qps);
+ ret = ehea_port_res_setup(port, port->num_def_qps);
if (ret) {
netdev_err(dev, "port_res_failed\n");
goto out;
@@ -2585,7 +2571,7 @@ static int ehea_up(struct net_device *de
goto out_clean_pr;
}
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
ret = ehea_activate_qp(port->adapter, port->port_res[i].qp);
if (ret) {
netdev_err(dev, "activate_qp failed\n");
@@ -2631,7 +2617,7 @@ static void port_napi_disable(struct ehe
{
int i;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
+ for (i = 0; i < port->num_def_qps; i++)
napi_disable(&port->port_res[i].napi);
}
@@ -2639,7 +2625,7 @@ static void port_napi_enable(struct ehea
{
int i;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++)
+ for (i = 0; i < port->num_def_qps; i++)
napi_enable(&port->port_res[i].napi);
}
@@ -2728,7 +2714,7 @@ static void ehea_flush_sq(struct ehea_po
{
int i;
- for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
+ for (i = 0; i < port->num_def_qps; i++) {
struct ehea_port_res *pr = &port->port_res[i];
int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count;
int ret;
@@ -2762,7 +2748,7 @@ int ehea_stop_qps(struct net_device *dev
goto out;
}
- for (i = 0; i < (port->num_def_qps + port->num_add_tx_qps); i++) {
+ for (i = 0; i < (port->num_def_qps); i++) {
struct ehea_port_res *pr = &port->port_res[i];
struct ehea_qp *qp = pr->qp;
@@ -2864,7 +2850,7 @@ int ehea_restart_qps(struct net_device *
goto out;
}
- for (i = 0; i < (port->num_def_qps + port->num_add_tx_qps); i++) {
+ for (i = 0; i < (port->num_def_qps); i++) {
struct ehea_port_res *pr = &port->port_res[i];
struct ehea_qp *qp = pr->qp;
@@ -3221,8 +3207,7 @@ struct ehea_port *ehea_setup_single_port
goto out_free_mc_list;
netif_set_real_num_rx_queues(dev, port->num_def_qps);
- netif_set_real_num_tx_queues(dev, port->num_def_qps +
- port->num_add_tx_qps);
+ netif_set_real_num_tx_queues(dev, port->num_def_qps);
port_dev = ehea_register_port(port, dn);
if (!port_dev)
^ permalink raw reply
* [PATCH 3/14] ehea: Remove force_irq logic in napi poll routine
From: Anton Blanchard @ 2011-04-05 11:30 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
commit 18604c548545 (ehea: NAPI multi queue TX/RX path for SMP) added
driver specific logic for exiting napi mode. I'm not sure what it was
trying to solve and it should be up to the network stack to decide when
we are done polling so remove it.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-03-21 09:44:15.792816780 +1100
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-03-21 14:18:42.213238477 +1100
@@ -931,7 +931,6 @@ static struct ehea_cqe *ehea_proc_cqes(s
return cqe;
}
-#define EHEA_NAPI_POLL_NUM_BEFORE_IRQ 16
#define EHEA_POLL_MAX_CQES 65535
static int ehea_poll(struct napi_struct *napi, int budget)
@@ -941,18 +940,13 @@ static int ehea_poll(struct napi_struct
struct net_device *dev = pr->port->netdev;
struct ehea_cqe *cqe;
struct ehea_cqe *cqe_skb = NULL;
- int force_irq, wqe_index;
+ int wqe_index;
int rx = 0;
- force_irq = (pr->poll_counter > EHEA_NAPI_POLL_NUM_BEFORE_IRQ);
cqe_skb = ehea_proc_cqes(pr, EHEA_POLL_MAX_CQES);
+ rx += ehea_proc_rwqes(dev, pr, budget - rx);
- if (!force_irq)
- rx += ehea_proc_rwqes(dev, pr, budget - rx);
-
- while ((rx != budget) || force_irq) {
- pr->poll_counter = 0;
- force_irq = 0;
+ while ((rx != budget)) {
napi_complete(napi);
ehea_reset_cq_ep(pr->recv_cq);
ehea_reset_cq_ep(pr->send_cq);
@@ -972,7 +966,6 @@ static int ehea_poll(struct napi_struct
rx += ehea_proc_rwqes(dev, pr, budget - rx);
}
- pr->poll_counter++;
return rx;
}
Index: linux-2.6/drivers/net/ehea/ehea.h
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea.h 2011-03-21 14:18:26.442655734 +1100
+++ linux-2.6/drivers/net/ehea/ehea.h 2011-03-21 14:18:33.252907379 +1100
@@ -383,7 +383,6 @@ struct ehea_port_res {
u64 tx_bytes;
u64 rx_packets;
u64 rx_bytes;
- u32 poll_counter;
struct net_lro_mgr lro_mgr;
struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS];
int sq_restart_flag;
^ permalink raw reply
* Re: extending feature word.
From: Michał Mirosław @ 2011-04-05 11:30 UTC (permalink / raw)
To: Mahesh Bandewar; +Cc: linux-netdev, Ben Hutchings, David Miller
In-Reply-To: <BANLkTi=hCqT5BPe926N36omObpYvMcNtjg@mail.gmail.com>
On Sat, Apr 02, 2011 at 08:09:14PM -0700, Mahesh Bandewar wrote:
> On Sat, Apr 2, 2011 at 5:42 AM, Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote:
> > On Fri, Apr 01, 2011 at 07:07:05PM -0700, Mahesh Bandewar wrote:
> > If you want to split the work, it would be clearer to first convert
> > hw_features and wanted_features (with all the core code touching it -
> > this is the easy part), then vlan_features (this includes drivers'
> > and VLAN code) and then features (it's all over).
> I like the idea of splitting but it will be only useful when all of it
> is done and not partially, isn't it? Or am I missing something?
Since this is a big change, when split it might be easier to follow.
OTOH, with your idea of macro it might be easier to do incremental
changes (I think this will be a lot of work for no gain in this case).
Best Regards,
Michał Mirosław
^ permalink raw reply
* [PATCH 2/14] ehea: Update multiqueue support
From: Anton Blanchard @ 2011-04-05 11:29 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
In-Reply-To: <20110405212825.6eb85677@kryten>
The ehea driver had some multiqueue support but was missing the last
few years of networking stack improvements:
- Use skb_record_rx_queue to record which queue an skb came in on.
- Remove the driver specific netif_queue lock and use the networking
stack transmit lock instead.
- Remove the driver specific transmit queue hashing and use
skb_get_queue_mapping instead.
- Use netif_tx_{start|stop|wake}_queue where appropriate. We can also
remove pr->queue_stopped and just check the queue status directly.
- Print all 16 queues in the ethtool stats.
We now enable multiqueue by default since it is a clear win on all my
testing so far.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-04-05 20:34:36.300715364 +1000
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-04-05 20:35:36.703818722 +1000
@@ -60,7 +60,7 @@ static int rq1_entries = EHEA_DEF_ENTRIE
static int rq2_entries = EHEA_DEF_ENTRIES_RQ2;
static int rq3_entries = EHEA_DEF_ENTRIES_RQ3;
static int sq_entries = EHEA_DEF_ENTRIES_SQ;
-static int use_mcs;
+static int use_mcs = 1;
static int use_lro;
static int lro_max_aggr = EHEA_LRO_MAX_AGGR;
static int num_tx_qps = EHEA_NUM_TX_QP;
@@ -753,6 +753,8 @@ static int ehea_proc_rwqes(struct net_de
skb_copy_to_linear_data(skb, ((char *)cqe) + 64,
cqe->num_bytes_transfered - 4);
ehea_fill_skb(dev, skb, cqe);
+ skb_record_rx_queue(skb,
+ pr - &pr->port->port_res[0]);
} else if (rq == 2) {
/* RQ2 */
skb = get_skb_by_index(skb_arr_rq2,
@@ -763,6 +765,8 @@ static int ehea_proc_rwqes(struct net_de
break;
}
ehea_fill_skb(dev, skb, cqe);
+ skb_record_rx_queue(skb,
+ pr - &pr->port->port_res[0]);
processed_rq2++;
} else {
/* RQ3 */
@@ -774,6 +778,8 @@ static int ehea_proc_rwqes(struct net_de
break;
}
ehea_fill_skb(dev, skb, cqe);
+ skb_record_rx_queue(skb,
+ pr - &pr->port->port_res[0]);
processed_rq3++;
}
@@ -859,7 +865,8 @@ static struct ehea_cqe *ehea_proc_cqes(s
int cqe_counter = 0;
int swqe_av = 0;
int index;
- unsigned long flags;
+ struct netdev_queue *txq = netdev_get_tx_queue(pr->port->netdev,
+ pr - &pr->port->port_res[0]);
cqe = ehea_poll_cq(send_cq);
while (cqe && (quota > 0)) {
@@ -909,14 +916,16 @@ static struct ehea_cqe *ehea_proc_cqes(s
ehea_update_feca(send_cq, cqe_counter);
atomic_add(swqe_av, &pr->swqe_avail);
- spin_lock_irqsave(&pr->netif_queue, flags);
-
- if (pr->queue_stopped && (atomic_read(&pr->swqe_avail)
- >= pr->swqe_refill_th)) {
- netif_wake_queue(pr->port->netdev);
- pr->queue_stopped = 0;
+ if (unlikely(netif_tx_queue_stopped(txq) &&
+ (atomic_read(&pr->swqe_avail) >= pr->swqe_refill_th))) {
+ __netif_tx_lock(txq, smp_processor_id());
+ if (netif_tx_queue_stopped(txq) &&
+ (atomic_read(&pr->swqe_avail) >= pr->swqe_refill_th)) {
+ netif_tx_wake_queue(txq);
+ __netif_tx_unlock(txq);
+ }
}
- spin_unlock_irqrestore(&pr->netif_queue, flags);
+
wake_up(&pr->port->swqe_avail_wq);
return cqe;
@@ -1253,7 +1262,7 @@ static void ehea_parse_eqe(struct ehea_a
netif_info(port, link, dev,
"Logical port down\n");
netif_carrier_off(dev);
- netif_stop_queue(dev);
+ netif_tx_disable(dev);
}
if (EHEA_BMASK_GET(NEQE_EXTSWITCH_PORT_UP, eqe)) {
@@ -1284,7 +1293,7 @@ static void ehea_parse_eqe(struct ehea_a
case EHEA_EC_PORT_MALFUNC:
netdev_info(dev, "Port malfunction\n");
netif_carrier_off(dev);
- netif_stop_queue(dev);
+ netif_tx_disable(dev);
break;
default:
netdev_err(dev, "unknown event code %x, eqe=0x%llX\n", ec, eqe);
@@ -1536,7 +1545,6 @@ static int ehea_init_port_res(struct ehe
pr->rx_packets = rx_packets;
pr->port = port;
- spin_lock_init(&pr->netif_queue);
pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0);
if (!pr->eq) {
@@ -2233,35 +2241,17 @@ static void ehea_xmit3(struct sk_buff *s
dev_kfree_skb(skb);
}
-static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps)
-{
- struct tcphdr *tcp;
- u32 tmp;
-
- if ((skb->protocol == htons(ETH_P_IP)) &&
- (ip_hdr(skb)->protocol == IPPROTO_TCP)) {
- tcp = (struct tcphdr *)(skb_network_header(skb) +
- (ip_hdr(skb)->ihl * 4));
- tmp = (tcp->source + (tcp->dest << 16)) % 31;
- tmp += ip_hdr(skb)->daddr % 31;
- return tmp % num_qps;
- } else
- return 0;
-}
-
static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ehea_port *port = netdev_priv(dev);
struct ehea_swqe *swqe;
- unsigned long flags;
u32 lkey;
int swqe_index;
struct ehea_port_res *pr;
+ struct netdev_queue *txq;
- pr = &port->port_res[ehea_hash_skb(skb, port->num_tx_qps)];
-
- if (pr->queue_stopped)
- return NETDEV_TX_BUSY;
+ pr = &port->port_res[skb_get_queue_mapping(skb)];
+ txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
swqe = ehea_get_swqe(pr->qp, &swqe_index);
memset(swqe, 0, SWQE_HEADER_SIZE);
@@ -2311,20 +2301,15 @@ static int ehea_start_xmit(struct sk_buf
ehea_dump(swqe, 512, "swqe");
if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) {
- netif_stop_queue(dev);
+ netif_tx_stop_queue(txq);
swqe->tx_control |= EHEA_SWQE_PURGE;
}
ehea_post_swqe(pr->qp, swqe);
if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
- spin_lock_irqsave(&pr->netif_queue, flags);
- if (unlikely(atomic_read(&pr->swqe_avail) <= 1)) {
- pr->p_stats.queue_stopped++;
- netif_stop_queue(dev);
- pr->queue_stopped = 1;
- }
- spin_unlock_irqrestore(&pr->netif_queue, flags);
+ pr->p_stats.queue_stopped++;
+ netif_tx_stop_queue(txq);
}
return NETDEV_TX_OK;
@@ -2677,7 +2662,7 @@ static int ehea_open(struct net_device *
ret = ehea_up(dev);
if (!ret) {
port_napi_enable(port);
- netif_start_queue(dev);
+ netif_tx_start_all_queues(dev);
}
init_waitqueue_head(&port->swqe_avail_wq);
@@ -2724,7 +2709,7 @@ static int ehea_stop(struct net_device *
set_bit(__EHEA_DISABLE_PORT_RESET, &port->flags);
cancel_work_sync(&port->reset_task);
mutex_lock(&port->port_lock);
- netif_stop_queue(dev);
+ netif_tx_stop_all_queues(dev);
port_napi_disable(port);
ret = ehea_down(dev);
mutex_unlock(&port->port_lock);
@@ -2948,7 +2933,7 @@ static void ehea_reset_port(struct work_
mutex_lock(&dlpar_mem_lock);
port->resets++;
mutex_lock(&port->port_lock);
- netif_stop_queue(dev);
+ netif_tx_disable(dev);
port_napi_disable(port);
@@ -2964,7 +2949,7 @@ static void ehea_reset_port(struct work_
port_napi_enable(port);
- netif_wake_queue(dev);
+ netif_tx_wake_all_queues(dev);
out:
mutex_unlock(&port->port_lock);
mutex_unlock(&dlpar_mem_lock);
@@ -2991,7 +2976,7 @@ static void ehea_rereg_mrs(void)
if (dev->flags & IFF_UP) {
mutex_lock(&port->port_lock);
- netif_stop_queue(dev);
+ netif_tx_disable(dev);
ehea_flush_sq(port);
ret = ehea_stop_qps(dev);
if (ret) {
@@ -3036,7 +3021,7 @@ static void ehea_rereg_mrs(void)
ret = ehea_restart_qps(dev);
check_sqs(port);
if (!ret)
- netif_wake_queue(dev);
+ netif_tx_wake_all_queues(dev);
mutex_unlock(&port->port_lock);
}
}
@@ -3210,7 +3195,7 @@ struct ehea_port *ehea_setup_single_port
int jumbo;
/* allocate memory for the port structures */
- dev = alloc_etherdev(sizeof(struct ehea_port));
+ dev = alloc_etherdev_mq(sizeof(struct ehea_port), EHEA_MAX_PORT_RES);
if (!dev) {
pr_err("no mem for net_device\n");
@@ -3242,6 +3227,10 @@ struct ehea_port *ehea_setup_single_port
if (ret)
goto out_free_mc_list;
+ netif_set_real_num_rx_queues(dev, port->num_def_qps);
+ netif_set_real_num_tx_queues(dev, port->num_def_qps +
+ port->num_add_tx_qps);
+
port_dev = ehea_register_port(port, dn);
if (!port_dev)
goto out_free_mc_list;
Index: linux-2.6/drivers/net/ehea/ehea.h
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea.h 2011-04-05 20:34:36.300715364 +1000
+++ linux-2.6/drivers/net/ehea/ehea.h 2011-04-05 20:35:17.266038117 +1000
@@ -375,8 +375,6 @@ struct ehea_port_res {
struct ehea_q_skb_arr rq3_skba;
struct ehea_q_skb_arr sq_skba;
int sq_skba_size;
- spinlock_t netif_queue;
- int queue_stopped;
int swqe_refill_th;
atomic_t swqe_avail;
int swqe_ll_count;
Index: linux-2.6/drivers/net/ehea/ehea_ethtool.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_ethtool.c 2011-04-05 20:34:33.431043010 +1000
+++ linux-2.6/drivers/net/ehea/ehea_ethtool.c 2011-04-05 20:35:17.266038117 +1000
@@ -176,7 +176,6 @@ static char ehea_ethtool_stats_keys[][ET
{"IP cksum errors"},
{"Frame cksum errors"},
{"num SQ stopped"},
- {"SQ stopped"},
{"PR0 free_swqes"},
{"PR1 free_swqes"},
{"PR2 free_swqes"},
@@ -185,6 +184,14 @@ static char ehea_ethtool_stats_keys[][ET
{"PR5 free_swqes"},
{"PR6 free_swqes"},
{"PR7 free_swqes"},
+ {"PR8 free_swqes"},
+ {"PR9 free_swqes"},
+ {"PR10 free_swqes"},
+ {"PR11 free_swqes"},
+ {"PR12 free_swqes"},
+ {"PR13 free_swqes"},
+ {"PR14 free_swqes"},
+ {"PR15 free_swqes"},
{"LRO aggregated"},
{"LRO flushed"},
{"LRO no_desc"},
@@ -242,11 +249,7 @@ static void ehea_get_ethtool_stats(struc
tmp += port->port_res[k].p_stats.queue_stopped;
data[i++] = tmp;
- for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
- tmp |= port->port_res[k].queue_stopped;
- data[i++] = tmp;
-
- for (k = 0; k < 8; k++)
+ for (k = 0; k < 16; k++)
data[i++] = atomic_read(&port->port_res[k].swqe_avail);
for (k = 0, tmp = 0; k < EHEA_MAX_PORT_RES; k++)
^ permalink raw reply
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-05 11:21 UTC (permalink / raw)
To: Jamie Iles
Cc: Russell King - ARM Linux, netdev, Nicolas Ferre, David Miller,
Peter Korsgaard, Andrew Victor, linux-arm-kernel
In-Reply-To: <20110405104910.GE4797@pulham.picochip.com>
On 11:49 Tue 05 Apr , Jamie Iles wrote:
> On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > work fine on 9263ek except the IP version detection.
> >
> > the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> > At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> > but we can detect that it's a macb.
> >
> > So could keep the ifdef for 2 archs but use the ip version on arm
>
> OK, well I think my patches are already doing that so should be OK as
> they are.
>
> Russell, are you able to take these through your tree (I think they
> count as consolidation work) or should I ask Stephen for a tree in
> linux-next for a while first?
no please do not us the is_gem but the same way as I did in the ip detection
keep the version register and then check it.
as this ip can be used on other arch we do not want to see thousands of is_xxx
Best Regards,
J.
^ permalink raw reply
* [PATCH 1/14] ehea: Remove NETIF_F_LLTX
From: Anton Blanchard @ 2011-04-05 11:28 UTC (permalink / raw)
To: leitao; +Cc: netdev, michael
Remove the deprecated NETIF_F_LLTX feature. Since the network stack
now provides the locking we can remove the driver specific
pr->xmit_lock.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-2.6/drivers/net/ehea/ehea_main.c
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea_main.c 2011-03-14 09:44:36.568408321 +1100
+++ linux-2.6/drivers/net/ehea/ehea_main.c 2011-03-14 09:44:38.538481778 +1100
@@ -1536,7 +1536,6 @@ static int ehea_init_port_res(struct ehe
pr->rx_packets = rx_packets;
pr->port = port;
- spin_lock_init(&pr->xmit_lock);
spin_lock_init(&pr->netif_queue);
pr->eq = ehea_create_eq(adapter, eq_type, EHEA_MAX_ENTRIES_EQ, 0);
@@ -2261,14 +2260,9 @@ static int ehea_start_xmit(struct sk_buf
pr = &port->port_res[ehea_hash_skb(skb, port->num_tx_qps)];
- if (!spin_trylock(&pr->xmit_lock))
+ if (pr->queue_stopped)
return NETDEV_TX_BUSY;
- if (pr->queue_stopped) {
- spin_unlock(&pr->xmit_lock);
- return NETDEV_TX_BUSY;
- }
-
swqe = ehea_get_swqe(pr->qp, &swqe_index);
memset(swqe, 0, SWQE_HEADER_SIZE);
atomic_dec(&pr->swqe_avail);
@@ -2332,8 +2326,6 @@ static int ehea_start_xmit(struct sk_buf
}
spin_unlock_irqrestore(&pr->netif_queue, flags);
}
- dev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
- spin_unlock(&pr->xmit_lock);
return NETDEV_TX_OK;
}
@@ -3264,8 +3256,7 @@ struct ehea_port *ehea_setup_single_port
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
| NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
- | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
- | NETIF_F_LLTX;
+ | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
if (use_lro)
Index: linux-2.6/drivers/net/ehea/ehea.h
===================================================================
--- linux-2.6.orig/drivers/net/ehea/ehea.h 2011-03-14 09:44:26.428030236 +1100
+++ linux-2.6/drivers/net/ehea/ehea.h 2011-03-14 09:44:38.538481778 +1100
@@ -363,7 +363,6 @@ struct ehea_port_res {
struct port_stats p_stats;
struct ehea_mr send_mr; /* send memory region */
struct ehea_mr recv_mr; /* receive memory region */
- spinlock_t xmit_lock;
struct ehea_port *port;
char int_recv_name[EHEA_IRQ_NAME_SIZE];
char int_send_name[EHEA_IRQ_NAME_SIZE];
^ permalink raw reply
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Peter Korsgaard @ 2011-04-05 11:12 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Jamie Iles, Nicolas Ferre, David Miller, Russell King - ARM Linux,
netdev, linux-arm-kernel, Andrew Victor
In-Reply-To: <20110405102842.GC22192@game.jcrosoft.org>
>>>>> "Jean-Christophe" == Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> writes:
Hi,
JC> work fine on 9263ek except the IP version detection.
JC> the at91 macb ip version is supposed to be at 0x0601010C but it's not.
JC> At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
JC> but we can detect that it's a macb.
Same here on a 9g45.
--
Bye, Peter Korsgaard
^ permalink raw reply
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jamie Iles @ 2011-04-05 10:49 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD, Russell King - ARM Linux
Cc: Jamie Iles, netdev, Nicolas Ferre, David Miller, Peter Korsgaard,
Andrew Victor, linux-arm-kernel
In-Reply-To: <20110405102842.GC22192@game.jcrosoft.org>
On Tue, Apr 05, 2011 at 12:28:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> work fine on 9263ek except the IP version detection.
>
> the at91 macb ip version is supposed to be at 0x0601010C but it's not.
> At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
> but we can detect that it's a macb.
>
> So could keep the ifdef for 2 archs but use the ip version on arm
OK, well I think my patches are already doing that so should be OK as
they are.
Russell, are you able to take these through your tree (I think they
count as consolidation work) or should I ask Stephen for a tree in
linux-next for a while first?
Jamie
^ permalink raw reply
* Re: shutdown oops in xt_compat_calc_jump
From: Patrick McHardy @ 2011-04-05 10:41 UTC (permalink / raw)
To: Eric Dumazet; +Cc: dann frazier, netdev, netfilter-devel@vger.kernel.org
In-Reply-To: <1301987879.3021.714.camel@edumazet-laptop>
On 05.04.2011 09:17, Eric Dumazet wrote:
> Here is the cumulative patch
Thanks Eric. I'll wait for confirmation from Dann before applying this.
> [PATCH] netfilter: fix ebtables
>
> commit 255d0dc34068a976 (netfilter: x_table: speedup compat operations)
> made ebtables not working anymore.
>
> 1) xt_compat_calc_jump() is not an exact match lookup, and
> 2) compat_table_info() has a typo in xt_compat_init_offsets() call
> 3) compat_do_replace() misses a xt_compat_init_offsets() call
>
> Reported-by: dann frazier <dannf@dannf.org>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> net/bridge/netfilter/ebtables.c | 3 ++-
> net/netfilter/x_tables.c | 3 +++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
> index 893669c..c66aa80 100644
> --- a/net/bridge/netfilter/ebtables.c
> +++ b/net/bridge/netfilter/ebtables.c
> @@ -1766,7 +1766,7 @@ static int compat_table_info(const struct ebt_table_info *info,
>
> newinfo->entries_size = size;
>
> - xt_compat_init_offsets(AF_INET, info->nentries);
> + xt_compat_init_offsets(NFPROTO_BRIDGE, info->nentries /* + 4*/);
I assume the /* + 4 */ is left over from debugging, I'll remove it
before applying.
^ permalink raw reply
* Re: Netxen packet loss with VLANs and LRO (was: [PATCH] netxen: fix LRO disable warning)
From: Michał Mirosław @ 2011-04-05 10:38 UTC (permalink / raw)
To: Amit Salecha
Cc: Marc Haber, davem@davemloft.net, netdev@vger.kernel.org,
Ameen Rahman, Rajesh Borundia
In-Reply-To: <99737F4847ED0A48AECC9F4A1974A4B80FD10E8E3C@MNEXMB2.qlogic.org>
2011/4/5 Amit Salecha <amit.salecha@qlogic.com>:
>> On Mon, Mar 21, 2011 at 03:37:08AM -0700, Amit Kumar Salecha wrote:
>> > netxen_nic_set_flags() rejects data if other flag than ETH_FLAG_LRO
>> is set.
>> > Driver also supports NETIF_F_HW_VLAN_TX.
>> > Now compare data with ethtool_op_get_flags(), to get all supported
>> features.
[...]
>> My ethtool doesn't allow me to influence the LRO setting alone - it is
>> disabled when I set rx off but doesn't come on again when rx is set to
>> on again. So, ethtool -K rx off, ethtool -K rx on fixes the issue.
> If rx csum is disabled, LRO will be disable. LRO won't be enabled automatically if you enable rx csum.
> You need to explicitly enable LRO.
This will change once the driver is converted to hw_features.
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: [PATCHv2 0/9] macb: add support for Cadence GEM
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-04-05 10:28 UTC (permalink / raw)
To: Jamie Iles
Cc: Nicolas Ferre, David Miller, Russell King - ARM Linux, netdev,
linux-arm-kernel, Andrew Victor, Peter Korsgaard
In-Reply-To: <20110331094041.GD3371@pulham.picochip.com>
On 10:40 Thu 31 Mar , Jamie Iles wrote:
> Hi Jean-Christophe,
>
> On Thu, Mar 24, 2011 at 05:25:17PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 17:55 Tue 22 Mar , Jamie Iles wrote:
> > > Hi Jean-Christophe,
> > > > Also, can you confirm that the module ID's that you are using to
> > > > differentiate between AT91 and AVR32 won't clash with MACB uses in
> > > > other, non-at91/avr32 chips, or that it doesn't matter?
> > >
> > > If this does work, then it would be nice if we made the else path of the
> > > RMII AT91 tests also test for avr32 too so we aren't driving the USRIO
> > > pins on platforms that aren't at91 but also aren't avr32. So something
> > > the patch below instead.
> > I'm currently traveling so I can not test it yet will test it next week
> > but looks good
>
> Just wondering if you'd had chance to test. If so, would you mind
> reposting and I'll rebase my patches on top of it.
>
> I also have patches for checksum offloading, receive packet timestamping
> and wake-on-lan support but I'd like to get the basic GEM ones into next
> first.
work fine on 9263ek except the IP version detection.
the at91 macb ip version is supposed to be at 0x0601010C but it's not.
At least on 9263 it's 0x0001010C. So we can not detect the arch at runtime
but we can detect that it's a macb.
So could keep the ifdef for 2 archs but use the ip version on arm
Best Regards,
J.
^ permalink raw reply
* Re: [GIT PULL nf-next-2.6] IPVS
From: Patrick McHardy @ 2011-04-05 10:18 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel, netdev, netfilter-devel, netfilter, Wensong Zhang,
Julian Anastasov
In-Reply-To: <1301973732-8989-1-git-send-email-horms@verge.net.au>
On 05.04.2011 05:22, Simon Horman wrote:
> Hi Patrick,
>
> please consider pulling
> git://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs-next-2.6.git master
> to get the following minor change from myself. This pull request is
> based on nf-next-2.6.
>
> Simon Horman (1):
> IPVS: combine consecutive #ifdef CONFIG_PROC_FS blocks
>
Pulled, thanks Simon.
^ permalink raw reply
* Re: [PATCH v2] ROSE: prevent heap corruption with bad facilities
From: Jiri Bohac @ 2011-04-05 8:20 UTC (permalink / raw)
To: David Miller; +Cc: jbohac, ben, drosenberg, ralf, netdev, security
In-Reply-To: <20110401.214148.242136667.davem@davemloft.net>
On Fri, Apr 01, 2011 at 09:41:48PM -0700, David Miller wrote:
> From: Jiri Bohac <jbohac@suse.cz>
> Date: Thu, 31 Mar 2011 20:02:25 +0200
> > So, to get the old behaviour back:
>
> Jiri, please do not submit two patches in one email, it's beyond
> confusing.
>
> Instead, please submit a proper two-patch series.
The two one line patches were two suggestions what to do. It's
either one or the other...
Sorry for the confusion.
--
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ
^ permalink raw reply
* Re: [patch net-next-2.6] net: vlan: make non-hw-accel rx path similar to hw-accel
From: Jiri Pirko @ 2011-04-05 7:26 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Eric W. Biederman, Jesse Gross, netdev, davem, shemminger, kaber,
fubar, eric.dumazet, andy, xiaosuo
In-Reply-To: <4D9A2E74.70105@gmail.com>
Mon, Apr 04, 2011 at 10:47:48PM CEST, nicolas.2p.debian@gmail.com wrote:
>Le 04/04/2011 21:51, Eric W. Biederman a écrit :
>
>>
>>__netif_receive_skb is actually late for untagging. eth_type_trans
>>would be better but not path of control into __netif_receive_skb
>>actually calls eth_type_trans.
>
>Because vlan may nest, we need to keep some sort of frame untagging inside __netif_receive_skb.
You are correct here. It needs to stay inside __netif_receive_skb
^ permalink raw reply
* Re: [patch net-next-2.6] net: vlan: make non-hw-accel rx path similar to hw-accel
From: Jiri Pirko @ 2011-04-05 7:25 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Jesse Gross, Eric W. Biederman, netdev, davem, shemminger, kaber,
fubar, eric.dumazet, andy, xiaosuo
In-Reply-To: <4D9A3249.6040106@gmail.com>
Mon, Apr 04, 2011 at 11:04:09PM CEST, nicolas.2p.debian@gmail.com wrote:
>Le 04/04/2011 22:50, Jesse Gross a écrit :
>>On Mon, Apr 4, 2011 at 1:47 PM, Nicolas de Pesloüan
>><nicolas.2p.debian@gmail.com> wrote:
>>>Can someone clarify whether hwaccel capable NIC will always untag tagged
>>>frames or will only do so if requested at device setup?
>>
>>It can be changed on the fly by ethtool, similar to other forms of offloading.
>
>Thanks Jesse.
>
>So if hwaccell vlan untagging is disabled, what is the current
>behavior? Is the frame delivered untouched (tagged) to ptype_all
>handlers if no particular vlan device is setup on the parent device?
Even if vlan device is setup on the parent device.
>
>With Jiri's patch, it would be always untagged, whatever requested by ethtool.
Correct. That's more or less purpose of the patch.
>
>Am I right?
>
> Nicolas.
>
^ permalink raw reply
* Re: [patch net-next-2.6] net: vlan: make non-hw-accel rx path similar to hw-accel
From: Jiri Pirko @ 2011-04-05 7:19 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Jesse Gross, netdev, davem, shemminger, kaber, fubar,
eric.dumazet, andy, xiaosuo, Eric W. Biederman
In-Reply-To: <4D9A2F4D.1000100@gmail.com>
Mon, Apr 04, 2011 at 10:51:25PM CEST, nicolas.2p.debian@gmail.com wrote:
>Le 04/04/2011 22:30, Jiri Pirko a écrit :
>>Mon, Apr 04, 2011 at 09:00:00PM CEST, nicolas.2p.debian@gmail.com wrote:
>>>Le 04/04/2011 09:14, Jiri Pirko a écrit :
><snip>
>>>So you want to move vlan_do_receive into an rx_handler, but want
>>>untagging to stay hard-coded at the beginning of __netif_receive_skb.
>>>I don't think I understand the rational behind that.
>>
>>vlan_hwaccel_do_receive/vlan_do_receive could be converted to
>>rx_handler, not untagging.
>
>Why do you consider untagging cannot be converted to rx_handler?
I already told you that the reason ot the patch is to unify hwaccel path
and nonhwaccel path. When you do untag in rx_handler, that's too late.
Paths would be still different.
^ permalink raw reply
* Re: shutdown oops in xt_compat_calc_jump
From: Eric Dumazet @ 2011-04-05 7:17 UTC (permalink / raw)
To: Patrick McHardy; +Cc: dann frazier, netdev, netfilter-devel@vger.kernel.org
In-Reply-To: <1301984679.3021.655.camel@edumazet-laptop>
Le mardi 05 avril 2011 à 08:24 +0200, Eric Dumazet a écrit :
> Le mardi 05 avril 2011 à 00:48 +0200, Eric Dumazet a écrit :
> > Le lundi 04 avril 2011 à 22:37 +0200, Eric Dumazet a écrit :
> > > Le lundi 04 avril 2011 à 22:02 +0200, Patrick McHardy a écrit :
> > > > CCed netfilter-devel.
> > > >
> > > > Am 04.04.2011 21:48, schrieb dann frazier:
> > > > > fyi, noticed this oops when shutting down a system running top of git
> > > > > (@ 78fca1be)
> > > > >
> > > > > [ 1169.794644] cfg80211: Calling CRDA to update world regulatory domain
> > > > > [ 1170.490646] bluetoothd[2029]: segfault at f8ad9944 ip 00000000f77045e0 sp 00000000ffcb14e0 error 4 in bluetoothd[f76bf000+8b000]
> > > > > [ 1170.543817] BUG: unable to handle kernel paging request at 00000001dc1be9f8
> > > > > [ 1170.543875] IP: [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > > [ 1170.543927] PGD 1215b3067 PUD 0
> > > > > [ 1170.543955] Oops: 0000 [#1] SMP
> > > > > [ 1170.543982] last sysfs file: /sys/module/bridge/initstate
> > > > > [ 1170.544017] CPU 3
> > > > > [ 1170.544031] Modules linked in: ebtable_broute ebtable_filter vfat msdos fat ext3 jbd ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc acpi_cpufreq mperf cpufreq_powersave cpufreq_userspace cpufreq_conservative cpufreq_stats binfmt_misc kvm(-) fuse ext2 loop snd_hda_codec_hdmi snd_hda_codec_conexant arc4 ecb snd_usb_audio snd_usbmidi_lib snd_seq_midi snd_seq_midi_event snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_rawmidi i915 drm_kms_helper thinkpad_acpi snd_seq iwlagn snd_timer snd_seq_device drm snd mac80211 psmouse btusb serio_raw bluetooth evdev tpm_tis snd_page_alloc tpm i2c_i801 i2c_algo_bit cfg80211 battery soundcore nvram tpm_bios i2c_core rfkill wmi ac power_supply video button processor ext4 mbcache jbd2 crc16 sha256_generic aesni_intel cryptd aes_x86_64 aes_generic cbc dm_crypt dm_mod sd_mod crc_t10di
> > > > f
> > > > > usbhid
> > > > > hid usb_storage ahci libahci libata ehci_hcd scsi_mod usbcore e1000e thermal thermal_sys [last unloaded: kvm_intel]
> > > > > [ 1170.544836]
> > > > > [ 1170.544849] Pid: 4901, comm: ebtables Not tainted 2.6.39-rc1+ #9 LENOVO 2516CTO/2516CTO
> > > > > [ 1170.544902] RIP: 0010:[<ffffffffa051e7b0>] [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > > [ 1170.544958] RSP: 0018:ffff880121473cf8 EFLAGS: 00010217
> > > > > [ 1170.544989] RAX: 000000003b837d3f RBX: 0000000000000090 RCX: 000000007706fa7f
> > > > > [ 1170.545029] RDX: 0000000000000000 RSI: 0000000000000090 RDI: 000000003b837d3f
> > > > > [ 1170.545067] RBP: ffffc900111a3000 R08: 0000000000000000 R09: dead000000200200
> > > > > [ 1170.545104] R10: dead000000100100 R11: 0000000000001311 R12: ffff880121473d88
> > > > > [ 1170.545147] R13: ffffc900111a6000 R14: ffffffff817de300 R15: 0000000000000000
> > > > > [ 1170.545185] FS: 0000000000000000(0000) GS:ffff880137d80000(0063) knlGS:00000000f761b6c0
> > > > > [ 1170.545227] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
> > > > > [ 1170.545258] CR2: 00000001dc1be9f8 CR3: 0000000125868000 CR4: 00000000000006e0
> > > > > [ 1170.545297] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > > > [ 1170.545334] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> > > > > [ 1170.545375] Process ebtables (pid: 4901, threadinfo ffff880121472000, task ffff8801322d1ac0)
> > > > > [ 1170.545418] Stack:
> > > > > [ 1170.545433] 0000000000000090 ffffffffa0576d46 f7007265746c6966 0000000000000054
> > > > > [ 1170.545479] 0000000000000000 0000000000000000 000000000000000e 0000000000000090
> > > > > [ 1170.545529] 0000000000000000 0000000008af2180 0000000008af21b0 0000000008af21e0
> > > > > [ 1170.545579] Call Trace:
> > > > > [ 1170.545600] [<ffffffffa0576d46>] ? compat_do_replace+0x117/0x221 [ebtables]
> > > > > [ 1170.545639] [<ffffffffa0577392>] ? compat_do_ebt_set_ctl+0x55/0xbb [ebtables]
> > > > > [ 1170.545688] [<ffffffff810337e3>] ? need_resched+0x1a/0x23
> > > > > [ 1170.545723] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > > [ 1170.545730] [<ffffffff81314cc5>] ? _cond_resched+0x9/0x20
> > > > > [ 1170.545733] [<ffffffff813152fe>] ? mutex_lock_interruptible+0x18/0x32
> > > > > [ 1170.545738] [<ffffffff8128490b>] ? nf_sockopt_find.clone.1+0xda/0xec
> > > > > [ 1170.545742] [<ffffffff81284996>] ? compat_nf_sockopt+0x79/0xa5
> > > > > [ 1170.545744] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > > [ 1170.545747] [<ffffffff812849f3>] ? compat_nf_setsockopt+0x1a/0x1f
> > > > > [ 1170.545751] [<ffffffff8128fb35>] ? compat_ip_setsockopt+0x80/0xa0
> > > > > [ 1170.545756] [<ffffffff812784a2>] ? compat_sys_setsockopt+0x1d5/0x204
> > > > > [ 1170.545759] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > > [ 1170.545761] [<ffffffff81314cc5>] ? _cond_resched+0x9/0x20
> > > > > [ 1170.545764] [<ffffffff812788a5>] ? compat_sys_socketcall+0x148/0x1a7
> > > > > [ 1170.545768] [<ffffffff8131d2c0>] ? sysenter_dispatch+0x7/0x2e
> > > > > [ 1170.545769] Code: 5d 41 5e 41 5f c3 40 0f b6 ff 53 31 d2 48 6b ff 70 48 03 3d 03 1b 00 00 8b 4f 6c 4c 8b 47 60 ff c9 eb 27 8d 04 11 d1 f8 48 63 f8
> > > > > [ 1170.545787] RIP [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > > [ 1170.545792] RSP <ffff880121473cf8>
> > > > > [ 1170.545794] CR2: 00000001dc1be9f8
> > > > > [ 1170.654269] ---[ end trace d44667d90dcbd115 ]---
> > > > > [ 1170.662411] fuse exit
> > > > > Kernel logging (proc) stopped.
> > > > > --
> > >
> > >
> > > Hmm, commit 255d0dc34068a976550ce555e must have a problem for ebtables ?
> > >
> > > Dann, could you give us what you do with ebtables ?
> > >
> > > Thanks
> > >
> >
> > For sure, there was a typo in above commit, but this is not enough to
> > make ebtables work in COMPAT mode.
> >
> > Hmm...
> >
>
> Update : xt_compat_calc_jump() misses this bit, and I still have to find
> the ebtables problem.
>
> I'll provide a cumulative patch once done
>
Here is the cumulative patch
Thanks
[PATCH] netfilter: fix ebtables
commit 255d0dc34068a976 (netfilter: x_table: speedup compat operations)
made ebtables not working anymore.
1) xt_compat_calc_jump() is not an exact match lookup, and
2) compat_table_info() has a typo in xt_compat_init_offsets() call
3) compat_do_replace() misses a xt_compat_init_offsets() call
Reported-by: dann frazier <dannf@dannf.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/bridge/netfilter/ebtables.c | 3 ++-
net/netfilter/x_tables.c | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 893669c..c66aa80 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1766,7 +1766,7 @@ static int compat_table_info(const struct ebt_table_info *info,
newinfo->entries_size = size;
- xt_compat_init_offsets(AF_INET, info->nentries);
+ xt_compat_init_offsets(NFPROTO_BRIDGE, info->nentries /* + 4*/);
return EBT_ENTRY_ITERATE(entries, size, compat_calc_entry, info,
entries, newinfo);
}
@@ -2240,6 +2240,7 @@ static int compat_do_replace(struct net *net, void __user *user,
xt_compat_lock(NFPROTO_BRIDGE);
+ xt_compat_init_offsets(NFPROTO_BRIDGE, tmp.nentries);
ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state);
if (ret < 0)
goto out_unlock;
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index a9adf4c..e6dbec5 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -455,6 +455,7 @@ void xt_compat_flush_offsets(u_int8_t af)
vfree(xt[af].compat_tab);
xt[af].compat_tab = NULL;
xt[af].number = 0;
+ xt[af].cur = 0;
}
}
EXPORT_SYMBOL_GPL(xt_compat_flush_offsets);
@@ -473,6 +474,8 @@ int xt_compat_calc_jump(u_int8_t af, unsigned int offset)
else
return mid ? tmp[mid - 1].delta : 0;
}
+ if (left)
+ return tmp[left - 1].delta;
WARN_ON_ONCE(1);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: shutdown oops in xt_compat_calc_jump
From: Eric Dumazet @ 2011-04-05 6:24 UTC (permalink / raw)
To: Patrick McHardy; +Cc: dann frazier, netdev, netfilter-devel@vger.kernel.org
In-Reply-To: <1301957293.3021.191.camel@edumazet-laptop>
Le mardi 05 avril 2011 à 00:48 +0200, Eric Dumazet a écrit :
> Le lundi 04 avril 2011 à 22:37 +0200, Eric Dumazet a écrit :
> > Le lundi 04 avril 2011 à 22:02 +0200, Patrick McHardy a écrit :
> > > CCed netfilter-devel.
> > >
> > > Am 04.04.2011 21:48, schrieb dann frazier:
> > > > fyi, noticed this oops when shutting down a system running top of git
> > > > (@ 78fca1be)
> > > >
> > > > [ 1169.794644] cfg80211: Calling CRDA to update world regulatory domain
> > > > [ 1170.490646] bluetoothd[2029]: segfault at f8ad9944 ip 00000000f77045e0 sp 00000000ffcb14e0 error 4 in bluetoothd[f76bf000+8b000]
> > > > [ 1170.543817] BUG: unable to handle kernel paging request at 00000001dc1be9f8
> > > > [ 1170.543875] IP: [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > [ 1170.543927] PGD 1215b3067 PUD 0
> > > > [ 1170.543955] Oops: 0000 [#1] SMP
> > > > [ 1170.543982] last sysfs file: /sys/module/bridge/initstate
> > > > [ 1170.544017] CPU 3
> > > > [ 1170.544031] Modules linked in: ebtable_broute ebtable_filter vfat msdos fat ext3 jbd ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc acpi_cpufreq mperf cpufreq_powersave cpufreq_userspace cpufreq_conservative cpufreq_stats binfmt_misc kvm(-) fuse ext2 loop snd_hda_codec_hdmi snd_hda_codec_conexant arc4 ecb snd_usb_audio snd_usbmidi_lib snd_seq_midi snd_seq_midi_event snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_rawmidi i915 drm_kms_helper thinkpad_acpi snd_seq iwlagn snd_timer snd_seq_device drm snd mac80211 psmouse btusb serio_raw bluetooth evdev tpm_tis snd_page_alloc tpm i2c_i801 i2c_algo_bit cfg80211 battery soundcore nvram tpm_bios i2c_core rfkill wmi ac power_supply video button processor ext4 mbcache jbd2 crc16 sha256_generic aesni_intel cryptd aes_x86_64 aes_generic cbc dm_crypt dm_mod sd_mod crc_t10di
> > > f
> > > > usbhid
> > > > hid usb_storage ahci libahci libata ehci_hcd scsi_mod usbcore e1000e thermal thermal_sys [last unloaded: kvm_intel]
> > > > [ 1170.544836]
> > > > [ 1170.544849] Pid: 4901, comm: ebtables Not tainted 2.6.39-rc1+ #9 LENOVO 2516CTO/2516CTO
> > > > [ 1170.544902] RIP: 0010:[<ffffffffa051e7b0>] [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > [ 1170.544958] RSP: 0018:ffff880121473cf8 EFLAGS: 00010217
> > > > [ 1170.544989] RAX: 000000003b837d3f RBX: 0000000000000090 RCX: 000000007706fa7f
> > > > [ 1170.545029] RDX: 0000000000000000 RSI: 0000000000000090 RDI: 000000003b837d3f
> > > > [ 1170.545067] RBP: ffffc900111a3000 R08: 0000000000000000 R09: dead000000200200
> > > > [ 1170.545104] R10: dead000000100100 R11: 0000000000001311 R12: ffff880121473d88
> > > > [ 1170.545147] R13: ffffc900111a6000 R14: ffffffff817de300 R15: 0000000000000000
> > > > [ 1170.545185] FS: 0000000000000000(0000) GS:ffff880137d80000(0063) knlGS:00000000f761b6c0
> > > > [ 1170.545227] CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033
> > > > [ 1170.545258] CR2: 00000001dc1be9f8 CR3: 0000000125868000 CR4: 00000000000006e0
> > > > [ 1170.545297] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > > > [ 1170.545334] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> > > > [ 1170.545375] Process ebtables (pid: 4901, threadinfo ffff880121472000, task ffff8801322d1ac0)
> > > > [ 1170.545418] Stack:
> > > > [ 1170.545433] 0000000000000090 ffffffffa0576d46 f7007265746c6966 0000000000000054
> > > > [ 1170.545479] 0000000000000000 0000000000000000 000000000000000e 0000000000000090
> > > > [ 1170.545529] 0000000000000000 0000000008af2180 0000000008af21b0 0000000008af21e0
> > > > [ 1170.545579] Call Trace:
> > > > [ 1170.545600] [<ffffffffa0576d46>] ? compat_do_replace+0x117/0x221 [ebtables]
> > > > [ 1170.545639] [<ffffffffa0577392>] ? compat_do_ebt_set_ctl+0x55/0xbb [ebtables]
> > > > [ 1170.545688] [<ffffffff810337e3>] ? need_resched+0x1a/0x23
> > > > [ 1170.545723] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > [ 1170.545730] [<ffffffff81314cc5>] ? _cond_resched+0x9/0x20
> > > > [ 1170.545733] [<ffffffff813152fe>] ? mutex_lock_interruptible+0x18/0x32
> > > > [ 1170.545738] [<ffffffff8128490b>] ? nf_sockopt_find.clone.1+0xda/0xec
> > > > [ 1170.545742] [<ffffffff81284996>] ? compat_nf_sockopt+0x79/0xa5
> > > > [ 1170.545744] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > [ 1170.545747] [<ffffffff812849f3>] ? compat_nf_setsockopt+0x1a/0x1f
> > > > [ 1170.545751] [<ffffffff8128fb35>] ? compat_ip_setsockopt+0x80/0xa0
> > > > [ 1170.545756] [<ffffffff812784a2>] ? compat_sys_setsockopt+0x1d5/0x204
> > > > [ 1170.545759] [<ffffffff810337f1>] ? should_resched+0x5/0x24
> > > > [ 1170.545761] [<ffffffff81314cc5>] ? _cond_resched+0x9/0x20
> > > > [ 1170.545764] [<ffffffff812788a5>] ? compat_sys_socketcall+0x148/0x1a7
> > > > [ 1170.545768] [<ffffffff8131d2c0>] ? sysenter_dispatch+0x7/0x2e
> > > > [ 1170.545769] Code: 5d 41 5e 41 5f c3 40 0f b6 ff 53 31 d2 48 6b ff 70 48 03 3d 03 1b 00 00 8b 4f 6c 4c 8b 47 60 ff c9 eb 27 8d 04 11 d1 f8 48 63 f8
> > > > [ 1170.545787] RIP [<ffffffffa051e7b0>] xt_compat_calc_jump+0x25/0x6f [x_tables]
> > > > [ 1170.545792] RSP <ffff880121473cf8>
> > > > [ 1170.545794] CR2: 00000001dc1be9f8
> > > > [ 1170.654269] ---[ end trace d44667d90dcbd115 ]---
> > > > [ 1170.662411] fuse exit
> > > > Kernel logging (proc) stopped.
> > > > --
> >
> >
> > Hmm, commit 255d0dc34068a976550ce555e must have a problem for ebtables ?
> >
> > Dann, could you give us what you do with ebtables ?
> >
> > Thanks
> >
>
> For sure, there was a typo in above commit, but this is not enough to
> make ebtables work in COMPAT mode.
>
> Hmm...
>
Update : xt_compat_calc_jump() misses this bit, and I still have to find
the ebtables problem.
I'll provide a cumulative patch once done
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index a9adf4c..1acda09 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -473,6 +473,8 @@ int xt_compat_calc_jump(u_int8_t af, unsigned int offset)
else
return mid ? tmp[mid - 1].delta : 0;
}
+ if (left)
+ return tmp[left - 1].delta;
WARN_ON_ONCE(1);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
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