{
int err;
- printk(VLAN_INF "%s v%s %s\n",
- vlan_fullname, vlan_version, vlan_copyright);
- printk(VLAN_INF "All bugs added by %s\n",
- vlan_buggyright);
+ pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright);
+ pr_info("All bugs added by %s\n", vlan_buggyright);
/* proc file system initialization */
err = vlan_proc_init();
if (err < 0) {
- printk(KERN_ERR
- "%s: can't create entry in proc filesystem!\n",
+ pr_err("%s: can't create entry in proc filesystem!\n",
__FUNCTION__);
return err;
}
struct vlan_group *grp;
int i, ret;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: VID: %i\n", __FUNCTION__, vlan_id);
-#endif
-
/* sanity check */
if (vlan_id >= VLAN_VID_MASK)
return -EINVAL;
int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
{
+ char *name = real_dev->name;
+
if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
- printk(VLAN_DBG "%s: VLANs not supported on %s.\n",
- __FUNCTION__, real_dev->name);
+ pr_info("8021q: VLANs not supported on %s\n", name);
return -EOPNOTSUPP;
}
if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
!real_dev->vlan_rx_register) {
- printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
- __FUNCTION__, real_dev->name);
+ pr_info("8021q: device %s has buggy VLAN hw accel\n", name);
return -EOPNOTSUPP;
}
if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
(!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) {
- printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
- __FUNCTION__, real_dev->name);
+ pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
return -EOPNOTSUPP;
}
if (!(real_dev->flags & IFF_UP))
return -ENETDOWN;
- if (__find_vlan_dev(real_dev, vlan_id) != NULL) {
- /* was already registered. */
- printk(VLAN_DBG "%s: ALREADY had VLAN registered\n", __FUNCTION__);
+ if (__find_vlan_dev(real_dev, vlan_id) != NULL)
return -EEXIST;
- }
return 0;
}
real_dev->vlan_rx_add_vid(real_dev, vlan_id);
if (vlan_proc_add_dev(dev) < 0)
- printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
- dev->name);
+ pr_warning("8021q: failed to add proc entry for %s\n",
+ dev->name);
return 0;
out_free_group:
char name[IFNAMSIZ];
int err;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n",
- __FUNCTION__, eth_IF_name, VLAN_ID);
-#endif
-
if (VLAN_ID >= VLAN_VID_MASK)
return -ERANGE;
return err;
/* Gotta set up the fields for the device. */
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "About to allocate name, vlan_name_type: %i\n",
- vlan_name_type);
-#endif
switch (vlan_name_type) {
case VLAN_NAME_TYPE_RAW_PLUS_VID:
/* name will look like: eth1.0005 */
*/
new_dev->mtu = real_dev->mtu;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name);
- VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n",
- new_dev->priv,
- sizeof(struct vlan_dev_info));
-#endif
-
VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
VLAN_DEV_INFO(new_dev)->real_dev = real_dev;
VLAN_DEV_INFO(new_dev)->dent = NULL;
if (err < 0)
goto out_free_newdev;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "Allocated new device successfully, returning.\n");
-#endif
return 0;
out_free_newdev:
args.device1[23] = 0;
args.u.device2[23] = 0;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: args.cmd: %x\n", __FUNCTION__, args.cmd);
-#endif
-
rtnl_lock();
switch (args.cmd) {
default:
/* pass on to underlying device instead?? */
- printk(VLAN_DBG "%s: Unknown VLAN CMD: %x \n",
- __FUNCTION__, args.cmd);
err = -EINVAL;
break;
}
#include <linux/if_vlan.h>
-/* Uncomment this if you want debug traces to be shown. */
-/* #define VLAN_DEBUG */
-
-#define VLAN_ERR KERN_ERR
-#define VLAN_INF KERN_INFO
-#define VLAN_DBG KERN_ALERT /* change these... to debug, having a hard time
- * changing the log level at run-time..for some reason.
- */
-
-/*
-
-These I use for memory debugging. I feared a leak at one time, but
-I never found it..and the problem seems to have dissappeared. Still,
-I'll bet they might prove useful again... --Ben
-
-
-#define VLAN_MEM_DBG(x, y, z) printk(VLAN_DBG "%s: " x, __FUNCTION__, y, z);
-#define VLAN_FMEM_DBG(x, y) printk(VLAN_DBG "%s: " x, __FUNCTION__, y);
-*/
-
-/* This way they don't do anything! */
-#define VLAN_MEM_DBG(x, y, z)
-#define VLAN_FMEM_DBG(x, y)
-
-
extern unsigned short vlan_name_type;
#define VLAN_GRP_HASH_SHIFT 5
return arp_find(veth->h_dest, skb);
#endif
default:
- printk(VLAN_DBG
- "%s: unable to resolve type %X addresses.\n",
- dev->name, ntohs(veth->h_vlan_encapsulated_proto));
+ pr_debug("%s: unable to resolve type %X addresses.\n",
+ dev->name, ntohs(veth->h_vlan_encapsulated_proto));
memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
break;
vid = (vlan_TCI & VLAN_VID_MASK);
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: skb: %p vlan_id: %hx\n",
- __FUNCTION__, skb, vid);
-#endif
-
/* Ok, we will find the correct VLAN device, strip the header,
* and then go on as usual.
*/
skb->dev = __find_vlan_dev(dev, vid);
if (!skb->dev) {
rcu_read_unlock();
-
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
- __FUNCTION__, (unsigned int)(vid), dev->name, dev->ifindex);
-#endif
+ pr_debug("%s: ERROR: No net_device for VID: %u on dev: %s [%i]\n",
+ __FUNCTION__, (unsigned int)vid, dev->name, dev->ifindex);
kfree_skb(skb);
return -1;
}
*/
skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI));
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n",
- __FUNCTION__, (unsigned long)(skb->priority),
- ntohs(vhdr->h_vlan_TCI));
-#endif
+ pr_debug("%s: priority: %u for TCI: %hu\n",
+ __FUNCTION__, skb->priority, ntohs(vhdr->h_vlan_TCI));
/* The ethernet driver already did the pkt_type calculations
* for us...
int build_vlan_header = 0;
struct net_device *vdev = dev; /* save this for the bottom of the method */
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: skb: %p type: %hx len: %x vlan_id: %hx, daddr: %p\n",
- __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
-#endif
+ pr_debug("%s: skb: %p type: %hx len: %u vlan_id: %hx, daddr: %p\n",
+ __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
/* build vlan header only if re_order_header flag is NOT set. This
* fixes some programs that get confused when they see a VLAN device
return -ENOMEM;
}
VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
-#endif
+ pr_debug("%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
}
if (build_vlan_header) {
/* This is not a VLAN frame...but we can fix that! */
VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++;
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n",
- __FUNCTION__, htons(veth->h_vlan_proto));
-#endif
+ pr_debug("%s: proto to encap: 0x%hx\n",
+ __FUNCTION__, htons(veth->h_vlan_proto));
/* Construct the second two bytes. This field looks something
* like:
* usr_priority: 3 bits (high bits)
}
}
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
+ pr_debug("%s: about to send skb: %p to dev: %s\n",
__FUNCTION__, skb, skb->dev->name);
- printk(VLAN_DBG " %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n",
- veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
- veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5],
- veth->h_vlan_proto, veth->h_vlan_TCI, veth->h_vlan_encapsulated_proto);
-#endif
+ pr_debug(" " MAC_FMT " " MAC_FMT " %4hx %4hx %4hx\n",
+ veth->h_dest[0], veth->h_dest[1], veth->h_dest[2],
+ veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
+ veth->h_source[0], veth->h_source[1], veth->h_source[2],
+ veth->h_source[3], veth->h_source[4], veth->h_source[5],
+ veth->h_vlan_proto, veth->h_vlan_TCI,
+ veth->h_vlan_encapsulated_proto);
stats->tx_packets++; /* for statics only */
stats->tx_bytes += skb->len;
}
return 0;
}
- printk(KERN_ERR "%s: flag %i is not valid.\n", __FUNCTION__, flag);
return -EINVAL;
}
{
struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
- if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
- printk(KERN_ERR
- "ERROR: vlan_proc_add, device -:%s:- is NOT a VLAN\n",
- vlandev->name);
- return -EINVAL;
- }
-
dev_info->dent = create_proc_entry(vlandev->name,
S_IFREG|S_IRUSR|S_IWUSR,
proc_vlan_dir);
dev_info->dent->proc_fops = &vlandev_fops;
dev_info->dent->data = vlandev;
-
-#ifdef VLAN_DEBUG
- printk(KERN_ERR "vlan_proc_add, device -:%s:- being added.\n",
- vlandev->name);
-#endif
return 0;
}
*/
int vlan_proc_rem_dev(struct net_device *vlandev)
{
- if (!vlandev) {
- printk(VLAN_ERR "%s: invalid argument: %p\n",
- __FUNCTION__, vlandev);
- return -EINVAL;
- }
-
- if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
- printk(VLAN_DBG "%s: invalid argument, device: %s is not a VLAN device, priv_flags: 0x%4hX.\n",
- __FUNCTION__, vlandev->name, vlandev->priv_flags);
- return -EINVAL;
- }
-
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: dev: %p\n", __FUNCTION__, vlandev);
-#endif
-
/** NOTE: This will consume the memory pointed to by dent, it seems. */
if (VLAN_DEV_INFO(vlandev)->dent) {
remove_proc_entry(VLAN_DEV_INFO(vlandev)->dent->name, proc_vlan_dir);
VLAN_DEV_INFO(vlandev)->dent = NULL;
}
-
return 0;
}