|
@@ -467,29 +467,14 @@ static void hhf_reset(struct Qdisc *sch)
|
|
|
rtnl_kfree_skbs(skb, skb);
|
|
|
}
|
|
|
|
|
|
-static void *hhf_zalloc(size_t sz)
|
|
|
-{
|
|
|
- void *ptr = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN);
|
|
|
-
|
|
|
- if (!ptr)
|
|
|
- ptr = vzalloc(sz);
|
|
|
-
|
|
|
- return ptr;
|
|
|
-}
|
|
|
-
|
|
|
-static void hhf_free(void *addr)
|
|
|
-{
|
|
|
- kvfree(addr);
|
|
|
-}
|
|
|
-
|
|
|
static void hhf_destroy(struct Qdisc *sch)
|
|
|
{
|
|
|
int i;
|
|
|
struct hhf_sched_data *q = qdisc_priv(sch);
|
|
|
|
|
|
for (i = 0; i < HHF_ARRAYS_CNT; i++) {
|
|
|
- hhf_free(q->hhf_arrays[i]);
|
|
|
- hhf_free(q->hhf_valid_bits[i]);
|
|
|
+ kvfree(q->hhf_arrays[i]);
|
|
|
+ kvfree(q->hhf_valid_bits[i]);
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < HH_FLOWS_CNT; i++) {
|
|
@@ -503,7 +488,7 @@ static void hhf_destroy(struct Qdisc *sch)
|
|
|
kfree(flow);
|
|
|
}
|
|
|
}
|
|
|
- hhf_free(q->hh_flows);
|
|
|
+ kvfree(q->hh_flows);
|
|
|
}
|
|
|
|
|
|
static const struct nla_policy hhf_policy[TCA_HHF_MAX + 1] = {
|
|
@@ -609,8 +594,8 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
|
|
|
|
|
if (!q->hh_flows) {
|
|
|
/* Initialize heavy-hitter flow table. */
|
|
|
- q->hh_flows = hhf_zalloc(HH_FLOWS_CNT *
|
|
|
- sizeof(struct list_head));
|
|
|
+ q->hh_flows = kvzalloc(HH_FLOWS_CNT *
|
|
|
+ sizeof(struct list_head), GFP_KERNEL);
|
|
|
if (!q->hh_flows)
|
|
|
return -ENOMEM;
|
|
|
for (i = 0; i < HH_FLOWS_CNT; i++)
|
|
@@ -624,8 +609,8 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
|
|
|
|
|
/* Initialize heavy-hitter filter arrays. */
|
|
|
for (i = 0; i < HHF_ARRAYS_CNT; i++) {
|
|
|
- q->hhf_arrays[i] = hhf_zalloc(HHF_ARRAYS_LEN *
|
|
|
- sizeof(u32));
|
|
|
+ q->hhf_arrays[i] = kvzalloc(HHF_ARRAYS_LEN *
|
|
|
+ sizeof(u32), GFP_KERNEL);
|
|
|
if (!q->hhf_arrays[i]) {
|
|
|
/* Note: hhf_destroy() will be called
|
|
|
* by our caller.
|
|
@@ -637,8 +622,8 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt)
|
|
|
|
|
|
/* Initialize valid bits of heavy-hitter filter arrays. */
|
|
|
for (i = 0; i < HHF_ARRAYS_CNT; i++) {
|
|
|
- q->hhf_valid_bits[i] = hhf_zalloc(HHF_ARRAYS_LEN /
|
|
|
- BITS_PER_BYTE);
|
|
|
+ q->hhf_valid_bits[i] = kvzalloc(HHF_ARRAYS_LEN /
|
|
|
+ BITS_PER_BYTE, GFP_KERNEL);
|
|
|
if (!q->hhf_valid_bits[i]) {
|
|
|
/* Note: hhf_destroy() will be called
|
|
|
* by our caller.
|