Commit 403e8fa0 authored by Sridhar Samudrala's avatar Sridhar Samudrala

[SCTP] Use __get_free_pages() to allocate ssnmap.

This is needed to avoid kmalloc()'s 128K limit when an association is
initialized with a large no. of streams(more than 65000 inbound +
outbound streams).
parent a5cfa3a2
...@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out) ...@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
{ {
struct sctp_ssnmap *retval; struct sctp_ssnmap *retval;
int order;
retval = kmalloc(sctp_ssnmap_size(in, out), gfp); order = get_order(sctp_ssnmap_size(in,out));
retval = (struct sctp_ssnmap *)__get_free_pages(gfp, order);
if (!retval) if (!retval)
goto fail; goto fail;
...@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) ...@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
return retval; return retval;
fail_map: fail_map:
kfree(retval); free_pages((unsigned long)retval, order);
fail: fail:
return NULL; return NULL;
} }
...@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map) ...@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
void sctp_ssnmap_free(struct sctp_ssnmap *map) void sctp_ssnmap_free(struct sctp_ssnmap *map)
{ {
if (map && map->malloced) { if (map && map->malloced) {
kfree(map); free_pages((unsigned long)map,
get_order(sctp_ssnmap_size(map->in.len,
map->out.len)));
SCTP_DBG_OBJCNT_DEC(ssnmap); SCTP_DBG_OBJCNT_DEC(ssnmap);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment