deinline a few large functions in vlan code - v3
Subsystems (3)
PATCH 1/3 deinline a few large functions in vlan code - v3
Hi,
After davem and Dave Dillow comments I realized that a lot of drivers try to do VLAN-related things even on non-VLAN-enabled kernels.
These patches exclude VLAN code from netdevice drivers and from bonding module, and even remove vlan-related members of struct netdevice if VLAN is not configured.
Compile tested on allyesconfig kernel with CONFIG_8021Q=y,m,n.
Below is a patch which takes care of drivers/net/*.
Please comment.
--
vda
drivers/net/bnx2.c +3 -0
@@ -4436,10 +4436,13 @@ bnx2_start_xmit(struct sk_buff *skb, str vlan_tag_flags |=TX_BD_FLAGS_TCP_UDP_CKSUM ; } +#ifdef BCM_VLAN if (bp->vlgrp !=0 &&vlan_tx_tag_present (skb)) { vlan_tag_flags |= (TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get (skb) <<16 )); } +#endif +#ifdef BCM_TSO if ((mss =skb_shinfo (skb)->tso_size) && (skb->len > (bp->dev->mtu +ETH_HLEN ))) {
drivers/net/bnx2.h +2 -0
@@ -40,7 +40,9 @@#include <linux/mii.h> #ifdef NETIF_F_HW_VLAN_TX #include <linux/if_vlan.h> +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )#define BCM_VLAN 1 +#endif #endif #ifdef NETIF_F_TSO #include <net/ip.h>
drivers/net/chelsio/sge.c +4 -1
@@ -978,6 +978,7 @@ static int sge_rx(struct sge *sge, struc }else skb->ip_summed =CHECKSUM_NONE ; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (unlikely (adapter->vlan_grp && p->vlan_valid)) { sge->port_stats[p->iff].vlan_xtract++;if (adapter->params.sge.polling)
@@ -986,7 +987,9 @@ static int sge_rx(struct sge *sge, struc else vlan_hwaccel_rx(skb, adapter->vlan_grp, ntohs(p->vlan)); - }else if (adapter->params.sge.polling) + } else +#endif +if (adapter->params.sge.polling)netif_receive_skb (skb);else netif_rx (skb);
drivers/net/e1000/e1000.h +2 -0
@@ -254,8 +254,10 @@ struct e1000_adapter {struct timer_list tx_fifo_stall_timer;struct timer_list watchdog_timer;struct timer_list phy_info_timer; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct vlan_group *vlgrp;uint16_t mng_vlan_id; +#endif uint32_t bd_number;uint32_t rx_buffer_len;uint32_t part_num;
drivers/net/e1000/e1000_main.c +36 -8
188 lines not on this page · raw message
drivers/net/gianfar.c +16 -0
@@ -270,6 +270,7 @@ static int gfar_probe(struct platform_de }else priv->rx_csum_enable =0 ; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE ) priv->vlgrp =NULL ;if (priv->einfo->device_flags &FSL_GIANFAR_DEV_HAS_VLAN ) {
@@ -280,6 +281,7 @@ static int gfar_probe(struct platform_de priv->vlan_enable = 1; } +#endif if (priv->einfo->device_flags &FSL_GIANFAR_DEV_HAS_EXTENDED_HASH ) { priv->extended_hash =1 ;
@@ -792,8 +794,10 @@ int startup_gfar(struct net_device *dev) rctrl |=RCTRL_EMEN ; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (priv->vlan_enable) rctrl |=RCTRL_VLAN ; +#endif if (priv->padding) { rctrl &= ~RCTRL_PAL_MASK ;
@@ -945,6 +949,7 @@ static int gfar_start_xmit(struct sk_bufgfar_tx_checksum (skb, fcb); } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (priv->vlan_enable &&unlikely (priv->vlgrp &&vlan_tx_tag_present (skb))) {if (unlikely (NULL == fcb)) {
@@ -954,6 +959,7 @@ static int gfar_start_xmit(struct sk_buf gfar_tx_vlan(skb, fcb); } +#endif /* Set buffer length and pointer */ txbdp->length = skb->len;
@@ -1037,6 +1043,7 @@ int gfar_set_mac_address(struct net_devi } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )/* Enables and disables VLAN insertion/extraction */ static void gfar_vlan_rx_register (struct net_device *dev,struct vlan_group *grp)
@@ -1074,8 +1081,10 @@ static void gfar_vlan_rx_register(structspin_unlock_irqrestore (&priv->lock, flags); } +#endif +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )static void gfar_vlan_rx_kill_vid (struct net_device *dev,uint16_t vid) {struct gfar_private *priv =netdev_priv (dev);
@@ -1088,6 +1097,7 @@ static void gfar_vlan_rx_kill_vid(struct spin_unlock_irqrestore(&priv->lock, flags); } +#endif static int gfar_change_mtu (struct net_device *dev,int new_mtu)
@@ -1097,8 +1107,10 @@ static int gfar_change_mtu(struct net_deint oldsize = priv->rx_buffer_size;int frame_size = new_mtu +ETH_HLEN ; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (priv->vlan_enable) frame_size +=VLAN_ETH_HLEN ; +#endif if (gfar_uses_fcb (priv)) frame_size +=GMAC_FCB_LEN ;
@@ -1343,6 +1355,7 @@ irqreturn_t gfar_receive(int irq, void *return IRQ_HANDLED ; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )static inline int gfar_rx_vlan (struct sk_buff *skb,struct vlan_group *vlgrp,unsigned short vlctl) {
@@ -1352,6 +1365,7 @@ static inline int gfar_rx_vlan(struct skreturn vlan_hwaccel_rx (skb, vlgrp, vlctl); #endif } +#endif static inline void gfar_rx_checksum (struct sk_buff *skb,struct rxfcb *fcb) {
@@ -1409,9 +1423,11 @@ static int gfar_process_frame(struct net skb->protocol =eth_type_trans (skb, dev);/* Send the packet up the stack */ +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (unlikely (priv->vlgrp && (fcb->flags &RXFCB_VLN ))) ret =gfar_rx_vlan (skb, priv->vlgrp, fcb->vlctl); else +#endif ret =RECEIVE (skb);if (NET_RX_DROP == ret)
drivers/net/gianfar.h +2 -0
@@ -702,7 +702,9 @@ struct gfar_private { extended_hash:1 , bd_stash_en:1;unsigned short padding; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct vlan_group *vlgrp; +#endif /* Info structure initialized by board setup code */ unsigned int interruptTransmit;unsigned int interruptReceive;
drivers/net/ixgb/ixgb.h +2 -0
@@ -155,7 +155,9 @@ struct ixgb_desc_ring {struct ixgb_adapter {struct timer_list watchdog_timer; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct vlan_group *vlgrp; +#endif uint32_t bd_number;uint32_t rx_buffer_len;uint32_t part_num;
drivers/net/ixgb/ixgb_main.c +16 -4
@@ -121,11 +121,13 @@ static void ixgb_alloc_rx_buffers(structvoid ixgb_set_ethtool_ops (struct net_device *netdev);static void ixgb_tx_timeout (struct net_device *dev);static void ixgb_tx_timeout_task (struct net_device *dev); +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )static void ixgb_vlan_rx_register (struct net_device *netdev,struct vlan_group *grp);static void ixgb_vlan_rx_add_vid (struct net_device *netdev,uint16_t vid);static void ixgb_vlan_rx_kill_vid (struct net_device *netdev,uint16_t vid);static void ixgb_restore_vlan (struct ixgb_adapter *adapter); +#endif #ifdef CONFIG_NET_POLL_CONTROLLER /* for netdump / net console */
@@ -233,7 +235,9 @@ ixgb_up(struct ixgb_adapter *adapter)ixgb_set_multi (netdev); +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )ixgb_restore_vlan (adapter); +#endif ixgb_configure_tx (adapter);ixgb_setup_rctl (adapter);
@@ -419,9 +423,11 @@ ixgb_probe(struct pci_dev *pdev, netdev->poll = &ixgb_clean; netdev->weight =64 ;#endif +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE ) netdev->vlan_rx_register = ixgb_vlan_rx_register; netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid; netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid; +#endif #ifdef CONFIG_NET_POLL_CONTROLLER netdev->poll_controller = ixgb_netpoll;#endif
@@ -1398,10 +1404,12 @@ ixgb_xmit_frame(struct sk_buff *skb, str }spin_unlock_irqrestore (&adapter->tx_lock, flags); +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (adapter->vlgrp &&vlan_tx_tag_present (skb)) { tx_flags |=IXGB_TX_FLAGS_VLAN ; vlan_id =vlan_tx_tag_get (skb); } +#endif first = adapter->tx_ring.next_to_use;
@@ -1905,21 +1913,23 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a skb->protocol =eth_type_trans (skb, netdev);#ifdef CONFIG_IXGB_NAPI +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (adapter->vlgrp && (status &IXGB_RX_DESC_STATUS_VP )) {vlan_hwaccel_receive_skb (skb, adapter->vlgrp,le16_to_cpu (rx_desc->special) &IXGB_RX_DESC_SPECIAL_VLAN_MASK ); - }else { + } else +#endif netif_receive_skb (skb); - }#else /* CONFIG_IXGB_NAPI */ +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (adapter->vlgrp && (status &IXGB_RX_DESC_STATUS_VP )) {vlan_hwaccel_rx (skb, adapter->vlgrp,le16_to_cpu (rx_desc->special) &IXGB_RX_DESC_SPECIAL_VLAN_MASK ); - }else { + } else +#endif netif_rx (skb); - }#endif /* CONFIG_IXGB_NAPI */ netdev->last_rx = jiffies;
@@ -2014,6 +2024,7 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte rx_ring->next_to_use = i; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )/** * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping. *
@@ -2107,6 +2118,7 @@ ixgb_restore_vlan(struct ixgb_adapter *a } } } +#endif /* defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) */ #ifdef CONFIG_NET_POLL_CONTROLLER /*
drivers/net/s2io.c +16 -4
@@ -182,6 +182,7 @@ static char ethtool_stats_keys[][ETH_GST timer.data = (unsigned long ) arg; \ mod_timer(&timer, (jiffies + exp)) \ +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )/* Add the vlan */ static void s2io_vlan_rx_register (struct net_device *dev,struct vlan_group *grp)
@@ -205,6 +206,7 @@ static void s2io_vlan_rx_kill_vid(struct nic->vlgrp->vlan_devices[vid] =NULL ; spin_unlock_irqrestore(&nic->tx_lock, flags); } +#endif /* * Constants to be programmed into the Xena's registers, to configure
@@ -3469,8 +3471,10 @@ static int s2io_xmit(struct sk_buff *skb#ifdef NETIF_F_TSO int mss;#endif +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )u16 vlan_tag =0 ;int vlan_priority =0 ; +#endif mac_info_t *mac_control;struct config_param *config;
@@ -3489,12 +3493,14 @@ static int s2io_xmit(struct sk_buff *skb queue =0 ; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )/* Get Fifo number to Transmit based on vlan priority */ if (sp->vlgrp &&vlan_tx_tag_present (skb)) { vlan_tag =vlan_tx_tag_get (skb); vlan_priority = vlan_tag >>13 ; queue = config->fifo_mapping[vlan_priority]; } +#endif put_off = (u16 ) mac_control->fifos[queue].tx_curr_put_info.offset; get_off = (u16 ) mac_control->fifos[queue].tx_curr_get_info.offset;
@@ -3537,10 +3543,12 @@ static int s2io_xmit(struct sk_buff *skb txdp->Control_1 |=TXD_LIST_OWN_XENA ; txdp->Control_2 |= config->tx_intr_type; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (sp->vlgrp &&vlan_tx_tag_present (skb)) { txdp->Control_2 |=TXD_VLAN_ENABLE ; txdp->Control_2 |=TXD_VLAN_TAG (vlan_tag); } +#endif frg_len = skb->len - skb->data_len;if (skb_shinfo (skb)->ufo_size) {
@@ -5680,21 +5688,23 @@ static int rx_osm_handler(ring_info_t *r skb->protocol =eth_type_trans (skb, dev);#ifdef CONFIG_S2IO_NAPI +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (sp->vlgrp &&RXD_GET_VLAN_TAG (rxdp->Control_2)) {/* Queueing the vlan frame to the upper layer */ vlan_hwaccel_receive_skb (skb, sp->vlgrp,RXD_GET_VLAN_TAG (rxdp->Control_2)); - }else { + } else +#endif netif_receive_skb (skb); - }#else +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (sp->vlgrp &&RXD_GET_VLAN_TAG (rxdp->Control_2)) {/* Queueing the vlan frame to the upper layer */ vlan_hwaccel_rx (skb, sp->vlgrp,RXD_GET_VLAN_TAG (rxdp->Control_2)); - }else { + } else +#endif netif_rx (skb); - }#endif dev->last_rx = jiffies;atomic_dec (&sp->rx_bufs_left[ring_no]);
@@ -6051,9 +6061,11 @@ Defaulting to INTA\n"); dev->do_ioctl = &s2io_ioctl; dev->change_mtu = &s2io_change_mtu;SET_ETHTOOL_OPS (dev, &netdev_ethtool_ops); +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE ) dev->features |=NETIF_F_HW_VLAN_TX |NETIF_F_HW_VLAN_RX ; dev->vlan_rx_register = s2io_vlan_rx_register; dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid; +#endif /* * will use eth_mac_addr() for dev->set_mac_address
drivers/net/s2io.h +2 -0
@@ -771,7 +771,9 @@ struct s2io_nic {#define CARD_UP 2atomic_t card_state;volatile unsigned long link_state; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct vlan_group *vlgrp; +#endif #define MSIX_FLG 0xA5struct msix_entry *entries;struct s2io_msix_entry *s2io_entries;
drivers/net/typhoon.c +16 -4
@@ -285,7 +285,9 @@ struct typhoon {struct pci_dev * pdev;struct net_device * dev;spinlock_t state_lock; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct vlan_group * vlgrp; +#endif struct basic_ring rxHiRing;struct basic_ring rxBuffRing;struct rxbuff_ent rxbuffers[RXENT_ENTRIES ];
@@ -707,6 +709,7 @@ out:return err; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )static void typhoon_vlan_rx_register (struct net_device *dev,struct vlan_group *grp) {
@@ -754,6 +757,7 @@ typhoon_vlan_rx_kill_vid(struct net_devi tp->vlgrp->vlan_devices[vid] =NULL ;spin_unlock_bh (&tp->state_lock); } +#endif static inline void typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
@@ -837,6 +841,7 @@ typhoon_start_tx(struct sk_buff *skb, st first_txd->processFlags |=TYPHOON_TX_PF_IP_CHKSUM ; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (vlan_tx_tag_present (skb)) { first_txd->processFlags |=TYPHOON_TX_PF_INSERT_VLAN |TYPHOON_TX_PF_VLAN_PRIORITY ;
@@ -844,6 +849,7 @@ typhoon_start_tx(struct sk_buff *skb, stcpu_to_le32 (htons (vlan_tx_tag_get (skb)) << TYPHOON_TX_PF_VLAN_TAG_SHIFT); } +#endif if (skb_tso_size (skb)) { first_txd->processFlags |=TYPHOON_TX_PF_TCP_SEGMENT ;
@@ -1744,13 +1750,15 @@ typhoon_rx(struct typhoon *tp, struct ba }else new_skb->ip_summed =CHECKSUM_NONE ; -spin_lock (&tp->state_lock); -if (tp->vlgrp !=NULL && rx->rxStatus &TYPHOON_RX_VLAN ) +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE ) +if (tp->vlgrp !=NULL && rx->rxStatus &TYPHOON_RX_VLAN ) { +spin_lock (&tp->state_lock);vlan_hwaccel_receive_skb (new_skb, tp->vlgrp,ntohl (rx->vlanTag) &0xffff ); -else +spin_unlock (&tp->state_lock); + } else +#endif netif_receive_skb (new_skb); -spin_unlock (&tp->state_lock); tp->dev->last_rx = jiffies; received++;
@@ -2232,6 +2240,7 @@ typhoon_suspend(struct pci_dev *pdev, pmif (!netif_running (dev))return 0 ; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )spin_lock_bh (&tp->state_lock);if (tp->vlgrp && tp->wol_events &TYPHOON_WAKE_MAGIC_PKT ) {spin_unlock_bh (&tp->state_lock);
@@ -2240,6 +2249,7 @@ typhoon_suspend(struct pci_dev *pdev, pm return -EBUSY; }spin_unlock_bh (&tp->state_lock); +#endif netif_device_detach (dev);
@@ -2549,8 +2559,10 @@ typhoon_init_one(struct pci_dev *pdev, c dev->watchdog_timeo =TX_TIMEOUT ; dev->get_stats = typhoon_get_stats; dev->set_mac_address = typhoon_set_mac_address; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE ) dev->vlan_rx_register = typhoon_vlan_rx_register; dev->vlan_rx_kill_vid = typhoon_vlan_rx_kill_vid; +#endif SET_ETHTOOL_OPS (dev, &typhoon_ethtool_ops);/* We can handle scatter gather, up to 16 entries, and
PATCH 2/3 deinline a few large functions in vlan code - v3
Quoted 5 lines · Denis Vlasenko
These patches exclude VLAN code from netdevice drivers and from bonding module, and even remove vlan-related members of struct netdevice if VLAN is not configured.
Compile tested on allyesconfig kernel with
CONFIG_8021Q=y,m,n.
This one takes care of drivers/net/bonding/bonding.[ch] --
vda
drivers/net/bonding/bond_alb.c +12 -3
@@ -502,6 +502,7 @@ static void rlb_update_client(struct rlb skb->dev = client_info->slave->dev; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (client_info->tag) { skb =vlan_put_tag (skb, client_info->vlan_id);if (!skb) {
@@ -511,7 +512,7 @@ static void rlb_update_client(struct rlb continue; } } - +#endif arp_xmit (skb); } }
@@ -671,6 +672,7 @@ static struct slave *rlb_choose_channel( client_info->ntt =0 ; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (!list_empty (&bond->vlan_list)) {unsigned short vlan_id;int res =vlan_get_tag (skb, &vlan_id);
@@ -679,6 +681,7 @@ static struct slave *rlb_choose_channel( client_info->vlan_id = vlan_id; } } +#endif if (!client_info->assigned) {u32 prev_tbl_head = bond_info->rx_hashtbl_head;
@@ -833,6 +836,7 @@ static void rlb_deinitialize(struct bond_unlock_rx_hashtbl (bond); } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )static void rlb_clear_vlan (struct bonding *bond,unsigned short vlan_id) {struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));
@@ -865,12 +869,15 @@ static void rlb_clear_vlan(struct bondin _unlock_rx_hashtbl(bond); } +#endif /*********************** tlb/rlb shared functions *********************/ static void alb_send_learning_packets (struct slave *slave,u8 mac_addr[]) { +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct bonding *bond =bond_get_bond_by_slave (slave); +#endif struct learning_pkt pkt;int size =sizeof (struct learning_pkt );int i;
@@ -898,6 +905,7 @@ static void alb_send_learning_packets(st skb->priority =TC_PRIO_CONTROL ; skb->dev = slave->dev; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )if (!list_empty (&bond->vlan_list)) {struct vlan_entry *vlan;
@@ -918,7 +926,7 @@ static void alb_send_learning_packets(st continue; } } - +#endif dev_queue_xmit (skb); } }
@@ -1665,6 +1673,7 @@ int bond_alb_set_mac_address(struct net_return 0 ; } +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )void bond_alb_clear_vlan (struct bonding *bond,unsigned short vlan_id) { if (bond->alb_info.current_alb_vlan &&
@@ -1676,4 +1685,4 @@ void bond_alb_clear_vlan(struct bonding rlb_clear_vlan(bond, vlan_id); } } - +#endif
drivers/net/bonding/bond_main.c +49 -7
266 lines not on this page · raw message
drivers/net/bonding/bonding.h +2 -0
@@ -196,8 +196,10 @@ struct bonding {struct ad_bond_info ad_info;struct alb_bond_info alb_info;struct bond_params params; +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )struct list_head vlan_list;struct vlan_group *vlgrp; +#endif };/**
PATCH 3/3 deinline a few large functions in vlan code - v3
On Tuesday 11 April 2006 10:44, Denis Vlasenko wrote:
Quoted 5 lines · Denis Vlasenko
These patches exclude VLAN code from netdevice drivers and from bonding module, and even remove vlan-related members of struct netdevice if VLAN is not configured.
Compile tested on allyesconfig kernel with
CONFIG_8021Q=y,m,n.
This one add #ifdefs around vlan_rx_* members of struct netdevice, and moves large inlines out-of-line.
--
vda
include/linux/if_vlan.h +3 -79
@@ -149,49 +149,9 @@ struct vlan_skb_tx_cookie {#define vlan_tx_tag_get (__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag)/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ -static inline int __vlan_hwaccel_rx (struct sk_buff *skb, +int __vlan_hwaccel_rx (struct sk_buff *skb,struct vlan_group *grp, -unsigned short vlan_tag,int polling) -{ -struct net_device_stats *stats; - - skb->dev = grp->vlan_devices[vlan_tag &VLAN_VID_MASK ]; -if (skb->dev ==NULL ) { -dev_kfree_skb_any (skb); - -/* Not NET_RX_DROP, this is not being dropped -* due to congestion. -*/ -return 0 ; - } - - skb->dev->last_rx = jiffies; - - stats =vlan_dev_get_stats (skb->dev); - stats->rx_packets++; - stats->rx_bytes += skb->len; - - skb->priority =vlan_get_ingress_priority (skb->dev, vlan_tag); -switch (skb->pkt_type) { -case PACKET_BROADCAST : -break ; - -case PACKET_MULTICAST : - stats->multicast++; -break ; - -case PACKET_OTHERHOST : -/* Our lower layer thinks this is not local, let's make sure. -* This allows the VLAN to have a different MAC than the underlying -* device, and still route correctly. -*/ -if (!memcmp (eth_hdr (skb)->h_dest, skb->dev->dev_addr,ETH_ALEN )) - skb->pkt_type =PACKET_HOST ; -break ; - }; - -return (polling ?netif_receive_skb (skb) :netif_rx (skb)); -} +unsigned short vlan_tag,int polling); static inline int vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
@@ -218,43 +178,7 @@ static inline int vlan_hwaccel_receive_s* Following the skb_unshare() example, in case of error, the calling function * doesn't have to worry about freeing the original skb. */ -static inline struct sk_buff *__vlan_put_tag (struct sk_buff *skb,unsigned short tag) -{ -struct vlan_ethhdr *veth; - -if (skb_headroom (skb) <VLAN_HLEN ) { -struct sk_buff *sk_tmp = skb; - skb =skb_realloc_headroom (sk_tmp,VLAN_HLEN ); -kfree_skb (sk_tmp); -if (!skb) { -printk (KERN_ERR "vlan: failed to realloc headroom\n" ); -return NULL ; - } - }else { - skb =skb_unshare (skb,GFP_ATOMIC ); -if (!skb) { -printk (KERN_ERR "vlan: failed to unshare skbuff\n" ); -return NULL ; - } - } - - veth = (struct vlan_ethhdr *)skb_push (skb,VLAN_HLEN ); - -/* Move the mac addresses to the beginning of the new header. */ -memmove (skb->data, skb->data +VLAN_HLEN ,2 *VLAN_ETH_ALEN ); - -/* first, the ethernet type */ - veth->h_vlan_proto =__constant_htons (ETH_P_8021Q ); - -/* now, the tag */ - veth->h_vlan_TCI =htons (tag); - - skb->protocol =__constant_htons (ETH_P_8021Q ); - skb->mac.raw -=VLAN_HLEN ; - skb->nh.raw -=VLAN_HLEN ; - -return skb; -} +struct sk_buff *__vlan_put_tag (struct sk_buff *skb,unsigned short tag);/** * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
include/linux/netdevice.h +2 -0
@@ -475,12 +475,14 @@ struct net_device#define HAVE_TX_TIMEOUT void (*tx_timeout) (struct net_device *dev); +#if defined(CONFIG_VLAN_8021Q ) || defined(CONFIG_VLAN_8021Q_MODULE )void (*vlan_rx_register)(struct net_device *dev,struct vlan_group *grp);void (*vlan_rx_add_vid)(struct net_device *dev,unsigned short vid);void (*vlan_rx_kill_vid)(struct net_device *dev,unsigned short vid); +#endif int (*hard_header_parse)(struct sk_buff *skb,unsigned char *haddr);
net/core/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o obj-$(CONFIG_SYSCTL) += sysctl_net_core.o -obj-y += dev.o ethtool.o dev_mcast.o dst.o \ +obj-y += dev.o ethtool.o dev_mcast.o dev_vlan.o dst.o \ neighbour.o rtnetlink.o utils.o link_watch.o filter.o obj-$(CONFIG_XFRM) += flow.o
net/core/dev_vlan.c +110 -0
110 lines not on this page · raw message
David S. Miller
maintainerFrom: Denis Vlasenko <[email protected]>
Date: Tue, 11 Apr 2006 10:47:36 +0300
Quoted 10 lines · Denis Vlasenko
Quoted 5 lines · Denis Vlasenko
These patches exclude VLAN code from netdevice drivers and from bonding module, and even remove vlan-related members of struct netdevice if VLAN is not configured.
Compile tested on allyesconfig kernel with
CONFIG_8021Q=y,m,n.This one add #ifdefs around vlan_rx_* members of struct netdevice, and moves large inlines out-of-line.
This is not very nice, there is no way I'm applying these patches.
I think the current situation is far better than the large pile of ifdefs these patches are adding to the tree.
Let's just leave things the way they are ok?
Quoted 6 lines · David S. Miller
This is not very nice, there is no way I'm applying these patches.
I think the current situation is far better than the large pile of ifdefs these patches are adding to the tree.
Let's just leave things the way they are ok?
:(
Ok, one last try. Would you like this smallish patch instead? It takes care of those BIG inlines.
--
vda
net/core/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o obj-$(CONFIG_SYSCTL) += sysctl_net_core.o -obj-y += dev.o ethtool.o dev_mcast.o dst.o \ +obj-y += dev.o ethtool.o dev_mcast.o dev_vlan.o dst.o \ neighbour.o rtnetlink.o utils.o link_watch.o filter.o obj-$(CONFIG_XFRM) += flow.o
include/linux/if_vlan.h +3 -79
95 lines not on this page · raw message
net/core/dev_vlan.c +110 -0
110 lines not on this page · raw message
David S. Miller
maintainerFrom: Denis Vlasenko <[email protected]>
Date: Tue, 11 Apr 2006 11:11:12 +0300
Quoted 2 lines
Ok, one last try. Would you like this smallish patch instead? It takes care of those BIG inlines.
You're putting vlan stuff into a net/core/*.c file, that is not correct.
If we're not going to do the ifdef mess, fudging around it by putting a "VLAN" function into generic networking core code isn't the way to try and deal with it.
Like I said, let's just leave things they way they are. Every suggestion shown so far has been worse than what we have now.
Quoted 8 lines · David S. Miller
From: Denis Vlasenko <[email protected]>
Date: Tue, 11 Apr 2006 11:11:12 +0300Quoted 2 lines
Ok, one last try. Would you like this smallish patch instead? It takes care of those BIG inlines.
You're putting vlan stuff into a
net/core/*.cfile, that is not correct.
This code is _already_ there, duplicated in every driver of VLAN-capable NIC.
In other words:
if you have just one VLAN-capable NIC driver compiled in, you have that code in bzImage. If you have ten drivers, you have that code duplicated ten times.
On my current kernel, I have several dozens NIC drivers compiled in, because I don't want to mess with modules on initrd for network boot...
Regarding net/core/*.c. You are right.
The below patch puts this code into net/8021q/if_vlan.c. Does it look better?
--
vda
include/linux/if_vlan.h +3 -79
@@ -149,49 +149,9 @@ struct vlan_skb_tx_cookie {#define vlan_tx_tag_get (__skb) (VLAN_TX_SKB_CB(__skb)->vlan_tag)/* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ -static inline int __vlan_hwaccel_rx (struct sk_buff *skb, +int __vlan_hwaccel_rx (struct sk_buff *skb,struct vlan_group *grp, -unsigned short vlan_tag,int polling) -{ -struct net_device_stats *stats; - - skb->dev = grp->vlan_devices[vlan_tag &VLAN_VID_MASK ]; -if (skb->dev ==NULL ) { -dev_kfree_skb_any (skb); - -/* Not NET_RX_DROP, this is not being dropped -* due to congestion. -*/ -return 0 ; - } - - skb->dev->last_rx = jiffies; - - stats =vlan_dev_get_stats (skb->dev); - stats->rx_packets++; - stats->rx_bytes += skb->len; - - skb->priority =vlan_get_ingress_priority (skb->dev, vlan_tag); -switch (skb->pkt_type) { -case PACKET_BROADCAST : -break ; - -case PACKET_MULTICAST : - stats->multicast++; -break ; - -case PACKET_OTHERHOST : -/* Our lower layer thinks this is not local, let's make sure. -* This allows the VLAN to have a different MAC than the underlying -* device, and still route correctly. -*/ -if (!memcmp (eth_hdr (skb)->h_dest, skb->dev->dev_addr,ETH_ALEN )) - skb->pkt_type =PACKET_HOST ; -break ; - }; - -return (polling ?netif_receive_skb (skb) :netif_rx (skb)); -} +unsigned short vlan_tag,int polling); static inline int vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
@@ -218,43 +178,7 @@ static inline int vlan_hwaccel_receive_s* Following the skb_unshare() example, in case of error, the calling function * doesn't have to worry about freeing the original skb. */ -static inline struct sk_buff *__vlan_put_tag (struct sk_buff *skb,unsigned short tag) -{ -struct vlan_ethhdr *veth; - -if (skb_headroom (skb) <VLAN_HLEN ) { -struct sk_buff *sk_tmp = skb; - skb =skb_realloc_headroom (sk_tmp,VLAN_HLEN ); -kfree_skb (sk_tmp); -if (!skb) { -printk (KERN_ERR "vlan: failed to realloc headroom\n" ); -return NULL ; - } - }else { - skb =skb_unshare (skb,GFP_ATOMIC ); -if (!skb) { -printk (KERN_ERR "vlan: failed to unshare skbuff\n" ); -return NULL ; - } - } - - veth = (struct vlan_ethhdr *)skb_push (skb,VLAN_HLEN ); - -/* Move the mac addresses to the beginning of the new header. */ -memmove (skb->data, skb->data +VLAN_HLEN ,2 *VLAN_ETH_ALEN ); - -/* first, the ethernet type */ - veth->h_vlan_proto =__constant_htons (ETH_P_8021Q ); - -/* now, the tag */ - veth->h_vlan_TCI =htons (tag); - - skb->protocol =__constant_htons (ETH_P_8021Q ); - skb->mac.raw -=VLAN_HLEN ; - skb->nh.raw -=VLAN_HLEN ; - -return skb; -} +struct sk_buff *__vlan_put_tag (struct sk_buff *skb,unsigned short tag);/** * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
net/8021q/Makefile +2 -0
@@ -2,6 +2,8 @@ # Makefile for the Linux VLAN layer. # +obj-y += if_vlan.o + obj-$(CONFIG_VLAN_8021Q) += 8021q.o 8021q-objs := vlan.o vlan_dev.o
net/8021q/if_vlan.c +106 -0
106 lines not on this page · raw message
net/Makefile +1 -1
@@ -41,7 +41,7 @@ obj-$(CONFIG_RXRPC) += rxrpc/ obj-$(CONFIG_ATM) += atm/ obj-$(CONFIG_DECNET) += decnet/ obj-$(CONFIG_ECONET) += econet/ -obj-$(CONFIG_VLAN_8021Q) += 8021q/ +obj-y += 8021q/ obj-$(CONFIG_IP_DCCP) += dccp/ obj-$(CONFIG_IP_SCTP) += sctp/ obj-$(CONFIG_IEEE80211) += ieee80211/