···255 xor 8(%ebp),%r4256 xor 12(%ebp),%r5257258- sub $8,%esp // space for register saves on stack259- add $16,%ebp // increment to next round key260- sub $10,%r3 261- je 4f // 10 rounds for 128-bit key262- add $32,%ebp263- sub $2,%r3264- je 3f // 12 rounds for 128-bit key265- add $32,%ebp266267-2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 128-bit key268 fwd_rnd2( -48(%ebp) ,ft_tab)269-3: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 128-bit key270 fwd_rnd2( -16(%ebp) ,ft_tab)2714: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key272 fwd_rnd2( +16(%ebp) ,ft_tab)···333 xor 8(%ebp),%r4334 xor 12(%ebp),%r5335336- sub $8,%esp // space for register saves on stack337- sub $16,%ebp // increment to next round key338- sub $10,%r3 339- je 4f // 10 rounds for 128-bit key340- sub $32,%ebp341- sub $2,%r3342- je 3f // 12 rounds for 128-bit key343- sub $32,%ebp344345-2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 128-bit key346 inv_rnd2( +48(%ebp), it_tab)347-3: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 128-bit key348 inv_rnd2( +16(%ebp), it_tab)3494: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key350 inv_rnd2( -16(%ebp), it_tab)
···255 xor 8(%ebp),%r4256 xor 12(%ebp),%r5257258+ sub $8,%esp // space for register saves on stack259+ add $16,%ebp // increment to next round key260+ cmp $12,%r3261+ jb 4f // 10 rounds for 128-bit key262+ lea 32(%ebp),%ebp263+ je 3f // 12 rounds for 192-bit key264+ lea 32(%ebp),%ebp0265266+2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key267 fwd_rnd2( -48(%ebp) ,ft_tab)268+3: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 192-bit key269 fwd_rnd2( -16(%ebp) ,ft_tab)2704: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key271 fwd_rnd2( +16(%ebp) ,ft_tab)···334 xor 8(%ebp),%r4335 xor 12(%ebp),%r5336337+ sub $8,%esp // space for register saves on stack338+ sub $16,%ebp // increment to next round key339+ cmp $12,%r3340+ jb 4f // 10 rounds for 128-bit key341+ lea -32(%ebp),%ebp342+ je 3f // 12 rounds for 192-bit key343+ lea -32(%ebp),%ebp0344345+2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key346 inv_rnd2( +48(%ebp), it_tab)347+3: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 192-bit key348 inv_rnd2( +16(%ebp), it_tab)3494: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key350 inv_rnd2( -16(%ebp), it_tab)
···2 * Cryptographic API.3 *4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>05 *6 * This program is free software; you can redistribute it and/or modify it7 * under the terms of the GNU General Public License as published by the Free···17#include <linux/highmem.h>18#include <linux/interrupt.h>19#include <linux/init.h>020#include <linux/kernel.h>021#include <linux/slab.h>22#include <asm/kmap_types.h>0002324extern enum km_type crypto_km_types[];25
···2 * Cryptographic API.3 *4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>5+ * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>6 *7 * This program is free software; you can redistribute it and/or modify it8 * under the terms of the GNU General Public License as published by the Free···16#include <linux/highmem.h>17#include <linux/interrupt.h>18#include <linux/init.h>19+#include <linux/list.h>20#include <linux/kernel.h>21+#include <linux/rwsem.h>22#include <linux/slab.h>23#include <asm/kmap_types.h>24+25+extern struct list_head crypto_alg_list;26+extern struct rw_semaphore crypto_alg_sem;2728extern enum km_type crypto_km_types[];29
···4 * Procfs information.5 *6 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>07 *8 * This program is free software; you can redistribute it and/or modify it9 * under the terms of the GNU General Public License as published by the Free···18#include <linux/proc_fs.h>19#include <linux/seq_file.h>20#include "internal.h"21-22-extern struct list_head crypto_alg_list;23-extern struct rw_semaphore crypto_alg_sem;2425static void *c_start(struct seq_file *m, loff_t *pos)26{···51 struct crypto_alg *alg = (struct crypto_alg *)p;5253 seq_printf(m, "name : %s\n", alg->cra_name);054 seq_printf(m, "module : %s\n", module_name(alg->cra_module));05556 switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {57 case CRYPTO_ALG_TYPE_CIPHER:
···4 * Procfs information.5 *6 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>7+ * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>8 *9 * This program is free software; you can redistribute it and/or modify it10 * under the terms of the GNU General Public License as published by the Free···17#include <linux/proc_fs.h>18#include <linux/seq_file.h>19#include "internal.h"0002021static void *c_start(struct seq_file *m, loff_t *pos)22{···53 struct crypto_alg *alg = (struct crypto_alg *)p;5455 seq_printf(m, "name : %s\n", alg->cra_name);56+ seq_printf(m, "driver : %s\n", alg->cra_driver_name);57 seq_printf(m, "module : %s\n", module_name(alg->cra_module));58+ seq_printf(m, "priority : %d\n", alg->cra_priority);5960 switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {61 case CRYPTO_ALG_TYPE_CIPHER:
+2
crypto/serpent.c
···20#include <linux/errno.h>21#include <asm/byteorder.h>22#include <linux/crypto.h>02324/* Key is padded to the maximum of 256 bits before round key generation.25 * Any key length <= 256 bits (32 bytes) is allowed by the algorithm.···553 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,554 .cra_blocksize = SERPENT_BLOCK_SIZE,555 .cra_ctxsize = sizeof(struct serpent_ctx),0556 .cra_module = THIS_MODULE,557 .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list),558 .cra_u = { .cipher = {
···20#include <linux/errno.h>21#include <asm/byteorder.h>22#include <linux/crypto.h>23+#include <linux/types.h>2425/* Key is padded to the maximum of 256 bits before round key generation.26 * Any key length <= 256 bits (32 bytes) is allowed by the algorithm.···552 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,553 .cra_blocksize = SERPENT_BLOCK_SIZE,554 .cra_ctxsize = sizeof(struct serpent_ctx),555+ .cra_alignmask = 3,556 .cra_module = THIS_MODULE,557 .cra_list = LIST_HEAD_INIT(serpent_alg.cra_list),558 .cra_u = { .cipher = {
···99 return x >> (n << 3);100}101000102#define E_KEY ctx->E103#define D_KEY ctx->D104···294aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags)295{296 struct aes_ctx *ctx = aes_ctx(ctx_arg);297+ const __le32 *key = (const __le32 *)in_key;298 uint32_t i, t, u, v, w;299 uint32_t P[AES_EXTENDED_KEY_SIZE];300 uint32_t rounds;···313 ctx->E = ctx->e_data;314 ctx->D = ctx->e_data;315316+ E_KEY[0] = le32_to_cpu(key[0]);317+ E_KEY[1] = le32_to_cpu(key[1]);318+ E_KEY[2] = le32_to_cpu(key[2]);319+ E_KEY[3] = le32_to_cpu(key[3]);320321 /* Prepare control words. */322 memset(&ctx->cword, 0, sizeof(ctx->cword));···343 break;344345 case 24:346+ E_KEY[4] = le32_to_cpu(key[4]);347+ t = E_KEY[5] = le32_to_cpu(key[5]);348 for (i = 0; i < 8; ++i)349 loop6 (i);350 break;351352 case 32:353+ E_KEY[4] = le32_to_cpu(in_key[4]);354+ E_KEY[5] = le32_to_cpu(in_key[5]);355+ E_KEY[6] = le32_to_cpu(in_key[6]);356+ t = E_KEY[7] = le32_to_cpu(in_key[7]);357 for (i = 0; i < 7; ++i)358 loop8 (i);359 break;···468469static struct crypto_alg aes_alg = {470 .cra_name = "aes",471+ .cra_driver_name = "aes-padlock",472+ .cra_priority = 300,473 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,474 .cra_blocksize = AES_BLOCK_SIZE,475 .cra_ctxsize = sizeof(struct aes_ctx),
+1-1
drivers/crypto/padlock.h
···1718/* Control word. */19struct cword {20- int __attribute__ ((__packed__))21 rounds:4,22 algo:3,23 keygen:1,
···1718/* Control word. */19struct cword {20+ unsigned int __attribute__ ((__packed__))21 rounds:4,22 algo:3,23 keygen:1,
+13
drivers/net/Kconfig
···27# that for each of the symbols.28if NETDEVICES29000000000000030config DUMMY31 tristate "Dummy net driver support"32 ---help---
···27# that for each of the symbols.28if NETDEVICES2930+config IFB31+ tristate "Intermediate Functional Block support"32+ depends on NET_CLS_ACT33+ ---help---34+ This is an intermidiate driver that allows sharing of35+ resources.36+ To compile this driver as a module, choose M here: the module37+ will be called ifb. If you want to use more than one ifb38+ device at a time, you need to compile this driver as a module.39+ Instead of 'ifb', the devices will then be called 'ifb0',40+ 'ifb1' etc.41+ Look at the iproute2 documentation directory for usage etc42+43config DUMMY44 tristate "Dummy net driver support"45 ---help---
···1+/* drivers/net/ifb.c: 2+3+ The purpose of this driver is to provide a device that allows4+ for sharing of resources:5+6+ 1) qdiscs/policies that are per device as opposed to system wide.7+ ifb allows for a device which can be redirected to thus providing8+ an impression of sharing.9+10+ 2) Allows for queueing incoming traffic for shaping instead of11+ dropping. 12+13+ The original concept is based on what is known as the IMQ14+ driver initially written by Martin Devera, later rewritten15+ by Patrick McHardy and then maintained by Andre Correa.16+17+ You need the tc action mirror or redirect to feed this device18+ packets.19+20+ This program is free software; you can redistribute it and/or21+ modify it under the terms of the GNU General Public License22+ as published by the Free Software Foundation; either version23+ 2 of the License, or (at your option) any later version.24+25+ Authors: Jamal Hadi Salim (2005)26+27+*/28+29+30+#include <linux/config.h>31+#include <linux/module.h>32+#include <linux/kernel.h>33+#include <linux/netdevice.h>34+#include <linux/etherdevice.h>35+#include <linux/init.h>36+#include <linux/moduleparam.h>37+#include <net/pkt_sched.h> 38+39+#define TX_TIMEOUT (2*HZ)40+41+#define TX_Q_LIMIT 3242+struct ifb_private {43+ struct net_device_stats stats;44+ struct tasklet_struct ifb_tasklet;45+ int tasklet_pending;46+ /* mostly debug stats leave in for now */47+ unsigned long st_task_enter; /* tasklet entered */48+ unsigned long st_txq_refl_try; /* transmit queue refill attempt */49+ unsigned long st_rxq_enter; /* receive queue entered */50+ unsigned long st_rx2tx_tran; /* receive to trasmit transfers */51+ unsigned long st_rxq_notenter; /*receiveQ not entered, resched */52+ unsigned long st_rx_frm_egr; /* received from egress path */53+ unsigned long st_rx_frm_ing; /* received from ingress path */54+ unsigned long st_rxq_check;55+ unsigned long st_rxq_rsch;56+ struct sk_buff_head rq;57+ struct sk_buff_head tq;58+};59+60+static int numifbs = 1;61+62+static void ri_tasklet(unsigned long dev);63+static int ifb_xmit(struct sk_buff *skb, struct net_device *dev);64+static struct net_device_stats *ifb_get_stats(struct net_device *dev);65+static int ifb_open(struct net_device *dev);66+static int ifb_close(struct net_device *dev);67+68+static void ri_tasklet(unsigned long dev) 69+{70+71+ struct net_device *_dev = (struct net_device *)dev;72+ struct ifb_private *dp = netdev_priv(_dev);73+ struct net_device_stats *stats = &dp->stats;74+ struct sk_buff *skb;75+76+ dp->st_task_enter++;77+ if ((skb = skb_peek(&dp->tq)) == NULL) {78+ dp->st_txq_refl_try++;79+ if (spin_trylock(&_dev->xmit_lock)) {80+ dp->st_rxq_enter++;81+ while ((skb = skb_dequeue(&dp->rq)) != NULL) {82+ skb_queue_tail(&dp->tq, skb);83+ dp->st_rx2tx_tran++;84+ }85+ spin_unlock(&_dev->xmit_lock);86+ } else {87+ /* reschedule */88+ dp->st_rxq_notenter++;89+ goto resched;90+ }91+ }92+93+ while ((skb = skb_dequeue(&dp->tq)) != NULL) {94+ u32 from = G_TC_FROM(skb->tc_verd);95+96+ skb->tc_verd = 0;97+ skb->tc_verd = SET_TC_NCLS(skb->tc_verd);98+ stats->tx_packets++;99+ stats->tx_bytes +=skb->len;100+ if (from & AT_EGRESS) {101+ dp->st_rx_frm_egr++;102+ dev_queue_xmit(skb);103+ } else if (from & AT_INGRESS) {104+105+ dp->st_rx_frm_ing++;106+ netif_rx(skb);107+ } else {108+ dev_kfree_skb(skb);109+ stats->tx_dropped++;110+ }111+ }112+113+ if (spin_trylock(&_dev->xmit_lock)) {114+ dp->st_rxq_check++;115+ if ((skb = skb_peek(&dp->rq)) == NULL) {116+ dp->tasklet_pending = 0;117+ if (netif_queue_stopped(_dev))118+ netif_wake_queue(_dev);119+ } else {120+ dp->st_rxq_rsch++;121+ spin_unlock(&_dev->xmit_lock);122+ goto resched;123+ }124+ spin_unlock(&_dev->xmit_lock);125+ } else {126+resched:127+ dp->tasklet_pending = 1;128+ tasklet_schedule(&dp->ifb_tasklet);129+ }130+131+}132+133+static void __init ifb_setup(struct net_device *dev)134+{135+ /* Initialize the device structure. */136+ dev->get_stats = ifb_get_stats;137+ dev->hard_start_xmit = ifb_xmit;138+ dev->open = &ifb_open;139+ dev->stop = &ifb_close;140+141+ /* Fill in device structure with ethernet-generic values. */142+ ether_setup(dev);143+ dev->tx_queue_len = TX_Q_LIMIT;144+ dev->change_mtu = NULL;145+ dev->flags |= IFF_NOARP;146+ dev->flags &= ~IFF_MULTICAST;147+ SET_MODULE_OWNER(dev);148+ random_ether_addr(dev->dev_addr);149+}150+151+static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)152+{153+ struct ifb_private *dp = netdev_priv(dev);154+ struct net_device_stats *stats = &dp->stats;155+ int ret = 0;156+ u32 from = G_TC_FROM(skb->tc_verd);157+158+ stats->tx_packets++;159+ stats->tx_bytes+=skb->len;160+161+ if (!from || !skb->input_dev) {162+dropped:163+ dev_kfree_skb(skb);164+ stats->rx_dropped++;165+ return ret;166+ } else {167+ /* 168+ * note we could be going169+ * ingress -> egress or170+ * egress -> ingress171+ */172+ skb->dev = skb->input_dev;173+ skb->input_dev = dev;174+ if (from & AT_INGRESS) {175+ skb_pull(skb, skb->dev->hard_header_len);176+ } else {177+ if (!(from & AT_EGRESS)) {178+ goto dropped;179+ }180+ }181+ }182+183+ if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) {184+ netif_stop_queue(dev);185+ }186+187+ dev->trans_start = jiffies;188+ skb_queue_tail(&dp->rq, skb);189+ if (!dp->tasklet_pending) {190+ dp->tasklet_pending = 1;191+ tasklet_schedule(&dp->ifb_tasklet);192+ }193+194+ return ret;195+}196+197+static struct net_device_stats *ifb_get_stats(struct net_device *dev)198+{199+ struct ifb_private *dp = netdev_priv(dev);200+ struct net_device_stats *stats = &dp->stats;201+202+ pr_debug("tasklets stats %ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld:%ld \n",203+ dp->st_task_enter, dp->st_txq_refl_try, dp->st_rxq_enter, 204+ dp->st_rx2tx_tran dp->st_rxq_notenter, dp->st_rx_frm_egr,205+ dp->st_rx_frm_ing, dp->st_rxq_check, dp->st_rxq_rsch );206+207+ return stats;208+}209+210+static struct net_device **ifbs;211+212+/* Number of ifb devices to be set up by this module. */213+module_param(numifbs, int, 0);214+MODULE_PARM_DESC(numifbs, "Number of ifb devices");215+216+static int ifb_close(struct net_device *dev)217+{218+ struct ifb_private *dp = netdev_priv(dev);219+220+ tasklet_kill(&dp->ifb_tasklet);221+ netif_stop_queue(dev);222+ skb_queue_purge(&dp->rq);223+ skb_queue_purge(&dp->tq);224+ return 0;225+}226+227+static int ifb_open(struct net_device *dev)228+{229+ struct ifb_private *dp = netdev_priv(dev);230+231+ tasklet_init(&dp->ifb_tasklet, ri_tasklet, (unsigned long)dev);232+ skb_queue_head_init(&dp->rq);233+ skb_queue_head_init(&dp->tq);234+ netif_start_queue(dev);235+236+ return 0;237+}238+239+static int __init ifb_init_one(int index)240+{241+ struct net_device *dev_ifb;242+ int err;243+244+ dev_ifb = alloc_netdev(sizeof(struct ifb_private),245+ "ifb%d", ifb_setup);246+247+ if (!dev_ifb)248+ return -ENOMEM;249+250+ if ((err = register_netdev(dev_ifb))) {251+ free_netdev(dev_ifb);252+ dev_ifb = NULL;253+ } else {254+ ifbs[index] = dev_ifb; 255+ }256+257+ return err;258+}259+260+static void ifb_free_one(int index)261+{262+ unregister_netdev(ifbs[index]);263+ free_netdev(ifbs[index]);264+} 265+266+static int __init ifb_init_module(void)267+{ 268+ int i, err = 0;269+ ifbs = kmalloc(numifbs * sizeof(void *), GFP_KERNEL); 270+ if (!ifbs)271+ return -ENOMEM; 272+ for (i = 0; i < numifbs && !err; i++)273+ err = ifb_init_one(i); 274+ if (err) { 275+ while (--i >= 0)276+ ifb_free_one(i);277+ }278+279+ return err;280+} 281+282+static void __exit ifb_cleanup_module(void)283+{284+ int i;285+286+ for (i = 0; i < numifbs; i++) 287+ ifb_free_one(i); 288+ kfree(ifbs); 289+}290+291+module_init(ifb_init_module);292+module_exit(ifb_cleanup_module);293+MODULE_LICENSE("GPL");294+MODULE_AUTHOR("Jamal Hadi Salim");
+5
include/linux/crypto.h
···3 *4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)06 *7 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>8 * and Nettle, by Niels M�ller.···127 unsigned int cra_blocksize;128 unsigned int cra_ctxsize;129 unsigned int cra_alignmask;000130 const char cra_name[CRYPTO_MAX_ALG_NAME];0131132 union {133 struct cipher_alg cipher;
···3 *4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)6+ * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>7 *8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>9 * and Nettle, by Niels M�ller.···126 unsigned int cra_blocksize;127 unsigned int cra_ctxsize;128 unsigned int cra_alignmask;129+130+ int cra_priority;131+132 const char cra_name[CRYPTO_MAX_ALG_NAME];133+ const char cra_driver_name[CRYPTO_MAX_ALG_NAME];134135 union {136 struct cipher_alg cipher;
+1-1
include/net/act_api.h
···63 __u32 type; /* TBD to match kind */64 __u32 capab; /* capabilities includes 4 bit version */65 struct module *owner;66- int (*act)(struct sk_buff **, struct tc_action *, struct tcf_result *);67 int (*get_stats)(struct sk_buff *, struct tc_action *);68 int (*dump)(struct sk_buff *, struct tc_action *,int , int);69 int (*cleanup)(struct tc_action *, int bind);
···63 __u32 type; /* TBD to match kind */64 __u32 capab; /* capabilities includes 4 bit version */65 struct module *owner;66+ int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);67 int (*get_stats)(struct sk_buff *, struct tc_action *);68 int (*dump)(struct sk_buff *, struct tc_action *,int , int);69 int (*cleanup)(struct tc_action *, int bind);
+12-11
include/net/pkt_sched.h
···1#ifndef __NET_PKT_SCHED_H2#define __NET_PKT_SCHED_H304#include <net/sch_generic.h>56struct qdisc_walker···60typedef long psched_tdiff_t;6162#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))63-#define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ))64-#define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ))6566#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */67···124 default: \125 __delta = 0; \126 case 2: \127- __delta += 1000000; \128 case 1: \129- __delta += 1000000; \130 } \131 } \132 __delta; \···137{138 int delta;139140- if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1)141 return bound;142- delta = delta_sec * 1000000;143 if (delta > bound || delta < 0)144 delta = bound;145 return delta;···153 default: \154 __delta = psched_tod_diff(__delta_sec, bound); break; \155 case 2: \156- __delta += 1000000; \157 case 1: \158- __delta += 1000000; \159 case 0: \160 if (__delta > bound || __delta < 0) \161 __delta = bound; \···171({ \172 int __delta = (tv).tv_usec + (delta); \173 (tv_res).tv_sec = (tv).tv_sec; \174- if (__delta > 1000000) { (tv_res).tv_sec++; __delta -= 1000000; } \175 (tv_res).tv_usec = __delta; \176})177178#define PSCHED_TADD(tv, delta) \179({ \180 (tv).tv_usec += (delta); \181- if ((tv).tv_usec > 1000000) { (tv).tv_sec++; \182- (tv).tv_usec -= 1000000; } \183})184185/* Set/check that time is in the "past perfect";
···1#ifndef __NET_PKT_SCHED_H2#define __NET_PKT_SCHED_H34+#include <linux/jiffies.h>5#include <net/sch_generic.h>67struct qdisc_walker···59typedef long psched_tdiff_t;6061#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))62+#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)63+#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)6465#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */66···123 default: \124 __delta = 0; \125 case 2: \126+ __delta += USEC_PER_SEC; \127 case 1: \128+ __delta += USEC_PER_SEC; \129 } \130 } \131 __delta; \···136{137 int delta;138139+ if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)140 return bound;141+ delta = delta_sec * USEC_PER_SEC;142 if (delta > bound || delta < 0)143 delta = bound;144 return delta;···152 default: \153 __delta = psched_tod_diff(__delta_sec, bound); break; \154 case 2: \155+ __delta += USEC_PER_SEC; \156 case 1: \157+ __delta += USEC_PER_SEC; \158 case 0: \159 if (__delta > bound || __delta < 0) \160 __delta = bound; \···170({ \171 int __delta = (tv).tv_usec + (delta); \172 (tv_res).tv_sec = (tv).tv_sec; \173+ if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \174 (tv_res).tv_usec = __delta; \175})176177#define PSCHED_TADD(tv, delta) \178({ \179 (tv).tv_usec += (delta); \180+ if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \181+ (tv).tv_usec -= USEC_PER_SEC; } \182})183184/* Set/check that time is in the "past perfect";
···304 /* look for a node to insert instead of p */305 struct inet_peer *t;306 t = lookup_rightempty(p);307- if (*stackptr[-1] != t)308- BUG();309 **--stackptr = t->avl_left;310 /* t is removed, t->v4daddr > x->v4daddr for any311 * x in p->avl_left subtree.···313 t->avl_left = p->avl_left;314 t->avl_right = p->avl_right;315 t->avl_height = p->avl_height;316- if (delp[1] != &p->avl_left)317- BUG();318 delp[1] = &t->avl_left; /* was &p->avl_left */319 }320 peer_avl_rebalance(stack, stackptr);
···304 /* look for a node to insert instead of p */305 struct inet_peer *t;306 t = lookup_rightempty(p);307+ BUG_ON(*stackptr[-1] != t);0308 **--stackptr = t->avl_left;309 /* t is removed, t->v4daddr > x->v4daddr for any310 * x in p->avl_left subtree.···314 t->avl_left = p->avl_left;315 t->avl_right = p->avl_right;316 t->avl_height = p->avl_height;317+ BUG_ON(delp[1] != &p->avl_left);0318 delp[1] = &t->avl_left; /* was &p->avl_left */319 }320 peer_avl_rebalance(stack, stackptr);
···201}202203static int204-tcf_ipt(struct sk_buff **pskb, struct tc_action *a, struct tcf_result *res)205{206 int ret = 0, result = 0;207 struct tcf_ipt *p = PRIV(a, ipt);208- struct sk_buff *skb = *pskb;209210 if (skb_cloned(skb)) {211 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))···221 worry later - danger - this API seems to have changed222 from earlier kernels */223000224 ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,225 p->hook, p->t->data, NULL);226 switch (ret) {
···201}202203static int204+tcf_ipt(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res)205{206 int ret = 0, result = 0;207 struct tcf_ipt *p = PRIV(a, ipt);0208209 if (skb_cloned(skb)) {210 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))···222 worry later - danger - this API seems to have changed223 from earlier kernels */224225+ /* iptables targets take a double skb pointer in case the skb226+ * needs to be replaced. We don't own the skb, so this must not227+ * happen. The pskb_expand_head above should make sure of this */228 ret = p->t->u.kernel.target->target(&skb, skb->dev, NULL,229 p->hook, p->t->data, NULL);230 switch (ret) {
···248249void __xfrm_policy_destroy(struct xfrm_policy *policy)250{251- if (!policy->dead)252- BUG();253254- if (policy->bundles)255- BUG();256257 if (del_timer(&policy->timer))258 BUG();
···248249void __xfrm_policy_destroy(struct xfrm_policy *policy)250{251+ BUG_ON(!policy->dead);0252253+ BUG_ON(policy->bundles);0254255 if (del_timer(&policy->timer))256 BUG();